static uint64_t omap_mcbsp_read(void *opaque, hwaddr addr,

                                unsigned size)

{

    struct omap_mcbsp_s *s = (struct omap_mcbsp_s *) opaque;

    int offset = addr & OMAP_MPUI_REG_MASK;

    uint16_t ret;



    if (size != 2) {

        return omap_badwidth_read16(opaque, addr);

    }



    switch (offset) {

    case 0x00:	/* DRR2 */

        if (((s->rcr[0] >> 5) & 7) < 3)			/* RWDLEN1 */

            return 0x0000;

        /* Fall through.  */

    case 0x02:	/* DRR1 */

        if (s->rx_req < 2) {

            printf("%s: Rx FIFO underrun\n", __FUNCTION__);

            omap_mcbsp_rx_done(s);

        } else {

            s->tx_req -= 2;

            if (s->codec && s->codec->in.len >= 2) {

                ret = s->codec->in.fifo[s->codec->in.start ++] << 8;

                ret |= s->codec->in.fifo[s->codec->in.start ++];

                s->codec->in.len -= 2;

            } else

                ret = 0x0000;

            if (!s->tx_req)

                omap_mcbsp_rx_done(s);

            return ret;

        }

        return 0x0000;



    case 0x04:	/* DXR2 */

    case 0x06:	/* DXR1 */

        return 0x0000;



    case 0x08:	/* SPCR2 */

        return s->spcr[1];

    case 0x0a:	/* SPCR1 */

        return s->spcr[0];

    case 0x0c:	/* RCR2 */

        return s->rcr[1];

    case 0x0e:	/* RCR1 */

        return s->rcr[0];

    case 0x10:	/* XCR2 */

        return s->xcr[1];

    case 0x12:	/* XCR1 */

        return s->xcr[0];

    case 0x14:	/* SRGR2 */

        return s->srgr[1];

    case 0x16:	/* SRGR1 */

        return s->srgr[0];

    case 0x18:	/* MCR2 */

        return s->mcr[1];

    case 0x1a:	/* MCR1 */

        return s->mcr[0];

    case 0x1c:	/* RCERA */

        return s->rcer[0];

    case 0x1e:	/* RCERB */

        return s->rcer[1];

    case 0x20:	/* XCERA */

        return s->xcer[0];

    case 0x22:	/* XCERB */

        return s->xcer[1];

    case 0x24:	/* PCR0 */

        return s->pcr;

    case 0x26:	/* RCERC */

        return s->rcer[2];

    case 0x28:	/* RCERD */

        return s->rcer[3];

    case 0x2a:	/* XCERC */

        return s->xcer[2];

    case 0x2c:	/* XCERD */

        return s->xcer[3];

    case 0x2e:	/* RCERE */

        return s->rcer[4];

    case 0x30:	/* RCERF */

        return s->rcer[5];

    case 0x32:	/* XCERE */

        return s->xcer[4];

    case 0x34:	/* XCERF */

        return s->xcer[5];

    case 0x36:	/* RCERG */

        return s->rcer[6];

    case 0x38:	/* RCERH */

        return s->rcer[7];

    case 0x3a:	/* XCERG */

        return s->xcer[6];

    case 0x3c:	/* XCERH */

        return s->xcer[7];

    }



    OMAP_BAD_REG(addr);

    return 0;

}

static uint64_t omap_mcbsp_read(void *opaque, hwaddr addr,

                                unsigned size)

