31#ifndef _MK6X_ETH_DRIVER_H
32#define _MK6X_ETH_DRIVER_H
35#ifndef MK6X_ETH_TX_BUFFER_COUNT
36 #define MK6X_ETH_TX_BUFFER_COUNT 3
37#elif (MK6X_ETH_TX_BUFFER_COUNT < 1)
38 #error MK6X_ETH_TX_BUFFER_COUNT parameter is not valid
42#ifndef MK6X_ETH_TX_BUFFER_SIZE
43 #define MK6X_ETH_TX_BUFFER_SIZE 1536
44#elif (MK6X_ETH_TX_BUFFER_SIZE != 1536)
45 #error MK6X_ETH_TX_BUFFER_SIZE parameter is not valid
49#ifndef MK6X_ETH_RX_BUFFER_COUNT
50 #define MK6X_ETH_RX_BUFFER_COUNT 6
51#elif (MK6X_ETH_RX_BUFFER_COUNT < 1)
52 #error MK6X_ETH_RX_BUFFER_COUNT parameter is not valid
56#ifndef MK6X_ETH_RX_BUFFER_SIZE
57 #define MK6X_ETH_RX_BUFFER_SIZE 1536
58#elif (MK6X_ETH_RX_BUFFER_SIZE != 1536)
59 #error MK6X_ETH_RX_BUFFER_SIZE parameter is not valid
63#ifndef MK6X_ETH_IRQ_PRIORITY_GROUPING
64 #define MK6X_ETH_IRQ_PRIORITY_GROUPING 3
65#elif (MK6X_ETH_IRQ_PRIORITY_GROUPING < 0)
66 #error MK6X_ETH_IRQ_PRIORITY_GROUPING parameter is not valid
70#ifndef MK6X_ETH_IRQ_GROUP_PRIORITY
71 #define MK6X_ETH_IRQ_GROUP_PRIORITY 12
72#elif (MK6X_ETH_IRQ_GROUP_PRIORITY < 0)
73 #error MK6X_ETH_IRQ_GROUP_PRIORITY parameter is not valid
77#ifndef MK6X_ETH_IRQ_SUB_PRIORITY
78 #define MK6X_ETH_IRQ_SUB_PRIORITY 0
79#elif (MK6X_ETH_IRQ_SUB_PRIORITY < 0)
80 #error MK6X_ETH_IRQ_SUB_PRIORITY parameter is not valid
88#ifndef MPU_CESR_VLD_MASK
89 #define MPU_CESR_VLD_MASK SYSMPU_CESR_VLD_MASK
93#define ENET_TBD0_R 0x8000
94#define ENET_TBD0_TO1 0x4000
95#define ENET_TBD0_W 0x2000
96#define ENET_TBD0_TO2 0x1000
97#define ENET_TBD0_L 0x0800
98#define ENET_TBD0_TC 0x0400
99#define ENET_TBD1_DATA_LENGTH 0xFFFF
100#define ENET_TBD2_DATA_POINTER_H 0xFFFF
101#define ENET_TBD3_DATA_POINTER_L 0xFFFF
102#define ENET_TBD4_INT 0x4000
103#define ENET_TBD4_TS 0x2000
104#define ENET_TBD4_PINS 0x1000
105#define ENET_TBD4_IINS 0x0800
106#define ENET_TBD5_TXE 0x8000
107#define ENET_TBD5_UE 0x2000
108#define ENET_TBD5_EE 0x1000
109#define ENET_TBD5_FE 0x0800
110#define ENET_TBD5_LCE 0x0400
111#define ENET_TBD5_OE 0x0200
112#define ENET_TBD5_TSE 0x0100
113#define ENET_TBD8_BDU 0x8000
114#define ENET_TBD10_TIMESTAMP_H 0xFFFF
115#define ENET_TBD11_TIMESTAMP_L 0xFFFF
118#define ENET_RBD0_E 0x8000
119#define ENET_RBD0_RO1 0x4000
120#define ENET_RBD0_W 0x2000
121#define ENET_RBD0_RO2 0x1000
122#define ENET_RBD0_L 0x0800
123#define ENET_RBD0_M 0x0100
124#define ENET_RBD0_BC 0x0080
125#define ENET_RBD0_MC 0x0040
126#define ENET_RBD0_LG 0x0020
127#define ENET_RBD0_NO 0x0010
128#define ENET_RBD0_CR 0x0004
129#define ENET_RBD0_OV 0x0002
130#define ENET_RBD0_TR 0x0001
131#define ENET_RBD1_DATA_LENGTH 0xFFFF
132#define ENET_RBD2_DATA_POINTER_H 0xFFFF
133#define ENET_RBD3_DATA_POINTER_L 0xFFFF
134#define ENET_RBD4_ME 0x8000
135#define ENET_RBD4_PE 0x0400
136#define ENET_RBD4_CE 0x0200
137#define ENET_RBD4_UC 0x0100
138#define ENET_RBD4_INT 0x0080
139#define ENET_RBD5_VPCP 0xE000
140#define ENET_RBD5_ICE 0x0020
141#define ENET_RBD5_PCR 0x0010
142#define ENET_RBD5_VLAN 0x0004
143#define ENET_RBD5_IPV6 0x0002
144#define ENET_RBD5_FRAG 0x0001
145#define ENET_RBD6_HEADER_LENGTH 0xF800
146#define ENET_RBD6_PROTOCOL_TYPE 0x00FF
147#define ENET_RBD7_PAYLOAD_CHECKSUM 0xFFFF
148#define ENET_RBD8_BDU 0x8000
149#define ENET_RBD10_TIMESTAMP_H 0xFFFF
150#define ENET_RBD11_TIMESTAMP_L 0xFFFF
161error_t mk6xEthInit(NetInterface *interface);
163void mk6xEthInitBufferDesc(NetInterface *interface);
165void mk6xEthTick(NetInterface *interface);
167void mk6xEthEnableIrq(NetInterface *interface);
168void mk6xEthDisableIrq(NetInterface *interface);
169void mk6xEthEventHandler(NetInterface *interface);
171error_t mk6xEthSendPacket(NetInterface *interface,
172 const NetBuffer *buffer,
size_t offset, NetTxAncillary *ancillary);
174error_t mk6xEthReceivePacket(NetInterface *interface);
176error_t mk6xEthUpdateMacAddrFilter(NetInterface *interface);
177error_t mk6xEthUpdateMacConfig(NetInterface *interface);
179void mk6xEthWritePhyReg(uint8_t opcode, uint8_t phyAddr,
180 uint8_t regAddr, uint16_t data);
182uint16_t mk6xEthReadPhyReg(uint8_t opcode, uint8_t phyAddr,
185uint32_t mk6xEthCalcCrc(
const void *data,
size_t length);
error_t
Error codes.
Definition error.h:43
void mk6xEthInitGpio(NetInterface *interface)
Externally linked API for ETH configuration.
Definition hw_eth.h:82
Structure describing a buffer that spans multiple chunks.
Definition net_mem.h:89
NIC driver.
Definition nic.h:283