static void gpio_write(void *opaque, target_phys_addr_t addr, uint64_t value,

                       unsigned size)

{

    struct gpio_state_t *s = opaque;

    D(printf("%s %x=%x\n", __func__, addr, (unsigned)value));



    addr >>= 2;

    switch (addr)

    {

        case RW_PA_DOUT:

            /* Decode nand pins.  */

            s->nand->ale = !!(value & (1 << 6));

            s->nand->cle = !!(value & (1 << 5));

            s->nand->ce  = !!(value & (1 << 4));



            s->regs[addr] = value;

            break;



        case RW_PD_DOUT:

            /* Temp sensor clk.  */

            if ((s->regs[addr] ^ value) & 2)

                tempsensor_clkedge(&s->tempsensor, !!(value & 2),

                                   !!(value & 16));

            s->regs[addr] = value;

            break;



        default:

            s->regs[addr] = value;

            break;

    }

}

static void gpio_write(void *opaque, target_phys_addr_t addr, uint64_t value,

                       unsigned size)

{

    struct gpio_state_t *s = opaque;

    D(printf("%s %x=%x\n", __func__, addr, (unsigned)value));



    addr >>= 2;

    switch (addr)

    {

        case RW_PA_DOUT:

            

            s->nand->ale = !!(value & (1 << 6));

            s->nand->cle = !!(value & (1 << 5));

            s->nand->ce  = !!(value & (1 << 4));



            s->regs[addr] = value;

            break;



        case RW_PD_DOUT:

            

            if ((s->regs[addr] ^ value) & 2)

                tempsensor_clkedge(&s->tempsensor, !!(value & 2),

                                   !!(value & 16));

            s->regs[addr] = value;

            break;



        default:

            s->regs[addr] = value;

            break;

    }

}

static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2,

                       unsigned VAR_3)

{

    struct gpio_state_t *VAR_4 = VAR_0;

    D(printf("%VAR_4 %x=%x\n", __func__, VAR_1, (unsigned)VAR_2));



    VAR_1 >>= 2;

    switch (VAR_1)

    {

        case RW_PA_DOUT:

            

            VAR_4->nand->ale = !!(VAR_2 & (1 << 6));

            VAR_4->nand->cle = !!(VAR_2 & (1 << 5));

            VAR_4->nand->ce  = !!(VAR_2 & (1 << 4));



            VAR_4->regs[VAR_1] = VAR_2;

            break;



        case RW_PD_DOUT:

            

            if ((VAR_4->regs[VAR_1] ^ VAR_2) & 2)

                tempsensor_clkedge(&VAR_4->tempsensor, !!(VAR_2 & 2),

                                   !!(VAR_2 & 16));

            VAR_4->regs[VAR_1] = VAR_2;

            break;



        default:

            VAR_4->regs[VAR_1] = VAR_2;

            break;

    }

}

static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2,
unsigned VAR_3)
{ struct gpio_state_t *VAR_4 = VAR_0; D(printf("%VAR_4 %x=%x\n", __func__, VAR_1, (unsigned)VAR_2)); VAR_1 >>= 2; switch (VAR_1)
{ case RW_PA_DOUT:
VAR_4->nand->ale = !!(VAR_2 & (1 << 6)); VAR_4->nand->cle = !!(VAR_2 & (1 << 5)); VAR_4->nand->ce  = !!(VAR_2 & (1 << 4)); VAR_4->regs[VAR_1] = VAR_2; break; case RW_PD_DOUT:
if ((VAR_4->regs[VAR_1] ^ VAR_2) & 2)
tempsensor_clkedge(&VAR_4->tempsensor, !!(VAR_2 & 2),
!!(VAR_2 & 16)); VAR_4->regs[VAR_1] = VAR_2; break; default:
VAR_4->regs[VAR_1] = VAR_2; break; } }