Beispiel #1
0
static err_t
low_level_output(struct netif *netif, struct pbuf *p)
{
  struct pbuf *q;
  int l = 0;
  u8 *buffer = NULL;

  SYS_ARCH_DECL_PROTECT(sr);
  /* Interrupts are disabled through this whole thing to support multi-threading
	   transmit calls. Also this function might be called from an ISR. */
  SYS_ARCH_PROTECT(sr);

  buffer = (u8 *)ETH_GetCurrentTxBuffer();
  
  for(q = p; q != NULL; q = q->next) 
  {
    memcpy((u8_t*)&buffer[l], q->payload, q->len);
	l = l + q->len;
  }

  ETH_TxPkt_ChainMode(l);

  SYS_ARCH_UNPROTECT(sr);

  return ERR_OK;
}
Beispiel #2
0
static err_t
low_level_output(struct netif *netif, struct pbuf *p)
{
	static xSemaphoreHandle xTxSemaphore = NULL;
  	struct pbuf *q;
  	int l = 0;
  	u8 *buffer ;
  
  	if (xTxSemaphore == NULL)
  	{
  		vSemaphoreCreateBinary (xTxSemaphore);
  	} 
    
  	if (xSemaphoreTake(xTxSemaphore, netifGUARD_BLOCK_TIME))
  	{
  		u8 *buffer =  (u8 *)ETH_GetCurrentTxBuffer();
  		for(q = p; q != NULL; q = q->next) 
  		{
  			memcpy((u8_t*)&buffer[l], q->payload, q->len);
  			l = l + q->len;
  		}
  	}
  	xSemaphoreGive(xTxSemaphore);
  	ETH_TxPkt_ChainMode(l);

 	 return ERR_OK;
}
Beispiel #3
0
/*
 * This function should do the actual transmission of the packet. The packet is
 * contained in the pbuf that is passed to the function. This pbuf
 * might be chained.
 *
 * @param netif the lwip network interface structure for this ethernetif
 * @param p the MAC packet to send (e.g. IP packet including MAC addresses and type)
 * @return ERR_OK if the packet could be sent
 *         an err_t value if the packet couldn't be sent
 *
 * @note Returning ERR_MEM here if a DMA queue of your MAC is full can lead to
 *       strange results. You might consider waiting for space in the DMA queue
 *       to become availale since the stack doesn't retry to send a packet
 *       dropped because of memory failure (except for the TCP timers).
 */
err_t low_level_output(struct netif *netif, struct pbuf *p)
{
	struct pbuf *q;
	int l = 0;
	u8 *buffer =  (u8 *)ETH_GetCurrentTxBuffer();
  
	for (q = p; q != NULL; q = q->next) {
		memcpy((u8_t*)&buffer[l], q->payload, q->len);
		l = l + q->len;
	}

	ETH_TxPkt_ChainMode(l);

	return ERR_OK;
}