static uint64_t gpio_read(void *opaque, target_phys_addr_t addr, unsigned size)

{

    struct gpio_state_t *s = opaque;

    uint32_t r = 0;



    addr >>= 2;

    switch (addr)

    {

        case R_PA_DIN:

            r = s->regs[RW_PA_DOUT] & s->regs[RW_PA_OE];



            /* Encode pins from the nand.  */

            r |= s->nand->rdy << 7;

            break;

        case R_PD_DIN:

            r = s->regs[RW_PD_DOUT] & s->regs[RW_PD_OE];



            /* Encode temp sensor pins.  */

            r |= (!!(s->tempsensor.shiftreg & 0x10000)) << 4;

            break;



        default:

            r = s->regs[addr];

            break;

    }

    return r;

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

}

static uint64_t gpio_read(void *opaque, target_phys_addr_t addr, unsigned size)

{

    struct gpio_state_t *s = opaque;

    uint32_t r = 0;



    addr >>= 2;

    switch (addr)

    {

        case R_PA_DIN:

            r = s->regs[RW_PA_DOUT] & s->regs[RW_PA_OE];



            

            r |= s->nand->rdy << 7;

            break;

        case R_PD_DIN:

            r = s->regs[RW_PD_DOUT] & s->regs[RW_PD_OE];



            

            r |= (!!(s->tempsensor.shiftreg & 0x10000)) << 4;

            break;



        default:

            r = s->regs[addr];

            break;

    }

    return r;

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

}

static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr, unsigned size)

{

    struct gpio_state_t *VAR_0 = opaque;

    uint32_t r = 0;



    addr >>= 2;

    switch (addr)

    {

        case R_PA_DIN:

            r = VAR_0->regs[RW_PA_DOUT] & VAR_0->regs[RW_PA_OE];



            

            r |= VAR_0->nand->rdy << 7;

            break;

        case R_PD_DIN:

            r = VAR_0->regs[RW_PD_DOUT] & VAR_0->regs[RW_PD_OE];



            

            r |= (!!(VAR_0->tempsensor.shiftreg & 0x10000)) << 4;

            break;



        default:

            r = VAR_0->regs[addr];

            break;

    }

    return r;

    D(printf("%VAR_0 %x=%x\n", __func__, addr, r));

}

static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr, unsigned size)
{ struct gpio_state_t *VAR_0 = opaque; uint32_t r = 0; addr >>= 2; switch (addr)
{ case R_PA_DIN:
r = VAR_0->regs[RW_PA_DOUT] & VAR_0->regs[RW_PA_OE]; r |= VAR_0->nand->rdy << 7; break; case R_PD_DIN:
r = VAR_0->regs[RW_PD_DOUT] & VAR_0->regs[RW_PD_OE]; r |= (!!(VAR_0->tempsensor.shiftreg & 0x10000)) << 4; break; default:
r = VAR_0->regs[addr]; break; } return r; D(printf("%VAR_0 %x=%x\n", __func__, addr, r)); }