コード例 #1
0
ファイル: liteethif.c プロジェクト: carriercomm/artiq
static err_t liteeth_low_level_output(struct netif *netif, struct pbuf *p)
{
    struct pbuf *q;

    txlen = 0;
    q = p;
    while(q) {
        memcpy(txbuffer, q->payload, q->len);
        txbuffer += q->len;
        txlen += q->len;
        if(q->tot_len != q->len)
            q = q->next;
        else
            q = NULL;
    }

    ethmac_sram_reader_slot_write(txslot);
    ethmac_sram_reader_length_write(txlen);
    while(!ethmac_sram_reader_ready_read());
    ethmac_sram_reader_start_write(1);

    txslot = (txslot + 1) % 2;
    if(txslot)
        txbuffer = txbuffer1;
    else
        txbuffer = txbuffer0;

    return ERR_OK;
}
コード例 #2
0
ファイル: misoc_net.c プロジェクト: AlexShiLucky/NuttX
static void misoc_net_txavail_work(FAR void *arg)
{
  FAR struct misoc_net_driver_s *priv = (FAR struct misoc_net_driver_s *)arg;

  /* Ignore the notification if the interface is not yet up */

  net_lock();
  if (priv->misoc_net_bifup)
    {
      /* Check if there is room in the hardware to hold another outgoing packet. */

      if (!ethmac_sram_reader_ready_read())
        {
          /* If so, then poll the network for new XMIT data */

          (void)devif_poll(&priv->misoc_net_dev, misoc_net_txpoll);
        }
    }

  net_unlock();
}