int CALLBACK _DEV9irqHandler(void) { //dev9Ru16(SPD_R_INTR_STAT)|= dev9.irqcause; DEV9_LOG("_DEV9irqHandler %x, %x\n", dev9.irqcause, dev9Ru16(SPD_R_INTR_MASK)); if (dev9.irqcause & dev9Ru16(SPD_R_INTR_MASK)) return 1; return 0; }
void _DEV9irq(int cause, int cycles) { DEV9_LOG("_DEV9irq %x, %x\n", cause, dev9Ru16(SPD_R_INTR_MASK)); dev9.irqcause|= cause; if(cycles<1) DEV9irq(1); else DEV9irq(cycles); }
void emac3_write(u32 addr) { u32 value=wswap(dev9Ru32(addr)); switch(addr) { case SMAP_R_EMAC3_MODE0_L: DEV9_LOG("SMAP: SMAP_R_EMAC3_MODE0 write %x\n", value); value = (value & (~SMAP_E3_SOFT_RESET)) | SMAP_E3_TXMAC_IDLE | SMAP_E3_RXMAC_IDLE; dev9Ru16(SMAP_R_EMAC3_STA_CTRL_H)|= SMAP_E3_PHY_OP_COMP; break; case SMAP_R_EMAC3_TxMODE0_L: DEV9_LOG("SMAP: SMAP_R_EMAC3_TxMODE0_L write %x\n", value); //spams// emu_printf("SMAP: SMAP_R_EMAC3_TxMODE0_L write %x\n", value); //Process TX here ? if (!value&SMAP_E3_TX_GNP_0) emu_printf("SMAP_R_EMAC3_TxMODE0_L: SMAP_E3_TX_GNP_0 not set\n"); tx_process(); value = value& ~SMAP_E3_TX_GNP_0; if (value) emu_printf("SMAP_R_EMAC3_TxMODE0_L: extra bits set !\n"); break; case SMAP_R_EMAC3_TxMODE1_L: emu_printf("SMAP_R_EMAC3_TxMODE1_L 32bit write %x\n", value); break; case SMAP_R_EMAC3_STA_CTRL_L: DEV9_LOG("SMAP: SMAP_R_EMAC3_STA_CTRL write %x\n", value); { if (value & (SMAP_E3_PHY_READ)) { value|= SMAP_E3_PHY_OP_COMP; int reg = value & (SMAP_E3_PHY_REG_ADDR_MSK); u16 val = dev9.phyregs[reg]; switch (reg) { case SMAP_DsPHYTER_BMSR: if (has_link) val|= SMAP_PHY_BMSR_LINK | SMAP_PHY_BMSR_ANCP; break; case SMAP_DsPHYTER_PHYSTS: if (has_link) val|= SMAP_PHY_STS_LINK |SMAP_PHY_STS_100M | SMAP_PHY_STS_FDX | SMAP_PHY_STS_ANCP; break; } DEV9_LOG("phy_read %d: %x\n", reg, val); value=(value&0xFFFF)|(val<<16); } if (value & (SMAP_E3_PHY_WRITE)) { value|= SMAP_E3_PHY_OP_COMP; int reg = value & (SMAP_E3_PHY_REG_ADDR_MSK); u16 val = value>>16; switch (reg) { case SMAP_DsPHYTER_BMCR: val&= ~SMAP_PHY_BMCR_RST; val|= 0x1; break; } DEV9_LOG("phy_write %d: %x\n", reg, val); dev9.phyregs[reg] = val; } } break; default: DEV9_LOG("SMAP: emac3 write %x=%x\n",addr, value); }