示例#1
0
void enet_mac_rx_isr(void *enetIfPtr) {
  struct k64f_enetdata *k64f_enet = &k64f_enetdata;
  volatile enet_bd_struct_t * bdPtr = (enet_bd_struct_t*)k64f_enet->rx_desc_start_addr;
  static int idx = 0;

  /* Clear interrupt */
  enet_hal_clear_interrupt(((enet_dev_if_t *)enetIfPtr)->deviceNumber, kEnetRxFrameInterrupt);

  while ((bdPtr[idx].control & kEnetRxBdEmpty) == 0) {
    k64f_enetif_input(k64f_enet->netif, idx);
    idx = (idx + 1) % ENET_RX_RING_LEN;
  }
}
示例#2
0
文件: k64f_emac.c 项目: NXPmicro/mbed
/** \brief  Packet reception task
 *
 * This task is called when a packet is received. It will
 * pass the packet to the LWIP core.
 *
 *  \param[in] pvParameters pointer to the interface data
 */
static void packet_rx(void* pvParameters) {
  struct k64f_enetdata *k64f_enet = pvParameters;
  int idx = 0;

  while (1) {
    /* Wait for receive task to wakeup */
    sys_arch_sem_wait(&k64f_enet->RxReadySem, 0);

    while ((g_handle.rxBdCurrent->control & ENET_BUFFDESCRIPTOR_RX_EMPTY_MASK) == 0) {
      k64f_enetif_input(k64f_enet->netif, idx);
      idx = (idx + 1) % ENET_RX_RING_LEN;
    }
  }
}
示例#3
0
文件: k64f_emac.c 项目: Babody/mbed
/** \brief  Packet reception task
 *
 * This task is called when a packet is received. It will
 * pass the packet to the LWIP core.
 *
 *  \param[in] pvParameters pointer to the interface data
 */
static void packet_rx(void* pvParameters) {
  struct k64f_enetdata *k64f_enet = pvParameters;
  volatile enet_bd_struct_t * bdPtr = (enet_bd_struct_t*)k64f_enet->rx_desc_start_addr;
  int idx = 0;

  while (1) {
    /* Wait for receive task to wakeup */
    sys_arch_sem_wait(&k64f_enet->RxReadySem, 0);

    while ((bdPtr[idx].control & kEnetRxBdEmpty) == 0) {
      k64f_enetif_input(k64f_enet->netif, idx);
      idx = (idx + 1) % ENET_RX_RING_LEN;
    }
  }
}