OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [CORTEX_LPC1768_IAR/] [webserver/] [EthDev_LPC17xx.h] - Blame information for rev 581

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 581 jeremybenn
/*
2
 * @file:    EthDev_LPC17xx.h
3
 * @purpose: Ethernet Device Definitions for NXP LPC17xx
4
 * @version: V0.01
5
 * @date:    14. May 2009
6
 *----------------------------------------------------------------------------
7
 *
8
 * Copyright (C) 2009 ARM Limited. All rights reserved.
9
 *
10
 * ARM Limited (ARM) is supplying this software for use with Cortex-M3
11
 * processor based microcontrollers.  This file can be freely distributed
12
 * within development tools that are supporting such ARM based processors.
13
 *
14
 * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
15
 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
16
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
17
 * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
18
 * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
19
 *
20
 */
21
 
22
#ifndef __ETHDEV_LPC17XX_H
23
#define __ETHDEV_LPC17XX_H
24
 
25
#include <stdint.h>
26
 
27
/* EMAC Memory Buffer configuration for 16K Ethernet RAM. */
28
#define NUM_RX_FRAG         3           /* Num.of RX Fragments. */
29
#define NUM_TX_FRAG         2           /* Num.of TX Fragments. */
30
#define ETH_FRAG_SIZE       1536        /* Packet Fragment size 1536 Bytes   */
31
 
32
#define ETH_MAX_FLEN        1536        /* Max. Ethernet Frame Size          */
33
 
34
typedef struct {                        /* RX Descriptor struct              */
35
   uint32_t Packet;
36
   uint32_t Ctrl;
37
} RX_DESC_TypeDef;
38
 
39
typedef struct {                        /* RX Status struct                  */
40
   uint32_t Info;
41
   uint32_t HashCRC;
42
} RX_STAT_TypeDef;
43
 
44
typedef struct {                        /* TX Descriptor struct              */
45
   uint32_t Packet;
46
   uint32_t Ctrl;
47
} TX_DESC_TypeDef;
48
 
49
typedef struct {                        /* TX Status struct                  */
50
   uint32_t Info;
51
} TX_STAT_TypeDef;
52
 
53
 
54
/* EMAC variables located in AHB SRAM bank 1*/
55
#define AHB_SRAM_BANK1_BASE  0x2007c000UL
56
#define RX_DESC_BASE        (AHB_SRAM_BANK1_BASE         )
57
#define RX_STAT_BASE        (RX_DESC_BASE + NUM_RX_FRAG*(2*4))     /* 2 * uint32_t, see RX_DESC_TypeDef */
58
#define TX_DESC_BASE        (RX_STAT_BASE + NUM_RX_FRAG*(2*4))     /* 2 * uint32_t, see RX_STAT_TypeDef */
59
#define TX_STAT_BASE        (TX_DESC_BASE + NUM_TX_FRAG*(2*4))     /* 2 * uint32_t, see TX_DESC_TypeDef */
60
#define ETH_BUF_BASE            (TX_STAT_BASE + NUM_TX_FRAG*(1*4))     /* 1 * uint32_t, see TX_STAT_TypeDef */
61
 
62
/* RX and TX descriptor and status definitions. */
63
#define RX_DESC_PACKET(i)   (*(unsigned int *)(RX_DESC_BASE   + 8*i))
64
#define RX_DESC_CTRL(i)     (*(unsigned int *)(RX_DESC_BASE+4 + 8*i))
65
#define RX_STAT_INFO(i)     (*(unsigned int *)(RX_STAT_BASE   + 8*i))
66
#define RX_STAT_HASHCRC(i)  (*(unsigned int *)(RX_STAT_BASE+4 + 8*i))
67
#define TX_DESC_PACKET(i)   (*(unsigned int *)(TX_DESC_BASE   + 8*i))
68
#define TX_DESC_CTRL(i)     (*(unsigned int *)(TX_DESC_BASE+4 + 8*i))
69
#define TX_STAT_INFO(i)     (*(unsigned int *)(TX_STAT_BASE   + 4*i))
70
#define ETH_BUF(i)          ( ETH_BUF_BASE + ETH_FRAG_SIZE*i )
71
#define ETH_NUM_BUFFERS         ( NUM_TX_FRAG + NUM_RX_FRAG + 1 ) /* There are in fact 2 more buffers than descriptors as the two Tx descriptors use the same buffer to speed up the uip Tx. */
72
 
73
 
