source: rtems/c/src/lib/libbsp/powerpc/dmv177/sonic/sonic.h @ 7fc5d54e

4.104.114.84.95
Last change on this file since 7fc5d54e was 7fc5d54e, checked in by Joel Sherrill <joel.sherrill@…>, on 08/03/98 at 21:01:21

Switched to read/write register routines and added some basic debug
help.

  • Property mode set to 100644
File size: 13.2 KB
Line 
1/*
2 *******************************************************************
3 *******************************************************************
4 **                                                               **
5 **           DECLARATIONS FOR NATIONAL DP83932 `SONIC'           **
6 **         SYSTEMS-ORIENTED NETWORK INTERFACE CONTROLLER         **
7 **                                                               **
8 *******************************************************************
9 *******************************************************************
10 */
11
12/*
13 * $Revision$   $Date$   $Author$
14 * $State$
15 */
16
17#ifndef _SONIC_DP83932_
18#define _SONIC_DP83932_
19
20#include <bsp.h>
21
22/*
23 ******************************************************************
24 *                                                                *
25 *                        Device Registers                        *
26 *                                                                *
27 ******************************************************************
28 */
29#define SONIC_REG_CR      0x00 /* Command */
30#define SONIC_REG_DCR     0x01 /* Data configuration */
31#define SONIC_REG_RCR     0x02 /* Receive control */
32#define SONIC_REG_TCR     0x03 /* Transmit control */
33#define SONIC_REG_IMR     0x04 /* Interrupt mask */
34#define SONIC_REG_ISR     0x05 /* Interrupt status */
35#define SONIC_REG_UTDA    0x06 /* Upper transmit descriptor address */
36#define SONIC_REG_CTDA    0x07 /* Current transmit descriptor address */
37#define SONIC_REG_URDA    0x0D /* Upper receive descriptor address */
38#define SONIC_REG_CRDA    0x0E /* Current receive descriptor address */
39#define SONIC_REG_EOBC    0x13 /* End of buffer word count */
40#define SONIC_REG_URRA    0x14 /* Upper receive resource */
41#define SONIC_REG_RSA     0x15 /* Resource start address */
42#define SONIC_REG_REA     0x16 /* Resource end address */
43#define SONIC_REG_RRP     0x17 /* Resouce read pointer */
44#define SONIC_REG_RWP     0x18 /* Resouce write pointer */
45#define SONIC_REG_CEP     0x21 /* CAM entry pointer */
46#define SONIC_REG_CAP2    0x22 /* CAM address port 2 */
47#define SONIC_REG_CAP1    0x23 /* CAM address port 1 */
48#define SONIC_REG_CAP0    0x24 /* CAM address port 0 */
49#define SONIC_REG_CE      0x25 /* CAM enable */
50#define SONIC_REG_CDP     0x26 /* CAM descriptor pointer */
51#define SONIC_REG_CDC     0x27 /* CAM descriptor count */
52#define SONIC_REG_SR      0x28 /* Silicon revision */
53#define SONIC_REG_WT0     0x29 /* Watchdog timer 0 */
54#define SONIC_REG_WT1     0x2A /* Watchdog timer 1 */
55#define SONIC_REG_RSC     0x2B /* Receive sequence counter */
56#define SONIC_REG_CRCT    0x2C /* CRC error tally */
57#define SONIC_REG_FAET    0x2D /* FAE tally */
58#define SONIC_REG_MPT     0x2E /* Missed packet tally */
59#define SONIC_REG_MDT     0x2F /* TX Maximum Deferral */
60#define SONIC_REG_DCR2    0x3F /* Data configuration 2 */
61
62#if 0
63struct SonicRegisters {
64  /*
65   * Command and status registers
66   */
67  rtems_unsigned32     cr;     /* 0x00 - Command */
68  rtems_unsigned32     dcr;    /* 0x01 - Data configuration */
69  rtems_unsigned32     rcr;    /* 0x02 - Receive control */
70  rtems_unsigned32     tcr;    /* 0x03 - Transmit control */
71  rtems_unsigned32     imr;    /* 0x04 - Interrupt mask */
72  rtems_unsigned32     isr;    /* 0x05 - Interrupt status */
73
74  /*
75   * Transmit registers
76   */
77  rtems_unsigned32     utda;   /* 0x06 - Upper transmit descriptor address */
78  rtems_unsigned32     ctda;   /* 0x07 - Current transmit descriptor address */
79
80  /*
81   * Receive registers
82   */
83  rtems_unsigned32 pad0[5];    /* 0x08 - 0x0C */
84  rtems_unsigned32     urda;   /* 0x0D - Upper receive descriptor address */
85  rtems_unsigned32     crda;   /* 0x0E - Current receive descriptor address */
86  rtems_unsigned32 pad1[4];    /* 0x0F - 0x12 */
87  rtems_unsigned32     eobc;   /* 0x13 - End of buffer word count */
88  rtems_unsigned32     urra;   /* 0x14 - Upper receive resource */
89  rtems_unsigned32     rsa;    /* 0x15 - Resource start address */
90  rtems_unsigned32     rea;    /* 0x16 - Resource end address */
91  rtems_unsigned32     rrp;    /* 0x17 - Resouce read pointer */
92  rtems_unsigned32     rwp;    /* 0x18 - Resouce write pointer */
93
94  /*
95   * Content-addressable memory registers
96   */
97  rtems_unsigned32 pad2[8];    /* 0x19 - 0x20 */
98  rtems_unsigned32     cep;    /* 0x21 - CAM entry pointer */
99  rtems_unsigned32     cap2;   /* 0x22 - CAM address port 2 */
100  rtems_unsigned32     cap1;   /* 0x23 - CAM address port 1 */
101  rtems_unsigned32     cap0;   /* 0x24 - CAM address port 0 */
102  rtems_unsigned32     ce;     /* 0x25 - CAM enable */
103  rtems_unsigned32     cdp;    /* 0x26 - CAM descriptor pointer */
104  rtems_unsigned32     cdc;    /* 0x27 - CAM descriptor count */
105
106  /*
107   * Silicon revision
108   */
109  rtems_unsigned32     sr;     /* 0x28 - Silicon revision */
110
111  /*
112   * Watchdog counters
113   */
114  rtems_unsigned32     wt0;    /* 0x29 - Watchdog timer 0 */
115  rtems_unsigned32     wt1;    /* 0x2A - Watchdog timer 1 */
116
117  /*
118   * Another receive register
119   */
120  rtems_unsigned32     rsc;    /* 0x2B - Receive sequence counter */
121
122  /*
123   * Tally counters
124   */
125  rtems_unsigned32     crct;   /* 0x2C - CRC error tally */
126  rtems_unsigned32     faet;   /* 0x2D - FAE tally */
127  rtems_unsigned32     mpt;    /* 0x2E - Missed packet tally */
128
129  /*
130   * Another Transmitter register
131   */
132  rtems_unsigned32     mdt;    /* 0x2F - TX Maximum Deferral */
133
134  /*
135   * Another command and status register
136   */
137  rtems_unsigned32 pad3[15];   /* 0x30 - 0x3E */
138  rtems_unsigned32     dcr2;   /* 0x3F - Data configuration 2 */
139};
140#endif
141
142/*
143 * Command register
144 */
145#define CR_LCAM         0x0200
146#define CR_RRRA         0x0100
147#define CR_RST          0x0080
148#define CR_ST           0x0020
149#define CR_STP          0x0010
150#define CR_RXEN         0x0008
151#define CR_RXDIS        0x0004
152#define CR_TXP          0x0002
153#define CR_HTX          0x0001
154
155/*
156 * Data configuration register
157 */
158#define DCR_EXBUS       0x8000
159#define DCR_LBR         0x2000
160#define DCR_PO1         0x1000
161#define DCR_PO0         0x0800
162#define DCR_SBUS        0x0400
163#define DCR_USR1        0x0200
164#define DCR_USR0        0x0100
165#define DCR_WC1         0x0080
166#define DCR_WC0         0x0040
167#define DCR_DW          0x0020
168#define DCR_BMS         0x0010
169#define DCR_RFT1        0x0008
170#define DCR_RFT0        0x0004
171#define DCR_TFT1        0x0002
172#define DCR_TFT0        0x0001
173
174/*
175 * Receive control register
176 */
177#define RCR_ERR         0x8000
178#define RCR_RNT         0x4000
179#define RCR_BRD         0x2000
180#define RCR_PRO         0x1000
181#define RCR_AMC         0x0800
182#define RCR_LB1         0x0400
183#define RCR_LB0         0x0200
184#define RCR_MC          0x0100
185#define RCR_BC          0x0080
186#define RCR_LPKT        0x0040
187#define RCR_CRS         0x0020
188#define RCR_COL         0x0010
189#define RCR_CRCR        0x0008
190#define RCR_FAER        0x0004
191#define RCR_LBK         0x0002
192#define RCR_PRX         0x0001
193
194/*
195 * Transmit control register
196 */
197#define TCR_PINT        0x8000
198#define TCR_POWC        0x4000
199#define TCR_CRCI        0x2000
200#define TCR_EXDIS       0x1000
201#define TCR_EXD         0x0400
202#define TCR_DEF         0x0200
203#define TCR_NCRS        0x0100
204#define TCR_CRSL        0x0080
205#define TCR_EXC         0x0040
206#define TCR_OWC         0x0020
207#define TCR_PMB         0x0008
208#define TCR_FU          0x0004
209#define TCR_BCM         0x0002
210#define TCR_PTX         0x0001
211
212/*
213 * Interrupt mask register
214 */
215#define IMR_BREN        0x4000
216#define IMR_HBLEN       0x2000
217#define IMR_LCDEN       0x1000
218#define IMR_PINTEN      0x0800
219#define IMR_PRXEN       0x0400
220#define IMR_PTXEN       0x0200
221#define IMR_TXEREN      0x0100
222#define IMR_TCEN        0x0080
223#define IMR_RDEEN       0x0040
224#define IMR_RBEEN       0x0020
225#define IMR_RBAEEN      0x0010
226#define IMR_CRCEN       0x0008
227#define IMR_FAEEN       0x0004
228#define IMR_MPEN        0x0002
229#define IMR_RFOEN       0x0001
230
231/*
232 * Interrupt status register
233 */
234#define ISR_BR          0x4000
235#define ISR_HBL         0x2000
236#define ISR_LCD         0x1000
237#define ISR_PINT        0x0800
238#define ISR_PKTRX       0x0400
239#define ISR_TXDN        0x0200
240#define ISR_TXER        0x0100
241#define ISR_TC          0x0080
242#define ISR_RDE         0x0040
243#define ISR_RBE         0x0020
244#define ISR_RBAE        0x0010
245#define ISR_CRC         0x0008
246#define ISR_FAE         0x0004
247#define ISR_MP          0x0002
248#define ISR_RFO         0x0001
249
250/*
251 * Data configuration register 2
252 */
253#define DCR2_EXPO3      0x8000
254#define DCR2_EXPO2      0x4000
255#define DCR2_EXPO1      0x2000
256#define DCR2_EXPO0      0x1000
257#define DCR2_PH         0x0010
258#define DCR2_PCM        0x0004
259#define DCR2_PCNM       0x0002
260#define DCR2_RJCM       0x0001
261
262/*
263 ******************************************************************
264 *                                                                *
265 *                   Transmit Buffer Management                   *
266 *                                                                *
267 ******************************************************************
268 */
269
270/*
271 * Transmit descriptor area entry.
272 * There is one transmit descriptor for each packet to be transmitted.
273 * Statically reserve space for up to MAXIMUM_FRAGS_PER_PACKET fragments
274 * per descriptor.
275 */
276#define MAXIMUM_FRAGS_PER_DESCRIPTOR    6
277struct TransmitDescriptor {
278  rtems_unsigned32        status;
279  rtems_unsigned32        pkt_config;
280  rtems_unsigned32        pkt_size;
281  rtems_unsigned32        frag_count;
282
283  /*
284   * Packet fragment pointers
285   */
286  struct TransmitDescriptorFragLink {
287      rtems_unsigned32 frag_lsw;  /* LSW of fragment address */
288#define                      frag_link frag_lsw
289      rtems_unsigned32 frag_msw;  /* MSW of fragment address */
290      rtems_unsigned32 frag_size;
291  }                       frag[MAXIMUM_FRAGS_PER_DESCRIPTOR];
292
293  /*
294   * Space for link if all fragment pointers are used.
295   */
296  rtems_unsigned32        link_pad;
297
298  /*
299   * Extra RTEMS/KA9Q stuff
300   */
301  struct TransmitDescriptor       *next;  /* Circularly-linked list */
302  struct mbuf                     *mbufp; /* First mbuf in packet */
303  volatile rtems_unsigned32       *linkp; /* Pointer to un[xxx].link */
304};
305typedef struct TransmitDescriptor TransmitDescriptor_t;
306typedef volatile TransmitDescriptor_t *TransmitDescriptorPointer_t;
307
308/*
309 * Transmit Configuration.
310 * For standard Ethernet transmission, all bits in the transmit
311 * configuration field are set to 0.
312 */
313#define TDA_CONFIG_PINT 0x8000
314#define TDA_CONFIG_POWC 0x4000
315#define TDA_CONFIG_CRCI 0x2000
316#define TDA_CONFIG_EXDIS        0x1000
317
318/*
319 * Transmit status
320 */
321#define TDA_STATUS_COLLISION_MASK       0xF800
322#define TDA_STATUS_COLLISION_SHIFT      11
323#define TDA_STATUS_EXD          0x0400
324#define TDA_STATUS_DEF          0x0200
325#define TDA_STATUS_NCRS         0x0100
326#define TDA_STATUS_CRSL         0x0080
327#define TDA_STATUS_EXC          0x0040
328#define TDA_STATUS_OWC          0x0020
329#define TDA_STATUS_PMB          0x0008
330#define TDA_STATUS_FU           0x0004
331#define TDA_STATUS_BCM          0x0002
332#define TDA_STATUS_PTX          0x0001
333
334#define TDA_LINK_EOL 0x1
335
336
337
338/*
339 ******************************************************************
340 *                                                                *
341 *                    Receive Buffer Management                   *
342 *                                                                *
343 ******************************************************************
344 */
345
346/*
347 * Receive resource area entry.
348 * There is one receive resource entry for each receive buffer area (RBA).
349 * This driver allows only one packet per receive buffer area, so one
350 * receive resource entry corresponds to one correctly-received packet.
351 */
352struct ReceiveResource {
353  rtems_unsigned32        buff_ptr_lsw;   /* LSW of RBA address */
354  rtems_unsigned32        buff_ptr_msw;   /* MSW of RBA address */
355  rtems_unsigned32        buff_wc_lsw;    /* LSW of RBA size (16-bit words) */
356  rtems_unsigned32        buff_wc_msw;    /* MSW of RBA size (16-bit words) */
357};
358typedef struct ReceiveResource ReceiveResource_t;
359typedef volatile ReceiveResource_t *ReceiveResourcePointer_t;
360
361/*
362 * Receive descriptor area entry.
363 * There is one receive descriptor for each packet received.
364 */
365struct ReceiveDescriptor {
366  rtems_unsigned32        status;
367  rtems_unsigned32        byte_count;
368  rtems_unsigned32        pkt_lsw;        /* LSW of packet address */
369  rtems_unsigned32        pkt_msw;        /* MSW of packet address */
370  rtems_unsigned32        seq_no;
371  rtems_unsigned32        link;
372  rtems_unsigned32        in_use;
373
374  /*
375   * Extra RTEMS/KA9Q stuff
376   */
377  struct ReceiveDescriptor        *next;  /* Circularly-linked list */
378};
379typedef struct ReceiveDescriptor ReceiveDescriptor_t;
380typedef volatile ReceiveDescriptor_t *ReceiveDescriptorPointer_t;
381
382/*
383 * Receive status
384 */
385#define RDA_STATUS_ERR          0x8800
386#define RDA_STATUS_RNT          0x4000
387#define RDA_STATUS_BRD          0x2000
388#define RDA_STATUS_PRO          0x1000
389#define RDA_STATUS_AMC          0x0800
390#define RDA_STATUS_LB1          0x0400
391#define RDA_STATUS_LB0          0x0200
392#define RDA_STATUS_MC           0x0100
393#define RDA_STATUS_BC           0x0080
394#define RDA_STATUS_LPKT         0x0040
395#define RDA_STATUS_CRS          0x0020
396#define RDA_STATUS_COL          0x0010
397#define RDA_STATUS_CRCR         0x0008
398#define RDA_STATUS_FAER         0x0004
399#define RDA_STATUS_LBK          0x0002
400#define RDA_STATUS_PRX          0x0001
401
402#define RDA_LINK_EOL 0x1
403 
404#endif /* _SONIC_DP83932_ */
Note: See TracBrowser for help on using the repository browser.