* milliseconds. It will do this a maximum of netifMAX_TX_ATTEMPTS before\r
* giving up.
*/\r
-#define netifTX_BUFFER_FREE_WAIT ( ( portTickType ) 5UL / portTICK_RATE_MS )\r
+#define netifTX_BUFFER_FREE_WAIT ( ( portTickType ) 2UL / portTICK_RATE_MS )\r
#define netifMAX_TX_ATTEMPTS ( 5 )\r
\r
#define netifMAX_MTU 1500\r
/* Add whatever per-interface state that is needed here. */\r
};\r
\r
-/*\r
- * Place received packet in a pbuf and send a message to the tcpip task to let\r
- * it know new data has arrived.\r
- */\r
-static void prvEthernetInput( struct netif *pxNetIf, const unsigned char * const pucInputData, long lInputLength );\r
-\r
/*\r
* Copy the received data into a pbuf.\r
*/\r
static void prvLowLevelInit( struct netif *pxNetIf )\r
{\r
portBASE_TYPE xStatus;\r
+extern void vInitialisePHY( XEmacLite *xemaclitep );\r
+unsigned portBASE_TYPE uxOriginalPriority;\r
+\r
+ /* Hardware initialisation can take some time, so temporarily lower the\r
+ task priority to ensure other functionality is not adversely effected.\r
+ The priority will get raised again before this function exits. */
+ uxOriginalPriority = uxTaskPriorityGet( NULL );\r
+ vTaskPrioritySet( NULL, tskIDLE_PRIORITY );\r
\r
/* set MAC hardware address length */\r
pxNetIf->hwaddr_len = ETHARP_HWADDR_LEN;\r
for this purpose. */\r
xStatus = xPortInstallInterruptHandler( XPAR_INTC_0_EMACLITE_0_VEC_ID, ( XInterruptHandler ) XEmacLite_InterruptHandler, &xEMACInstance );\r
\r
+ vInitialisePHY( &xEMACInstance );\r
+\r
/* Enable the interrupt in the interrupt controller.\r
*NOTE* The vPortEnableInterrupt() API function must be used for this\r
purpose. */\r
vPortEnableInterrupt( XPAR_INTC_0_EMACLITE_0_VEC_ID );\r
}\r
\r
+ /* Reset the task priority back to its original value. */\r
+ vTaskPrioritySet( NULL, uxOriginalPriority );\r
+\r
configASSERT( xStatus == pdPASS );\r
}\r
\r
err_t xReturn = ERR_OK;\r
long x;\r
\r
+ ( void ) pxNetIf;\r
+\r
#if defined(LWIP_DEBUG) && LWIP_NETIF_TX_SINGLE_PBUF\r
LWIP_ASSERT("p->next == NULL && p->len == p->tot_len", p->next == NULL && p->len == p->tot_len);\r
#endif\r
return p; \r
}\r
\r
-/**\r
- * This function should be called when a packet is ready to be read\r
- * from the interface. It uses the function prvLowLevelInput() that\r
- * should handle the actual reception of bytes from the network\r
- * interface. Then the type of the received packet is determined and\r
- * the appropriate input function is called.\r
- *\r
- * @param pxNetIf the lwip network interface structure for this etherpxNetIf\r
- */\r
-static void prvEthernetInput( struct netif *pxNetIf, const unsigned char * const pucInputData, long lInputLength )\r
-{\r
- /* This is taken from lwIP example code and therefore does not conform\r
- to the FreeRTOS coding standard. */\r
- \r
-struct eth_hdr *pxHeader;\r
-struct pbuf *p;\r
-\r
- /* move received packet into a new pbuf */\r
- p = prvLowLevelInput( pucInputData, lInputLength );\r
-\r
- /* no packet could be read, silently ignore this */\r
- if( p != NULL )\r
- {\r
- /* points to packet payload, which starts with an Ethernet header */\r
- pxHeader = p->payload;\r
-\r
- switch( htons( pxHeader->type ) )\r
- {\r
- /* IP or ARP packet? */\r
- case ETHTYPE_IP:\r
- case ETHTYPE_ARP:\r
- /* full packet send to tcpip_thread to process */\r
- if( pxNetIf->input( p, pxNetIf ) != ERR_OK )\r
- {\r
- LWIP_DEBUGF(NETIF_DEBUG, ( "ethernetif_input: IP input error\n" ) );\r
- pbuf_free(p);\r
- p = NULL;\r
- }\r
- break;\r
-\r
- default:\r
- pbuf_free( p );\r
- p = NULL;\r
- break;\r
- }\r
- }\r
-}\r
-\r
/**\r
* Should be called at the beginning of the program to set up the\r
* network interface. It calls the function prvLowLevelInit() to do the\r
\r
static void prvTxHandler( void *pvUnused )\r
{\r
+ ( void ) pvUnused;\r
XIntc_AckIntr( XPAR_ETHERNET_LITE_BASEADDR, XPAR_ETHERNET_LITE_IP2INTC_IRPT_MASK );\r
}\r
\r
\r
-void vTemp( void )\r
-{\r
-char *pc;\r
-\r
- XEmacLite_Recv( &xEMACInstance, pc );\r
-}\r
-\r
-\r
-\r
-\r
-\r
-\r
-#if 0\r
-\r
-static void\r
-xemacif_recv_handler(void *arg) {\r
- struct xemac_s *xemac = (struct xemac_s *)(arg);\r
- xemacliteif_s *xemacliteif = (xemacliteif_s *)(xemac->state);\r
- XEmacLite *instance = xemacliteif->instance;\r
- struct pbuf *p;\r
- int len = 0;\r
- struct xtopology_t *xtopologyp = &xtopology[xemac->topology_index];\r
-\r
- XIntc_AckIntr(xtopologyp->intc_baseaddr, 1 << xtopologyp->intc_emac_intr);\r
- p = pbuf_alloc(PBUF_RAW, XEL_MAX_FRAME_SIZE, PBUF_POOL);\r
- if (!p) {\r
-#if LINK_STATS\r
- lwip_stats.link.memerr++;\r
- lwip_stats.link.drop++;\r
-#endif\r
- /* receive and just ignore the frame.\r
- * we need to receive the frame because otherwise emaclite will\r
- * not generate any other interrupts since it cannot receive,\r
- * and we do not actively poll the emaclite\r
- */\r
- XEmacLite_Recv(instance, xemac_tx_frame);\r
- return;\r
- }\r
-\r
- /* receive the packet */\r
- len = XEmacLite_Recv(instance, p->payload);\r
-\r
- if (len == 0) {\r
-#if LINK_STATS\r
- lwip_stats.link.drop++;\r
-#endif\r
- return;\r
- }\r
-\r
- /* store it in the receive queue, where it'll be processed by xemacif input thread */\r
- if (pq_enqueue(xemacliteif->recv_q, (void*)p) < 0) {\r
-#if LINK_STATS\r
- lwip_stats.link.memerr++;\r
- lwip_stats.link.drop++;\r
-#endif\r
- return;\r
- }\r
-\r
-#if !NO_SYS\r
- sys_sem_signal(xemac->sem_rx_data_available);\r
-#endif\r
-\r
-}\r
-\r
-#endif\r
\r
\r