static void omap_mcbsp_writeh(void *opaque, target_phys_addr_t addr,

                uint32_t value)

{

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

    int offset = addr & OMAP_MPUI_REG_MASK;



    switch (offset) {

    case 0x00:	/* DRR2 */

    case 0x02:	/* DRR1 */

        OMAP_RO_REG(addr);

        return;



    case 0x04:	/* DXR2 */

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

            return;

        /* Fall through.  */

    case 0x06:	/* DXR1 */

        if (s->tx_req > 1) {

            s->tx_req -= 2;

            if (s->codec && s->codec->cts) {

                s->codec->out.fifo[s->codec->out.len ++] = (value >> 8) & 0xff;

                s->codec->out.fifo[s->codec->out.len ++] = (value >> 0) & 0xff;

            }

            if (s->tx_req < 2)

                omap_mcbsp_tx_done(s);

        } else

            printf("%s: Tx FIFO overrun\n", __FUNCTION__);

        return;



    case 0x08:	/* SPCR2 */

        s->spcr[1] &= 0x0002;

        s->spcr[1] |= 0x03f9 & value;

        s->spcr[1] |= 0x0004 & (value << 2);		/* XEMPTY := XRST */

        if (~value & 1)					/* XRST */

            s->spcr[1] &= ~6;

        omap_mcbsp_req_update(s);

        return;

    case 0x0a:	/* SPCR1 */

        s->spcr[0] &= 0x0006;

        s->spcr[0] |= 0xf8f9 & value;

        if (value & (1 << 15))				/* DLB */

            printf("%s: Digital Loopback mode enable attempt\n", __FUNCTION__);

        if (~value & 1) {				/* RRST */

            s->spcr[0] &= ~6;

            s->rx_req = 0;

            omap_mcbsp_rx_done(s);

        }

        omap_mcbsp_req_update(s);

        return;



    case 0x0c:	/* RCR2 */

        s->rcr[1] = value & 0xffff;

        return;

    case 0x0e:	/* RCR1 */

        s->rcr[0] = value & 0x7fe0;

        return;

    case 0x10:	/* XCR2 */

        s->xcr[1] = value & 0xffff;

        return;

    case 0x12:	/* XCR1 */

        s->xcr[0] = value & 0x7fe0;

        return;

    case 0x14:	/* SRGR2 */

        s->srgr[1] = value & 0xffff;

        omap_mcbsp_req_update(s);

        return;

    case 0x16:	/* SRGR1 */

        s->srgr[0] = value & 0xffff;

        omap_mcbsp_req_update(s);

        return;

    case 0x18:	/* MCR2 */

        s->mcr[1] = value & 0x03e3;

        if (value & 3)					/* XMCM */

            printf("%s: Tx channel selection mode enable attempt\n",

                            __FUNCTION__);

        return;

    case 0x1a:	/* MCR1 */

        s->mcr[0] = value & 0x03e1;

        if (value & 1)					/* RMCM */

            printf("%s: Rx channel selection mode enable attempt\n",

                            __FUNCTION__);

        return;

    case 0x1c:	/* RCERA */

        s->rcer[0] = value & 0xffff;

        return;

    case 0x1e:	/* RCERB */

        s->rcer[1] = value & 0xffff;

        return;

    case 0x20:	/* XCERA */

        s->xcer[0] = value & 0xffff;

        return;

    case 0x22:	/* XCERB */

        s->xcer[1] = value & 0xffff;

        return;

    case 0x24:	/* PCR0 */

        s->pcr = value & 0x7faf;

        return;

    case 0x26:	/* RCERC */

        s->rcer[2] = value & 0xffff;

        return;

    case 0x28:	/* RCERD */

        s->rcer[3] = value & 0xffff;

        return;

    case 0x2a:	/* XCERC */

        s->xcer[2] = value & 0xffff;

        return;

    case 0x2c:	/* XCERD */

        s->xcer[3] = value & 0xffff;

        return;

    case 0x2e:	/* RCERE */

        s->rcer[4] = value & 0xffff;

        return;

    case 0x30:	/* RCERF */

        s->rcer[5] = value & 0xffff;

        return;

    case 0x32:	/* XCERE */

        s->xcer[4] = value & 0xffff;

        return;

    case 0x34:	/* XCERF */

        s->xcer[5] = value & 0xffff;

        return;

    case 0x36:	/* RCERG */

        s->rcer[6] = value & 0xffff;

        return;

    case 0x38:	/* RCERH */

        s->rcer[7] = value & 0xffff;

        return;

    case 0x3a:	/* XCERG */

        s->xcer[6] = value & 0xffff;

        return;

    case 0x3c:	/* XCERH */

        s->xcer[7] = value & 0xffff;

        return;

    }



    OMAP_BAD_REG(addr);

}

