|
KallistiOS git master
Independent SDK for the Sega Dreamcast
|
G1 bus ATA interface. More...
Go to the source code of this file.
Macros | |
| #define | G1_ATA_MASTER 0x00 |
| ATA master device. | |
| #define | G1_ATA_MASTER_ALT 0x90 |
| ATA master device (compatible with old drives). | |
| #define | G1_ATA_SLAVE 0xB0 |
| ATA slave device. | |
| #define | G1_ATA_LBA_MODE 0x40 |
| Select LBA addressing mode. | |
| #define | G1_ATA_BUS_PROTECTION 0x005F74E4 |
| G1 ATA bus protection register. | |
| #define | G1_ATA_BUS_PROTECTION_STATUS 0x005F74EC |
| G1 ATA bus protection status register. | |
| #define | G1_ATA_BUS_PROTECTION_STATUS_IN_PROGRESS 0x00 |
| G1 ATA bus protection in progress state. | |
| #define | G1_ATA_BUS_PROTECTION_STATUS_FAILED 0x02 |
| G1 ATA bus protection failed state. | |
| #define | G1_ATA_BUS_PROTECTION_STATUS_PASSED 0x03 |
| G1 ATA bus protection passed state. | |
| #define | G1_ATA_DMA_PROTECTION 0x005F74B8 |
| G1 ATA DMA protection register. | |
| #define | G1_ATA_DMA_UNLOCK_CODE 0x8843 |
| G1 ATA DMA protection register code. | |
| #define | G1_ATA_DMA_UNLOCK_SYSMEM (G1_ATA_DMA_UNLOCK_CODE << 16 | 0x407F) |
| System memory DMA protection unlock value. | |
| #define | G1_ATA_DMA_UNLOCK_ALLMEM (G1_ATA_DMA_UNLOCK_CODE << 16 | 0x007F) |
| All memory DMA protection unlock value. | |
Functions | |
| int | g1_dma_in_progress (void) |
| Is there a G1 DMA in progress currently? | |
| int | g1_ata_mutex_lock (void) |
| Lock the G1 ATA mutex. | |
| int | g1_ata_mutex_unlock (void) |
| Unlock the G1 ATA mutex. | |
| uint8_t | g1_ata_select_device (uint8_t dev) |
| Set the active ATA device. | |
| int | g1_ata_read_chs (uint16_t c, uint8_t h, uint8_t s, size_t count, void *buf) |
| Read one or more disk sectors with Cylinder-Head-Sector addressing. | |
| int | g1_ata_write_chs (uint16_t c, uint8_t h, uint8_t s, size_t count, const void *buf) |
| Write one or more disk sectors with Cylinder-Head-Sector addressing. | |
| int | g1_ata_read_lba (uint64_t sector, size_t count, void *buf) |
| Read one or more disk sectors with Linear Block Addressing (LBA). | |
| int | g1_ata_read_lba_dma (uint64_t sector, size_t count, void *buf, int block) |
| DMA read disk sectors with Linear Block Addressing (LBA). | |
| int | g1_ata_write_lba (uint64_t sector, size_t count, const void *buf) |
| Write one or more disk sectors with Linear Block Addressing (LBA). | |
| int | g1_ata_write_lba_dma (uint64_t sector, size_t count, const void *buf, int block) |
| DMA Write disk sectors with Linear Block Addressing (LBA). | |
| int | g1_ata_flush (void) |
| Flush the write cache on the attached disk. | |
| int | g1_ata_lba_mode (void) |
| Get LBA mode of the attached disk. | |
| int | g1_ata_blockdev_for_partition (int partition, int dma, kos_blockdev_t *rv, uint8_t *partition_type) |
| Get a block device for a given partition on the slave ATA device. | |
| int | g1_ata_blockdev_for_device (int dma, kos_blockdev_t *rv) |
| Get a block device for the attached ATA device. | |
| int | g1_ata_init (void) |
| Initialize G1 ATA support. | |
| void | g1_ata_shutdown (void) |
| Shut down G1 ATA support. | |
G1 bus ATA interface.
This file provides support for accessing an ATA device on the G1 bus in the Dreamcast. The G1 bus usually contains a few useful pieces of the system, including the flashrom and the GD-ROM drive. The interesting piece here is that the GD-ROM drive itself is actually an ATA device.
Luckily, Sega left everything in place to access both a master and slave device on this ATA port. The GD-ROM drive should always be the master device on the chain, but you can hook up a hard drive or some other device as a slave. The functions herein are for accessing just such a slave device.