Skip to content

Commit 42103f0

Browse files
committed
Correct the definition of M487/NUC472 EMAC NU_ETH_MAX_FLEN & PACKET_BUFFER_SIZE
1 parent 54d8c40 commit 42103f0

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC/TARGET_M480/m480_eth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ void numaker_eth_init(uint8_t *mac_addr)
263263
EMAC->CAMEN = 1; // Enable CAM entry 0
264264

265265
/* Limit the max receive frame length to 1514 + 4 */
266-
EMAC->MRFL = 1518;
266+
EMAC->MRFL = NU_ETH_MAX_FLEN;
267267
reset_phy();
268268

269269
EMAC_ENABLE_RX();

features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC/TARGET_M480/m480_eth.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
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

features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC/TARGET_NUC472/nuc472_eth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ void numaker_eth_init(uint8_t *mac_addr)
230230
numaker_set_mac_addr(mac_addr); // need to reconfigure hardware address 'cos we just RESET emc...
231231

232232
/* Limit the max receive frame length to 1514 + 4 */
233-
EMAC->MRFL = 1518;
233+
EMAC->MRFL = NU_ETH_MAX_FLEN;
234234
reset_phy();
235235

236236
EMAC->CTL |= EMAC_CTL_STRIPCRC_Msk | EMAC_CTL_RXON_Msk | EMAC_CTL_TXON_Msk | EMAC_CTL_RMIIEN_Msk | EMAC_CTL_RMIIRXCTL_Msk;

features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC/TARGET_NUC472/nuc472_eth.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
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

features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC/numaker_emac.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
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

4747
extern "C" void numaker_eth_rx_next(void);
4848
/* \brief Flags for worker thread */

features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC/numaker_emac_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
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

0 commit comments

Comments
 (0)