Skip to content

Commit 1c1257d

Browse files
cyliangtwccli8
authored andcommitted
EMAC buffer address word alignment
1 parent c2b9089 commit 1c1257d

File tree

1 file changed

+8
-3
lines changed
  • features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NUVOTON/TARGET_NUC472

1 file changed

+8
-3
lines changed

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NUVOTON/TARGET_NUC472/nuc472_eth.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "nuc472_eth.h"
2525
#include "lwip/opt.h"
2626
#include "lwip/def.h"
27-
27+
#include "toolchain.h"
2828

2929
#define ETH_TRIGGER_RX() do{EMAC->RXST = 0;}while(0)
3030
#define ETH_TRIGGER_TX() do{EMAC->TXST = 0;}while(0)
@@ -33,6 +33,7 @@
3333
#define ETH_DISABLE_TX() do{EMAC->CTL &= ~EMAC_CTL_TXON;}while(0)
3434
#define ETH_DISABLE_RX() do{EMAC->CTL &= ~EMAC_CTL_RXON;}while(0)
3535

36+
/*
3637
#ifdef __ICCARM__
3738
#pragma data_alignment=4
3839
struct eth_descriptor rx_desc[RX_DESCRIPTOR_NUM];
@@ -41,10 +42,14 @@ struct eth_descriptor tx_desc[TX_DESCRIPTOR_NUM];
4142
struct eth_descriptor rx_desc[RX_DESCRIPTOR_NUM] __attribute__ ((aligned(4)));
4243
struct eth_descriptor tx_desc[TX_DESCRIPTOR_NUM] __attribute__ ((aligned(4)));
4344
#endif
45+
*/
46+
struct eth_descriptor rx_desc[RX_DESCRIPTOR_NUM] MBED_ALIGN(4);
47+
struct eth_descriptor tx_desc[TX_DESCRIPTOR_NUM] MBED_ALIGN(4);
48+
4449
struct eth_descriptor volatile *cur_tx_desc_ptr, *cur_rx_desc_ptr, *fin_tx_desc_ptr;
4550

46-
u8_t rx_buf[RX_DESCRIPTOR_NUM][PACKET_BUFFER_SIZE];
47-
u8_t tx_buf[TX_DESCRIPTOR_NUM][PACKET_BUFFER_SIZE];
51+
u8_t rx_buf[RX_DESCRIPTOR_NUM][PACKET_BUFFER_SIZE] MBED_ALIGN(4);
52+
u8_t tx_buf[TX_DESCRIPTOR_NUM][PACKET_BUFFER_SIZE] MBED_ALIGN(4);
4853

4954
extern void ethernetif_input(u16_t len, u8_t *buf, u32_t s, u32_t ns);
5055
extern void ethernetif_loopback_input(struct pbuf *p);

0 commit comments

Comments
 (0)