source: rtems/doc/networking/decdriver.t @ f3482e3

4.104.114.84.95
Last change on this file since f3482e3 was 936ae5d, checked in by Joel Sherrill <joel.sherrill@…>, on 04/08/99 at 16:19:21

Added DEC21140 document from Emmanuel Raguet <raguet@…>.

  • Property mode set to 100644
File size: 11.1 KB
Line 
1@c
2@c  RTEMS Remote Debugger Server Specifications
3@c
4@c  Written by: Emmanuel Raguet <raguet@crf.canon.fr>
5@c
6@c
7@c  $Id$
8@c
9
10@chapter DEC 21140 Driver
11
12@section DEC 21240 Driver Introduction
13
14@c XXX add back in cross reference to list of boards.
15
16One aim of our project is to port RTEMS on a standard PowerPC platform. To achieve
17it, we have chosen a Motorola MCP750 board. This board includes an Ethernet
18controller based on a DEC21140 chip. Because RTEMS has a TCP/IP stack, we will
19have to develop the DEC21140 related ethernet driver for the PowerPC port of
20RTEMS. As this controller is able to support 100Mbps network and as there is
21a lot of PCI card using this DEC chip, we have decided to first
22implement this driver on an Intel PC386 target to provide a solution for using
23RTEMS on PC with the 100Mbps network and then to port this code on PowerPC in
24a second phase.
25
26
27The aim of this document is to give some PCI board generalities and
28to explain the software architecture of the RTEMS driver. Finally, we will see
29what will be done for ChorusOs and Netboot environment .
30
31
32@section Document Revision History
33
34@b{Current release}:
35
36@itemize @bullet
37@item Current applicable release is 1.0.
38@end itemize
39@b{Existing releases}:
40
41@itemize @bullet
42@item 1.0 : Released the 10/02/98. First version of this document.
43@item 0.1 : First draft of this document
44@end itemize
45@b{Planned releases}:
46
47@itemize @bullet
48@item None planned today.
49@end itemize
50
51@section DEC21140 PCI Board Generalities
52
53@c XXX add crossreference to PCI Register Figure
54This chapter describes rapidely the PCI interface of this Ethernet controller.
55The board we have chosen for our PC386 implementation is a D-Link DFE-500TX.
56This is a dual-speed 10/100Mbps Ethernet PCI adapter with a DEC21140AF chip.
57Like other PCI devices, this board has a PCI device's header containing some
58required configuration registers, as shown in the PCI Register Figure.
59By reading
60or writing these registers, a driver can obtain information about the type of
61the board, the interrupt it uses, the mapping of the chip specific registers, ...
62
63
64
65On Intel target, the chip specific registers can be accessed via 2
66methods : I/O port access or PCI address mapped access. We have chosen to implement
67the PCI address access to obtain compatible source code to the port the driver
68on a PowerPC target.
69
70@c
71@c PCI Device's Configuration Header Space Format
72@c
73
74@ifset use-ascii
75@example
76@group
77XXXXX reference it in the previous paragraph
78XXXXX insert PCI_reg.eps
79XXXXX Caption PCI Device's Configuration Header Space Format
80@end group
81@end example
82@end ifset
83
84@ifset use-tex
85@example
86@group
87XXXXX reference it in the previous paragraph
88XXXXX insert PCI_reg.eps
89XXXXX Caption PCI Device's Configuration Header Space Format
90@end group
91@end example
92@end ifset
93
94@c @image{PCI_reg}
95
96@ifset use-html
97@c <IMG SRC="PCI_reg.jpg" WIDTH=500 HEIGHT=600 ALT="PCI Device's Configuration Header Space Format">
98@html
99<IMG SRC="PCI_reg.jpg" ALT="PCI Device's Configuration Header Space Format">
100@end html
101@end ifset
102
103
104@c XXX add crossreference to PCI Register Figure
105
106On RTEMS, a PCI API exists. We have used it to configure the board. After initializing
107this PCI module via the @code{pcib_init()} function, we try to detect
108the DEC21140 based ethernet board. This board is characterized by its Vendor
109ID (0x1011) and its Device ID (0x0009). We give these arguments to the
110@code{pcib_find_by_deviceid}
111function which returns , if the device is present, a pointer to the configuration
112header space (see PCI Registers Fgure). Once this operation performed,
113the driver
114is able to extract the information it needs to configure the board internal
115registers, like the interrupt line, the base address,... The board internal
116registers will not be detailled here. You can find them in @b{DIGITAL
117Semiconductor 21140A PCI Fast Ethernet LAN Controller
118- Hardware Reference Manual}.
119
120@c fix citation
121
122
123@section RTEMS Driver Software Architecture
124
125In this chapter will see the initialization phase, how the controller uses the
126host memory and the 2 threads launched at the initialization time.
127
128
129@subsection Initialization phase
130
131The DEC21140 Ethernet driver keeps the same software architecture than the other
132RTEMS ethernet drivers. The only API the programmer can use is the @code{rtems_dec21140_driver_attach}
133@code{(struct rtems_bsdnet_ifconfig *config)} function which
134detects the board and initializes the associated data structure (with registers
135base address, entry points to low-level initialization function,...), if the
136board is found.
137
138Once the attach function executed, the driver initializes the DEC
139chip. Then the driver connects an interrupt handler to the interrupt line driven
140by the Ethernet controller (the only interrupt which will be treated is the
141receive interrupt) and launches 2 threads : a receiver thread and a transmitter
142thread. Then the driver waits for incoming frame to give to the protocol stack
143or outcoming frame to send on the physical link.
144
145
146@subsection Memory Buffer
147
148@c XXX add cross reference to Problem
149This DEC chip uses the host memory to store the incoming Ethernet frames and
150the descriptor of these frames. We have chosen to use 7 receive buffers and
1511 transmit buffer to optimize memory allocation due to cache and paging problem
152that will be explained in the section @b{Encountered Problems}.
153
154
155To reference these buffers to the DEC chip we use a buffer descriptors
156ring. The descriptor structure is defined in the Buffer Descriptor Figure.
157Each descriptor
158can reference one or two memory buffers. We choose to use only one buffer of
1591520 bytes per descriptor.
160
161
162The difference between a receive and a transmit buffer descriptor
163is located in the status and control bits fields. We do not give details here,
164please refer to the [DEC21140 Hardware Manual].
165
166@c
167@c Buffer Descriptor
168@c
169
170@ifset use-ascii
171@example
172@group
173XXXXX reference it in the previous paragraph
174XXXXX insert recv_bd.eps
175XXXXX Caption Buffer Descriptor
176@end group
177@end example
178@end ifset
179
180@ifset use-tex
181@example
182@group
183XXXXX reference it in the previous paragraph
184XXXXX insert recv_bd.eps
185XXXXX Caption Buffer Descriptor
186@end group
187@end example
188@end ifset
189
190@c @image{recv_bd}
191
192@ifset use-html
193@c <IMG SRC="recv_bd.jpg" WIDTH=500 HEIGHT=600 ALT="Buffer Descriptor">
194@html
195<IMG SRC="recv_bd.jpg" ALT="Buffer Descriptor">
196@end html
197@end ifset
198
199
200
201@subsection Receiver Thread
202
203This thread is event driven. Each time a DEC PCI board interrupt occurs, the
204handler checks if this is a receive interrupt and send an event ``reception''
205to the receiver thread which looks into the entire buffer descriptors ring the
206ones that contain a valid incoming frame (bit OWN=0 means descriptor belongs
207to host processor). Each valid incoming ethernet frame is sent to the protocol
208stack and the buffer descriptor is given back to the DEC board (the host processor
209reset bit OWN, which means descriptor belongs to 21140).
210
211
212@subsection Transmitter Thread
213
214This thread is also event driven. Each time an Ethernet frame is put in the
215transmit queue, an event is sent to the transmit thread, which empty the queue
216by sending each outcoming frame. Because we use only one transmit buffer, we
217are sure that the frame is well-sent before sending the next.
218
219
220@section Encountered Problems
221
222On Intel PC386 target, we were faced with a problem of memory cache management.
223Because the DEC chip uses the host memory to store the incoming frame and because
224the DEC21140 configuration registers are mapped into the PCI address space,
225we must ensure that the data read (or written) by the host processor are the
226ones written (or read) by the DEC21140 device in the host memory and not old
227data stored in the cache memory. Therefore, we had to provide a way to manage
228the cache. This module is described in the document @b{RTEMS
229Cache Management For Intel}. On Intel, the
230memory region cache management is available only if the paging unit is enabled.
231We have used this paging mechanism, with 4Kb page. All the buffers allocated
232to store the incoming or outcoming frames, buffer descriptor and also the PCI
233address space of the DEC board are located in a memory space with cache disable.
234
235
236Concerning the buffers and their descriptors, we have tried to optimize
237the memory space in term of allocated page. One buffer has 1520 bytes, one descriptor
238has 16 bytes. We have 7 receive buffers and 1 transmit buffer, and for each,
2391 descriptor : (7+1)*(1520+16) = 12288 bytes = 12Kb = 3 entire pages. This
240allows not to lose too much memory or not to disable cache memory for a page
241which contains other data than buffer, which could decrease performance.
242
243
244@section ChorusOs DEC Driver
245
246Because ChorusOs is used in several Canon CRF projects, we must provide such
247a driver on this OS to ensure compatibility between the RTEMS and ChorusOs developments.
248On ChorusOs, a DEC driver source code already exists but only for a PowerPC
249target. We plan to port this code (which uses ChorusOs API) on Intel target.
250This will allow us to have homogeneous developments. Moreover, the port of the
251development performed with ChorusOs environment to RTEMS environment will be
252easier for the developers.
253
254
255@section Netboot DEC driver
256
257We use Netboot tool to load our development from a server to the target via
258an ethernet network. Currently, this tool does not support the DEC board. We
259plan to port the DEC driver for the Netboot tool.
260
261
262But concerning the port of the DEC driver into Netboot, we are faced
263with a problem : in RTEMS environment, the DEC driver is interrupt or event
264driven, in Netboot environment, it must be used in polling mode. It means that
265we will have to re-write some mechanisms of this driver.
266
267
268@section List of Ethernet cards using the DEC chip
269
270Many Ethernet adapter cards use the Tulip chip. Here is a non exhaustive list
271of adapters which support this driver :
272
273@itemize @bullet
274@item Accton EtherDuo PCI.
275@item Accton EN1207 All three media types supported.
276@item Adaptec ANA6911/TX 21140-AC.
277@item Cogent EM110 21140-A with DP83840 N-Way MII transceiver.
278@item Cogent EM400 EM100 with 4 21140 100mbps-only ports + PCI Bridge.
279@item Danpex EN-9400P3.
280@item D-Link DFE500-Tx 21140-A with DP83840 transceiver.
281@item Kingston EtherX KNE100TX 21140AE.
282@item Netgear FX310 TX 10/100 21140AE.
283@item SMC EtherPower10/100 With DEC21140 and 68836 SYM transceiver.
284@item SMC EtherPower10/100 With DEC21140-AC and DP83840 MII transceiver.
285Note: The EtherPower II uses the EPIC chip, which requires a different driver.
286@item Surecom EP-320X DEC 21140.
287@item Thomas Conrad TC5048.
288@item Znyx ZX345 21140-A, usually with the DP83840 N-Way MII transciever. Some ZX345
289cards made in 1996 have an ICS 1890 transciver instead.
290@item ZNYX ZX348 Two 21140-A chips using ICS 1890 transcievers and either a 21052
291or 21152 bridge. Early versions used National 83840 transcievers, but later
292versions are depopulated ZX346 boards.
293@item ZNYX ZX351 21140 chip with a Broadcom 100BaseT4 transciever.
294@end itemize
295
296Our DEC driver has not been tested with all these cards, only with the D-Link
297DFE500-TX.
298
299@itemize @code{ }
300@item @cite{[DEC21140 Hardware Manual] DIGITAL, @b{DIGITAL
301Semiconductor 21140A PCI Fast Ethernet LAN Controller - Hardware
302Reference Manual}}.
303
304@item @cite{[99.TA.0021.M.ER]Emmanuel Raguet,
305@b{RTEMS Cache Management For Intel}}.
306@end itemize
Note: See TracBrowser for help on using the repository browser.