src/mess/drivers/ip22.c
| r6434 | r6435 | |
| 373 | 373 | switch( offset ) |
| 374 | 374 | { |
| 375 | 375 | case 0x0004/4: |
| 376 | verboselog(machine, 0, "HPC3 SCSI0DESC Read: %08x (%08x): %08x\n", 0x1fb90000 + ( offset << 2), mem_mask, nHPC_SCSI0Descriptor ); |
| 376 | 377 | return nHPC_SCSI0Descriptor; |
| 377 | 378 | case 0x1004/4: |
| 379 | verboselog(machine, 0, "HPC3 SCSI0DMACTRL Read: %08x (%08x): %08x\n", 0x1fb90000 + ( offset << 2), mem_mask, nHPC_SCSI0DMACtrl ); |
| 378 | 380 | return nHPC_SCSI0DMACtrl; |
| 379 | 381 | case 0x4000/4: |
| 380 | 382 | verboselog(machine, 2, "HPC3 ENETR CBP Read: %08x (%08x): %08x\n", 0x1fb90000 + ( offset << 2), mem_mask, nHPC3_enetr_nbdp ); |
| r6434 | r6435 | |
| 396 | 398 | switch( offset ) |
| 397 | 399 | { |
| 398 | 400 | case 0x0004/4: |
| 401 | verboselog(machine, 2, "HPC3 SCSI0DESC Write: %08x\n", data ); |
| 399 | 402 | nHPC_SCSI0Descriptor = data; |
| 400 | 403 | break; |
| 401 | 404 | case 0x1004/4: |
| 405 | verboselog(machine, 2, "HPC3 SCSI0DMACTRL Write: %08x\n", data ); |
| 402 | 406 | nHPC_SCSI0DMACtrl = data; |
| 403 | 407 | break; |
| 404 | 408 | case 0x4000/4: |
| r6434 | r6435 | |
| 1133 | 1137 | verboselog(machine, 0, "Unknown PBUS DMA Channel %d Write: 0x%08x: 0x%08x (%08x)\n", channel, 0x1fb80000 + offset*4, data, mem_mask ); |
| 1134 | 1138 | } |
| 1135 | 1139 | |
| 1140 | static UINT32 *unkpbus0; |
| 1141 | static READ32_HANDLER( hpc3_unkpbus0_r ) |
| 1142 | { |
| 1143 | return 0; |
| 1144 | //verboselog(space->machine, 0, "Unknown PBUS Read: 0x%08x (%08x)\n", 0x1fbc8000 + offset*4, mem_mask ); |
| 1145 | //return unkpbus0[offset]; |
| 1146 | } |
| 1147 | |
| 1148 | static WRITE32_HANDLER( hpc3_unkpbus0_w ) |
| 1149 | { |
| 1150 | //verboselog(space->machine, 0, "Unknown PBUS Write: 0x%08x = 0x%08x (%08x)\n", 0x1fbc8000 + offset*4, data, mem_mask ); |
| 1151 | //COMBINE_DATA(&unkpbus0[offset]); |
| 1152 | } |
| 1153 | |
| 1136 | 1154 | static ADDRESS_MAP_START( ip225015_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 1137 | 1155 | AM_RANGE( 0x00000000, 0x0007ffff ) AM_READWRITE( SMH_BANK(1), SMH_BANK(1) ) /* mirror of first 512k of main RAM */ |
| 1138 | 1156 | AM_RANGE( 0x08000000, 0x0fffffff ) AM_SHARE(1) AM_BASE( &ip22_mainram ) AM_RAM_WRITE(ip22_write_ram) /* 128 MB of main RAM */ |
| r6434 | r6435 | |
| 1141 | 1159 | AM_RANGE( 0x1fb90000, 0x1fb9ffff ) AM_READWRITE( hpc3_hd_enet_r, hpc3_hd_enet_w ) |
| 1142 | 1160 | AM_RANGE( 0x1fbb0000, 0x1fbb0003 ) AM_RAM /* unknown, but read a lot and discarded */ |
| 1143 | 1161 | AM_RANGE( 0x1fbc0000, 0x1fbc7fff ) AM_READWRITE( hpc3_hd0_r, hpc3_hd0_w ) |
| 1162 | AM_RANGE( 0x1fbc8000, 0x1fbcffff ) AM_READWRITE( hpc3_unkpbus0_r, hpc3_unkpbus0_w ) AM_BASE(&unkpbus0) |
| 1144 | 1163 | AM_RANGE( 0x1fb80000, 0x1fb8ffff ) AM_READWRITE( hpc3_pbusdma_r, hpc3_pbusdma_w ) |
| 1145 | 1164 | AM_RANGE( 0x1fbd8000, 0x1fbd83ff ) AM_READWRITE( hal2_r, hal2_w ) |
| 1165 | AM_RANGE( 0x1fbd8400, 0x1fbd87ff ) AM_RAM /* hack */ |
| 1146 | 1166 | AM_RANGE( 0x1fbd9000, 0x1fbd93ff ) AM_READWRITE( hpc3_pbus4_r, hpc3_pbus4_w ) |
| 1147 | 1167 | AM_RANGE( 0x1fbd9800, 0x1fbd9bff ) AM_READWRITE( hpc3_pbus6_r, hpc3_pbus6_w ) |
| 1168 | AM_RANGE( 0x1fbdc000, 0x1fbdc7ff ) AM_RAM |
| 1169 | AM_RANGE( 0x1fbdd000, 0x1fbdd3ff ) AM_RAM |
| 1148 | 1170 | AM_RANGE( 0x1fbe0000, 0x1fbe04ff ) AM_READWRITE( rtc_r, rtc_w ) |
| 1149 | 1171 | AM_RANGE( 0x1fc00000, 0x1fc7ffff ) AM_ROM AM_REGION( "user1", 0 ) |
| 1150 | 1172 | AM_RANGE( 0x20000000, 0x27ffffff ) AM_SHARE(1) AM_RAM_WRITE(ip22_write_ram) |
| r6434 | r6435 | |
| 1174 | 1196 | memory_set_bankptr(machine, 1, ip22_mainram); |
| 1175 | 1197 | |
| 1176 | 1198 | nPBUS_DMA_Active = 0; |
| 1199 | |
| 1200 | mips3drc_set_options(cputag_get_cpu(machine, "maincpu"), MIPS3DRC_COMPATIBLE_OPTIONS); |
| 1177 | 1201 | } |
| 1178 | 1202 | |
| 1179 | 1203 | static void dump_chain(const address_space *space, UINT32 ch_base) |
| 1180 | 1204 | { |
| 1181 | 1205 | |
| 1182 | | // mame_printf_info("node: %08x %08x %08x (len = %x)\n", memory_read_dword(space, ch_base), memory_read_dword(space, ch_base+4), memory_read_dword(space, ch_base+8), memory_read_dword(space, ch_base+4) & 0x3fff); |
| 1206 | printf("node: %08x %08x %08x (len = %x)\n", memory_read_dword(space, ch_base), memory_read_dword(space, ch_base+4), memory_read_dword(space, ch_base+8), memory_read_dword(space, ch_base+4) & 0x3fff); |
| 1183 | 1207 | |
| 1184 | 1208 | if ((memory_read_dword(space, ch_base+8) != 0) && !(memory_read_dword(space, ch_base+4) & 0x80000000)) |
| 1185 | 1209 | { |
| r6434 | r6435 | |
| 1203 | 1227 | { |
| 1204 | 1228 | if (wd33c93_get_dma_count()) |
| 1205 | 1229 | { |
| 1230 | printf("wd33c93_get_dma_count() is %d\n", wd33c93_get_dma_count() ); |
| 1206 | 1231 | if (nHPC_SCSI0DMACtrl & HPC3_DMACTRL_ENABLE) |
| 1207 | 1232 | { |
| 1208 | 1233 | if (nHPC_SCSI0DMACtrl & HPC3_DMACTRL_IRQ) logerror("IP22: Unhandled SCSI DMA IRQ\n"); |
| r6434 | r6435 | |
| 1211 | 1236 | // HPC3 DMA: host to device |
| 1212 | 1237 | if ((nHPC_SCSI0DMACtrl & HPC3_DMACTRL_ENABLE) && (nHPC_SCSI0DMACtrl & HPC3_DMACTRL_DIR)) |
| 1213 | 1238 | { |
| 1214 | | UINT32 rptr, dptr, tmpword; |
| 1215 | | int length; |
| 1239 | UINT32 wptr, tmpword; |
| 1240 | int words, dptr, twords; |
| 1216 | 1241 | |
| 1217 | | rptr = memory_read_dword(space, nHPC_SCSI0Descriptor); |
| 1218 | | length = memory_read_dword(space, nHPC_SCSI0Descriptor + 4) & 0x3fff; |
| 1242 | words = wd33c93_get_dma_count(); |
| 1243 | words /= 4; |
| 1219 | 1244 | |
| 1220 | | /* mame_printf_info("DMA to device: length %x\n", length); |
| 1221 | | mame_printf_info("first words: %08x %08x %08x %08x\n", |
| 1222 | | memory_read_dword(space, rptr), |
| 1223 | | memory_read_dword(space, rptr+4), |
| 1224 | | memory_read_dword(space, rptr+8), |
| 1225 | | memory_read_dword(space, rptr+12));*/ |
| 1245 | wptr = memory_read_dword(space, nHPC_SCSI0Descriptor); |
| 1246 | nHPC_SCSI0Descriptor += words*4; |
| 1247 | dptr = 0; |
| 1226 | 1248 | |
| 1227 | | if (length <= 4096) |
| 1249 | printf("DMA to device: %d words @ %x\n", words, wptr); |
| 1250 | |
| 1251 | dump_chain(space, nHPC_SCSI0Descriptor); |
| 1252 | |
| 1253 | if (words <= (512/4)) |
| 1228 | 1254 | { |
| 1255 | // one-shot |
| 1256 | //wd33c93_get_dma_data(wd33c93_get_dma_count(), dma_buffer); |
| 1257 | |
| 1258 | while (words) |
| 1259 | { |
| 1260 | tmpword = memory_read_dword(space, wptr); |
| 1261 | |
| 1262 | if (nHPC_SCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) |
| 1263 | { |
| 1264 | dma_buffer[dptr+3] = (tmpword>>24)&0xff; |
| 1265 | dma_buffer[dptr+2] = (tmpword>>16)&0xff; |
| 1266 | dma_buffer[dptr+1] = (tmpword>>8)&0xff; |
| 1267 | dma_buffer[dptr] = tmpword&0xff; |
| 1268 | } |
| 1269 | else |
| 1270 | { |
| 1271 | dma_buffer[dptr] = (tmpword>>24)&0xff; |
| 1272 | dma_buffer[dptr+1] = (tmpword>>16)&0xff; |
| 1273 | dma_buffer[dptr+2] = (tmpword>>8)&0xff; |
| 1274 | dma_buffer[dptr+3] = tmpword&0xff; |
| 1275 | } |
| 1276 | |
| 1277 | wptr += 4; |
| 1278 | dptr += 4; |
| 1279 | words--; |
| 1280 | } |
| 1281 | |
| 1282 | words = wd33c93_get_dma_count(); |
| 1283 | wd33c93_write_data(words, dma_buffer); |
| 1284 | } |
| 1285 | else |
| 1286 | { |
| 1287 | while (words) |
| 1288 | { |
| 1289 | //wd33c93_get_dma_data(512, dma_buffer); |
| 1290 | twords = 512/4; |
| 1291 | nHPC_SCSI0Descriptor += 512; |
| 1292 | dptr = 0; |
| 1293 | |
| 1294 | while (twords) |
| 1295 | { |
| 1296 | tmpword = memory_read_dword(space, wptr); |
| 1297 | |
| 1298 | if (nHPC_SCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) |
| 1299 | { |
| 1300 | dma_buffer[dptr+3] = (tmpword>>24)&0xff; |
| 1301 | dma_buffer[dptr+2] = (tmpword>>16)&0xff; |
| 1302 | dma_buffer[dptr+1] = (tmpword>>8)&0xff; |
| 1303 | dma_buffer[dptr] = tmpword&0xff; |
| 1304 | } |
| 1305 | else |
| 1306 | { |
| 1307 | dma_buffer[dptr] = (tmpword>>24)&0xff; |
| 1308 | dma_buffer[dptr+1] = (tmpword>>16)&0xff; |
| 1309 | dma_buffer[dptr+2] = (tmpword>>8)&0xff; |
| 1310 | dma_buffer[dptr+3] = tmpword&0xff; |
| 1311 | } |
| 1312 | |
| 1313 | wptr += 4; |
| 1314 | dptr += 4; |
| 1315 | twords--; |
| 1316 | } |
| 1317 | |
| 1318 | wd33c93_write_data(512, dma_buffer); |
| 1319 | |
| 1320 | words -= (512/4); |
| 1321 | } |
| 1322 | } |
| 1323 | |
| 1324 | // clear DMA on the controller too |
| 1325 | wd33c93_clear_dma(); |
| 1326 | /* |
| 1327 | UINT32 dptr, tmpword; |
| 1328 | UINT32 bc = memory_read_dword(space, nHPC_SCSI0Descriptor + 4); |
| 1329 | UINT32 rptr = memory_read_dword(space, nHPC_SCSI0Descriptor); |
| 1330 | int length = bc & 0x3fff; |
| 1331 | int xie = (bc & 0x20000000) ? 1 : 0; |
| 1332 | int eox = (bc & 0x80000000) ? 1 : 0; |
| 1333 | |
| 1334 | dump_chain(space, nHPC_SCSI0Descriptor); |
| 1335 | |
| 1336 | printf("PC is %08x\n", cpu_get_pc(cputag_get_cpu(machine, "maincpu"))); |
| 1337 | printf("DMA to device: length %x xie %d eox %d\n", length, xie, eox); |
| 1338 | |
| 1339 | if (length <= 0x4000) |
| 1340 | { |
| 1229 | 1341 | dptr = 0; |
| 1230 | 1342 | while (length > 0) |
| 1231 | 1343 | { |
| r6434 | r6435 | |
| 1260 | 1372 | { |
| 1261 | 1373 | logerror("IP22: overly large host to device transfer, can't handle!\n"); |
| 1262 | 1374 | } |
| 1375 | */ |
| 1263 | 1376 | } |
| 1264 | 1377 | |
| 1265 | 1378 | // HPC3 DMA: device to host |
| r6434 | r6435 | |
| 1348 | 1461 | |
| 1349 | 1462 | static const SCSIConfigTable dev_table = |
| 1350 | 1463 | { |
| 1351 | | 1, /* 1 SCSI device */ |
| 1352 | | { { SCSI_ID_4, "cdrom", SCSI_DEVICE_CDROM } } /* SCSI ID 4, using CD 0, and it's a CD-ROM */ |
| 1353 | | // { SCSI_ID_2, "cdrom", SCSI_DEVICE_CDROM } } /* SCSI ID 2, using HD 0, and it's a CD-ROM */ |
| 1464 | 2, /* 1 SCSI device */ |
| 1465 | { { SCSI_ID_1, "harddisk1", SCSI_DEVICE_HARDDISK }, |
| 1466 | { SCSI_ID_4, "cdrom", SCSI_DEVICE_CDROM } } /* SCSI ID 4, using CD 0, and it's a CD-ROM */ |
| 1354 | 1467 | }; |
| 1355 | 1468 | |
| 1356 | 1469 | static const struct WD33C93interface scsi_intf = |
| r6434 | r6435 | |
| 1535 | 1648 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) |
| 1536 | 1649 | |
| 1537 | 1650 | MDRV_CDROM_ADD( "cdrom" ) |
| 1651 | MDRV_HARDDISK_ADD( "harddisk1" ) |
| 1538 | 1652 | MACHINE_DRIVER_END |
| 1539 | 1653 | |
| 1540 | 1654 | static MACHINE_DRIVER_START( ip224613 ) |