{

    struct omap_mcbsp_s *s = (struct omap_mcbsp_s *) opaque;

    int offset = addr & OMAP_MPUI_REG_MASK;

    uint16_t ret;



    if (size != 2) {

        return omap_badwidth_read16(opaque, addr);

    }



    switch (offset) {

    case 0x00:	

        if (((s->rcr[0] >> 5) & 7) < 3)			

            return 0x0000;

        

    case 0x02:	

        if (s->rx_req < 2) {

            printf("%s: Rx FIFO underrun\n", __FUNCTION__);

            omap_mcbsp_rx_done(s);

        } else {

            s->tx_req -= 2;

            if (s->codec && s->codec->in.len >= 2) {

                ret = s->codec->in.fifo[s->codec->in.start ++] << 8;

                ret |= s->codec->in.fifo[s->codec->in.start ++];

                s->codec->in.len -= 2;

            } else

                ret = 0x0000;

            if (!s->tx_req)

                omap_mcbsp_rx_done(s);

            return ret;

        }

        return 0x0000;



    case 0x04:	

    case 0x06:	

        return 0x0000;



    case 0x08:	

        return s->spcr[1];

    case 0x0a:	

        return s->spcr[0];

    case 0x0c:	

        return s->rcr[1];

    case 0x0e:	

        return s->rcr[0];

    case 0x10:	

        return s->xcr[1];

    case 0x12:	

        return s->xcr[0];

    case 0x14:	

        return s->srgr[1];

    case 0x16:	

        return s->srgr[0];

    case 0x18:	

        return s->mcr[1];

    case 0x1a:	

        return s->mcr[0];

    case 0x1c:	

        return s->rcer[0];

    case 0x1e:	

        return s->rcer[1];

    case 0x20:	

        return s->xcer[0];

    case 0x22:	

        return s->xcer[1];

    case 0x24:	

        return s->pcr;

    case 0x26:	

        return s->rcer[2];

    case 0x28:	

        return s->rcer[3];

    case 0x2a:	

        return s->xcer[2];

    case 0x2c:	

        return s->xcer[3];

    case 0x2e:	

        return s->rcer[4];

    case 0x30:	

        return s->rcer[5];

    case 0x32:	

        return s->xcer[4];

    case 0x34:	

        return s->xcer[5];

    case 0x36:	

        return s->rcer[6];

    case 0x38:	

        return s->rcer[7];

    case 0x3a:	

        return s->xcer[6];

    case 0x3c:	

        return s->xcer[7];

    }



    OMAP_BAD_REG(addr);

    return 0;

}

static uint64_t FUNC_0(void *opaque, hwaddr addr,

                                unsigned size)

{

    struct omap_mcbsp_s *VAR_0 = (struct omap_mcbsp_s *) opaque;

    int VAR_1 = addr & OMAP_MPUI_REG_MASK;

    uint16_t ret;



    if (size != 2) {

        return omap_badwidth_read16(opaque, addr);

    }



    switch (VAR_1) {

    case 0x00:	

        if (((VAR_0->rcr[0] >> 5) & 7) < 3)			

            return 0x0000;

        

    case 0x02:	

        if (VAR_0->rx_req < 2) {

            printf("%VAR_0: Rx FIFO underrun\n", __FUNCTION__);

            omap_mcbsp_rx_done(VAR_0);

        } else {

            VAR_0->tx_req -= 2;

            if (VAR_0->codec && VAR_0->codec->in.len >= 2) {

                ret = VAR_0->codec->in.fifo[VAR_0->codec->in.start ++] << 8;

                ret |= VAR_0->codec->in.fifo[VAR_0->codec->in.start ++];

                VAR_0->codec->in.len -= 2;

            } else

                ret = 0x0000;

            if (!VAR_0->tx_req)

                omap_mcbsp_rx_done(VAR_0);

            return ret;

        }

        return 0x0000;



    case 0x04:	

    case 0x06:	

        return 0x0000;



    case 0x08:	

        return VAR_0->spcr[1];

    case 0x0a:	

        return VAR_0->spcr[0];

    case 0x0c:	

        return VAR_0->rcr[1];

    case 0x0e:	

        return VAR_0->rcr[0];

    case 0x10:	

        return VAR_0->xcr[1];

    case 0x12:	

        return VAR_0->xcr[0];

    case 0x14:	

        return VAR_0->srgr[1];

    case 0x16:	

        return VAR_0->srgr[0];

    case 0x18:	

        return VAR_0->mcr[1];

    case 0x1a:	

        return VAR_0->mcr[0];

    case 0x1c:	

        return VAR_0->rcer[0];

    case 0x1e:	

        return VAR_0->rcer[1];

    case 0x20:	

        return VAR_0->xcer[0];

    case 0x22:	

        return VAR_0->xcer[1];

    case 0x24:	

        return VAR_0->pcr;

    case 0x26:	

        return VAR_0->rcer[2];

    case 0x28:	

        return VAR_0->rcer[3];

    case 0x2a:	

        return VAR_0->xcer[2];

    case 0x2c:	

        return VAR_0->xcer[3];

    case 0x2e:	

        return VAR_0->rcer[4];

    case 0x30:	

        return VAR_0->rcer[5];

    case 0x32:	

        return VAR_0->xcer[4];

    case 0x34:	

        return VAR_0->xcer[5];

    case 0x36:	

        return VAR_0->rcer[6];

    case 0x38:	

        return VAR_0->rcer[7];

    case 0x3a:	

        return VAR_0->xcer[6];

    case 0x3c:	

        return VAR_0->xcer[7];

    }



    OMAP_BAD_REG(addr);

    return 0;

}

