static err_t low_level_output(struct netif *netif, struct pbuf *p) { struct pbuf *q; static xSemaphoreHandle xTxSemaphore = NULL; err_t xReturn = ERR_OK; /* Parameter not used. */ ( void ) netif; if( xTxSemaphore == NULL ) { vSemaphoreCreateBinary( xTxSemaphore ); } #if ETH_PAD_SIZE pbuf_header( p, -ETH_PAD_SIZE ); /* drop the padding word */ #endif /* Access to the MACB is guarded using a semaphore. */ if( xSemaphoreTake( xTxSemaphore, netifGUARD_BLOCK_TIME ) ) { for( q = p; q != NULL; q = q->next ) { /* Send the data from the pbuf to the interface, one pbuf at a time. The size of the data in each pbuf is kept in the ->len variable. if q->next == NULL then this is the last pbuf in the chain. */ if( !lMACBSend(&AVR32_MACB, q->payload, q->len, ( q->next == NULL ) ) ) { xReturn = ~ERR_OK; } } xSemaphoreGive( xTxSemaphore ); } #if ETH_PAD_SIZE pbuf_header( p, ETH_PAD_SIZE ); /* reclaim the padding word */ #endif #if LINK_STATS lwip_stats.link.xmit++; #endif /* LINK_STATS */ return xReturn; }
static err_t low_level_output(struct netif *netif, struct pbuf *p) { struct pbuf *q; #ifdef FREERTOS_USED static xSemaphoreHandle xTxSemaphore = NULL; #endif ( void )netif; // Unused param, avoid a compiler warning. #ifdef FREERTOS_USED if( xTxSemaphore == NULL ) { vSemaphoreCreateBinary( xTxSemaphore ); } #endif #if ETH_PAD_SIZE pbuf_header( p, -ETH_PAD_SIZE ); /* drop the padding word */ #endif #ifdef FREERTOS_USED /* Access to the MACB is guarded using a semaphore. */ if( xSemaphoreTake( xTxSemaphore, netifGUARD_BLOCK_NBTICKS ) ) { #endif for( q = p; q != NULL; q = q->next ) { /* Send the data from the pbuf to the interface, one pbuf at a time. The size of the data in each pbuf is kept in the ->len variable. This function also signals to the MACB that the packet should be sent. */ lMACBSend(&AVR32_MACB, q->payload, q->len, ( q->next == NULL ) ); } #ifdef FREERTOS_USED xSemaphoreGive( xTxSemaphore ); } #endif #if ETH_PAD_SIZE pbuf_header( p, ETH_PAD_SIZE ); /* reclaim the padding word */ #endif LINK_STATS_INC(link.xmit); // Traces return ERR_OK; }