74
/* MAC Configuration Register 1 */
75
#define MAC1_REC_EN         0x00000001  /* Receive Enable                    */
76
#define MAC1_PASS_ALL       0x00000002  /* Pass All Receive Frames           */
77
#define MAC1_RX_FLOWC       0x00000004  /* RX Flow Control                   */
78
#define MAC1_TX_FLOWC       0x00000008  /* TX Flow Control                   */
79
#define MAC1_LOOPB          0x00000010  /* Loop Back Mode                    */
80
#define MAC1_RES_TX         0x00000100  /* Reset TX Logic                    */
81
#define MAC1_RES_MCS_TX     0x00000200  /* Reset MAC TX Control Sublayer     */
82
#define MAC1_RES_RX         0x00000400  /* Reset RX Logic                    */
83
#define MAC1_RES_MCS_RX     0x00000800  /* Reset MAC RX Control Sublayer     */
84
#define MAC1_SIM_RES        0x00004000  /* Simulation Reset                  */
85
#define MAC1_SOFT_RES       0x00008000  /* Soft Reset MAC                    */
86
 
87
/* MAC Configuration Register 2 */
88
#define MAC2_FULL_DUP       0x00000001  /* Full Duplex Mode                  */
89
#define MAC2_FRM_LEN_CHK    0x00000002  /* Frame Length Checking             */
90
#define MAC2_HUGE_FRM_EN    0x00000004  /* Huge Frame Enable                 */
91
#define MAC2_DLY_CRC        0x00000008  /* Delayed CRC Mode                  */
92
#define MAC2_CRC_EN         0x00000010  /* Append CRC to every Frame         */
93
#define MAC2_PAD_EN         0x00000020  /* Pad all Short Frames              */
94
#define MAC2_VLAN_PAD_EN    0x00000040  /* VLAN Pad Enable                   */
95
#define MAC2_ADET_PAD_EN    0x00000080  /* Auto Detect Pad Enable            */
96
#define MAC2_PPREAM_ENF     0x00000100  /* Pure Preamble Enforcement         */
97
#define MAC2_LPREAM_ENF     0x00000200  /* Long Preamble Enforcement         */
98
#define MAC2_NO_BACKOFF     0x00001000  /* No Backoff Algorithm              */
99
#define MAC2_BACK_PRESSURE  0x00002000  /* Backoff Presurre / No Backoff     */
100
#define MAC2_EXCESS_DEF     0x00004000  /* Excess Defer                      */
101
 
102
/* Back-to-Back Inter-Packet-Gap Register */
103
#define IPGT_FULL_DUP       0x00000015  /* Recommended value for Full Duplex */
104
#define IPGT_HALF_DUP       0x00000012  /* Recommended value for Half Duplex */
105
 
106
/* Non Back-to-Back Inter-Packet-Gap Register */
107
#define IPGR_DEF            0x00000012  /* Recommended value                 */
108
 
109
/* Collision Window/Retry Register */
110
#define CLRT_DEF            0x0000370F  /* Default value                     */
111
 
112
/* PHY Support Register */
113
#define SUPP_SPEED          0x00000100  /* Reduced MII Logic Current Speed   */
114
#define SUPP_RES_RMII       0x00000800  /* Reset Reduced MII Logic           */
115
 
116
/* Test Register */
117
#define TEST_SHCUT_PQUANTA  0x00000001  /* Shortcut Pause Quanta             */
118
#define TEST_TST_PAUSE      0x00000002  /* Test Pause                        */
119
#define TEST_TST_BACKP      0x00000004  /* Test Back Pressure                */
120
 
121
/* MII Management Configuration Register */
122
#define MCFG_SCAN_INC       0x00000001  /* Scan Increment PHY Address        */
123
#define MCFG_SUPP_PREAM     0x00000002  /* Suppress Preamble                 */
124
#define MCFG_CLK_SEL        0x0000003C  /* Clock Select Mask                 */
125
#define MCFG_RES_MII        0x00008000  /* Reset MII Management Hardware     */
126
 
127
/* MII Management Command Register */
128
#define MCMD_READ           0x00000001  /* MII Read                          */
129
#define MCMD_SCAN           0x00000002  /* MII Scan continuously             */
130
 
131
#define MII_WR_TOUT         0x00050000  /* MII Write timeout count           */
132
#define MII_RD_TOUT         0x00050000  /* MII Read timeout count            */
133
 
134
/* MII Management Address Register */
135
#define MADR_REG_ADR        0x0000001F  /* MII Register Address Mask         */
136
#define MADR_PHY_ADR        0x00001F00  /* PHY Address Mask                  */
137
 
