trunk/src/emu/machine/idectrl.c
| r23656 | r23657 | |
| 93 | 93 | |
| 94 | 94 | void ide_controller_device::set_irq(int state) |
| 95 | 95 | { |
| 96 | ide_device_interface *dev = slot[cur_drive]->dev(); |
| 97 | |
| 96 | 98 | if (state == ASSERT_LINE) |
| 97 | 99 | LOG(("IDE interrupt assert\n")); |
| 98 | 100 | else |
| r23656 | r23657 | |
| 100 | 102 | |
| 101 | 103 | /* signal an interrupt */ |
| 102 | 104 | m_irq_handler(state); |
| 103 | | interrupt_pending = state; |
| 105 | dev->interrupt_pending = state; |
| 104 | 106 | } |
| 105 | 107 | |
| 106 | 108 | void ide_controller_device::set_dmarq(int state) |
| r23656 | r23657 | |
| 333 | 335 | |
| 334 | 336 | /* signal an interrupt */ |
| 335 | 337 | if (!dev->verify_only) |
| 336 | | sectors_until_int--; |
| 337 | | if (sectors_until_int == 0 || dev->sector_count == 1) |
| 338 | dev->sectors_until_int--; |
| 339 | if (dev->sectors_until_int == 0 || dev->sector_count == 1) |
| 338 | 340 | { |
| 339 | | sectors_until_int = ((command == IDE_COMMAND_READ_MULTIPLE) ? dev->block_count : 1); |
| 341 | dev->sectors_until_int = ((command == IDE_COMMAND_READ_MULTIPLE) ? dev->block_count : 1); |
| 340 | 342 | set_irq(ASSERT_LINE); |
| 341 | 343 | } |
| 342 | 344 | |
| r23656 | r23657 | |
| 389 | 391 | |
| 390 | 392 | void ide_controller_device::read_next_sector() |
| 391 | 393 | { |
| 394 | ide_device_interface *dev = slot[cur_drive]->dev(); |
| 395 | |
| 392 | 396 | /* mark ourselves busy */ |
| 393 | 397 | status |= IDE_STATUS_BUSY; |
| 394 | 398 | |
| 395 | 399 | if (command == IDE_COMMAND_READ_MULTIPLE) |
| 396 | 400 | { |
| 397 | | if (sectors_until_int != 1) |
| 401 | if (dev->sectors_until_int != 1) |
| 398 | 402 | /* make ready now */ |
| 399 | 403 | read_sector_done(); |
| 400 | 404 | else |
| r23656 | r23657 | |
| 427 | 431 | |
| 428 | 432 | if (command == IDE_COMMAND_WRITE_MULTIPLE) |
| 429 | 433 | { |
| 430 | | if (sectors_until_int != 1) |
| 434 | if (dev->sectors_until_int != 1) |
| 431 | 435 | { |
| 432 | 436 | /* ready to write now */ |
| 433 | 437 | write_sector_done(); |
| r23656 | r23657 | |
| 541 | 545 | error = IDE_ERROR_NONE; |
| 542 | 546 | |
| 543 | 547 | /* signal an interrupt */ |
| 544 | | if (--sectors_until_int == 0 || dev->sector_count == 1) |
| 548 | if (--dev->sectors_until_int == 0 || dev->sector_count == 1) |
| 545 | 549 | { |
| 546 | | sectors_until_int = ((command == IDE_COMMAND_WRITE_MULTIPLE) ? dev->block_count : 1); |
| 550 | dev->sectors_until_int = ((command == IDE_COMMAND_WRITE_MULTIPLE) ? dev->block_count : 1); |
| 547 | 551 | set_irq(ASSERT_LINE); |
| 548 | 552 | } |
| 549 | 553 | |
| r23656 | r23657 | |
| 598 | 602 | |
| 599 | 603 | /* reset the buffer */ |
| 600 | 604 | dev->buffer_offset = 0; |
| 601 | | sectors_until_int = 1; |
| 605 | dev->sectors_until_int = 1; |
| 602 | 606 | dev->dma_active = 0; |
| 603 | 607 | dev->verify_only = 0; |
| 604 | 608 | |
| r23656 | r23657 | |
| 612 | 616 | |
| 613 | 617 | /* reset the buffer */ |
| 614 | 618 | dev->buffer_offset = 0; |
| 615 | | sectors_until_int = 1; |
| 619 | dev->sectors_until_int = 1; |
| 616 | 620 | dev->dma_active = 0; |
| 617 | 621 | dev->verify_only = 0; |
| 618 | 622 | |
| r23656 | r23657 | |
| 627 | 631 | |
| 628 | 632 | /* reset the buffer */ |
| 629 | 633 | dev->buffer_offset = 0; |
| 630 | | sectors_until_int = 1; |
| 634 | dev->sectors_until_int = 1; |
| 631 | 635 | dev->dma_active = 0; |
| 632 | 636 | dev->verify_only = 1; |
| 633 | 637 | |
| r23656 | r23657 | |
| 641 | 645 | |
| 642 | 646 | /* reset the buffer */ |
| 643 | 647 | dev->buffer_offset = 0; |
| 644 | | sectors_until_int = dev->sector_count; |
| 648 | dev->sectors_until_int = dev->sector_count; |
| 645 | 649 | dev->dma_active = 1; |
| 646 | 650 | dev->verify_only = 0; |
| 647 | 651 | |
| r23656 | r23657 | |
| 656 | 660 | |
| 657 | 661 | /* reset the buffer */ |
| 658 | 662 | dev->buffer_offset = 0; |
| 659 | | sectors_until_int = 1; |
| 663 | dev->sectors_until_int = 1; |
| 660 | 664 | dev->dma_active = 0; |
| 661 | 665 | |
| 662 | 666 | /* mark the buffer ready */ |
| r23656 | r23657 | |
| 669 | 673 | |
| 670 | 674 | /* reset the buffer */ |
| 671 | 675 | dev->buffer_offset = 0; |
| 672 | | sectors_until_int = 1; |
| 676 | dev->sectors_until_int = 1; |
| 673 | 677 | dev->dma_active = 0; |
| 674 | 678 | |
| 675 | 679 | /* mark the buffer ready */ |
| r23656 | r23657 | |
| 682 | 686 | |
| 683 | 687 | /* reset the buffer */ |
| 684 | 688 | dev->buffer_offset = 0; |
| 685 | | sectors_until_int = dev->sector_count; |
| 689 | dev->sectors_until_int = dev->sector_count; |
| 686 | 690 | dev->dma_active = 1; |
| 687 | 691 | |
| 688 | 692 | /* start the read going */ |
| r23656 | r23657 | |
| 694 | 698 | |
| 695 | 699 | /* reset the buffer */ |
| 696 | 700 | dev->buffer_offset = 0; |
| 697 | | sectors_until_int = 0; |
| 701 | dev->sectors_until_int = 0; |
| 698 | 702 | dev->dma_active = 0; |
| 699 | 703 | |
| 700 | 704 | /* mark the buffer ready */ |
| r23656 | r23657 | |
| 802 | 806 | |
| 803 | 807 | /* reset the buffer */ |
| 804 | 808 | dev->buffer_offset = 0; |
| 805 | | sectors_until_int = 0; |
| 809 | dev->sectors_until_int = 0; |
| 806 | 810 | dev->dma_active = 0; |
| 807 | 811 | |
| 808 | 812 | /* mark the buffer ready */ |
| r23656 | r23657 | |
| 1006 | 1010 | result |= IDE_STATUS_HIT_INDEX; |
| 1007 | 1011 | last_status_timer->adjust(attotime::never); |
| 1008 | 1012 | } |
| 1009 | | if (interrupt_pending == ASSERT_LINE) |
| 1013 | if (dev->interrupt_pending == ASSERT_LINE) |
| 1010 | 1014 | set_irq(CLEAR_LINE); |
| 1011 | 1015 | break; |
| 1012 | 1016 | |
| r23656 | r23657 | |
| 1273 | 1277 | status(0), |
| 1274 | 1278 | error(0), |
| 1275 | 1279 | command(0), |
| 1276 | | interrupt_pending(0), |
| 1277 | | sectors_until_int(0), |
| 1278 | 1280 | config_unknown(0), |
| 1279 | 1281 | config_register_num(0), |
| 1280 | 1282 | cur_drive(0), |
| r23656 | r23657 | |
| 1289 | 1291 | device_t(mconfig, IDE_CONTROLLER, "IDE Controller", tag, owner, clock), |
| 1290 | 1292 | error(0), |
| 1291 | 1293 | command(0), |
| 1292 | | interrupt_pending(0), |
| 1293 | | sectors_until_int(0), |
| 1294 | 1294 | config_unknown(0), |
| 1295 | 1295 | config_register_num(0), |
| 1296 | 1296 | cur_drive(0), |
| r23656 | r23657 | |
| 1318 | 1318 | save_item(NAME(status)); |
| 1319 | 1319 | save_item(NAME(error)); |
| 1320 | 1320 | save_item(NAME(command)); |
| 1321 | | save_item(NAME(interrupt_pending)); |
| 1322 | 1321 | |
| 1323 | | save_item(NAME(sectors_until_int)); |
| 1324 | 1322 | save_item(NAME(config_unknown)); |
| 1325 | 1323 | save_item(NAME(config_register)); |
| 1326 | 1324 | save_item(NAME(config_register_num)); |