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)
262262 EMAC_CAMCTL_ABP_Msk ;
263263 EMAC -> CAMEN = 1 ; // Enable CAM entry 0
264264
265+ /* Limit the max receive frame length to 1514 + 4 */
266+ EMAC -> MRFL = NU_ETH_MAX_FLEN ;
265267 reset_phy ();
266268
267269 EMAC_ENABLE_RX ();
Original file line number Diff line number Diff line change 8585#define RX_DESCRIPTOR_NUM NU_RX_RING_LEN//4 //2 // 4: Max Number of Rx Frame Descriptors
8686#define TX_DESCRIPTOR_NUM NU_TX_RING_LEN//4 //2 // 4: Max number of Tx Frame Descriptors
8787
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
8989
9090#define CONFIG_PHY_ADDR 1
9191
Original file line number Diff line number Diff line change @@ -228,6 +228,9 @@ void numaker_eth_init(uint8_t *mac_addr)
228228 init_rx_desc ();
229229
230230 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 ;
231234 reset_phy ();
232235
233236 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 8484#define RX_DESCRIPTOR_NUM NU_RX_RING_LEN//4 //2 // 4: Max Number of Rx Frame Descriptors
8585#define TX_DESCRIPTOR_NUM NU_TX_RING_LEN//4 //2 // 4: Max number of Tx Frame Descriptors
8686
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
8888
8989#define CONFIG_PHY_ADDR 1
9090
Original file line number Diff line number Diff line change 4242#define NU_BUFF_ALIGNMENT 4
4343#define PHY_LINKED_STATE 1
4444#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
4646
4747extern " C" void numaker_eth_rx_next (void );
4848/* \brief Flags for worker thread */
Original file line number Diff line number Diff line change 2222#define NU_RX_RING_LEN (8)
2323#define NU_TX_RING_LEN (4)
2424
25- #define NU_ETH_MAX_FLEN (1520 )
25+ #define NU_ETH_MAX_FLEN (1518 )
2626
2727#define NU_HWADDR_SIZE (6)
2828
You can’t perform that action at this time.
0 commit comments