static void omap_mcbsp_writeh(void *opaque, target_phys_addr_t addr,

                uint32_t value)

{

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

    int offset = addr & OMAP_MPUI_REG_MASK;



    switch (offset) {

    case 0x00:	

    case 0x02:	

        OMAP_RO_REG(addr);

        return;



    case 0x04:	

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

            return;

        

    case 0x06:	

        if (s->tx_req > 1) {

            s->tx_req -= 2;

            if (s->codec && s->codec->cts) {

                s->codec->out.fifo[s->codec->out.len ++] = (value >> 8) & 0xff;

                s->codec->out.fifo[s->codec->out.len ++] = (value >> 0) & 0xff;

            }

            if (s->tx_req < 2)

                omap_mcbsp_tx_done(s);

        } else

            printf("%s: Tx FIFO overrun\n", __FUNCTION__);

        return;



    case 0x08:	

        s->spcr[1] &= 0x0002;

        s->spcr[1] |= 0x03f9 & value;

        s->spcr[1] |= 0x0004 & (value << 2);		

        if (~value & 1)					

            s->spcr[1] &= ~6;

        omap_mcbsp_req_update(s);

        return;

    case 0x0a:	

        s->spcr[0] &= 0x0006;

        s->spcr[0] |= 0xf8f9 & value;

        if (value & (1 << 15))				

            printf("%s: Digital Loopback mode enable attempt\n", __FUNCTION__);

        if (~value & 1) {				

            s->spcr[0] &= ~6;

            s->rx_req = 0;

            omap_mcbsp_rx_done(s);

        }

        omap_mcbsp_req_update(s);

        return;



    case 0x0c:	

        s->rcr[1] = value & 0xffff;

        return;

    case 0x0e:	

        s->rcr[0] = value & 0x7fe0;

        return;

    case 0x10:	

        s->xcr[1] = value & 0xffff;

        return;

    case 0x12:	

        s->xcr[0] = value & 0x7fe0;

        return;

    case 0x14:	

        s->srgr[1] = value & 0xffff;

        omap_mcbsp_req_update(s);

        return;

    case 0x16:	

        s->srgr[0] = value & 0xffff;

        omap_mcbsp_req_update(s);

        return;

    case 0x18:	

        s->mcr[1] = value & 0x03e3;

        if (value & 3)					

            printf("%s: Tx channel selection mode enable attempt\n",

                            __FUNCTION__);

        return;

    case 0x1a:	

        s->mcr[0] = value & 0x03e1;

        if (value & 1)					

            printf("%s: Rx channel selection mode enable attempt\n",

                            __FUNCTION__);

        return;

    case 0x1c:	

        s->rcer[0] = value & 0xffff;

        return;

    case 0x1e:	

        s->rcer[1] = value & 0xffff;

        return;

    case 0x20:	

        s->xcer[0] = value & 0xffff;

        return;

    case 0x22:	

        s->xcer[1] = value & 0xffff;

        return;

    case 0x24:	

        s->pcr = value & 0x7faf;

        return;

    case 0x26:	

        s->rcer[2] = value & 0xffff;

        return;

    case 0x28:	

        s->rcer[3] = value & 0xffff;

        return;

    case 0x2a:	

        s->xcer[2] = value & 0xffff;

        return;

    case 0x2c:	

        s->xcer[3] = value & 0xffff;

        return;

    case 0x2e:	

        s->rcer[4] = value & 0xffff;

        return;

    case 0x30:	

        s->rcer[5] = value & 0xffff;

        return;

    case 0x32:	

        s->xcer[4] = value & 0xffff;

        return;

    case 0x34:	

        s->xcer[5] = value & 0xffff;

        return;

    case 0x36:	

        s->rcer[6] = value & 0xffff;

        return;

    case 0x38:	

        s->rcer[7] = value & 0xffff;

        return;

    case 0x3a:	

        s->xcer[6] = value & 0xffff;

        return;

    case 0x3c:	

        s->xcer[7] = value & 0xffff;

        return;

    }



    OMAP_BAD_REG(addr);

}

static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,

                uint32_t VAR_2)

