|
KallistiOS git master
Independent SDK for the Sega Dreamcast
|
Driver for the Dreamcast's GD-ROM drive More...
Topics | |
| CDDA Read Modes | |
| Read modes for CDDA | |
| Command Responses | |
| Responses from GD-ROM syscalls | |
| GDROM System Calls | |
| GDROM Syscalls and Data Types | |
| TOC Access Macros | |
| Macros used to access the TOC | |
Files | |
| file | cdrom.h |
| CD access to the GD-ROM drive. | |
| file | fs_iso9660.h |
| ISO9660 (CD-ROM) filesystem driver. | |
Functions | |
| int | cdrom_set_sector_size (int size) |
| Set the sector size for read sectors. | |
| int | cdrom_exec_cmd (cd_cmd_code_t cmd, void *param) |
| Execute a CD-ROM command. | |
| int | cdrom_exec_cmd_timed (cd_cmd_code_t cmd, void *param, uint32_t timeout) |
| Execute a CD-ROM command with timeout. | |
| int | cdrom_abort_cmd (uint32_t timeout, bool abort_dma) |
| Abort a CD-ROM command with timeout. | |
| int | cdrom_get_status (int *status, int *disc_type) |
| Get the status of the GD-ROM drive. | |
| int | cdrom_change_datatype (cd_read_sec_part_t sector_part, int track_type, int sector_size) |
| Change the datatype of disc. | |
| int | cdrom_reinit (void) |
| Re-initialize the GD-ROM drive. | |
| int | cdrom_reinit_ex (cd_read_sec_part_t sector_part, int cdxa, int sector_size) |
| Re-initialize the GD-ROM drive with custom parameters. | |
| int | cdrom_read_toc (cd_toc_t *toc_buffer, bool high_density) |
| Read the table of contents from the disc. | |
| int | cdrom_read_sectors_ex (void *buffer, uint32_t sector, size_t cnt, bool dma) |
| Read one or more sector from a CD-ROM. | |
| int | cdrom_read_sectors (void *buffer, uint32_t sector, size_t cnt) |
| Read one or more sector from a CD-ROM in PIO mode. | |
| int | cdrom_stream_start (int sector, int cnt, bool dma) |
| Start streaming from a CD-ROM. | |
| int | cdrom_stream_stop (bool abort_dma) |
| Stop streaming from a CD-ROM. | |
| int | cdrom_stream_request (void *buffer, size_t size, bool block) |
| Request stream transfer. | |
| int | cdrom_stream_progress (size_t *size) |
| Check requested stream transfer. | |
| void | cdrom_stream_set_callback (cdrom_stream_callback_t callback, void *param) |
| Setting up a callback for transfers. | |
| int | cdrom_get_subcode (void *buffer, size_t buflen, cd_sub_type_t which) |
| Read subcode data from the most recently read sectors. | |
| uint32_t | cdrom_locate_data_track (cd_toc_t *toc) |
| Locate the sector of the data track. | |
| int | cdrom_cdda_play (uint32_t start, uint32_t end, uint32_t loops, int mode) |
| Play CDDA audio tracks or sectors. | |
| int | cdrom_cdda_pause (void) |
| Pause CDDA audio playback. | |
| int | cdrom_cdda_resume (void) |
| Resume CDDA audio playback after a pause. | |
| int | cdrom_spin_down (void) |
| Spin down the CD. | |
| void | cdrom_init (void) |
| Initialize the GD-ROM for reading CDs. | |
| void | cdrom_shutdown (void) |
| Shutdown the CD reading system. | |
| int | iso_reset (void) |
| Reset the internal ISO9660 cache. | |
Driver for the Dreamcast's GD-ROM drive
| int cdrom_abort_cmd | ( | uint32_t | timeout, |
| bool | abort_dma ) |
Abort a CD-ROM command with timeout.
This function aborts current command using the BIOS syscall for aborting GD-ROM commands. They can also abort DMA transfers.
| timeout | Timeout in milliseconds. |
| abort_dma | Whether to abort the DMA transfer. |
| int cdrom_cdda_pause | ( | void | ) |
| int cdrom_cdda_play | ( | uint32_t | start, |
| uint32_t | end, | ||
| uint32_t | loops, | ||
| int | mode ) |
Play CDDA audio tracks or sectors.
This function starts playback of CDDA audio.
| start | The track or sector to start playback from. |
| end | The track or sector to end playback at. |
| loops | The number of times to repeat (max of 15). |
| mode | The mode to play (see CDDA Read Modes). |
Referenced by main().
| int cdrom_cdda_resume | ( | void | ) |
Resume CDDA audio playback after a pause.
| int cdrom_change_datatype | ( | cd_read_sec_part_t | sector_part, |
| int | track_type, | ||
| int | sector_size ) |
Change the datatype of disc.
This function will take in all parameters to pass to the change_datatype syscall. This allows these parameters to be modified without a reinit. Each parameter allows -1 as a default, which is tied to the former static values provided by cdrom_reinit and cdrom_set_sector_size.
| sector_part | How much of each sector to return. |
| track_type | What CDXA mode to read as (if applicable). |
| sector_size | What sector size to read (eg. - 2048, 2532). |
| int cdrom_exec_cmd | ( | cd_cmd_code_t | cmd, |
| void * | param ) |
Execute a CD-ROM command.
This function executes the specified command using the BIOS syscall for executing GD-ROM commands.
| cmd | The command to execute. |
| param | Data to pass to the syscall. |
| int cdrom_exec_cmd_timed | ( | cd_cmd_code_t | cmd, |
| void * | param, | ||
| uint32_t | timeout ) |
Execute a CD-ROM command with timeout.
This function executes the specified command using the BIOS syscall for executing GD-ROM commands with timeout.
| cmd | The command to execute. |
| param | Data to pass to the syscall. |
| timeout | Timeout in milliseconds. |
| int cdrom_get_status | ( | int * | status, |
| int * | disc_type ) |
Get the status of the GD-ROM drive.
| status | Space to return the drive's status. |
| disc_type | Space to return the type of disc in the drive. |
Referenced by cd::cd(), and cd::checkStatus().
| int cdrom_get_subcode | ( | void * | buffer, |
| size_t | buflen, | ||
| cd_sub_type_t | which ) |
Read subcode data from the most recently read sectors.
After reading sectors, this can pull subcode data regarding the sectors read. If reading all subcode data with CD_SUB_CURRENT_POSITION, this needs to be performed one sector at a time.
| buffer | Space to store the read subcode data. |
| buflen | Amount of data to be read. |
| which | Which subcode type do you wish to get. |
| void cdrom_init | ( | void | ) |
Initialize the GD-ROM for reading CDs.
This initializes the CD-ROM reading system, reactivating the drive and handling initial setup of the disc.
| uint32_t cdrom_locate_data_track | ( | cd_toc_t * | toc | ) |
Locate the sector of the data track.
This function will search the toc for the last entry that has a CTRL value of 4, and return its FAD address.
| toc | The TOC to search through. |
Referenced by main().
| int cdrom_read_sectors | ( | void * | buffer, |
| uint32_t | sector, | ||
| size_t | cnt ) |
Read one or more sector from a CD-ROM in PIO mode.
Default version of cdrom_read_sectors_ex, which forces PIO mode.
| buffer | Space to store the read sectors. |
| sector | The sector to start reading from. |
| cnt | The number of sectors to read. |
| int cdrom_read_sectors_ex | ( | void * | buffer, |
| uint32_t | sector, | ||
| size_t | cnt, | ||
| bool | dma ) |
Read one or more sector from a CD-ROM.
This function reads the specified number of sectors from the disc, starting where requested. This will respect the size of the sectors set with cdrom_change_datatype(). The buffer must have enough space to store the specified number of sectors and size must be a multiple of 32 for DMA.
| buffer | Space to store the read sectors. |
| sector | The sector to start reading from. |
| cnt | The number of sectors to read. |
| dma | True for read using dma, false for pio. |
Referenced by main().
| int cdrom_read_toc | ( | cd_toc_t * | toc_buffer, |
| bool | high_density ) |
Read the table of contents from the disc.
This function reads the TOC from the specified area of the disc. On regular CD-ROMs, there are only low density area.
| toc_buffer | Space to store the returned TOC in. |
| high_density | Whether to read from the high density area. |
Referenced by main().
| int cdrom_reinit | ( | void | ) |
Re-initialize the GD-ROM drive.
This function is for reinitializing the GD-ROM drive after a disc change to its default settings. Calls cdrom_reinit(-1,-1,-1)
| int cdrom_reinit_ex | ( | cd_read_sec_part_t | sector_part, |
| int | cdxa, | ||
| int | sector_size ) |
Re-initialize the GD-ROM drive with custom parameters.
At the end of each cdrom_reinit(), cdrom_change_datatype is called. This passes in the requested values to that function after reinitialization, as opposed to defaults.
| sector_part | How much of each sector to return. |
| cdxa | What CDXA mode to read as (if applicable). |
| sector_size | What sector size to read (eg. - 2048, 2532). |
| int cdrom_set_sector_size | ( | int | size | ) |
Set the sector size for read sectors.
This function sets the sector size that the cdrom_read_sectors() function will return. Be sure to set this to the correct value for the type of sectors you're trying to read. Common values are 2048 (for reading CD-ROM sectors) or 2352 (for reading raw sectors).
| size | The size of the sector data. |
| void cdrom_shutdown | ( | void | ) |
Shutdown the CD reading system.
| int cdrom_spin_down | ( | void | ) |
Spin down the CD.
This stops the disc in the drive from spinning until it is accessed again.
Referenced by main().
| int cdrom_stream_progress | ( | size_t * | size | ) |
Check requested stream transfer.
This function check requested stream transfer.
| size | The transfered (if in progress) or remain size in bytes. |
Referenced by cd_stream_test().
| int cdrom_stream_request | ( | void * | buffer, |
| size_t | size, | ||
| bool | block ) |
Request stream transfer.
This function request data from stream.
| buffer | Space to store the read sectors (DMA aligned to 32, PIO to 2). |
| size | The size in bytes to read (DMA min 32, PIO min 2). |
| block | True to block until DMA transfer completes. |
Referenced by cd_stream_test().
| void cdrom_stream_set_callback | ( | cdrom_stream_callback_t | callback, |
| void * | param ) |
Setting up a callback for transfers.
This callback is called for every transfer request that is completed.
| callback | Callback function. |
| param | Callback function param. |
Referenced by cd_stream_test().
| int cdrom_stream_start | ( | int | sector, |
| int | cnt, | ||
| bool | dma ) |
Start streaming from a CD-ROM.
This function pre-reads the specified number of sectors from the disc.
| sector | The sector to start reading from. |
| cnt | The number of sectors to read, 0x1ff means until end of disc. |
| dma | True for read using dma, false for pio. |
Referenced by cd_stream_test().
| int cdrom_stream_stop | ( | bool | abort_dma | ) |
Stop streaming from a CD-ROM.
This function finishing stream commands.
| abort_dma | Abort current G1 DMA transfer. |
Referenced by cd_stream_test().
| int iso_reset | ( | void | ) |
Reset the internal ISO9660 cache.
This function resets the cache of the ISO9660 driver, breaking connections to all files. This generally assumes that a new disc has been or will be inserted.
| 0 | On success. |