static void imx_timerp_write(void *opaque, target_phys_addr_t offset,

                             uint64_t value, unsigned size)

{

    IMXTimerPState *s = (IMXTimerPState *)opaque;

    DPRINTF("p-write(offset=%x, value = %x)\n", (unsigned int)offset >> 2,

            (unsigned int)value);



    switch (offset >> 2) {

    case 0: /* CR */

        if (value & CR_SWR) {

            imx_timerp_reset(&s->busdev.qdev);

            value &= ~CR_SWR;

        }

        s->cr = value & 0x03ffffff;

        set_timerp_freq(s);



        if (s->freq && (s->cr & CR_EN)) {

            if (!(s->cr & CR_ENMOD)) {

                ptimer_set_count(s->timer, s->lr);

            }

            ptimer_run(s->timer, 0);

        } else {

            ptimer_stop(s->timer);

        }

        break;



    case 1: /* SR - ACK*/

        s->int_level = 0;

        imx_timerp_update(s);

        break;



    case 2: /* LR - set ticks */

        s->lr = value;

        ptimer_set_limit(s->timer, value, !!(s->cr & CR_IOVW));

        break;



    case 3: /* CMP */

        s->cmp = value;

        if (value) {

            IPRINTF(

                "Values for EPIT comparison other than zero not supported\n"

            );

        }

        break;



    default:

        IPRINTF("imx_timerp_write: Bad offset %x\n",

                   (int)offset >> 2);

    }

}

static void imx_timerp_write(void *opaque, target_phys_addr_t offset,

                             uint64_t value, unsigned size)

{

    IMXTimerPState *s = (IMXTimerPState *)opaque;

    DPRINTF("p-write(offset=%x, value = %x)\n", (unsigned int)offset >> 2,

            (unsigned int)value);



    switch (offset >> 2) {

    case 0: 

        if (value & CR_SWR) {

            imx_timerp_reset(&s->busdev.qdev);

            value &= ~CR_SWR;

        }

        s->cr = value & 0x03ffffff;

        set_timerp_freq(s);



        if (s->freq && (s->cr & CR_EN)) {

            if (!(s->cr & CR_ENMOD)) {

                ptimer_set_count(s->timer, s->lr);

            }

            ptimer_run(s->timer, 0);

        } else {

            ptimer_stop(s->timer);

        }

        break;



    case 1: 

        s->int_level = 0;

        imx_timerp_update(s);

        break;



    case 2: 

        s->lr = value;

        ptimer_set_limit(s->timer, value, !!(s->cr & CR_IOVW));

        break;



    case 3: 

        s->cmp = value;

        if (value) {

            IPRINTF(

                "Values for EPIT comparison other than zero not supported\n"

            );

        }

        break;



    default:

        IPRINTF("imx_timerp_write: Bad offset %x\n",

                   (int)offset >> 2);

    }

}

static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,

                             uint64_t VAR_2, unsigned VAR_3)

{

    IMXTimerPState *s = (IMXTimerPState *)VAR_0;

    DPRINTF("p-write(VAR_1=%x, VAR_2 = %x)\n", (unsigned int)VAR_1 >> 2,

            (unsigned int)VAR_2);



    switch (VAR_1 >> 2) {

    case 0: 

        if (VAR_2 & CR_SWR) {

            imx_timerp_reset(&s->busdev.qdev);

            VAR_2 &= ~CR_SWR;

        }

        s->cr = VAR_2 & 0x03ffffff;

        set_timerp_freq(s);



        if (s->freq && (s->cr & CR_EN)) {

            if (!(s->cr & CR_ENMOD)) {

                ptimer_set_count(s->timer, s->lr);

            }

            ptimer_run(s->timer, 0);

        } else {

            ptimer_stop(s->timer);

        }

        break;



    case 1: 

        s->int_level = 0;

        imx_timerp_update(s);

        break;



    case 2: 

        s->lr = VAR_2;

        ptimer_set_limit(s->timer, VAR_2, !!(s->cr & CR_IOVW));

        break;



    case 3: 

        s->cmp = VAR_2;

        if (VAR_2) {

            IPRINTF(

                "Values for EPIT comparison other than zero not supported\n"

            );

        }

        break;



    default:

        IPRINTF("FUNC_0: Bad VAR_1 %x\n",

                   (int)VAR_1 >> 2);

    }

}

static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,
uint64_t VAR_2, unsigned VAR_3)
{ IMXTimerPState *s = (IMXTimerPState *)VAR_0; DPRINTF("p-write(VAR_1=%x, VAR_2 = %x)\n", (unsigned int)VAR_1 >> 2,
(unsigned int)VAR_2); switch (VAR_1 >> 2) { case 0:
if (VAR_2 & CR_SWR) { imx_timerp_reset(&s->busdev.qdev); VAR_2 &= ~CR_SWR; } s->cr = VAR_2 & 0x03ffffff; set_timerp_freq(s); if (s->freq && (s->cr & CR_EN)) { if (!(s->cr & CR_ENMOD)) { ptimer_set_count(s->timer, s->lr); } ptimer_run(s->timer, 0); } else { ptimer_stop(s->timer); } break; case 1:
s->int_level = 0; imx_timerp_update(s); break; case 2:
s->lr = VAR_2; ptimer_set_limit(s->timer, VAR_2, !!(s->cr & CR_IOVW)); break; case 3:
s->cmp = VAR_2; if (VAR_2) { IPRINTF(
"Values for EPIT comparison other than zero not supported\n"
); } break; default:
IPRINTF("FUNC_0: Bad VAR_1 %x\n",
(int)VAR_1 >> 2); } }