{

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

    int VAR_4 = VAR_1 & OMAP_MPUI_REG_MASK;



    switch (VAR_4) {

    case 0x00:	

    case 0x02:	

        OMAP_RO_REG(VAR_1);

        return;



    case 0x04:	

        if (((VAR_3->xcr[0] >> 5) & 7) < 3)			

            return;

        

    case 0x06:	

        if (VAR_3->tx_req > 1) {

            VAR_3->tx_req -= 2;

            if (VAR_3->codec && VAR_3->codec->cts) {

                VAR_3->codec->out.fifo[VAR_3->codec->out.len ++] = (VAR_2 >> 8) & 0xff;

                VAR_3->codec->out.fifo[VAR_3->codec->out.len ++] = (VAR_2 >> 0) & 0xff;

            }

            if (VAR_3->tx_req < 2)

                omap_mcbsp_tx_done(VAR_3);

        } else

            printf("%VAR_3: Tx FIFO overrun\n", __FUNCTION__);

        return;



    case 0x08:	

        VAR_3->spcr[1] &= 0x0002;

        VAR_3->spcr[1] |= 0x03f9 & VAR_2;

        VAR_3->spcr[1] |= 0x0004 & (VAR_2 << 2);		

        if (~VAR_2 & 1)					

            VAR_3->spcr[1] &= ~6;

        omap_mcbsp_req_update(VAR_3);

        return;

    case 0x0a:	

        VAR_3->spcr[0] &= 0x0006;

        VAR_3->spcr[0] |= 0xf8f9 & VAR_2;

        if (VAR_2 & (1 << 15))				

            printf("%VAR_3: Digital Loopback mode enable attempt\n", __FUNCTION__);

        if (~VAR_2 & 1) {				

            VAR_3->spcr[0] &= ~6;

            VAR_3->rx_req = 0;

            omap_mcbsp_rx_done(VAR_3);

        }

        omap_mcbsp_req_update(VAR_3);

        return;



    case 0x0c:	

        VAR_3->rcr[1] = VAR_2 & 0xffff;

        return;

    case 0x0e:	

        VAR_3->rcr[0] = VAR_2 & 0x7fe0;

        return;

    case 0x10:	

        VAR_3->xcr[1] = VAR_2 & 0xffff;

        return;

    case 0x12:	

        VAR_3->xcr[0] = VAR_2 & 0x7fe0;

        return;

    case 0x14:	

        VAR_3->srgr[1] = VAR_2 & 0xffff;

        omap_mcbsp_req_update(VAR_3);

        return;

    case 0x16:	

        VAR_3->srgr[0] = VAR_2 & 0xffff;

        omap_mcbsp_req_update(VAR_3);

        return;

    case 0x18:	

        VAR_3->mcr[1] = VAR_2 & 0x03e3;

        if (VAR_2 & 3)					

            printf("%VAR_3: Tx channel selection mode enable attempt\n",

                            __FUNCTION__);

        return;

    case 0x1a:	

        VAR_3->mcr[0] = VAR_2 & 0x03e1;

        if (VAR_2 & 1)					

            printf("%VAR_3: Rx channel selection mode enable attempt\n",

                            __FUNCTION__);

        return;

    case 0x1c:	

        VAR_3->rcer[0] = VAR_2 & 0xffff;

        return;

    case 0x1e:	

        VAR_3->rcer[1] = VAR_2 & 0xffff;

        return;

    case 0x20:	

        VAR_3->xcer[0] = VAR_2 & 0xffff;

        return;

    case 0x22:	

        VAR_3->xcer[1] = VAR_2 & 0xffff;

        return;

    case 0x24:	

        VAR_3->pcr = VAR_2 & 0x7faf;

        return;

    case 0x26:	

        VAR_3->rcer[2] = VAR_2 & 0xffff;

        return;

    case 0x28:	

        VAR_3->rcer[3] = VAR_2 & 0xffff;

        return;

    case 0x2a:	

        VAR_3->xcer[2] = VAR_2 & 0xffff;

        return;

    case 0x2c:	

        VAR_3->xcer[3] = VAR_2 & 0xffff;

        return;

    case 0x2e:	

        VAR_3->rcer[4] = VAR_2 & 0xffff;

        return;

    case 0x30:	

        VAR_3->rcer[5] = VAR_2 & 0xffff;

        return;

    case 0x32:	

        VAR_3->xcer[4] = VAR_2 & 0xffff;

        return;

    case 0x34:	

        VAR_3->xcer[5] = VAR_2 & 0xffff;

        return;

    case 0x36:	

        VAR_3->rcer[6] = VAR_2 & 0xffff;

        return;

    case 0x38:	

        VAR_3->rcer[7] = VAR_2 & 0xffff;

        return;

    case 0x3a:	

        VAR_3->xcer[6] = VAR_2 & 0xffff;

        return;

    case 0x3c:	

        VAR_3->xcer[7] = VAR_2 & 0xffff;

        return;

    }



    OMAP_BAD_REG(VAR_1);

}

