static void rtl8139_io_writeb(void *opaque, uint8_t addr, uint32_t val)

{

    RTL8139State *s = opaque;



    switch (addr)

    {

        case MAC0 ... MAC0+5:

            s->phys[addr - MAC0] = val;

            qemu_format_nic_info_str(qemu_get_queue(s->nic), s->phys);

            break;

        case MAC0+6 ... MAC0+7:

            /* reserved */

            break;

        case MAR0 ... MAR0+7:

            s->mult[addr - MAR0] = val;

            break;

        case ChipCmd:

            rtl8139_ChipCmd_write(s, val);

            break;

        case Cfg9346:

            rtl8139_Cfg9346_write(s, val);

            break;

        case TxConfig: /* windows driver sometimes writes using byte-lenth call */

            rtl8139_TxConfig_writeb(s, val);

            break;

        case Config0:

            rtl8139_Config0_write(s, val);

            break;

        case Config1:

            rtl8139_Config1_write(s, val);

            break;

        case Config3:

            rtl8139_Config3_write(s, val);

            break;

        case Config4:

            rtl8139_Config4_write(s, val);

            break;

        case Config5:

            rtl8139_Config5_write(s, val);

            break;

        case MediaStatus:

            /* ignore */

            DPRINTF("not implemented write(b) to MediaStatus val=0x%02x\n",

                val);

            break;



        case HltClk:

            DPRINTF("HltClk write val=0x%08x\n", val);

            if (val == 'R')

            {

                s->clock_enabled = 1;

            }

            else if (val == 'H')

            {

                s->clock_enabled = 0;

            }

            break;



        case TxThresh:

            DPRINTF("C+ TxThresh write(b) val=0x%02x\n", val);

            s->TxThresh = val;

            break;



        case TxPoll:

            DPRINTF("C+ TxPoll write(b) val=0x%02x\n", val);

            if (val & (1 << 7))

            {

                DPRINTF("C+ TxPoll high priority transmission (not "

                    "implemented)\n");

                //rtl8139_cplus_transmit(s);

            }

            if (val & (1 << 6))

            {

                DPRINTF("C+ TxPoll normal priority transmission\n");

                rtl8139_cplus_transmit(s);

            }



            break;



        default:

            DPRINTF("not implemented write(b) addr=0x%x val=0x%02x\n", addr,

                val);

            break;

    }

}

static void rtl8139_io_writeb(void *opaque, uint8_t addr, uint32_t val)

{

    RTL8139State *s = opaque;



    switch (addr)

    {

        case MAC0 ... MAC0+5:

            s->phys[addr - MAC0] = val;

            qemu_format_nic_info_str(qemu_get_queue(s->nic), s->phys);

            break;

        case MAC0+6 ... MAC0+7:

            

            break;

        case MAR0 ... MAR0+7:

            s->mult[addr - MAR0] = val;

            break;

        case ChipCmd:

            rtl8139_ChipCmd_write(s, val);

            break;

        case Cfg9346:

            rtl8139_Cfg9346_write(s, val);

            break;

        case TxConfig: 

            rtl8139_TxConfig_writeb(s, val);

            break;

        case Config0:

            rtl8139_Config0_write(s, val);

            break;

        case Config1:

            rtl8139_Config1_write(s, val);

            break;

        case Config3:

            rtl8139_Config3_write(s, val);

            break;

        case Config4:

            rtl8139_Config4_write(s, val);

            break;

        case Config5:

            rtl8139_Config5_write(s, val);

            break;

        case MediaStatus:

            

            DPRINTF("not implemented write(b) to MediaStatus val=0x%02x\n",

                val);

            break;



        case HltClk:

            DPRINTF("HltClk write val=0x%08x\n", val);

            if (val == 'R')

            {

                s->clock_enabled = 1;

            }

            else if (val == 'H')

            {

                s->clock_enabled = 0;

            }

            break;



        case TxThresh:

            DPRINTF("C+ TxThresh write(b) val=0x%02x\n", val);

            s->TxThresh = val;

            break;



        case TxPoll:

            DPRINTF("C+ TxPoll write(b) val=0x%02x\n", val);

            if (val & (1 << 7))

            {

                DPRINTF("C+ TxPoll high priority transmission (not "

                    "implemented)\n");

                

            }

            if (val & (1 << 6))

            {

                DPRINTF("C+ TxPoll normal priority transmission\n");

                rtl8139_cplus_transmit(s);

            }



            break;



        default:

            DPRINTF("not implemented write(b) addr=0x%x val=0x%02x\n", addr,

                val);

            break;

    }

}

static void FUNC_0(void *VAR_0, uint8_t VAR_1, uint32_t VAR_2)

