31#ifndef _RZA1_ETH_DRIVER_H
32#define _RZA1_ETH_DRIVER_H
38#ifndef RZA1_ETH_TX_BUFFER_COUNT
39 #define RZA1_ETH_TX_BUFFER_COUNT 8
40#elif (RZA1_ETH_TX_BUFFER_COUNT < 1)
41 #error RZA1_ETH_TX_BUFFER_COUNT parameter is not valid
45#ifndef RZA1_ETH_TX_BUFFER_SIZE
46 #define RZA1_ETH_TX_BUFFER_SIZE 1536
47#elif (RZA1_ETH_TX_BUFFER_SIZE != 1536)
48 #error RZA1_ETH_TX_BUFFER_SIZE parameter is not valid
52#ifndef RZA1_ETH_RX_BUFFER_COUNT
53 #define RZA1_ETH_RX_BUFFER_COUNT 8
54#elif (RZA1_ETH_RX_BUFFER_COUNT < 1)
55 #error RZA1_ETH_RX_BUFFER_COUNT parameter is not valid
59#ifndef RZA1_ETH_RX_BUFFER_SIZE
60 #define RZA1_ETH_RX_BUFFER_SIZE 1536
61#elif (RZA1_ETH_RX_BUFFER_SIZE != 1536)
62 #error RZA1_ETH_RX_BUFFER_SIZE parameter is not valid
66#ifndef RZA1_ETH_IRQ_PRIORITY
67 #define RZA1_ETH_IRQ_PRIORITY 25
68#elif (RZA1_ETH_IRQ_PRIORITY < 0)
69 #error RZA1_ETH_IRQ_PRIORITY parameter is not valid
73#ifndef RZA1_ETH_RAM_SECTION
74 #define RZA1_ETH_RAM_SECTION ".BSS_DMAC_SAMPLE_INTERNAL_RAM"
78#define ETHER_ARSTR_ARST 0x00000001
81#define ETH_ECMR0_TRCCM 0x04000000
82#define ETH_ECMR0_RCSC 0x00800000
83#define ETH_ECMR0_DPAD 0x00200000
84#define ETH_ECMR0_RZPF 0x00100000
85#define ETH_ECMR0_ZPF 0x00080000
86#define ETH_ECMR0_PFR 0x00040000
87#define ETH_ECMR0_RXF 0x00020000
88#define ETH_ECMR0_TXF 0x00010000
89#define ETH_ECMR0_MCT 0x00002000
90#define ETH_ECMR0_RE 0x00000040
91#define ETH_ECMR0_TE 0x00000020
92#define ETH_ECMR0_DM 0x00000002
93#define ETH_ECMR0_PRM 0x00000001
96#define ETHER_PIR0_MDI 0x00000008
97#define ETHER_PIR0_MDO 0x00000004
98#define ETHER_PIR0_MMD 0x00000002
99#define ETHER_PIR0_MDC 0x00000001
102#define ETHER_TSU_ADSBSY_ADSBSY 0x00000001
105#define ETHER_EDSR0_ENT 0x00000002
106#define ETHER_EDSR0_ENR 0x00000001
109#define ETHER_EDMR0_DE 0x00000040
110#define ETHER_EDMR0_DL 0x00000030
111#define ETHER_EDMR0_SWRT 0x00000002
112#define ETHER_EDMR0_SWRR 0x00000001
114#define ETHER_EDMR0_DL_16 0x00000000
115#define ETHER_EDMR0_DL_32 0x00000010
116#define ETHER_EDMR0_DL_64 0x00000020
119#define ETHER_EDTRR0_TR 0x00000003
122#define ETHER_EDRRR0_RR 0x00000001
125#define ETHER_EESR0_TWB 0xC0000000
126#define ETHER_EESR0_TC1 0x20000000
127#define ETHER_EESR0_TUC 0x10000000
128#define ETHER_EESR0_ROC 0x08000000
129#define ETHER_EESR0_TABT 0x04000000
130#define ETHER_EESR0_RABT 0x02000000
131#define ETHER_EESR0_RFCOF 0x01000000
132#define ETHER_EESR0_ECI 0x00400000
133#define ETHER_EESR0_TC0 0x00200000
134#define ETHER_EESR0_TDE 0x00100000
135#define ETHER_EESR0_TFUF 0x00080000
136#define ETHER_EESR0_FR 0x00040000
137#define ETHER_EESR0_RDE 0x00020000
138#define ETHER_EESR0_RFOF 0x00010000
139#define ETHER_EESR0_RMAF 0x00000080
140#define ETHER_EESR0_RRF 0x00000010
141#define ETHER_EESR0_RTLF 0x00000008
142#define ETHER_EESR0_RTSF 0x00000004
143#define ETHER_EESR0_PRE 0x00000002
144#define ETHER_EESR0_CERF 0x00000001
147#define ETHER_EESIPR0_TWBIP 0xC0000000
148#define ETHER_EESIPR0_TC1IP 0x20000000
149#define ETHER_EESIPR0_TUCIP 0x10000000
150#define ETHER_EESIPR0_ROCIP 0x08000000
151#define ETHER_EESIPR0_TABTIP 0x04000000
152#define ETHER_EESIPR0_RABTIP 0x02000000
153#define ETHER_EESIPR0_RFCOFIP 0x01000000
154#define ETHER_EESIPR0_ECIIP 0x00400000
155#define ETHER_EESIPR0_TC0IP 0x00200000
156#define ETHER_EESIPR0_TDEIP 0x00100000
157#define ETHER_EESIPR0_TFUFIP 0x00080000
158#define ETHER_EESIPR0_FRIP 0x00040000
159#define ETHER_EESIPR0_RDEIP 0x00020000
160#define ETHER_EESIPR0_RFOFIP 0x00010000
161#define ETHER_EESIPR0_RMAFIP 0x00000080
162#define ETHER_EESIPR0_RRFIP 0x00000010
163#define ETHER_EESIPR0_RTLFIP 0x00000008
164#define ETHER_EESIPR0_RTSFIP 0x00000004
165#define ETHER_EESIPR0_PREIP 0x00000002
166#define ETHER_EESIPR0_CERFIP 0x00000001
169#define ETHER_TDFFR_TDLF 0x00000001
172#define ETHER_RDFFR0_RDLF 0x00000001
175#define ETHER_FDR0_TFD 0x00000700
176#define ETHER_FDR0_RFD 0X0000001F
178#define ETHER_FDR0_TFD_2048 0x00000700
179#define ETHER_FDR0_RFD_2048 0x00000007
182#define ETHER_RMCR0_RNC 0x00000001
185#define ETHER_FCFTR0_RFF 0x001F0000
186#define ETHER_FCFTR0_RFD 0x000000FF
188#define ETHER_FCFTR0_RFF_8 0x00070000
189#define ETHER_FCFTR0_RFD_2048 0x00000007
192#define ETHER_TD0_TACT 0x80000000
193#define ETHER_TD0_TDLE 0x40000000
194#define ETHER_TD0_TFP_SOF 0x20000000
195#define ETHER_TD0_TFP_EOF 0x10000000
196#define ETHER_TD0_TFE 0x08000000
197#define ETHER_TD0_TWBI 0x04000000
198#define ETHER_TD0_TFS_MASK 0x00000300
199#define ETHER_TD0_TFS_TUC 0x00000200
200#define ETHER_TD0_TFS_TABT 0x00000100
201#define ETHER_TD1_TDL 0xFFFF0000
202#define ETHER_TD2_TBA 0xFFFFFFFF
205#define ETHER_RD0_RACT 0x80000000
206#define ETHER_RD0_RDLE 0x40000000
207#define ETHER_RD0_RFP_SOF 0x20000000
208#define ETHER_RD0_RFP_EOF 0x10000000
209#define ETHER_RD0_RFE 0x08000000
210#define ETHER_RD0_RCSE 0x04000000
211#define ETHER_RD0_RFS_MASK 0x02DF0000
212#define ETHER_RD0_RFS_RFOF 0x02000000
213#define ETHER_RD0_RFS_RMAF 0x00800000
214#define ETHER_RD0_RFS_RUAF 0x00400000
215#define ETHER_RD0_RFS_RRF 0x00100000
216#define ETHER_RD0_RFS_RTLF 0x00080000
217#define ETHER_RD0_RFS_RTSF 0x00040000
218#define ETHER_RD0_RFS_PRE 0x00020000
219#define ETHER_RD0_RFS_CERF 0x00010000
220#define ETHER_RD0_RCS 0x0000FFFF
221#define ETHER_RD1_RBL 0xFFFF0000
222#define ETHER_RD1_RDL 0x0000FFFF
223#define ETHER_RD2_RBA 0xFFFFFFFF
261error_t rza1EthInit(NetInterface *interface);
262void rza1EthInitGpio(NetInterface *interface);
263void rza1EthInitDmaDesc(NetInterface *interface);
265void rza1EthTick(NetInterface *interface);
267void rza1EthEnableIrq(NetInterface *interface);
268void rza1EthDisableIrq(NetInterface *interface);
269void rza1EthIrqHandler(uint32_t intSense);
270void rza1EthEventHandler(NetInterface *interface);
272error_t rza1EthSendPacket(NetInterface *interface,
273 const NetBuffer *buffer,
size_t offset, NetTxAncillary *ancillary);
275error_t rza1EthReceivePacket(NetInterface *interface);
277error_t rza1EthUpdateMacAddrFilter(NetInterface *interface);
278error_t rza1EthUpdateMacConfig(NetInterface *interface);
280void rza1EthWritePhyReg(uint8_t opcode, uint8_t phyAddr,
281 uint8_t regAddr, uint16_t data);
283uint16_t rza1EthReadPhyReg(uint8_t opcode, uint8_t phyAddr,
286void rza1EthWriteSmi(uint32_t data, uint_t length);
287uint32_t rza1EthReadSmi(uint_t length);
error_t
Error codes.
Definition error.h:43
Network interface controller abstraction layer.
Structure describing a buffer that spans multiple chunks.
Definition net_mem.h:89
NIC driver.
Definition nic.h:283
Receive DMA descriptor.
Definition rza1_eth_driver.h:249
Transmit DMA descriptor.
Definition rza1_eth_driver.h:236