KallistiOS git master
Independent SDK for the Sega Dreamcast
|
API for the Dreamcast's system calls More...
Files | |
file | syscalls.h |
Functions to access the system calls of the Dreamcast ROM. | |
Functions | |
void | syscall_sysinfo_init (void) |
Inits data needed by sysinfo id/icon. | |
int | syscall_sysinfo_icon (uint32_t icon, uint8_t *dest) |
Reads an icon from the flashrom. | |
uint64_t | syscall_sysinfo_id (void) |
Reads the ID of the Dreamcast. | |
uint8_t * | syscall_font_address (void) |
Gets the romfont address. | |
int | syscall_font_lock (void) |
Locks access to ROM font. | |
void | syscall_font_unlock (void) |
Unlocks access to ROM font. | |
int | syscall_flashrom_info (uint32_t part, void *info) |
Gets info on partition in the flashrom. | |
int | syscall_flashrom_read (uint32_t pos, void *dest, size_t n) |
Read data from the flashrom. | |
int | syscall_flashrom_write (uint32_t pos, const void *src, size_t n) |
Write data to the flashrom. | |
int | syscall_flashrom_delete (uint32_t pos) |
Delete a partition of the flashrom. | |
void | syscall_gdrom_init (void) |
Initialize the GDROM drive. | |
void | syscall_gdrom_reset (void) |
Reset the GDROM drive. | |
int | syscall_gdrom_check_drive (uint32_t status[2]) |
Checks the GDROM drive status. | |
uint32_t | syscall_gdrom_send_command (uint32_t cmd, void *params) |
Send a command to the GDROM command queue. | |
int | syscall_gdrom_check_command (uint32_t id, int32_t status[4]) |
Check status of queued command for the GDROM. | |
void | syscall_gdrom_exec_server (void) |
Process queued GDROM commands. | |
int | syscall_gdrom_abort_command (uint32_t id) |
Abort a queued GDROM command. | |
int | syscall_gdrom_sector_mode (uint32_t mode[4]) |
Sets/gets the sector mode for read commands. | |
void | syscall_gdrom_dma_callback (uintptr_t callback, void *param) |
Setup GDROM DMA callback. | |
int | syscall_gdrom_dma_transfer (uint32_t id, const int32_t params[2]) |
Initiates a GDROM DMA transfer. | |
int | syscall_gdrom_dma_check (uint32_t id, size_t *size) |
Checks a GDROM DMA transfer. | |
void | syscall_gdrom_pio_callback (uintptr_t callback, void *param) |
Setup GDROM PIO callback. | |
int | syscall_gdrom_pio_transfer (uint32_t id, const int32_t params[2]) |
Initiates a GDROM PIO transfer. | |
int | syscall_gdrom_pio_check (uint32_t id, size_t *size) |
Checks a GDROM PIO transfer. | |
int | syscall_misc_init (void) |
Initializes all the syscall vectors. | |
int | syscall_misc_setvector (uint32_t super, uintptr_t handler) |
Set/Clear a user defined super function. | |
void | syscall_system_reset (void) __noreturn |
Resets the Dreamcast. | |
void | syscall_system_bios_menu (void) __noreturn |
Go to the BIOS menu. | |
void | syscall_system_cd_menu (void) __noreturn |
Exit to CD menu. | |
API for the Dreamcast's system calls
This module encapsulates all the system calls available in the Dreamcast BIOS, allowing direct interaction with system hardware components such as the GDROM drive, flash ROM, and bios fonts. These functions are essential for performing low-level operations that are not handled by standard user-space APIs.
int syscall_flashrom_delete | ( | uint32_t | pos | ) |
Delete a partition of the flashrom.
This function returns a flashrom partition to all 1's, so that it may be rewritten.
pos | The offset from the start of the flashrom you want to delete. |
0 | On success. |
-1 | On failure. |
int syscall_flashrom_info | ( | uint32_t | part, |
void * | info ) |
Gets info on partition in the flashrom.
This function fetches the info of a partition in the flashrom.
part | The partition number (0-4). |
info | The buffer to store info (8 bytes in size). |
0 | On success. |
-1 | On failure. |
int syscall_flashrom_read | ( | uint32_t | pos, |
void * | dest, | ||
size_t | n ) |
Read data from the flashrom.
This function reads data from an offset into the flashrom to the destination buffer.
pos | The read start position into the flashrom. |
dest | The destination buffer. |
n | The number of bytes to read. |
int syscall_flashrom_write | ( | uint32_t | pos, |
const void * | src, | ||
size_t | n ) |
Write data to the flashrom.
This function writes data to an offset into the flashrom from the source buffer.
pos | The start position to write into the flashrom. |
src | The source buffer. |
n | The number of bytes to write. |
uint8_t * syscall_font_address | ( | void | ) |
Gets the romfont address.
This function returns the address of the ROM font.
int syscall_font_lock | ( | void | ) |
Locks access to ROM font.
This function tries to lock a mutex for exclusive access to the ROM font. This is needed because you can't access the BIOS font during G1 DMA.
0 | On success. |
-1 | On failure. |
void syscall_font_unlock | ( | void | ) |
Unlocks access to ROM font.
This function releases the mutex locked with syscall_font_lock().
int syscall_gdrom_abort_command | ( | uint32_t | id | ) |
Abort a queued GDROM command.
This function tries to abort a previously queued command.
id | The request id (>=1) to abort. |
int syscall_gdrom_check_command | ( | uint32_t | id, |
int32_t | status[4] ) |
Check status of queued command for the GDROM.
This function checks if a queued command has completed.
id | The request id (>=1). |
status | The pointer to four 32-bit integers to receive status information. |
-1 | Request has failed. |
0 | Request not found. |
1 | Request is still being processed. |
2 | Request completed successfully. |
3 | Stream type command is in progress. |
4 | GD syscalls are busy. |
int syscall_gdrom_check_drive | ( | uint32_t | status[2] | ) |
Checks the GDROM drive status.
This function retrieves the general condition of the GDROM drive. It populates a provided array with two elements. The first element indicates the current drive status, and the second element identifies the type of disk inserted (if any).
status | The pointer to two 32-bit unsigned integers to receive extended status information. |
void syscall_gdrom_dma_callback | ( | uintptr_t | callback, |
void * | param ) |
Setup GDROM DMA callback.
This function sets up DMA transfer end callback for CMD_DMAREAD_STREAM_EX (dc/cdrom.h).
callback | The function to call upon completion of the DM. |
param | The data to pass to the callback function. |
int syscall_gdrom_dma_check | ( | uint32_t | id, |
size_t * | size ) |
Checks a GDROM DMA transfer.
This function checks the progress of a DMA transfer for CMD_DMAREAD_STREAM_EX (see dc/cdrom.h).
id | The request id (>=1). |
size | The pointer to receive the remaining amount of bytes to transfer. |
0 | On success. |
-1 | On failure. |
int syscall_gdrom_dma_transfer | ( | uint32_t | id, |
const int32_t | params[2] ) |
Initiates a GDROM DMA transfer.
This function initiates a DMA transfer for CMD_DMAREAD_STREAM_EX (dc/cdrom.h).
id | The request id (>=1). |
params | The pointer to two 32-bit integers. The first element indicates the destination address, and the second element identifies how many bytes to transfer. |
void syscall_gdrom_exec_server | ( | void | ) |
Process queued GDROM commands.
This function starts processing queued commands. This must be called a few times to process all commands. An example of it in use can be seen in
void syscall_gdrom_init | ( | void | ) |
Initialize the GDROM drive.
This function initializes the GDROM drive. Should be called before any commands are sent.
void syscall_gdrom_pio_callback | ( | uintptr_t | callback, |
void * | param ) |
Setup GDROM PIO callback.
This function sets up PIO transfer end callback for CMD_PIOREAD_STREAM_EX (see dc/cdrom.h).
callback | The function to call upon completion of the transfer. |
param | The data to pass to the callback function. |
int syscall_gdrom_pio_check | ( | uint32_t | id, |
size_t * | size ) |
Checks a GDROM PIO transfer.
This function checks the progress of a PIO transfer for CMD_PIOREAD_STREAM_EX (see dc/cdrom.h).
id | The request id (>=1). |
size | The pointer to receive the remaining amount of bytes to transfer. |
0 | On success. |
-1 | On failure. |
int syscall_gdrom_pio_transfer | ( | uint32_t | id, |
const int32_t | params[2] ) |
Initiates a GDROM PIO transfer.
This function initiates a PIO transfer for CMD_PIOREAD_STREAM_EX (see dc/cdrom.h).
id | The request id (>=1). |
params | The pointer to two 32-bit integers. The first element indicates the destination address, and the second element identifies how many bytes to transfer. |
void syscall_gdrom_reset | ( | void | ) |
Reset the GDROM drive.
This function resets the GDROM drive.
int syscall_gdrom_sector_mode | ( | uint32_t | mode[4] | ) |
Sets/gets the sector mode for read commands.
This function sets/gets the sector mode for read commands.
mode | The pointer to a struct of four 32 bit integers containing new values, or to receive the old values. |
0 | On success. |
-1 | On failure. |
uint32_t syscall_gdrom_send_command | ( | uint32_t | cmd, |
void * | params ) |
Send a command to the GDROM command queue.
This function sends a command to the GDROM queue.
cmd | The command code (see CMD_* in dc/cdrom.h). |
params | The pointer to parameter block for the command, can be NULL if the command does not take parameters. |
int syscall_misc_init | ( | void | ) |
Initializes all the syscall vectors.
This function initializes all the syscall vectors to their default values.
int syscall_misc_setvector | ( | uint32_t | super, |
uintptr_t | handler ) |
Set/Clear a user defined super function.
This function sets/clears the handler for one of the seven user defined super functions. Setting a handler is only allowed if it not currently set.
super | The super function number (1-7). |
handler | The pointer to handler function, or NULL to clear. |
0 | On success. |
-1 | On failure. |
int syscall_sysinfo_icon | ( | uint32_t | icon, |
uint8_t * | dest ) |
Reads an icon from the flashrom.
This function reads an icon from the flashrom into a destination buffer.
icon | The icon number (0-9, 5-9 seems to really be icons). |
dest | The destination buffer (704 bytes in size). |
uint64_t syscall_sysinfo_id | ( | void | ) |
Reads the ID of the Dreamcast.
This function returns the unique 64-bit ID for the Dreamcast.
void syscall_sysinfo_init | ( | void | ) |
Inits data needed by sysinfo id/icon.
void syscall_system_bios_menu | ( | void | ) |
Go to the BIOS menu.
This function exits the program to the BIOS menu.
void syscall_system_cd_menu | ( | void | ) |
Exit to CD menu.
This function exits the program to the BIOS CD menu.
void syscall_system_reset | ( | void | ) |
Resets the Dreamcast.
This function soft resets the Dreamcast console.