Skip to content

Commit b4f3841

Browse files
authored
Merge pull request #2861 from OpenNuvoton/nuvoton
[NuMaker] Add PFM-M453 and Migrate PFM-NUC472 Crypto
2 parents fefde9d + 15dbd36 commit b4f3841

File tree

132 files changed

+48719
-190
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+48719
-190
lines changed

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

Lines changed: 9 additions & 4 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,13 +42,18 @@ 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);
56+
extern void ack_emac_rx_isr(void);
5157

5258
// PTP source clock is 84MHz (Real chip using PLL). Each tick is 11.90ns
5359
// Assume we want to set each tick to 100ns.
@@ -256,7 +262,6 @@ unsigned int m_status;
256262

257263
void EMAC_RX_IRQHandler(void)
258264
{
259-
unsigned int cur_entry, status;
260265

261266
m_status = EMAC->INTSTS & 0xFFFF;
262267
EMAC->INTSTS = m_status;

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ struct netif *_netif;
7979

8080
unsigned char my_mac_addr[6] = {0x02, 0x00, 0xac, 0x55, 0x66, 0x77};
8181
extern u8_t my_mac_addr[6];
82+
extern int ETH_link_ok(void);
83+
extern void EMAC_RX_Action(void);
8284

8385
sys_sem_t RxReadySem; /**< RX packet ready semaphore */
8486

@@ -421,7 +423,7 @@ err_t
421423
/* Packet receive task */
422424

423425
err = sys_sem_new(&RxReadySem, 0);
424-
LWIP_ASSERT("RxReadySem creation error", (err == ERR_OK));
426+
if(err != ERR_OK) LWIP_ASSERT("RxReadySem creation error", (err == ERR_OK));
425427
// In GCC code, DEFAULT_THREAD_STACKSIZE 512 bytes is not enough for rx_task
426428
#if defined (__GNUC__)
427429
// mbed OS 2.0, DEFAULT_THREAD_STACKSIZE*3
@@ -482,10 +484,10 @@ typedef struct {
482484

483485
static void __phy_task(void *data) {
484486
struct netif *netif = (struct netif*)data;
485-
PHY_STATE crt_state = {STATE_UNKNOWN, (phy_speed_t)STATE_UNKNOWN, (phy_duplex_t)STATE_UNKNOWN};
486-
PHY_STATE prev_state;
487+
// PHY_STATE crt_state = {STATE_UNKNOWN, (phy_speed_t)STATE_UNKNOWN, (phy_duplex_t)STATE_UNKNOWN};
488+
// PHY_STATE prev_state;
487489

488-
prev_state = crt_state;
490+
// prev_state = crt_state;
489491
while (1) {
490492
// Get current status
491493
// Get the actual PHY link speed

0 commit comments

Comments
 (0)