Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NUC472/M487: Limit EMAC receive frame length as 1518 #12057

Merged
merged 3 commits into from Dec 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -262,6 +262,8 @@ void numaker_eth_init(uint8_t *mac_addr)
EMAC_CAMCTL_ABP_Msk;
EMAC->CAMEN = 1; // Enable CAM entry 0

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

EMAC_ENABLE_RX();
Expand Down
Expand Up @@ -85,7 +85,7 @@
#define RX_DESCRIPTOR_NUM NU_RX_RING_LEN//4 //2 // 4: Max Number of Rx Frame Descriptors
#define TX_DESCRIPTOR_NUM NU_TX_RING_LEN//4 //2 // 4: Max number of Tx Frame Descriptors

#define PACKET_BUFFER_SIZE NU_ETH_MAX_FLEN//1520
#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

#define CONFIG_PHY_ADDR 1

Expand Down
Expand Up @@ -228,6 +228,9 @@ void numaker_eth_init(uint8_t *mac_addr)
init_rx_desc();

numaker_set_mac_addr(mac_addr); // need to reconfigure hardware address 'cos we just RESET emc...

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

EMAC->CTL |= EMAC_CTL_STRIPCRC_Msk | EMAC_CTL_RXON_Msk | EMAC_CTL_TXON_Msk | EMAC_CTL_RMIIEN_Msk | EMAC_CTL_RMIIRXCTL_Msk;
Expand Down
Expand Up @@ -84,7 +84,7 @@
#define RX_DESCRIPTOR_NUM NU_RX_RING_LEN//4 //2 // 4: Max Number of Rx Frame Descriptors
#define TX_DESCRIPTOR_NUM NU_TX_RING_LEN//4 //2 // 4: Max number of Tx Frame Descriptors

#define PACKET_BUFFER_SIZE NU_ETH_MAX_FLEN//1520
#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

#define CONFIG_PHY_ADDR 1

Expand Down
Expand Up @@ -42,7 +42,7 @@
#define NU_BUFF_ALIGNMENT 4
#define PHY_LINKED_STATE 1
#define PHY_UNLINKED_STATE 0
#define PACKET_BUFFER_SIZE NU_ETH_MAX_FLEN
#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

extern "C" void numaker_eth_rx_next(void);
/* \brief Flags for worker thread */
Expand Down
Expand Up @@ -22,7 +22,7 @@
#define NU_RX_RING_LEN (8)
#define NU_TX_RING_LEN (4)

#define NU_ETH_MAX_FLEN (1520)
#define NU_ETH_MAX_FLEN (1518)

#define NU_HWADDR_SIZE (6)

Expand Down