From 0b6043432773974fe3483d674612ffd38fc9f8b5 Mon Sep 17 00:00:00 2001 From: cyliangtw Date: Wed, 5 Oct 2016 20:26:36 +0800 Subject: [PATCH] EMAC buffer address word alignment --- .../arch/TARGET_NUVOTON/TARGET_NUC472/nuc472_eth.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NUVOTON/TARGET_NUC472/nuc472_eth.c b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NUVOTON/TARGET_NUC472/nuc472_eth.c index 441a1a0a5d..22610c3209 100644 --- a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NUVOTON/TARGET_NUC472/nuc472_eth.c +++ b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NUVOTON/TARGET_NUC472/nuc472_eth.c @@ -24,7 +24,7 @@ #include "nuc472_eth.h" #include "lwip/opt.h" #include "lwip/def.h" - +#include "toolchain.h" #define ETH_TRIGGER_RX() do{EMAC->RXST = 0;}while(0) #define ETH_TRIGGER_TX() do{EMAC->TXST = 0;}while(0) @@ -33,6 +33,7 @@ #define ETH_DISABLE_TX() do{EMAC->CTL &= ~EMAC_CTL_TXON;}while(0) #define ETH_DISABLE_RX() do{EMAC->CTL &= ~EMAC_CTL_RXON;}while(0) +/* #ifdef __ICCARM__ #pragma data_alignment=4 struct eth_descriptor rx_desc[RX_DESCRIPTOR_NUM]; @@ -41,10 +42,14 @@ struct eth_descriptor tx_desc[TX_DESCRIPTOR_NUM]; struct eth_descriptor rx_desc[RX_DESCRIPTOR_NUM] __attribute__ ((aligned(4))); struct eth_descriptor tx_desc[TX_DESCRIPTOR_NUM] __attribute__ ((aligned(4))); #endif +*/ +struct eth_descriptor rx_desc[RX_DESCRIPTOR_NUM] MBED_ALIGN(4); +struct eth_descriptor tx_desc[TX_DESCRIPTOR_NUM] MBED_ALIGN(4); + struct eth_descriptor volatile *cur_tx_desc_ptr, *cur_rx_desc_ptr, *fin_tx_desc_ptr; -u8_t rx_buf[RX_DESCRIPTOR_NUM][PACKET_BUFFER_SIZE]; -u8_t tx_buf[TX_DESCRIPTOR_NUM][PACKET_BUFFER_SIZE]; +u8_t rx_buf[RX_DESCRIPTOR_NUM][PACKET_BUFFER_SIZE] MBED_ALIGN(4); +u8_t tx_buf[TX_DESCRIPTOR_NUM][PACKET_BUFFER_SIZE] MBED_ALIGN(4); extern void ethernetif_input(u16_t len, u8_t *buf, u32_t s, u32_t ns); extern void ethernetif_loopback_input(struct pbuf *p);