trunk/src/mame/drivers/naomi.c
| r23535 | r23536 | |
| 1534 | 1534 | AM_RANGE(0x005f7000, 0x005f70ff) AM_MIRROR(0x02000000) AM_DEVICE16( "rom_board", naomi_board, submap, U64(0x0000ffff0000ffff) ) |
| 1535 | 1535 | AM_RANGE(0x005f7400, 0x005f74ff) AM_MIRROR(0x02000000) AM_DEVICE32( "rom_board", naomi_g1_device, amap, U64(0xffffffffffffffff) ) |
| 1536 | 1536 | AM_RANGE(0x005f7800, 0x005f78ff) AM_MIRROR(0x02000000) AM_READWRITE(dc_g2_ctrl_r, dc_g2_ctrl_w ) |
| 1537 | | AM_RANGE(0x005f7c00, 0x005f7cff) AM_MIRROR(0x02000000) AM_DEVREADWRITE("powervr2", powervr2_device, pvr_ctrl_r, pvr_ctrl_w) |
| 1538 | | AM_RANGE(0x005f8000, 0x005f9fff) AM_MIRROR(0x02000000) AM_DEVREADWRITE("powervr2", powervr2_device, pvr_ta_r, pvr_ta_w ) |
| 1537 | AM_RANGE(0x005f7c00, 0x005f7cff) AM_MIRROR(0x02000000) AM_DEVREADWRITE32("powervr2", powervr2_device, pvr_ctrl_r, pvr_ctrl_w, U64(0xffffffffffffffff)) |
| 1538 | AM_RANGE(0x005f8000, 0x005f9fff) AM_MIRROR(0x02000000) AM_DEVREADWRITE32("powervr2", powervr2_device, pvr_ta_r, pvr_ta_w, U64(0xffffffffffffffff)) |
| 1539 | 1539 | AM_RANGE(0x00600000, 0x006007ff) AM_MIRROR(0x02000000) AM_READWRITE(dc_modem_r, dc_modem_w ) |
| 1540 | 1540 | AM_RANGE(0x00700000, 0x00707fff) AM_MIRROR(0x02000000) AM_READWRITE(dc_aica_reg_r, dc_aica_reg_w ) |
| 1541 | 1541 | AM_RANGE(0x00710000, 0x0071000f) AM_MIRROR(0x02000000) AM_READWRITE(dc_rtc_r, dc_rtc_w ) |
| r23535 | r23536 | |
| 1586 | 1586 | AM_RANGE(0x005f7000, 0x005f70ff) AM_MIRROR(0x02000000) AM_DEVICE16( "rom_board", naomi_board, submap, U64(0x0000ffff0000ffff) ) |
| 1587 | 1587 | AM_RANGE(0x005f7400, 0x005f74ff) AM_MIRROR(0x02000000) AM_DEVICE32( "rom_board", naomi_g1_device, amap, U64(0xffffffffffffffff) ) |
| 1588 | 1588 | AM_RANGE(0x005f7800, 0x005f78ff) AM_MIRROR(0x02000000) AM_READWRITE(dc_g2_ctrl_r, dc_g2_ctrl_w ) |
| 1589 | | AM_RANGE(0x005f7c00, 0x005f7cff) AM_DEVREADWRITE("powervr2", powervr2_device, pvr_ctrl_r, pvr_ctrl_w) |
| 1590 | | AM_RANGE(0x005f8000, 0x005f9fff) AM_DEVREADWRITE("powervr2", powervr2_device, pvr_ta_r, pvr_ta_w ) |
| 1589 | AM_RANGE(0x005f7c00, 0x005f7cff) AM_DEVREADWRITE32("powervr2", powervr2_device, pvr_ctrl_r, pvr_ctrl_w, U64(0xffffffffffffffff)) |
| 1590 | AM_RANGE(0x005f8000, 0x005f9fff) AM_DEVREADWRITE32("powervr2", powervr2_device, pvr_ta_r, pvr_ta_w, U64(0xffffffffffffffff)) |
| 1591 | 1591 | AM_RANGE(0x00600000, 0x006007ff) AM_MIRROR(0x02000000) AM_READWRITE(dc_modem_r, dc_modem_w ) |
| 1592 | 1592 | AM_RANGE(0x00700000, 0x00707fff) AM_MIRROR(0x02000000) AM_READWRITE(dc_aica_reg_r, dc_aica_reg_w ) |
| 1593 | 1593 | AM_RANGE(0x00710000, 0x0071000f) AM_MIRROR(0x02000000) AM_READWRITE(dc_rtc_r, dc_rtc_w ) |
| r23535 | r23536 | |
| 1598 | 1598 | AM_RANGE(0x0103ff00, 0x0103ffff) AM_MIRROR(0x02000000) AM_READWRITE(naomi_unknown1_r, naomi_unknown1_w ) // bios uses it, actual start and end addresses not known |
| 1599 | 1599 | |
| 1600 | 1600 | // AM_RANGE(0x025f6800, 0x025f69ff) AM_READWRITE_LEGACY(dc_sysctrl_r, dc_sysctrl_w ) // second PVR DMA! |
| 1601 | | // AM_RANGE(0x025f7c00, 0x025f7cff) AM_DEVREADWRITE("powervr2", powervr2_device, pvr_ctrl_r, pvr_ctrl_w) |
| 1602 | | AM_RANGE(0x025f8000, 0x025f9fff) AM_DEVREADWRITE("powervr2", powervr2_device, pvr2_ta_r, pvr2_ta_w ) |
| 1601 | // AM_RANGE(0x025f7c00, 0x025f7cff) AM_DEVREADWRITE32("powervr2", powervr2_device, pvr_ctrl_r, pvr_ctrl_w, U64(0xffffffffffffffff)) |
| 1602 | AM_RANGE(0x025f8000, 0x025f9fff) AM_DEVREADWRITE32("powervr2", powervr2_device, pvr2_ta_r, pvr2_ta_w, U64(0xffffffffffffffff)) |
| 1603 | 1603 | |
| 1604 | 1604 | /* Area 1 */ |
| 1605 | 1605 | AM_RANGE(0x04000000, 0x04ffffff) AM_RAM AM_SHARE("dc_texture_ram") // texture memory 64 bit access |
| r23535 | r23536 | |
| 1609 | 1609 | |
| 1610 | 1610 | /* Area 2*/ |
| 1611 | 1611 | AM_RANGE(0x085f6800, 0x085f69ff) AM_WRITE(dc_sysctrl_w ) // writes to BOTH PVRs |
| 1612 | | AM_RANGE(0x085f8000, 0x085f9fff) AM_DEVWRITE("powervr2", powervr2_device, pvrs_ta_w ) // writes to BOTH PVRs |
| 1613 | | AM_RANGE(0x08800000, 0x088000ff) AM_DEVREADWRITE32("powervr2", powervr2_device, elan_regs_r, elan_regs_w, U64(0xffffffffffffffff) ) // T&L chip registers |
| 1612 | AM_RANGE(0x085f8000, 0x085f9fff) AM_DEVWRITE32("powervr2", powervr2_device, pvrs_ta_w, U64(0xffffffffffffffff) ) // writes to BOTH PVRs |
| 1613 | AM_RANGE(0x08800000, 0x088000ff) AM_DEVREADWRITE32("powervr2", powervr2_device, elan_regs_r, elan_regs_w, U64(0xffffffffffffffff)) // T&L chip registers |
| 1614 | 1614 | // AM_RANGE(0x09000000, 0x09??????) T&L command processing |
| 1615 | 1615 | AM_RANGE(0x0a000000, 0x0bffffff) AM_RAM AM_SHARE("elan_ram") // T&L chip RAM |
| 1616 | 1616 | |
| r23535 | r23536 | |
| 1739 | 1739 | AM_RANGE(0x005f7000, 0x005f70ff) AM_MIRROR(0x02000000) AM_DEVICE16( "rom_board", aw_rom_board, submap, U64(0x0000ffff0000ffff) ) |
| 1740 | 1740 | AM_RANGE(0x005f7400, 0x005f74ff) AM_MIRROR(0x02000000) AM_DEVICE32( "rom_board", naomi_g1_device, amap, U64(0xffffffffffffffff) ) |
| 1741 | 1741 | AM_RANGE(0x005f7800, 0x005f78ff) AM_READWRITE(dc_g2_ctrl_r, dc_g2_ctrl_w ) |
| 1742 | | AM_RANGE(0x005f7c00, 0x005f7cff) AM_DEVREADWRITE("powervr2", powervr2_device, pvr_ctrl_r, pvr_ctrl_w) |
| 1743 | | AM_RANGE(0x005f8000, 0x005f9fff) AM_DEVREADWRITE("powervr2", powervr2_device, pvr_ta_r, pvr_ta_w ) |
| 1742 | AM_RANGE(0x005f7c00, 0x005f7cff) AM_DEVREADWRITE32("powervr2", powervr2_device, pvr_ctrl_r, pvr_ctrl_w, U64(0xffffffffffffffff)) |
| 1743 | AM_RANGE(0x005f8000, 0x005f9fff) AM_DEVREADWRITE32("powervr2", powervr2_device, pvr_ta_r, pvr_ta_w, U64(0xffffffffffffffff)) |
| 1744 | 1744 | AM_RANGE(0x00600000, 0x006007ff) AM_READWRITE(aw_modem_r, aw_modem_w ) |
| 1745 | 1745 | AM_RANGE(0x00700000, 0x00707fff) AM_READWRITE(dc_aica_reg_r, dc_aica_reg_w ) |
| 1746 | 1746 | AM_RANGE(0x00710000, 0x0071000f) AM_READWRITE(dc_rtc_r, dc_rtc_w ) |
trunk/src/mame/video/powervr2.c
| r23535 | r23536 | |
| 860 | 860 | |
| 861 | 861 | } |
| 862 | 862 | |
| 863 | | // register decode helper |
| 864 | | static inline int decode_reg_64(UINT32 offset, UINT64 mem_mask, UINT64 *shift) |
| 863 | READ32_MEMBER( powervr2_device::pvr_ta_r ) |
| 865 | 864 | { |
| 866 | | int reg = offset * 2; |
| 867 | | |
| 868 | | *shift = 0; |
| 869 | | |
| 870 | | // non 32-bit accesses have not yet been seen here, we need to know when they are |
| 871 | | if ((mem_mask != U64(0xffffffff00000000)) && (mem_mask != U64(0x00000000ffffffff))) |
| 865 | switch (offset) |
| 872 | 866 | { |
| 873 | | /*assume to return the lower 32-bits ONLY*/ |
| 874 | | return reg & 0xffffffff; |
| 875 | | } |
| 876 | | |
| 877 | | if (mem_mask == U64(0xffffffff00000000)) |
| 878 | | { |
| 879 | | reg++; |
| 880 | | *shift = 32; |
| 881 | | } |
| 882 | | |
| 883 | | return reg; |
| 884 | | } |
| 885 | | |
| 886 | | READ64_MEMBER( powervr2_device::pvr_ta_r ) |
| 887 | | { |
| 888 | | int reg; |
| 889 | | UINT64 shift; |
| 890 | | |
| 891 | | reg = decode_reg_64(offset, mem_mask, &shift); |
| 892 | | |
| 893 | | switch (reg) |
| 894 | | { |
| 895 | 867 | case SPG_STATUS: |
| 896 | 868 | { |
| 897 | 869 | UINT8 fieldnum,vsync,hsync,blank; |
| r23535 | r23536 | |
| 908 | 880 | blank = (space.machine().primary_screen->vblank() | space.machine().primary_screen->hblank()) ? 0 : 1; |
| 909 | 881 | if(spg_blank_pol) { blank^=1; } |
| 910 | 882 | |
| 911 | | pvrta_regs[reg] = (vsync << 13) | (hsync << 12) | (blank << 11) | (fieldnum << 10) | (space.machine().primary_screen->vpos() & 0x3ff); |
| 883 | pvrta_regs[offset] = (vsync << 13) | (hsync << 12) | (blank << 11) | (fieldnum << 10) | (space.machine().primary_screen->vpos() & 0x3ff); |
| 912 | 884 | break; |
| 913 | 885 | } |
| 914 | 886 | case SPG_TRIGGER_POS: |
| r23535 | r23536 | |
| 922 | 894 | if (reg != 0x43) |
| 923 | 895 | mame_printf_verbose("PVRTA: [%08x] read %x @ %x (reg %x), mask %" I64FMT "x (PC=%x)\n", 0x5f8000+reg*4, pvrta_regs[reg], offset, reg, mem_mask, space.device().safe_pc()); |
| 924 | 896 | #endif |
| 925 | | return (UINT64)pvrta_regs[reg] << shift; |
| 897 | return (UINT64)pvrta_regs[offset]; |
| 926 | 898 | } |
| 927 | 899 | |
| 928 | | WRITE64_MEMBER( powervr2_device::pvr_ta_w ) |
| 900 | WRITE32_MEMBER( powervr2_device::pvr_ta_w ) |
| 929 | 901 | { |
| 930 | | int reg; |
| 931 | | UINT64 shift; |
| 932 | | UINT32 dat; |
| 933 | 902 | UINT32 sizera,offsetra; |
| 934 | 903 | int a; |
| 935 | 904 | int sanitycount; |
| 936 | 905 | |
| 937 | | reg = decode_reg_64(offset, mem_mask, &shift); |
| 938 | | dat = (UINT32)(data >> shift); |
| 939 | | //old = pvrta_regs[reg]; |
| 940 | | |
| 941 | 906 | // Dreamcast BIOS attempts to set PVRID to zero and then dies |
| 942 | 907 | // if it succeeds. Don't allow. |
| 943 | | if ((reg != PVRID) && (reg != REVISION)) |
| 908 | if ((offset != PVRID) && (offset != REVISION)) |
| 944 | 909 | { |
| 945 | | pvrta_regs[reg] = dat; // 5f8000+reg*4=dat |
| 910 | pvrta_regs[offset] = data; // 5f8000+reg*4=dat |
| 946 | 911 | } |
| 947 | 912 | |
| 948 | | switch (reg) |
| 913 | switch (offset) |
| 949 | 914 | { |
| 950 | 915 | case SOFTRESET: |
| 951 | | if (dat & 1) |
| 916 | if (data & 1) |
| 952 | 917 | { |
| 953 | 918 | #if DEBUG_PVRTA |
| 954 | 919 | mame_printf_verbose("pvr_ta_w: TA soft reset\n"); |
| 955 | 920 | #endif |
| 956 | 921 | listtype_used=0; |
| 957 | 922 | } |
| 958 | | if (dat & 2) |
| 923 | if (data & 2) |
| 959 | 924 | { |
| 960 | 925 | #if DEBUG_PVRTA |
| 961 | 926 | mame_printf_verbose("pvr_ta_w: Core Pipeline soft reset\n"); |
| r23535 | r23536 | |
| 968 | 933 | start_render_received = 0; |
| 969 | 934 | } |
| 970 | 935 | } |
| 971 | | if (dat & 4) |
| 936 | if (data & 4) |
| 972 | 937 | { |
| 973 | 938 | #if DEBUG_PVRTA |
| 974 | 939 | mame_printf_verbose("pvr_ta_w: sdram I/F soft reset\n"); |
| r23535 | r23536 | |
| 1068 | 1033 | assert_always(0, "TA grabber error A!\n"); |
| 1069 | 1034 | break; |
| 1070 | 1035 | case TA_LIST_INIT: |
| 1071 | | if(dat & 0x80000000) |
| 1036 | if(data & 0x80000000) |
| 1072 | 1037 | { |
| 1073 | 1038 | tafifo_pos=0; |
| 1074 | 1039 | tafifo_mask=7; |
| r23535 | r23536 | |
| 1138 | 1103 | break; |
| 1139 | 1104 | //#define TA_YUV_TEX_BASE ((0x005f8148-0x005f8000)/4) |
| 1140 | 1105 | case TA_YUV_TEX_BASE: |
| 1141 | | printf("TA_YUV_TEX_BASE initialized to %08x\n", dat); |
| 1106 | printf("TA_YUV_TEX_BASE initialized to %08x\n", data); |
| 1142 | 1107 | |
| 1143 | 1108 | // hack, this interrupt is generated after transfering a set amount of data |
| 1144 | 1109 | //state->state->dc_sysctrl_regs[SB_ISTNRM] |= IST_EOXFER_YUV; |
| r23535 | r23536 | |
| 1146 | 1111 | |
| 1147 | 1112 | break; |
| 1148 | 1113 | case TA_YUV_TEX_CTRL: |
| 1149 | | printf("TA_YUV_TEX_CTRL initialized to %08x\n", dat); |
| 1114 | printf("TA_YUV_TEX_CTRL initialized to %08x\n", data); |
| 1150 | 1115 | break; |
| 1151 | 1116 | |
| 1152 | 1117 | case SPG_VBLANK_INT: |
| r23535 | r23536 | |
| 1162 | 1127 | #if DEBUG_PVRTA |
| 1163 | 1128 | mame_printf_verbose("List continuation processing\n"); |
| 1164 | 1129 | #endif |
| 1165 | | if(dat & 0x80000000) |
| 1130 | if(data & 0x80000000) |
| 1166 | 1131 | { |
| 1167 | 1132 | tafifo_listtype= -1; // no list being received |
| 1168 | 1133 | listtype_used |= (1+4); |
| r23535 | r23536 | |
| 1188 | 1153 | } |
| 1189 | 1154 | |
| 1190 | 1155 | #if DEBUG_PVRTA_REGS |
| 1191 | | if ((reg != 0x14) && (reg != 0x15)) |
| 1192 | | mame_printf_verbose("PVRTA: [%08x=%x] write %" I64FMT "x to %x (reg %x %x), mask %" I64FMT "x\n", 0x5f8000+reg*4, dat, data>>shift, offset, reg, (reg*4)+0x8000, mem_mask); |
| 1156 | if ((offset != 0x14) && (offset != 0x15)) |
| 1157 | mame_printf_verbose("PVRTA: [%08x=%x] write %x to %x %x, mask %x\n", 0x5f8000+reg*4, data, offset, (reg*4)+0x8000, mem_mask); |
| 1193 | 1158 | #endif |
| 1194 | 1159 | } |
| 1195 | 1160 | |
| r23535 | r23536 | |
| 2539 | 2504 | |
| 2540 | 2505 | /* Naomi 2 attempts (TBD) */ |
| 2541 | 2506 | |
| 2542 | | READ64_MEMBER( powervr2_device::pvr2_ta_r ) |
| 2507 | READ32_MEMBER( powervr2_device::pvr2_ta_r ) |
| 2543 | 2508 | { |
| 2544 | | int reg; |
| 2545 | | UINT64 shift; |
| 2509 | printf("PVR2 %08x R\n", offset); |
| 2546 | 2510 | |
| 2547 | | reg = decode_reg_64(offset, mem_mask, &shift); |
| 2548 | | |
| 2549 | | switch (reg) |
| 2550 | | { |
| 2551 | | } |
| 2552 | | |
| 2553 | | printf("PVR2 %08x R\n",reg); |
| 2554 | | |
| 2555 | 2511 | return 0; |
| 2556 | 2512 | } |
| 2557 | 2513 | |
| 2558 | | WRITE64_MEMBER( powervr2_device::pvr2_ta_w ) |
| 2514 | WRITE32_MEMBER( powervr2_device::pvr2_ta_w ) |
| 2559 | 2515 | { |
| 2560 | 2516 | // int reg; |
| 2561 | 2517 | // UINT64 shift; |
| r23535 | r23536 | |
| 2609 | 2565 | } |
| 2610 | 2566 | |
| 2611 | 2567 | |
| 2612 | | WRITE64_MEMBER( powervr2_device::pvrs_ta_w ) |
| 2568 | WRITE32_MEMBER( powervr2_device::pvrs_ta_w ) |
| 2613 | 2569 | { |
| 2614 | 2570 | pvr_ta_w(space,offset,data,mem_mask); |
| 2615 | 2571 | pvr2_ta_w(space,offset,data,mem_mask); |
| r23535 | r23536 | |
| 2624 | 2580 | state->dc_update_interrupt_status(); |
| 2625 | 2581 | } |
| 2626 | 2582 | |
| 2627 | | READ64_MEMBER(powervr2_device::pvr_ctrl_r ) |
| 2583 | READ32_MEMBER(powervr2_device::pvr_ctrl_r) |
| 2628 | 2584 | { |
| 2629 | | int reg; |
| 2630 | | UINT64 shift; |
| 2631 | | |
| 2632 | | reg = decode_reg_64(offset, mem_mask, &shift); |
| 2633 | | |
| 2634 | 2585 | #if DEBUG_PVRCTRL |
| 2635 | | mame_printf_verbose("PVRCTRL: [%08x] read %x @ %x (reg %x), mask %" I64FMT "x (PC=%x)\n", 0x5f7c00+reg*4, pvrctrl_regs[reg], offset, reg, mem_mask, space.device().safe_pc()); |
| 2586 | mame_printf_verbose("PVRCTRL: [%08x] read %x @ %x, mask %x (PC=%x)\n", 0x5f7c00+reg*4, pvrctrl_regs[offset], offset, mem_mask, space.device().safe_pc()); |
| 2636 | 2587 | #endif |
| 2637 | 2588 | |
| 2638 | | return (UINT64)pvrctrl_regs[reg] << shift; |
| 2589 | return (UINT64)pvrctrl_regs[offset]; |
| 2639 | 2590 | } |
| 2640 | 2591 | |
| 2641 | | WRITE64_MEMBER(powervr2_device::pvr_ctrl_w ) |
| 2592 | WRITE32_MEMBER(powervr2_device::pvr_ctrl_w) |
| 2642 | 2593 | { |
| 2643 | | int reg; |
| 2644 | | UINT64 shift; |
| 2645 | | UINT32 dat; |
| 2646 | 2594 | UINT8 old; |
| 2647 | 2595 | |
| 2648 | | reg = decode_reg_64(offset, mem_mask, &shift); |
| 2649 | | dat = (UINT32)(data >> shift); |
| 2650 | | |
| 2651 | | switch (reg) |
| 2596 | switch (offset) |
| 2652 | 2597 | { |
| 2653 | | case SB_PDSTAP: m_pvr_dma.pvr_addr = dat; break; |
| 2654 | | case SB_PDSTAR: m_pvr_dma.sys_addr = dat; break; |
| 2655 | | case SB_PDLEN: m_pvr_dma.size = dat; break; |
| 2656 | | case SB_PDDIR: m_pvr_dma.dir = dat & 1; break; |
| 2598 | case SB_PDSTAP: m_pvr_dma.pvr_addr = data; break; |
| 2599 | case SB_PDSTAR: m_pvr_dma.sys_addr = data; break; |
| 2600 | case SB_PDLEN: m_pvr_dma.size = data; break; |
| 2601 | case SB_PDDIR: m_pvr_dma.dir = data & 1; break; |
| 2657 | 2602 | case SB_PDTSEL: |
| 2658 | | m_pvr_dma.sel = dat & 1; |
| 2603 | m_pvr_dma.sel = data & 1; |
| 2659 | 2604 | //if(m_pvr_dma.sel & 1) |
| 2660 | 2605 | // printf("Warning: Unsupported irq mode trigger PVR-DMA\n"); |
| 2661 | 2606 | break; |
| 2662 | | case SB_PDEN: m_pvr_dma.flag = dat & 1; break; |
| 2607 | case SB_PDEN: m_pvr_dma.flag = data & 1; break; |
| 2663 | 2608 | case SB_PDST: |
| 2664 | 2609 | old = m_pvr_dma.start & 1; |
| 2665 | | m_pvr_dma.start = dat & 1; |
| 2610 | m_pvr_dma.start = data & 1; |
| 2666 | 2611 | |
| 2667 | 2612 | if(((old & 1) == 0) && m_pvr_dma.flag && m_pvr_dma.start && ((m_pvr_dma.sel & 1) == 0)) // 0 -> 1 |
| 2668 | 2613 | pvr_dma_execute(space); |
| r23535 | r23536 | |
| 2670 | 2615 | } |
| 2671 | 2616 | |
| 2672 | 2617 | #if DEBUG_PVRCTRL |
| 2673 | | mame_printf_verbose("PVRCTRL: [%08x=%x] write %" I64FMT "x to %x (reg %x), mask %" I64FMT "x\n", 0x5f7c00+reg*4, dat, data>>shift, offset, reg, mem_mask); |
| 2618 | mame_printf_verbose("PVRCTRL: [%08x=%x] write %x to %x (reg %x), mask %x\n", 0x5f7c00+reg*4, data, offset, mem_mask); |
| 2674 | 2619 | #endif |
| 2675 | 2620 | |
| 2676 | | // pvrctrl_regs[reg] |= dat; |
| 2677 | | pvrctrl_regs[reg] = dat; |
| 2621 | pvrctrl_regs[offset] = data; |
| 2678 | 2622 | } |
| 2679 | 2623 | |
| 2680 | 2624 | void powervr2_device::pvr_dma_execute(address_space &space) |