Skip to content

Commit

Permalink
Merge pull request #2861 from OpenNuvoton/nuvoton
Browse files Browse the repository at this point in the history
[NuMaker] Add PFM-M453 and Migrate PFM-NUC472 Crypto
  • Loading branch information
sg- authored Oct 12, 2016
2 parents fefde9d + 15dbd36 commit b4f3841
Show file tree
Hide file tree
Showing 132 changed files with 48,719 additions and 190 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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];
Expand All @@ -41,13 +42,18 @@ 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);
extern void ack_emac_rx_isr(void);

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

void EMAC_RX_IRQHandler(void)
{
unsigned int cur_entry, status;

m_status = EMAC->INTSTS & 0xFFFF;
EMAC->INTSTS = m_status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ struct netif *_netif;

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

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

Expand Down Expand Up @@ -421,7 +423,7 @@ err_t
/* Packet receive task */

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

static void __phy_task(void *data) {
struct netif *netif = (struct netif*)data;
PHY_STATE crt_state = {STATE_UNKNOWN, (phy_speed_t)STATE_UNKNOWN, (phy_duplex_t)STATE_UNKNOWN};
PHY_STATE prev_state;
// PHY_STATE crt_state = {STATE_UNKNOWN, (phy_speed_t)STATE_UNKNOWN, (phy_duplex_t)STATE_UNKNOWN};
// PHY_STATE prev_state;

prev_state = crt_state;
// prev_state = crt_state;
while (1) {
// Get current status
// Get the actual PHY link speed
Expand Down
Loading

0 comments on commit b4f3841

Please sign in to comment.