Go to the documentation of this file.
31 #ifndef _TC3XX_ETH_DRIVER_H
32 #define _TC3XX_ETH_DRIVER_H
38 #ifndef TC3XX_ETH_TX_BUFFER_COUNT
39 #define TC3XX_ETH_TX_BUFFER_COUNT 3
40 #elif (TC3XX_ETH_TX_BUFFER_COUNT < 1)
41 #error TC3XX_ETH_TX_BUFFER_COUNT parameter is not valid
45 #ifndef TC3XX_ETH_TX_BUFFER_SIZE
46 #define TC3XX_ETH_TX_BUFFER_SIZE 1536
47 #elif (TC3XX_ETH_TX_BUFFER_SIZE != 1536)
48 #error TC3XX_ETH_TX_BUFFER_SIZE parameter is not valid
52 #ifndef TC3XX_ETH_RX_BUFFER_COUNT
53 #define TC3XX_ETH_RX_BUFFER_COUNT 6
54 #elif (TC3XX_ETH_RX_BUFFER_COUNT < 1)
55 #error TC3XX_ETH_RX_BUFFER_COUNT parameter is not valid
59 #ifndef TC3XX_ETH_RX_BUFFER_SIZE
60 #define TC3XX_ETH_RX_BUFFER_SIZE 1536
61 #elif (TC3XX_ETH_RX_BUFFER_SIZE != 1536)
62 #error TC3XX_ETH_RX_BUFFER_SIZE parameter is not valid
66 #ifndef TC3XX_ETH_IRQ_PRIORITY
67 #define TC3XX_ETH_IRQ_PRIORITY 10
68 #elif (TC3XX_ETH_IRQ_PRIORITY < 0)
69 #error TC3XX_ETH_IRQ_PRIORITY parameter is not valid
73 #define ETH_DMA_CH_STATUS_REB 0x00380000
74 #define ETH_DMA_CH_STATUS_TEB 0x00070000
75 #define ETH_DMA_CH_STATUS_NIS 0x00008000
76 #define ETH_DMA_CH_STATUS_AIS 0x00004000
77 #define ETH_DMA_CH_STATUS_CDE 0x00002000
78 #define ETH_DMA_CH_STATUS_FBE 0x00001000
79 #define ETH_DMA_CH_STATUS_ERI 0x00000800
80 #define ETH_DMA_CH_STATUS_ETI 0x00000400
81 #define ETH_DMA_CH_STATUS_RWT 0x00000200
82 #define ETH_DMA_CH_STATUS_RPS 0x00000100
83 #define ETH_DMA_CH_STATUS_RBU 0x00000080
84 #define ETH_DMA_CH_STATUS_RI 0x00000040
85 #define ETH_DMA_CH_STATUS_TBU 0x00000004
86 #define ETH_DMA_CH_STATUS_TPS 0x00000002
87 #define ETH_DMA_CH_STATUS_TI 0x00000001
90 #define ETH_DMA_CH_INTERRUPT_ENABLE_NIE 0x00008000
91 #define ETH_DMA_CH_INTERRUPT_ENABLE_AIE 0x00004000
92 #define ETH_DMA_CH_INTERRUPT_ENABLE_CDEE 0x00002000
93 #define ETH_DMA_CH_INTERRUPT_ENABLE_FBEE 0x00001000
94 #define ETH_DMA_CH_INTERRUPT_ENABLE_ERIE 0x00000800
95 #define ETH_DMA_CH_INTERRUPT_ENABLE_ETIE 0x00000400
96 #define ETH_DMA_CH_INTERRUPT_ENABLE_RWTE 0x00000200
97 #define ETH_DMA_CH_INTERRUPT_ENABLE_RSE 0x00000100
98 #define ETH_DMA_CH_INTERRUPT_ENABLE_RBUE 0x00000080
99 #define ETH_DMA_CH_INTERRUPT_ENABLE_RIE 0x00000040
100 #define ETH_DMA_CH_INTERRUPT_ENABLE_TBUE 0x00000004
101 #define ETH_DMA_CH_INTERRUPT_ENABLE_TXSE 0x00000002
102 #define ETH_DMA_CH_INTERRUPT_ENABLE_TIE 0x00000001
105 #define ETH_MAC_ADDRESS_HIGH_AE 0x80000000
106 #define ETH_MAC_ADDRESS_HIGH_SA 0x40000000
107 #define ETH_MAC_ADDRESS_HIGH_MBC 0x3F000000
108 #define ETH_MAC_ADDRESS_HIGH_DCS 0x00030000
109 #define ETH_MAC_ADDRESS_HIGH_ADDRHI 0x0000FFFF
112 #define ETH_TDES0_BUF1AP 0xFFFFFFFF
113 #define ETH_TDES1_BUF2AP 0xFFFFFFFF
114 #define ETH_TDES2_IOC 0x80000000
115 #define ETH_TDES2_TTSE 0x40000000
116 #define ETH_TDES2_B2L 0x3FFF0000
117 #define ETH_TDES2_B1L 0x00003FFF
118 #define ETH_TDES3_OWN 0x80000000
119 #define ETH_TDES3_CTXT 0x40000000
120 #define ETH_TDES3_FD 0x20000000
121 #define ETH_TDES3_LD 0x10000000
122 #define ETH_TDES3_CPC 0x0C000000
123 #define ETH_TDES3_SLOTNUM 0x00780000
124 #define ETH_TDES3_CIC 0x00030000
125 #define ETH_TDES3_FL 0x00007FFF
128 #define ETH_TDES0_TTSL 0xFFFFFFFF
129 #define ETH_TDES1_TTSH 0xFFFFFFFF
130 #define ETH_TDES3_OWN 0x80000000
131 #define ETH_TDES3_CTXT 0x40000000
132 #define ETH_TDES3_FD 0x20000000
133 #define ETH_TDES3_LD 0x10000000
134 #define ETH_TDES3_TTSS 0x00020000
135 #define ETH_TDES3_ES 0x00008000
136 #define ETH_TDES3_JT 0x00004000
137 #define ETH_TDES3_FF 0x00002000
138 #define ETH_TDES3_PCE 0x00001000
139 #define ETH_TDES3_LOC 0x00000800
140 #define ETH_TDES3_NC 0x00000400
141 #define ETH_TDES3_LC 0x00000200
142 #define ETH_TDES3_EC 0x00000100
143 #define ETH_TDES3_CC 0x000000F0
144 #define ETH_TDES3_ED 0x00000008
145 #define ETH_TDES3_UF 0x00000004
146 #define ETH_TDES3_DB 0x00000002
147 #define ETH_TDES3_IHE 0x00000001
150 #define ETH_RDES0_BUF1AP 0xFFFFFFFF
151 #define ETH_RDES2_BUF2AP 0xFFFFFFFF
152 #define ETH_RDES3_OWN 0x80000000
153 #define ETH_RDES3_IOC 0x40000000
154 #define ETH_RDES3_BUF2V 0x02000000
155 #define ETH_RDES3_BUF1V 0x01000000
158 #define ETH_RDES1_OPC 0xFFFF0000
159 #define ETH_RDES1_TD 0x00008000
160 #define ETH_RDES1_TSA 0x00004000
161 #define ETH_RDES1_PV 0x00002000
162 #define ETH_RDES1_PFT 0x00001000
163 #define ETH_RDES1_PMT 0x00000F00
164 #define ETH_RDES1_IPCE 0x00000080
165 #define ETH_RDES1_IPCB 0x00000040
166 #define ETH_RDES1_IPV6 0x00000020
167 #define ETH_RDES1_IPV4 0x00000010
168 #define ETH_RDES1_IPHE 0x00000008
169 #define ETH_RDES1_PT 0x00000007
170 #define ETH_RDES2_MADRM 0x07F80000
171 #define ETH_RDES2_DAF 0x00020000
172 #define ETH_RDES2_SAF 0x00010000
173 #define ETH_RDES3_OWN 0x80000000
174 #define ETH_RDES3_CTXT 0x40000000
175 #define ETH_RDES3_FD 0x20000000
176 #define ETH_RDES3_LD 0x10000000
177 #define ETH_RDES3_RS2V 0x08000000
178 #define ETH_RDES3_RS1V 0x04000000
179 #define ETH_RDES3_RS0V 0x02000000
180 #define ETH_RDES3_CE 0x01000000
181 #define ETH_RDES3_GP 0x00800000
182 #define ETH_RDES3_RWT 0x00400000
183 #define ETH_RDES3_OE 0x00200000
184 #define ETH_RDES3_RE 0x00100000
185 #define ETH_RDES3_DE 0x00080000
186 #define ETH_RDES3_LT 0x00070000
187 #define ETH_RDES3_ES 0x00008000
188 #define ETH_RDES3_PL 0x00007FFF
191 #define ETH_CPU_ID() (_mfcr(CPU_CORE_ID) & IFX_CPU_CORE_ID_CORE_ID_MSK)
194 #define ETH_GLOBAL_DSPR_ADDR(address) \
195 ((((uint32_t) (address) & 0xF0000000) == 0xD0000000) ? \
196 ((((uint32_t) (address) & 0x000FFFFF) | 0x70000000) - (ETH_CPU_ID() * 0x10000000)) : \
197 (uint32_t) (address))
uint16_t tc3xxEthReadPhyReg(uint8_t opcode, uint8_t phyAddr, uint8_t regAddr)
Read PHY register.
void tc3xxEthTick(NetInterface *interface)
TC3xx Ethernet MAC timer handler.
error_t tc3xxEthUpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
Structure describing a buffer that spans multiple chunks.
void tc3xxEthIrqHandler(int_t arg)
TC3xx Ethernet MAC interrupt service routine.
error_t tc3xxEthReceivePacket(NetInterface *interface)
Receive a packet.
void tc3xxEthInitDmaDesc(NetInterface *interface)
Initialize DMA descriptor lists.
void tc3xxEthInitGpio(NetInterface *interface)
GPIO configuration.
error_t tc3xxEthInit(NetInterface *interface)
TC3xx Ethernet MAC initialization.
void tc3xxEthEnableIrq(NetInterface *interface)
Enable interrupts.
Network interface controller abstraction layer.
void tc3xxEthEventHandler(NetInterface *interface)
TC3xx Ethernet MAC event handler.
void tc3xxEthWritePhyReg(uint8_t opcode, uint8_t phyAddr, uint8_t regAddr, uint16_t data)
Write PHY register.
const NicDriver tc3xxEthDriver
TC3xx Ethernet MAC driver.
error_t tc3xxEthUpdateMacConfig(NetInterface *interface)
Adjust MAC configuration parameters for proper operation.
void tc3xxEthDisableIrq(NetInterface *interface)
Disable interrupts.
error_t tc3xxEthSendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.