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

API for the Dreamcast's system calls More...

Topics

 GDROM System Calls
 GDROM Syscalls and Data Types
 
 dcload system calls
 API for dcload's system calls
 

Files

file  syscalls.h
 Functions to access the system calls of the Dreamcast ROM.
 

Data Structures

struct  cd_check_drive_status_t
 Status filled by Check Drive syscall. More...
 
struct  cd_read_params_t
 Params for READ commands. More...
 
struct  cd_toc_t
 TOC structure returned by the BIOS. More...
 
struct  cd_cmd_toc_params_t
 Params for GETTOC commands. More...
 
struct  cd_cmd_play_params_t
 Params for PLAY command. More...
 
struct  cd_cmd_getscd_params_t
 Params for GETSCD command. More...
 
struct  cd_cmd_chk_status_t
 GDROM Command Extra Status. More...
 
struct  cd_sec_mode_params_t
 Sector mode params. More...
 
struct  cd_transfer_params_t
 Parameters for transfer. More...
 

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

Detailed Description

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.

Function Documentation

◆ syscall_flashrom_delete()

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.

Warning
ALL data in the entire partition will be lost.
Parameters
posThe offset from the start of the flashrom you want to delete.
Return values
0On success.
-1On failure.
See also
syscall_flashrom_read(), syscall_flashrom_write()

◆ syscall_flashrom_info()

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.

Parameters
partThe partition number (0-4).
infoThe buffer to store info (8 bytes in size).
Return values
0On success.
-1On failure.

◆ syscall_flashrom_read()

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.

Parameters
posThe read start position into the flashrom.
destThe destination buffer.
nThe number of bytes to read.
Returns
Number of bytes read on success, or -1 on failure.
See also
syscall_flashrom_write(), syscall_flashrom_delete()

◆ syscall_flashrom_write()

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.

Warning
It is only possible to overwrite 1's with 0's. 0's can not be written back to 1's so general overwriting is therefore not possible. You would need to delete a whole partition to overwrite it.
Parameters
posThe start position to write into the flashrom.
srcThe source buffer.
nThe number of bytes to write.
Returns
Number of bytes written on success, or -1 on failure.
See also
syscall_flashrom_read(), syscall_flashrom_delete()

◆ syscall_font_address()

uint8_t * syscall_font_address ( void )

Gets the romfont address.

This function returns the address of the ROM font.

Warning
Before attempting to access the font data, you should always call syscall_font_lock() to ensure that you have exclusive access to the G1 BUS the ROM is located on. Call syscall_font_unlock() when you're done accessing the data.
Note
Defined in syscall_font.s
Returns
The address of the font.

◆ syscall_font_lock()

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.

Note
Defined in syscall_font.s
Return values
0On success.
-1On failure.
See also
syscall_font_unlock()

◆ syscall_font_unlock()

void syscall_font_unlock ( void )

Unlocks access to ROM font.

This function releases the mutex locked with syscall_font_lock().

Note
Defined in syscall_font.s
See also
syscall_font_lock()

◆ syscall_misc_init()

int syscall_misc_init ( void )

Initializes all the syscall vectors.

This function initializes all the syscall vectors to their default values.

Returns
0

◆ syscall_misc_setvector()

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.

Parameters
superThe super function number (1-7).
handlerThe pointer to handler function, or NULL to clear.
Return values
0On success.
-1On failure.

◆ syscall_sysinfo_icon()

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.

Note
The format of these icons is not known.
Parameters
iconThe icon number (0-9, 5-9 seems to really be icons).
destThe destination buffer (704 bytes in size).
Returns
Number of bytes read on success, or -1 on failure.

◆ syscall_sysinfo_id()

uint64_t syscall_sysinfo_id ( void )

Reads the ID of the Dreamcast.

This function returns the unique 64-bit ID for the Dreamcast.

Returns
The Dreamcast ID.

◆ syscall_sysinfo_init()

void syscall_sysinfo_init ( void )

Inits data needed by sysinfo id/icon.

Note
This is called automatically by KOS during initialization. This function prepares syscall_sysinfo_icon and syscall_sysinfo_id calls for use by copying the relevant data from the system flashrom into 8C000068-8C00007F.

◆ syscall_system_bios_menu()

void syscall_system_bios_menu ( void )

Go to the BIOS menu.

This function exits the program to the BIOS menu.

Referenced by cd::returnToBios().

◆ syscall_system_cd_menu()

void syscall_system_cd_menu ( void )

Exit to CD menu.

This function exits the program to the BIOS CD menu.

◆ syscall_system_reset()

void syscall_system_reset ( void )

Resets the Dreamcast.

This function soft resets the Dreamcast console.