mikroSDK Reference Manual
mimxrt1170_eth1_driver.h
Go to the documentation of this file.
1
31#ifndef _MIMXRT1170_ETH1_DRIVER_H
32#define _MIMXRT1170_ETH1_DRIVER_H
33
34//Number of TX buffers
35#ifndef MIMXRT1170_ETH1_TX_BUFFER_COUNT
36 #define MIMXRT1170_ETH1_TX_BUFFER_COUNT 8
37#elif (MIMXRT1170_ETH1_TX_BUFFER_COUNT < 1)
38 #error MIMXRT1170_ETH1_TX_BUFFER_COUNT parameter is not valid
39#endif
40
41//TX buffer size
42#ifndef MIMXRT1170_ETH1_TX_BUFFER_SIZE
43 #define MIMXRT1170_ETH1_TX_BUFFER_SIZE 1536
44#elif (MIMXRT1170_ETH1_TX_BUFFER_SIZE != 1536)
45 #error MIMXRT1170_ETH1_TX_BUFFER_SIZE parameter is not valid
46#endif
47
48//Number of RX buffers
49#ifndef MIMXRT1170_ETH1_RX_BUFFER_COUNT
50 #define MIMXRT1170_ETH1_RX_BUFFER_COUNT 8
51#elif (MIMXRT1170_ETH1_RX_BUFFER_COUNT < 1)
52 #error MIMXRT1170_ETH1_RX_BUFFER_COUNT parameter is not valid
53#endif
54
55//RX buffer size
56#ifndef MIMXRT1170_ETH1_RX_BUFFER_SIZE
57 #define MIMXRT1170_ETH1_RX_BUFFER_SIZE 1536
58#elif (MIMXRT1170_ETH1_RX_BUFFER_SIZE != 1536)
59 #error MIMXRT1170_ETH1_RX_BUFFER_SIZE parameter is not valid
60#endif
61
62//Interrupt priority grouping
63#ifndef MIMXRT1170_ETH1_IRQ_PRIORITY_GROUPING
64 #define MIMXRT1170_ETH1_IRQ_PRIORITY_GROUPING 3
65#elif (MIMXRT1170_ETH1_IRQ_PRIORITY_GROUPING < 0)
66 #error MIMXRT1170_ETH1_IRQ_PRIORITY_GROUPING parameter is not valid
67#endif
68
69//Ethernet interrupt group priority
70#ifndef MIMXRT1170_ETH1_IRQ_GROUP_PRIORITY
71 #define MIMXRT1170_ETH1_IRQ_GROUP_PRIORITY 12
72#elif (MIMXRT1170_ETH1_IRQ_GROUP_PRIORITY < 0)
73 #error MIMXRT1170_ETH1_IRQ_GROUP_PRIORITY parameter is not valid
74#endif
75
76//Ethernet interrupt subpriority
77#ifndef MIMXRT1170_ETH1_IRQ_SUB_PRIORITY
78 #define MIMXRT1170_ETH1_IRQ_SUB_PRIORITY 0
79#elif (MIMXRT1170_ETH1_IRQ_SUB_PRIORITY < 0)
80 #error MIMXRT1170_ETH1_IRQ_SUB_PRIORITY parameter is not valid
81#endif
82
83//Name of the section where to place DMA buffers
84#ifndef MIMXRT1170_ETH1_RAM_SECTION
85 #define MIMXRT1170_ETH1_RAM_SECTION ".ram_no_cache"
86#endif
87
88//Enhanced transmit buffer descriptor
89#define ENET_TBD0_R 0x80000000
90#define ENET_TBD0_TO1 0x40000000
91#define ENET_TBD0_W 0x20000000
92#define ENET_TBD0_TO2 0x10000000
93#define ENET_TBD0_L 0x08000000
94#define ENET_TBD0_TC 0x04000000
95#define ENET_TBD0_DATA_LENGTH 0x0000FFFF
96#define ENET_TBD1_DATA_POINTER 0xFFFFFFFF
97#define ENET_TBD2_INT 0x40000000
98#define ENET_TBD2_TS 0x20000000
99#define ENET_TBD2_PINS 0x10000000
100#define ENET_TBD2_IINS 0x08000000
101#define ENET_TBD2_TXE 0x00008000
102#define ENET_TBD2_UE 0x00002000
103#define ENET_TBD2_EE 0x00001000
104#define ENET_TBD2_FE 0x00000800
105#define ENET_TBD2_LCE 0x00000400
106#define ENET_TBD2_OE 0x00000200
107#define ENET_TBD2_TSE 0x00000100
108#define ENET_TBD4_BDU 0x80000000
109#define ENET_TBD5_TIMESTAMP 0xFFFFFFFF
110
111//Enhanced receive buffer descriptor
112#define ENET_RBD0_E 0x80000000
113#define ENET_RBD0_RO1 0x40000000
114#define ENET_RBD0_W 0x20000000
115#define ENET_RBD0_RO2 0x10000000
116#define ENET_RBD0_L 0x08000000
117#define ENET_RBD0_M 0x01000000
118#define ENET_RBD0_BC 0x00800000
119#define ENET_RBD0_MC 0x00400000
120#define ENET_RBD0_LG 0x00200000
121#define ENET_RBD0_NO 0x00100000
122#define ENET_RBD0_CR 0x00040000
123#define ENET_RBD0_OV 0x00020000
124#define ENET_RBD0_TR 0x00010000
125#define ENET_RBD0_DATA_LENGTH 0x0000FFFF
126#define ENET_RBD1_DATA_POINTER 0xFFFFFFFF
127#define ENET_RBD2_ME 0x80000000
128#define ENET_RBD2_PE 0x04000000
129#define ENET_RBD2_CE 0x02000000
130#define ENET_RBD2_UC 0x01000000
131#define ENET_RBD2_INT 0x00800000
132#define ENET_RBD2_VPCP 0x0000E000
133#define ENET_RBD2_ICE 0x00000020
134#define ENET_RBD2_PCR 0x00000010
135#define ENET_RBD2_VLAN 0x00000004
136#define ENET_RBD2_IPV6 0x00000002
137#define ENET_RBD2_FRAG 0x00000001
138#define ENET_RBD3_HEADER_LENGTH 0xF8000000
139#define ENET_RBD3_PROTOCOL_TYPE 0x00FF0000
140#define ENET_RBD3_PAYLOAD_CHECKSUM 0x0000FFFF
141#define ENET_RBD4_BDU 0x80000000
142#define ENET_RBD5_TIMESTAMP 0xFFFFFFFF
143
144//C++ guard
145#ifdef __cplusplus
146extern "C" {
147#endif
148
149//i.MX RT1170 Ethernet MAC driver (ENET instance)
150extern const NicDriver mimxrt1170Eth1Driver;
151
152//i.MX RT1170 Ethernet MAC related functions
153error_t mimxrt1170Eth1Init(NetInterface *interface);
154void mimxrt1170Eth1InitGpio(NetInterface *interface);
155void mimxrt1170Eth1InitBufferDesc(NetInterface *interface);
156
157void mimxrt1170Eth1Tick(NetInterface *interface);
158
159void mimxrt1170Eth1EnableIrq(NetInterface *interface);
160void mimxrt1170Eth1DisableIrq(NetInterface *interface);
161void mimxrt1170Eth1EventHandler(NetInterface *interface);
162
163error_t mimxrt1170Eth1SendPacket(NetInterface *interface,
164 const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary);
165
166error_t mimxrt1170Eth1ReceivePacket(NetInterface *interface);
167
168error_t mimxrt1170Eth1UpdateMacAddrFilter(NetInterface *interface);
169error_t mimxrt1170Eth1UpdateMacConfig(NetInterface *interface);
170
171void mimxrt1170Eth1WritePhyReg(uint8_t opcode, uint8_t phyAddr,
172 uint8_t regAddr, uint16_t data);
173
174uint16_t mimxrt1170Eth1ReadPhyReg(uint8_t opcode, uint8_t phyAddr,
175 uint8_t regAddr);
176
177uint32_t mimxrt1170Eth1CalcCrc(const void *data, size_t length);
178
179//C++ guard
180#ifdef __cplusplus
181}
182#endif
183
184#endif
error_t
Error codes.
Definition error.h:43
Structure describing a buffer that spans multiple chunks.
Definition net_mem.h:89
NIC driver.
Definition nic.h:283