File tree Expand file tree Collapse file tree 6 files changed +9
-4
lines changed
features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC Expand file tree Collapse file tree 6 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -262,6 +262,8 @@ void numaker_eth_init(uint8_t *mac_addr)
262
262
EMAC_CAMCTL_ABP_Msk ;
263
263
EMAC -> CAMEN = 1 ; // Enable CAM entry 0
264
264
265
+ /* Limit the max receive frame length to 1514 + 4 */
266
+ EMAC -> MRFL = NU_ETH_MAX_FLEN ;
265
267
reset_phy ();
266
268
267
269
EMAC_ENABLE_RX ();
Original file line number Diff line number Diff line change 85
85
#define RX_DESCRIPTOR_NUM NU_RX_RING_LEN//4 //2 // 4: Max Number of Rx Frame Descriptors
86
86
#define TX_DESCRIPTOR_NUM NU_TX_RING_LEN//4 //2 // 4: Max number of Tx Frame Descriptors
87
87
88
- #define PACKET_BUFFER_SIZE NU_ETH_MAX_FLEN//1520
88
+ #define PACKET_BUFFER_SIZE ( NU_ETH_MAX_FLEN + ((NU_ETH_MAX_FLEN%4) ? (4 - (NU_ETH_MAX_FLEN%4)) : 0) ) //For DMA 4 bytes alignment
89
89
90
90
#define CONFIG_PHY_ADDR 1
91
91
Original file line number Diff line number Diff line change @@ -228,6 +228,9 @@ void numaker_eth_init(uint8_t *mac_addr)
228
228
init_rx_desc ();
229
229
230
230
numaker_set_mac_addr (mac_addr ); // need to reconfigure hardware address 'cos we just RESET emc...
231
+
232
+ /* Limit the max receive frame length to 1514 + 4 */
233
+ EMAC -> MRFL = NU_ETH_MAX_FLEN ;
231
234
reset_phy ();
232
235
233
236
EMAC -> CTL |= EMAC_CTL_STRIPCRC_Msk | EMAC_CTL_RXON_Msk | EMAC_CTL_TXON_Msk | EMAC_CTL_RMIIEN_Msk | EMAC_CTL_RMIIRXCTL_Msk ;
Original file line number Diff line number Diff line change 84
84
#define RX_DESCRIPTOR_NUM NU_RX_RING_LEN//4 //2 // 4: Max Number of Rx Frame Descriptors
85
85
#define TX_DESCRIPTOR_NUM NU_TX_RING_LEN//4 //2 // 4: Max number of Tx Frame Descriptors
86
86
87
- #define PACKET_BUFFER_SIZE NU_ETH_MAX_FLEN//1520
87
+ #define PACKET_BUFFER_SIZE ( NU_ETH_MAX_FLEN + ((NU_ETH_MAX_FLEN%4) ? (4 - (NU_ETH_MAX_FLEN%4)) : 0) ) //For DMA 4 bytes alignment
88
88
89
89
#define CONFIG_PHY_ADDR 1
90
90
Original file line number Diff line number Diff line change 42
42
#define NU_BUFF_ALIGNMENT 4
43
43
#define PHY_LINKED_STATE 1
44
44
#define PHY_UNLINKED_STATE 0
45
- #define PACKET_BUFFER_SIZE NU_ETH_MAX_FLEN
45
+ #define PACKET_BUFFER_SIZE ( NU_ETH_MAX_FLEN + ((NU_ETH_MAX_FLEN% 4 ) ? ( 4 - (NU_ETH_MAX_FLEN% 4 )) : 0 ) ) // For DMA 4 bytes alignment
46
46
47
47
extern " C" void numaker_eth_rx_next (void );
48
48
/* \brief Flags for worker thread */
Original file line number Diff line number Diff line change 22
22
#define NU_RX_RING_LEN (8)
23
23
#define NU_TX_RING_LEN (4)
24
24
25
- #define NU_ETH_MAX_FLEN (1520 )
25
+ #define NU_ETH_MAX_FLEN (1518 )
26
26
27
27
#define NU_HWADDR_SIZE (6)
28
28
You can’t perform that action at this time.
0 commit comments