static void smp_cache_data_inv_all(void *arg) { rtems_cache_invalidate_entire_data(); }
static void fec_rxDaemon (void *arg) { volatile struct mcf5282_enet_struct *sc = (volatile struct mcf5282_enet_struct *)arg; struct ifnet *ifp = (struct ifnet* )&sc->arpcom.ac_if; struct mbuf *m; uint16_t status; volatile mcf5282BufferDescriptor_t *rxBd; int rxBdIndex; /* * Allocate space for incoming packets and start reception */ for (rxBdIndex = 0 ; ;) { rxBd = sc->rxBdBase + rxBdIndex; MGETHDR(m, M_WAIT, MT_DATA); MCLGET(m, M_WAIT); m->m_pkthdr.rcvif = ifp; sc->rxMbuf[rxBdIndex] = m; rxBd->buffer = mtod(m, void *); rxBd->status = MCF5282_FEC_RxBD_E; if (++rxBdIndex == sc->rxBdCount) { rxBd->status |= MCF5282_FEC_RxBD_W; break; } } /* * Input packet handling loop */ MCF5282_FEC_RDAR = 0; rxBdIndex = 0; for (;;) { rxBd = sc->rxBdBase + rxBdIndex; /* * Wait for packet if there's not one ready */ if ((status = rxBd->status) & MCF5282_FEC_RxBD_E) { /* * Clear old events. */ MCF5282_FEC_EIR = MCF5282_FEC_EIR_RXF; /* * Wait for packet to arrive. * Check the buffer descriptor before waiting for the event. * This catches the case when a packet arrives between the * `if' above, and the clearing of the RXF bit in the EIR. */ while ((status = rxBd->status) & MCF5282_FEC_RxBD_E) { rtems_event_set events; int level; rtems_interrupt_disable(level); MCF5282_FEC_EIMR |= MCF5282_FEC_EIMR_RXF; rtems_interrupt_enable(level); rtems_bsdnet_event_receive (RX_INTERRUPT_EVENT, RTEMS_WAIT|RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &events); } } /* * Check that packet is valid */ if (status & MCF5282_FEC_RxBD_L) { /* * Pass the packet up the chain. * FIXME: Packet filtering hook could be done here. */ struct ether_header *eh; int len = rxBd->length - sizeof(uint32_t); m = sc->rxMbuf[rxBdIndex]; #ifdef RTEMS_MCF5282_BSP_ENABLE_DATA_CACHE /* * Invalidate the cache. The cache is so small that it's * reasonable to simply invalidate the whole thing. */ rtems_cache_invalidate_entire_data(); #endif m->m_len = m->m_pkthdr.len = len - sizeof(struct ether_header); eh = mtod(m, struct ether_header *); m->m_data += sizeof(struct ether_header); ether_input(ifp, eh, m); /* * Allocate a new mbuf */ MGETHDR(m, M_WAIT, MT_DATA); MCLGET(m, M_WAIT); m->m_pkthdr.rcvif = ifp; sc->rxMbuf[rxBdIndex] = m; rxBd->buffer = mtod(m, void *); } /* * Reenable the buffer descriptor */ rxBd->status = (status & MCF5282_FEC_RxBD_W) | MCF5282_FEC_RxBD_E; MCF5282_FEC_RDAR = 0; /* * Move to next buffer descriptor */ if (++rxBdIndex == sc->rxBdCount) rxBdIndex = 0; } }