static void mv88w8618_pit_write(void *opaque, target_phys_addr_t offset,

                                uint64_t value, unsigned size)

{

    mv88w8618_pit_state *s = opaque;

    mv88w8618_timer_state *t;

    int i;



    switch (offset) {

    case MP_PIT_TIMER1_LENGTH ... MP_PIT_TIMER4_LENGTH:

        t = &s->timer[offset >> 2];

        t->limit = value;

        if (t->limit > 0) {

            ptimer_set_limit(t->ptimer, t->limit, 1);

        } else {

            ptimer_stop(t->ptimer);

        }

        break;



    case MP_PIT_CONTROL:

        for (i = 0; i < 4; i++) {

            t = &s->timer[i];

            if (value & 0xf && t->limit > 0) {

                ptimer_set_limit(t->ptimer, t->limit, 0);

                ptimer_set_freq(t->ptimer, t->freq);

                ptimer_run(t->ptimer, 0);

            } else {

                ptimer_stop(t->ptimer);

            }

            value >>= 4;

        }

        break;



    case MP_BOARD_RESET:

        if (value == MP_BOARD_RESET_MAGIC) {

            qemu_system_reset_request();

        }

        break;

    }

}

static void mv88w8618_pit_write(void *opaque, target_phys_addr_t offset,

                                uint64_t value, unsigned size)

{

    mv88w8618_pit_state *s = opaque;

    mv88w8618_timer_state *t;

    int i;



    switch (offset) {

    case MP_PIT_TIMER1_LENGTH ... MP_PIT_TIMER4_LENGTH:

        t = &s->timer[offset >> 2];

        t->limit = value;

        if (t->limit > 0) {

            ptimer_set_limit(t->ptimer, t->limit, 1);

        } else {

            ptimer_stop(t->ptimer);

        }

        break;



    case MP_PIT_CONTROL:

        for (i = 0; i < 4; i++) {

            t = &s->timer[i];

            if (value & 0xf && t->limit > 0) {

                ptimer_set_limit(t->ptimer, t->limit, 0);

                ptimer_set_freq(t->ptimer, t->freq);

                ptimer_run(t->ptimer, 0);

            } else {

                ptimer_stop(t->ptimer);

            }

            value >>= 4;

        }

        break;



    case MP_BOARD_RESET:

        if (value == MP_BOARD_RESET_MAGIC) {

            qemu_system_reset_request();

        }

        break;

    }

}

static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,

                                uint64_t VAR_2, unsigned VAR_3)

{

    mv88w8618_pit_state *s = VAR_0;

    mv88w8618_timer_state *t;

    int VAR_4;



    switch (VAR_1) {

    case MP_PIT_TIMER1_LENGTH ... MP_PIT_TIMER4_LENGTH:

        t = &s->timer[VAR_1 >> 2];

        t->limit = VAR_2;

        if (t->limit > 0) {

            ptimer_set_limit(t->ptimer, t->limit, 1);

        } else {

            ptimer_stop(t->ptimer);

        }

        break;



    case MP_PIT_CONTROL:

        for (VAR_4 = 0; VAR_4 < 4; VAR_4++) {

            t = &s->timer[VAR_4];

            if (VAR_2 & 0xf && t->limit > 0) {

                ptimer_set_limit(t->ptimer, t->limit, 0);

                ptimer_set_freq(t->ptimer, t->freq);

                ptimer_run(t->ptimer, 0);

            } else {

                ptimer_stop(t->ptimer);

            }

            VAR_2 >>= 4;

        }

        break;



    case MP_BOARD_RESET:

        if (VAR_2 == MP_BOARD_RESET_MAGIC) {

            qemu_system_reset_request();

        }

        break;

    }

}

static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,
uint64_t VAR_2, unsigned VAR_3)
{ mv88w8618_pit_state *s = VAR_0; mv88w8618_timer_state *t; int VAR_4; switch (VAR_1) { case MP_PIT_TIMER1_LENGTH ... MP_PIT_TIMER4_LENGTH:
t = &s->timer[VAR_1 >> 2]; t->limit = VAR_2; if (t->limit > 0) { ptimer_set_limit(t->ptimer, t->limit, 1); } else { ptimer_stop(t->ptimer); } break; case MP_PIT_CONTROL:
for (VAR_4 = 0; VAR_4 < 4; VAR_4++) { t = &s->timer[VAR_4]; if (VAR_2 & 0xf && t->limit > 0) { ptimer_set_limit(t->ptimer, t->limit, 0); ptimer_set_freq(t->ptimer, t->freq); ptimer_run(t->ptimer, 0); } else { ptimer_stop(t->ptimer); } VAR_2 >>= 4; } break; case MP_BOARD_RESET:
if (VAR_2 == MP_BOARD_RESET_MAGIC) { qemu_system_reset_request(); } break; } }