示例#1
0
// This DSR handles the card interrupt
static void
cf_irq_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data)
{
    struct cf_slot *slot = (struct cf_slot *)data;
#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT)
    cyg_bool was_ctrlc_int;
#endif

    // Clear interrupt [edge indication]
    cyg_drv_interrupt_acknowledge(SA1110_CF_IRQ);
#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT)
    was_ctrlc_int = HAL_CTRLC_CHECK(vector, data);
    if (!was_ctrlc_int) // Fall through and run normal code
#endif
    // Process interrupt
    (slot->irq_handler.handler)(vector, count, slot->irq_handler.param);
    // Allow interrupts to happen again
    cyg_drv_interrupt_unmask(SA1110_CF_IRQ);
}
示例#2
0
//
// Polls the lwIP stack.
//
void
cyg_lwip_simple_poll(void)
{
    cyg_tick_count_t ticks;
    cyg_uint32 delta;
    int i;
    
#if LWIP_HAVE_SLIPIF && defined(CYGIMP_LWIP_SLIPIF_INSTANCE)
    // Poll SLIP device
    slipif_poll(&slipif);
#endif

#if PPP_SUPPORT
    // Poll PPP device
#endif

#ifdef CYGPKG_LWIP_ETH
    {
        cyg_netdevtab_entry_t *t;

        // Poll ethernet devices
        for (t = &__NETDEVTAB__[0]; t != &__NETDEVTAB_END__; t++) {
            struct eth_drv_sc *sc = (struct eth_drv_sc *)t->device_instance;
            if (sc->state & ETH_DRV_NEEDS_DELIVERY) {
#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT)
                cyg_bool was_ctrlc_int;
#endif
                sc->state &= ~ETH_DRV_NEEDS_DELIVERY;
#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT)
                was_ctrlc_int = HAL_CTRLC_CHECK(sc->funs->int_vector(sc),
                                                (int) sc);
                if (!was_ctrlc_int) // Fall through and run normal code
#endif
                    sc->funs->deliver(sc);
            }
        }

        // Deliver received packets
        while (recv_packet_count > 0) {
            ethernet_input(recv_packet[recv_packet_read].p,
                           recv_packet[recv_packet_read].netif);
            recv_packet_read = (recv_packet_read + 1) % MAX_RECV_PACKETS;
            recv_packet_count--;
        }
    }
#endif

    // Process timers
    ticks = cyg_current_time();
    delta = TICKS_TO_MS(ticks - last_ticks);
    last_ticks = ticks;

    // The following check 'delta > 0' rejects a potential wrap-around in the
    // system ticks counter.
    if (delta > 0) {
        for (i = 0; i < NUM_LWIP_TIMERS; i++) {
            lwip_timers[i].time += delta;
            if (lwip_timers[i].time >= lwip_timers[i].interval) {
                lwip_timers[i].timer_func();
                lwip_timers[i].time -= lwip_timers[i].interval;
            }
        }
    }
}