KEIS

Dependents:   EthernetInterface_t

Fork of lwip-eth by mbed official

Revision:
2:5208926bd863
Parent:
1:0c9d93e2f51c
Child:
3:dd8b8f5b449a
--- a/arch/lpc17_emac.c	Fri Jun 22 11:17:21 2012 +0000
+++ b/arch/lpc17_emac.c	Fri Jun 22 11:57:39 2012 +0000
@@ -482,10 +482,9 @@
  */
 static s32_t lpc_packet_addr_notsafe(void *addr) {
     /* Check for legal address ranges */
-    if ((((u32_t) addr >= 0x20000000) && ((u32_t) addr < 0x20008000)) ||
-        (((u32_t) addr >= 0x80000000) && ((u32_t) addr < 0xF0000000)))
+    if ((((u32_t) addr >= 0x2007C000) && ((u32_t) addr < 0x20083FFF))) {
         return 0;
-
+    }
     return 1;
 }
 
@@ -837,9 +836,9 @@
 
     /* Enable MII clocking */
     LPC_SC->PCONP |= CLKPWR_PCONP_PCENET;
-	
-	LPC_PINCON->PINSEL2 = 0x50150105;  /* Enable P1 Ethernet Pins. */
-	LPC_PINCON->PINSEL3 = (LPC_PINCON->PINSEL3 & ~0x0000000F) | 0x00000005;
+    
+    LPC_PINCON->PINSEL2 = 0x50150105;  /* Enable P1 Ethernet Pins. */
+    LPC_PINCON->PINSEL3 = (LPC_PINCON->PINSEL3 & ~0x0000000F) | 0x00000005;
 
     /* Reset all MAC logic */
     LPC_EMAC->MAC1 = EMAC_MAC1_RES_TX | EMAC_MAC1_RES_MCS_TX |
@@ -1013,7 +1012,7 @@
     lpc_enetdata.xTXDCountSem.def.semaphore = lpc_enetdata.xTXDCountSem.data;
     #endif
     lpc_enetdata.xTXDCountSem.id = osSemaphoreCreate(&lpc_enetdata.xTXDCountSem.def, LPC_NUM_BUFF_TXDESCS);
-	LWIP_ASSERT("xTXDCountSem creation error", (lpc_enetdata.xTXDCountSem.id != NULL));
+    LWIP_ASSERT("xTXDCountSem creation error", (lpc_enetdata.xTXDCountSem.id != NULL));
 
     err = sys_mutex_new(&lpc_enetdata.TXLockMutex);
     LWIP_ASSERT("TXLockMutex creation error", (err == ERR_OK));
@@ -1024,11 +1023,13 @@
     sys_thread_new("receive_thread", packet_rx, netif->state, DEFAULT_THREAD_STACKSIZE, RX_PRIORITY);
 
     /* Transmit cleanup task */
+   	err = sys_sem_new(&lpc_enetdata.TxCleanSem, 0);
+	LWIP_ASSERT("TxCleanSem creation error", (err == ERR_OK));
     sys_thread_new("txclean_thread", packet_tx, netif->state, DEFAULT_THREAD_STACKSIZE, TX_PRIORITY);
-	
-	/* periodic PHY status update */
-	osTimerId phy_timer = osTimerCreate(osTimer(phy_update), osTimerPeriodic, (void *)netif);
-	osTimerStart(phy_timer, 250);
+    
+    /* periodic PHY status update */
+    osTimerId phy_timer = osTimerCreate(osTimer(phy_update), osTimerPeriodic, (void *)netif);
+    osTimerStart(phy_timer, 250);
 #endif
 
     return ERR_OK;