static uint64_t FUNC_0(void *opaque, hwaddr addr,
unsigned size)
{ struct omap_mcbsp_s *VAR_0 = (struct omap_mcbsp_s *) opaque; int VAR_1 = addr & OMAP_MPUI_REG_MASK; uint16_t ret; if (size != 2) { return omap_badwidth_read16(opaque, addr); } switch (VAR_1) { case 0x00:
if (((VAR_0->rcr[0] >> 5) & 7) < 3)
return 0x0000; case 0x02:
if (VAR_0->rx_req < 2) { printf("%VAR_0: Rx FIFO underrun\n", __FUNCTION__); omap_mcbsp_rx_done(VAR_0); } else { VAR_0->tx_req -= 2; if (VAR_0->codec && VAR_0->codec->in.len >= 2) { ret = VAR_0->codec->in.fifo[VAR_0->codec->in.start ++] << 8; ret |= VAR_0->codec->in.fifo[VAR_0->codec->in.start ++]; VAR_0->codec->in.len -= 2; } else ret = 0x0000; if (!VAR_0->tx_req)
omap_mcbsp_rx_done(VAR_0); return ret; } return 0x0000; case 0x04:
case 0x06:
return 0x0000; case 0x08:
return VAR_0->spcr[1]; case 0x0a:
return VAR_0->spcr[0]; case 0x0c:
return VAR_0->rcr[1]; case 0x0e:
return VAR_0->rcr[0]; case 0x10:
return VAR_0->xcr[1]; case 0x12:
return VAR_0->xcr[0]; case 0x14:
return VAR_0->srgr[1]; case 0x16:
return VAR_0->srgr[0]; case 0x18:
return VAR_0->mcr[1]; case 0x1a:
return VAR_0->mcr[0]; case 0x1c:
return VAR_0->rcer[0]; case 0x1e:
return VAR_0->rcer[1]; case 0x20:
return VAR_0->xcer[0]; case 0x22:
return VAR_0->xcer[1]; case 0x24:
return VAR_0->pcr; case 0x26:
return VAR_0->rcer[2]; case 0x28:
return VAR_0->rcer[3]; case 0x2a:
return VAR_0->xcer[2]; case 0x2c:
return VAR_0->xcer[3]; case 0x2e:
return VAR_0->rcer[4]; case 0x30:
return VAR_0->rcer[5]; case 0x32:
return VAR_0->xcer[4]; case 0x34:
return VAR_0->xcer[5]; case 0x36:
return VAR_0->rcer[6]; case 0x38:
return VAR_0->rcer[7]; case 0x3a:
return VAR_0->xcer[6]; case 0x3c:
return VAR_0->xcer[7]; } OMAP_BAD_REG(addr); return 0; }