KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches

Driver for the Dreamcast's GD-ROM drive. More...

Modules

 ATA Statuses
 ATA statuses for GD-ROM driver.
 
 CDDA Read Modes
 Read modes for CDDA.
 
 Command Responses
 Responses from GD-ROM syscalls.
 
 Command Status Responses
 GD-ROM status responses.
 
 Drive Disc Types
 Disc types within GD-ROM drive.
 
 Read Sector Mode
 Mode to use when reading sectors.
 
 Read Sector Part
 Whether to read data or whole sector.
 
 Read Subcode Type
 Types of data to read from sector subcode.
 
 Status Values
 Status values for GD-ROM drive.
 
 Subcode Audio Status
 GETSCD syscall response codes.
 
 Syscall Command Codes
 Command codes for GD-ROM syscalsl.
 
 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.
 

Data Structures

struct  CDROM_TOC
 TOC structure returned by the BIOS. More...
 

Functions

int cdrom_set_sector_size (int size)
 Set the sector size for read sectors.
 
int cdrom_exec_cmd (int cmd, void *param)
 Execute a CD-ROM command.
 
int cdrom_exec_cmd_timed (int cmd, void *param, int timeout)
 Execute 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_dataype (int sector_part, int cdxa, int sector_size) __depr("Use cdrom_change_datatype instead.")
 Change the datatype of disc.
 
int cdrom_change_datatype (int sector_part, int cdxa, int sector_size)
 Change the datatype of disc.
 
int cdrom_reinit (void)
 Re-initialize the GD-ROM drive.
 
int cdrom_reinit_ex (int sector_part, int cdxa, int sector_size)
 Re-initialize the GD-ROM drive with custom parameters.
 
int cdrom_read_toc (CDROM_TOC *toc_buffer, int session)
 Read the table of contents from the disc.
 
int cdrom_read_sectors_ex (void *buffer, int sector, int cnt, int mode)
 Read one or more sector from a CD-ROM.
 
int cdrom_read_sectors (void *buffer, int sector, int cnt)
 Read one or more sector from a CD-ROM in PIO mode.
 
int cdrom_get_subcode (void *buffer, int buflen, int which)
 Read subcode data from the most recently read sectors.
 
uint32 cdrom_locate_data_track (CDROM_TOC *toc)
 Locate the sector of the data track.
 
int cdrom_cdda_play (uint32 start, uint32 end, uint32 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.
 

Detailed Description

Driver for the Dreamcast's GD-ROM drive.

Function Documentation

◆ cdrom_cdda_pause()

int cdrom_cdda_pause ( void  )

Pause CDDA audio playback.

Returns
Command Responses

◆ cdrom_cdda_play()

int cdrom_cdda_play ( uint32  start,
uint32  end,
uint32  loops,
int  mode 
)

Play CDDA audio tracks or sectors.

This function starts playback of CDDA audio.

Parameters
startThe track or sector to start playback from.
endThe track or sector to end playback at.
loopsThe number of times to repeat (max of 15).
modeThe mode to play (see CDDA Read Modes).
Returns
Command Responses

◆ cdrom_cdda_resume()

int cdrom_cdda_resume ( void  )

Resume CDDA audio playback after a pause.

Returns
Command Responses

◆ cdrom_change_datatype()

int cdrom_change_datatype ( int  sector_part,
int  cdxa,
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.

Parameters
sector_partHow much of each sector to return.
cdxaWhat CDXA mode to read as (if applicable).
sector_sizeWhat sector size to read (eg. - 2048, 2532).
Returns
Command Responses
See also
Read Sector Part

◆ cdrom_change_dataype()

int cdrom_change_dataype ( int  sector_part,
int  cdxa,
int  sector_size 
)

Change the datatype of disc.

Note
This function is formally deprecated. It should not be used in any future code, and may be removed in the future. You should instead use cdrom_change_datatype.

◆ cdrom_exec_cmd()

int cdrom_exec_cmd ( int  cmd,
void *  param 
)

Execute a CD-ROM command.

This function executes the specified command using the BIOS syscall for executing GD-ROM commands.

Parameters
cmdThe command number to execute.
paramData to pass to the syscall.
Returns
Command Responses

◆ cdrom_exec_cmd_timed()

int cdrom_exec_cmd_timed ( int  cmd,
void *  param,
int  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.

Parameters
cmdThe command number to execute.
paramData to pass to the syscall.
timeoutTimeout in milliseconds.
Returns
Command Responses

◆ cdrom_get_status()

int cdrom_get_status ( int *  status,
int *  disc_type 
)

Get the status of the GD-ROM drive.

Parameters
statusSpace to return the drive's status.
disc_typeSpace to return the type of disc in the drive.
Returns
Command Responses
See also
Status Values
Drive Disc Types

◆ cdrom_get_subcode()

int cdrom_get_subcode ( void *  buffer,
int  buflen,
int  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.

Parameters
bufferSpace to store the read subcode data.
buflenAmount of data to be read.
whichWhich subcode type do you wish to get.
Returns
Command Responses
See also
Read Subcode Type

◆ cdrom_init()

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.

◆ cdrom_locate_data_track()

uint32 cdrom_locate_data_track ( CDROM_TOC 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.

Parameters
tocThe TOC to search through.
Returns
The FAD of the track, or 0 if none is found.

◆ cdrom_read_sectors()

int cdrom_read_sectors ( void *  buffer,
int  sector,
int  cnt 
)

Read one or more sector from a CD-ROM in PIO mode.

Default version of cdrom_read_sectors_ex, which forces PIO mode.

Parameters
bufferSpace to store the read sectors.
sectorThe sector to start reading from.
cntThe number of sectors to read.
Returns
Command Responses
See also
cdrom_read_sectors_ex

◆ cdrom_read_sectors_ex()

int cdrom_read_sectors_ex ( void *  buffer,
int  sector,
int  cnt,
int  mode 
)

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.

Parameters
bufferSpace to store the read sectors.
sectorThe sector to start reading from.
cntThe number of sectors to read.
modeDMA or PIO
Returns
Command Responses
See also
Read Sector Mode

◆ cdrom_read_toc()

int cdrom_read_toc ( CDROM_TOC toc_buffer,
int  session 
)

Read the table of contents from the disc.

This function reads the TOC from the specified session of the disc.

Parameters
toc_bufferSpace to store the returned TOC in.
sessionThe session of the disc to read.
Returns
Command Responses

◆ cdrom_reinit()

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)

Returns
Command Responses
See also
cdrom_reinit_ex

◆ cdrom_reinit_ex()

int cdrom_reinit_ex ( int  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.

Parameters
sector_partHow much of each sector to return.
cdxaWhat CDXA mode to read as (if applicable).
sector_sizeWhat sector size to read (eg. - 2048, 2532).
Returns
Command Responses
See also
Read Sector Part
cdrom_change_datatype

◆ cdrom_set_sector_size()

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).

Parameters
sizeThe size of the sector data.
Returns
Command Responses

◆ cdrom_shutdown()

void cdrom_shutdown ( void  )

Shutdown the CD reading system.

◆ cdrom_spin_down()

int cdrom_spin_down ( void  )

Spin down the CD.

This stops the disc in the drive from spinning until it is accessed again.

Returns
Command Responses

◆ iso_reset()

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.

Return values
0On success.