{

    RTL8139State *s = VAR_0;



    switch (VAR_1)

    {

        case MAC0 ... MAC0+5:

            s->phys[VAR_1 - MAC0] = VAR_2;

            qemu_format_nic_info_str(qemu_get_queue(s->nic), s->phys);

            break;

        case MAC0+6 ... MAC0+7:

            

            break;

        case MAR0 ... MAR0+7:

            s->mult[VAR_1 - MAR0] = VAR_2;

            break;

        case ChipCmd:

            rtl8139_ChipCmd_write(s, VAR_2);

            break;

        case Cfg9346:

            rtl8139_Cfg9346_write(s, VAR_2);

            break;

        case TxConfig: 

            rtl8139_TxConfig_writeb(s, VAR_2);

            break;

        case Config0:

            rtl8139_Config0_write(s, VAR_2);

            break;

        case Config1:

            rtl8139_Config1_write(s, VAR_2);

            break;

        case Config3:

            rtl8139_Config3_write(s, VAR_2);

            break;

        case Config4:

            rtl8139_Config4_write(s, VAR_2);

            break;

        case Config5:

            rtl8139_Config5_write(s, VAR_2);

            break;

        case MediaStatus:

            

            DPRINTF("not implemented write(b) to MediaStatus VAR_2=0x%02x\n",

                VAR_2);

            break;



        case HltClk:

            DPRINTF("HltClk write VAR_2=0x%08x\n", VAR_2);

            if (VAR_2 == 'R')

            {

                s->clock_enabled = 1;

            }

            else if (VAR_2 == 'H')

            {

                s->clock_enabled = 0;

            }

            break;



        case TxThresh:

            DPRINTF("C+ TxThresh write(b) VAR_2=0x%02x\n", VAR_2);

            s->TxThresh = VAR_2;

            break;



        case TxPoll:

            DPRINTF("C+ TxPoll write(b) VAR_2=0x%02x\n", VAR_2);

            if (VAR_2 & (1 << 7))

            {

                DPRINTF("C+ TxPoll high priority transmission (not "

                    "implemented)\n");

                

            }

            if (VAR_2 & (1 << 6))

            {

                DPRINTF("C+ TxPoll normal priority transmission\n");

                rtl8139_cplus_transmit(s);

            }



            break;



        default:

            DPRINTF("not implemented write(b) VAR_1=0x%x VAR_2=0x%02x\n", VAR_1,

                VAR_2);

            break;

    }

}

static void FUNC_0(void *VAR_0, uint8_t VAR_1, uint32_t VAR_2)
{ RTL8139State *s = VAR_0; switch (VAR_1)
{ case MAC0 ... MAC0+5:
s->phys[VAR_1 - MAC0] = VAR_2; qemu_format_nic_info_str(qemu_get_queue(s->nic), s->phys); break; case MAC0+6 ... MAC0+7:
break; case MAR0 ... MAR0+7:
s->mult[VAR_1 - MAR0] = VAR_2; break; case ChipCmd:
rtl8139_ChipCmd_write(s, VAR_2); break; case Cfg9346:
rtl8139_Cfg9346_write(s, VAR_2); break; case TxConfig:
rtl8139_TxConfig_writeb(s, VAR_2); break; case Config0:
rtl8139_Config0_write(s, VAR_2); break; case Config1:
rtl8139_Config1_write(s, VAR_2); break; case Config3:
rtl8139_Config3_write(s, VAR_2); break; case Config4:
rtl8139_Config4_write(s, VAR_2); break; case Config5:
rtl8139_Config5_write(s, VAR_2); break; case MediaStatus:
DPRINTF("not implemented write(b) to MediaStatus VAR_2=0x%02x\n",
VAR_2); break; case HltClk:
DPRINTF("HltClk write VAR_2=0x%08x\n", VAR_2); if (VAR_2 == 'R')
{ s->clock_enabled = 1; } else if (VAR_2 == 'H')
{ s->clock_enabled = 0; } break; case TxThresh:
DPRINTF("C+ TxThresh write(b) VAR_2=0x%02x\n", VAR_2); s->TxThresh = VAR_2; break; case TxPoll:
DPRINTF("C+ TxPoll write(b) VAR_2=0x%02x\n", VAR_2); if (VAR_2 & (1 << 7))
{ DPRINTF("C+ TxPoll high priority transmission (not "
"implemented)\n"); } if (VAR_2 & (1 << 6))
{ DPRINTF("C+ TxPoll normal priority transmission\n"); rtl8139_cplus_transmit(s); } break; default:
DPRINTF("not implemented write(b) VAR_1=0x%x VAR_2=0x%02x\n", VAR_1,
VAR_2); break; } }