示例#1
0
static void
tws_reset_cb(void *arg)
{
    struct tws_softc *sc = (struct tws_softc *)arg;
    time_t endt;
    int found = 0;
    u_int32_t reg;
  
    if ( tws_get_state(sc) != TWS_RESET ) {
        return;
    }

//  device_printf(sc->tws_dev,  "Draining Busy Queue\n");
    tws_drain_busy_queue(sc);
//  device_printf(sc->tws_dev,  "Draining Reserved Reqs\n");
    tws_drain_reserved_reqs(sc);
//  device_printf(sc->tws_dev,  "Draining Response Queue\n");
    tws_drain_response_queue(sc);

//  device_printf(sc->tws_dev,  "Looking for controller ready flag...\n");
    endt = TWS_LOCAL_TIME + TWS_POLL_TIMEOUT;
    while ((TWS_LOCAL_TIME <= endt) && (!found)) {
        reg = tws_read_reg(sc, TWS_I2O0_SCRPD3, 4);
        if ( reg & TWS_BIT13 ) {
            found = 1;
//          device_printf(sc->tws_dev,  " ... Got it!\n");
        }
    }
    if ( !found )
            device_printf(sc->tws_dev,  " ... Controller ready flag NOT found!\n");
}
示例#2
0
static void
tws_reset_cb(void *arg)
{

    struct tws_softc *sc = (struct tws_softc *)arg;
    u_int32_t reg;

    if ( tws_get_state(sc) != TWS_RESET ) {
        return;
    }
    reg = tws_read_reg(sc, TWS_I2O0_SCRPD3, 4);
    if (!( reg & TWS_BIT13 )) {
	callout_reset(&sc->reset_cb_handle, hz/10, tws_reset_cb, sc);
        return;
    }
    tws_drain_response_queue(sc);
    tws_drain_busy_queue(sc);
    tws_drain_reserved_reqs(sc);
    callout_reset(&sc->reinit_handle, 5*hz, tws_reinit, sc);
}