static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,
uint32_t VAR_2)
{ struct omap_mcbsp_s *VAR_3 = (struct omap_mcbsp_s *) VAR_0; int VAR_4 = VAR_1 & OMAP_MPUI_REG_MASK; switch (VAR_4) { case 0x00:
case 0x02:
OMAP_RO_REG(VAR_1); return; case 0x04:
if (((VAR_3->xcr[0] >> 5) & 7) < 3)
return; case 0x06:
if (VAR_3->tx_req > 1) { VAR_3->tx_req -= 2; if (VAR_3->codec && VAR_3->codec->cts) { VAR_3->codec->out.fifo[VAR_3->codec->out.len ++] = (VAR_2 >> 8) & 0xff; VAR_3->codec->out.fifo[VAR_3->codec->out.len ++] = (VAR_2 >> 0) & 0xff; } if (VAR_3->tx_req < 2)
omap_mcbsp_tx_done(VAR_3); } else printf("%VAR_3: Tx FIFO overrun\n", __FUNCTION__); return; case 0x08:
VAR_3->spcr[1] &= 0x0002; VAR_3->spcr[1] |= 0x03f9 & VAR_2; VAR_3->spcr[1] |= 0x0004 & (VAR_2 << 2); if (~VAR_2 & 1)
VAR_3->spcr[1] &= ~6; omap_mcbsp_req_update(VAR_3); return; case 0x0a:
VAR_3->spcr[0] &= 0x0006; VAR_3->spcr[0] |= 0xf8f9 & VAR_2; if (VAR_2 & (1 << 15))
printf("%VAR_3: Digital Loopback mode enable attempt\n", __FUNCTION__); if (~VAR_2 & 1) { VAR_3->spcr[0] &= ~6; VAR_3->rx_req = 0; omap_mcbsp_rx_done(VAR_3); } omap_mcbsp_req_update(VAR_3); return; case 0x0c:
VAR_3->rcr[1] = VAR_2 & 0xffff; return; case 0x0e:
VAR_3->rcr[0] = VAR_2 & 0x7fe0; return; case 0x10:
VAR_3->xcr[1] = VAR_2 & 0xffff; return; case 0x12:
VAR_3->xcr[0] = VAR_2 & 0x7fe0; return; case 0x14:
VAR_3->srgr[1] = VAR_2 & 0xffff; omap_mcbsp_req_update(VAR_3); return; case 0x16:
VAR_3->srgr[0] = VAR_2 & 0xffff; omap_mcbsp_req_update(VAR_3); return; case 0x18:
VAR_3->mcr[1] = VAR_2 & 0x03e3; if (VAR_2 & 3)
printf("%VAR_3: Tx channel selection mode enable attempt\n",
__FUNCTION__); return; case 0x1a:
VAR_3->mcr[0] = VAR_2 & 0x03e1; if (VAR_2 & 1)
printf("%VAR_3: Rx channel selection mode enable attempt\n",
__FUNCTION__); return; case 0x1c:
VAR_3->rcer[0] = VAR_2 & 0xffff; return; case 0x1e:
VAR_3->rcer[1] = VAR_2 & 0xffff; return; case 0x20:
VAR_3->xcer[0] = VAR_2 & 0xffff; return; case 0x22:
VAR_3->xcer[1] = VAR_2 & 0xffff; return; case 0x24:
VAR_3->pcr = VAR_2 & 0x7faf; return; case 0x26:
VAR_3->rcer[2] = VAR_2 & 0xffff; return; case 0x28:
VAR_3->rcer[3] = VAR_2 & 0xffff; return; case 0x2a:
VAR_3->xcer[2] = VAR_2 & 0xffff; return; case 0x2c:
VAR_3->xcer[3] = VAR_2 & 0xffff; return; case 0x2e:
VAR_3->rcer[4] = VAR_2 & 0xffff; return; case 0x30:
VAR_3->rcer[5] = VAR_2 & 0xffff; return; case 0x32:
VAR_3->xcer[4] = VAR_2 & 0xffff; return; case 0x34:
VAR_3->xcer[5] = VAR_2 & 0xffff; return; case 0x36:
VAR_3->rcer[6] = VAR_2 & 0xffff; return; case 0x38:
VAR_3->rcer[7] = VAR_2 & 0xffff; return; case 0x3a:
VAR_3->xcer[6] = VAR_2 & 0xffff; return; case 0x3c:
VAR_3->xcer[7] = VAR_2 & 0xffff; return; } OMAP_BAD_REG(VAR_1); }