138
/* MII Management Indicators Register */
139
#define MIND_BUSY           0x00000001  /* MII is Busy                       */
140
#define MIND_SCAN           0x00000002  /* MII Scanning in Progress          */
141
#define MIND_NOT_VAL        0x00000004  /* MII Read Data not valid           */
142
#define MIND_MII_LINK_FAIL  0x00000008  /* MII Link Failed                   */
143
 
144
/* Command Register */
145
#define CR_RX_EN            0x00000001  /* Enable Receive                    */
146
#define CR_TX_EN            0x00000002  /* Enable Transmit                   */
147
#define CR_REG_RES          0x00000008  /* Reset Host Registers              */
148
#define CR_TX_RES           0x00000010  /* Reset Transmit Datapath           */
149
#define CR_RX_RES           0x00000020  /* Reset Receive Datapath            */
150
#define CR_PASS_RUNT_FRM    0x00000040  /* Pass Runt Frames                  */
151
#define CR_PASS_RX_FILT     0x00000080  /* Pass RX Filter                    */
152
#define CR_TX_FLOW_CTRL     0x00000100  /* TX Flow Control                   */
153
#define CR_RMII             0x00000200  /* Reduced MII Interface             */
154
#define CR_FULL_DUP         0x00000400  /* Full Duplex                       */
155
 
156
/* Status Register */
157
#define SR_RX_EN            0x00000001  /* Enable Receive                    */
158
#define SR_TX_EN            0x00000002  /* Enable Transmit                   */
159
 
160
/* Transmit Status Vector 0 Register */
161
#define TSV0_CRC_ERR        0x00000001  /* CRC error                         */
162
#define TSV0_LEN_CHKERR     0x00000002  /* Length Check Error                */
163
#define TSV0_LEN_OUTRNG     0x00000004  /* Length Out of Range               */
164
#define TSV0_DONE           0x00000008  /* Tramsmission Completed            */
165
#define TSV0_MCAST          0x00000010  /* Multicast Destination             */
166
#define TSV0_BCAST          0x00000020  /* Broadcast Destination             */
167
#define TSV0_PKT_DEFER      0x00000040  /* Packet Deferred                   */
168
#define TSV0_EXC_DEFER      0x00000080  /* Excessive Packet Deferral         */
169
#define TSV0_EXC_COLL       0x00000100  /* Excessive Collision               */
170
#define TSV0_LATE_COLL      0x00000200  /* Late Collision Occured            */
171
#define TSV0_GIANT          0x00000400  /* Giant Frame                       */
172
#define TSV0_UNDERRUN       0x00000800  /* Buffer Underrun                   */
173
#define TSV0_BYTES          0x0FFFF000  /* Total Bytes Transferred           */
174
#define TSV0_CTRL_FRAME     0x10000000  /* Control Frame                     */
175
#define TSV0_PAUSE          0x20000000  /* Pause Frame                       */
176
#define TSV0_BACK_PRESS     0x40000000  /* Backpressure Method Applied       */
177
#define TSV0_VLAN           0x80000000  /* VLAN Frame                        */
178
 
179
/* Transmit Status Vector 1 Register */
180
#define TSV1_BYTE_CNT       0x0000FFFF  /* Transmit Byte Count               */
181
#define TSV1_COLL_CNT       0x000F0000  /* Transmit Collision Count          */
182
 
183
/* Receive Status Vector Register */
184
#define RSV_BYTE_CNT        0x0000FFFF  /* Receive Byte Count                */
185
#define RSV_PKT_IGNORED     0x00010000  /* Packet Previously Ignored         */
186
#define RSV_RXDV_SEEN       0x00020000  /* RXDV Event Previously Seen        */
187
#define RSV_CARR_SEEN       0x00040000  /* Carrier Event Previously Seen     */
188
#define RSV_REC_CODEV       0x00080000  /* Receive Code Violation            */
189
#define RSV_CRC_ERR         0x00100000  /* CRC Error                         */
190
#define RSV_LEN_CHKERR      0x00200000  /* Length Check Error                */
191
#define RSV_LEN_OUTRNG      0x00400000  /* Length Out of Range               */
192
#define RSV_REC_OK          0x00800000  /* Frame Received OK                 */
193
#define RSV_MCAST           0x01000000  /* Multicast Frame                   */
194
#define RSV_BCAST           0x02000000  /* Broadcast Frame                   */
195
#define RSV_DRIB_NIBB       0x04000000  /* Dribble Nibble                    */
196
#define RSV_CTRL_FRAME      0x08000000  /* Control Frame                     */
197
#define RSV_PAUSE           0x10000000  /* Pause Frame                       */
198
#define RSV_UNSUPP_OPC      0x20000000  /* Unsupported Opcode                */
199
#define RSV_VLAN            0x40000000  /* VLAN Frame                        */
200
 
201
/* Flow Control Counter Register */
202
#define FCC_MIRR_CNT        0x0000FFFF  /* Mirror Counter                    */
203
#define FCC_PAUSE_TIM       0xFFFF0000  /* Pause Timer                       */
204
 
205
/* Flow Control Status Register */
206
#define FCS_MIRR_CNT        0x0000FFFF  /* Mirror Counter Current            */
207
 
208
/* Receive Filter Control Register */
209
#define RFC_UCAST_EN        0x00000001  /* Accept Unicast Frames Enable      */
210
#define RFC_BCAST_EN        0x00000002  /* Accept Broadcast Frames Enable    */
211
#define RFC_MCAST_EN        0x00000004  /* Accept Multicast Frames Enable    */
212
#define RFC_UCAST_HASH_EN   0x00000008  /* Accept Unicast Hash Filter Frames */
213
#define RFC_MCAST_HASH_EN   0x00000010  /* Accept Multicast Hash Filter Fram.*/
214
#define RFC_PERFECT_EN      0x00000020  /* Accept Perfect Match Enable       */
215
#define RFC_MAGP_WOL_EN     0x00001000  /* Magic Packet Filter WoL Enable    */
216
#define RFC_PFILT_WOL_EN    0x00002000  /* Perfect Filter WoL Enable         */
217
 
218
/* Receive Filter WoL Status/Clear Registers */
219
#define WOL_UCAST           0x00000001  /* Unicast Frame caused WoL          */
220
#define WOL_BCAST           0x00000002  /* Broadcast Frame caused WoL        */
221
#define WOL_MCAST           0x00000004  /* Multicast Frame caused WoL        */
222
#define WOL_UCAST_HASH      0x00000008  /* Unicast Hash Filter Frame WoL     */
223
#define WOL_MCAST_HASH      0x00000010  /* Multicast Hash Filter Frame WoL   */
224
#define WOL_PERFECT         0x00000020  /* Perfect Filter WoL                */
225
#define WOL_RX_FILTER       0x00000080  /* RX Filter caused WoL              */
226
#define WOL_MAG_PACKET      0x00000100  /* Magic Packet Filter caused WoL    */
227
 
228
/* Interrupt Status/Enable/Clear/Set Registers */
229
#define INT_RX_OVERRUN      0x00000001  /* Overrun Error in RX Queue         */
230
#define INT_RX_ERR          0x00000002  /* Receive Error                     */
231
#define INT_RX_FIN          0x00000004  /* RX Finished Process Descriptors   */
232
#define INT_RX_DONE         0x00000008  /* Receive Done                      */
233
#define INT_TX_UNDERRUN     0x00000010  /* Transmit Underrun                 */
234
#define INT_TX_ERR          0x00000020  /* Transmit Error                    */
235
#define INT_TX_FIN          0x00000040  /* TX Finished Process Descriptors   */
236
#define INT_TX_DONE         0x00000080  /* Transmit Done                     */
237
#define INT_SOFT_INT        0x00001000  /* Software Triggered Interrupt      */
238
#define INT_WAKEUP          0x00002000  /* Wakeup Event Interrupt            */
239
 
240
/* Power Down Register */
241
#define PD_POWER_DOWN       0x80000000  /* Power Down MAC                    */
242
 
243
/* RX Descriptor Control Word */
244
#define RCTRL_SIZE          0x000007FF  /* Buffer size mask                  */
245
#define RCTRL_INT           0x80000000  /* Generate RxDone Interrupt         */
246
 
247
/* RX Status Hash CRC Word */
248
#define RHASH_SA            0x000001FF  /* Hash CRC for Source Address       */
249
#define RHASH_DA            0x001FF000  /* Hash CRC for Destination Address  */
250
 
251
/* RX Status Information Word */
252
#define RINFO_SIZE          0x000007FF  /* Data size in bytes                */
253
#define RINFO_CTRL_FRAME    0x00040000  /* Control Frame                     */
254
#define RINFO_VLAN          0x00080000  /* VLAN Frame                        */
255
#define RINFO_FAIL_FILT     0x00100000  /* RX Filter Failed                  */
256
#define RINFO_MCAST         0x00200000  /* Multicast Frame                   */
257
#define RINFO_BCAST         0x00400000  /* Broadcast Frame                   */
258
#define RINFO_CRC_ERR       0x00800000  /* CRC Error in Frame                */
259
#define RINFO_SYM_ERR       0x01000000  /* Symbol Error from PHY             */
260
#define RINFO_LEN_ERR       0x02000000  /* Length Error                      */
261
#define RINFO_RANGE_ERR     0x04000000  /* Range Error (exceeded max. size)  */
262
#define RINFO_ALIGN_ERR     0x08000000  /* Alignment Error                   */
263
#define RINFO_OVERRUN       0x10000000  /* Receive overrun                   */
264
#define RINFO_NO_DESCR      0x20000000  /* No new Descriptor available       */
265
#define RINFO_LAST_FLAG     0x40000000  /* Last Fragment in Frame            */
266
#define RINFO_ERR           0x80000000  /* Error Occured (OR of all errors)  */
267
 
268
#define RINFO_ERR_MASK     (RINFO_FAIL_FILT | RINFO_CRC_ERR   | RINFO_SYM_ERR | \
269
                            RINFO_LEN_ERR   | RINFO_ALIGN_ERR | RINFO_OVERRUN)
270
 
271
/* TX Descriptor Control Word */
272
#define TCTRL_SIZE          0x000007FF  /* Size of data buffer in bytes      */
273
#define TCTRL_OVERRIDE      0x04000000  /* Override Default MAC Registers    */
274
#define TCTRL_HUGE          0x08000000  /* Enable Huge Frame                 */
275
#define TCTRL_PAD           0x10000000  /* Pad short Frames to 64 bytes      */
276
#define TCTRL_CRC           0x20000000  /* Append a hardware CRC to Frame    */
277
#define TCTRL_LAST          0x40000000  /* Last Descriptor for TX Frame      */
278
#define TCTRL_INT           0x80000000  /* Generate TxDone Interrupt         */
279
 
280
/* TX Status Information Word */
281
#define TINFO_COL_CNT       0x01E00000  /* Collision Count                   */
282
#define TINFO_DEFER         0x02000000  /* Packet Deferred (not an error)    */
283
#define TINFO_EXCESS_DEF    0x04000000  /* Excessive Deferral                */
284
#define TINFO_EXCESS_COL    0x08000000  /* Excessive Collision               */
285
#define TINFO_LATE_COL      0x10000000  /* Late Collision Occured            */
286
#define TINFO_UNDERRUN      0x20000000  /* Transmit Underrun                 */
287
#define TINFO_NO_DESCR      0x40000000  /* No new Descriptor available       */
288
#define TINFO_ERR           0x80000000  /* Error Occured (OR of all errors)  */
289
 
290
/* ENET Device Revision ID */
291
#define OLD_EMAC_MODULE_ID  0x39022000  /* Rev. ID for first rev '-'         */
292
 
293
/* KSZ8721BL PHY Registers */
294
#define PHY_REG_BMCR        0x00        /* Basic Mode Control Register       */
295
#define PHY_REG_BMSR        0x01        /* Basic Mode Status Register        */
296
#define PHY_REG_IDR1        0x02        /* PHY Identifier 1                  */
297
#define PHY_REG_IDR2        0x03        /* PHY Identifier 2                  */
298
#define PHY_REG_ANAR        0x04        /* Auto-Negotiation Advertisement    */
299
#define PHY_REG_ANLPAR      0x05        /* Auto-Neg. Link Partner Abitily    */
300
#define PHY_REG_ANER        0x06        /* Auto-Neg. Expansion Register      */
301
#define PHY_REG_ANNPTR      0x07        /* Auto-Neg. Next Page TX            */
302
 
303
/* PHY Extended Registers */
304
#define PHY_REG_RECR        0x15        /* Receive Error Counter             */
305
#define PHY_CTRLER                      0x1f            /* 100BASE-TX-PHY Controller            */
306
 
307
#define PHY_FULLD_100M      0x2100      /* Full Duplex 100Mbit               */
308
#define PHY_HALFD_100M      0x2000      /* Half Duplex 100Mbit               */
309
#define PHY_FULLD_10M       0x0100      /* Full Duplex 10Mbit                */
310
#define PHY_HALFD_10M       0x0000      /* Half Duplex 10MBit                */
311
#define PHY_AUTO_NEG        0x3000      /* Select Auto Negotiation           */
312
#define PHY_AUTO_NEG_COMPLETE 0x0020    /* Auto negotiation have finished.   */
313
 
314
#define KS8721_DEF_ADR          0x0100      /* Default PHY device address        */
315
#define KS8721_ID               0x00221619  /* PHY Identifier                    */
316
 
317
#endif
318
 
319
/*----------------------------------------------------------------------------
320
 * end of file
321
 *---------------------------------------------------------------------------*/

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.