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

Driver for the Dreamcast's Internal Flash Storage. More...

Modules

 Connection Methods
 Connection method types stored within flashrom.
 
 Error Values
 Error values for the flashrom_get_block() function.
 
 ISP Config Fields
 Valid field constants for the flashrom_ispcfg_t struct.
 
 ISP Config Flags
 Flags for the flashrom_ispcfg_t struct.
 
 Language Settings
 Language settings possible in the BIOS menu.
 
 Logical Blocks
 Logical blocks available in the flashrom.
 
 Partitions
 Partitions available within the flashrom.
 
 Region Settings
 Region settings possible in the system.
 

Data Structures

struct  flashrom_syscfg_t
 System configuration structure. More...
 
struct  flashrom_ispcfg_t
 ISP configuration structure. More...
 

Functions

int flashrom_info (int part, int *start_out, int *size_out)
 Retrieve information about the given partition.
 
int flashrom_read (int offset, void *buffer_out, int bytes)
 Read data from the flashrom.
 
int flashrom_write (int offset, void *buffer, int bytes)
 Write data to the flashrom.
 
int flashrom_delete (int offset)
 Delete data from the flashrom.
 
int flashrom_get_block (int partid, int blockid, uint8 *buffer_out)
 Get a logical block from the specified partition.
 
int flashrom_get_syscfg (flashrom_syscfg_t *out)
 Retrieve the current system configuration settings.
 
int flashrom_get_region (void)
 Retrieve the console's region code.
 
int flashrom_get_ispcfg (flashrom_ispcfg_t *out)
 Retrieve DreamPassport's ISP configuration.
 
int flashrom_get_pw_ispcfg (flashrom_ispcfg_t *out)
 Retrieve PlanetWeb's ISP configuration.
 

Detailed Description

Driver for the Dreamcast's Internal Flash Storage.

Function Documentation

◆ flashrom_delete()

int flashrom_delete ( int  offset)

Delete data from the flashrom.

This function implements the FLASHROM_DELETE syscall; given a partition offset, that entire partition of the flashrom will be deleted and all data will be reset to 0xFF bytes.

Note
This does not rewrite the magic block to the start of the partition. It is your responsibility to do this after running this function.
Parameters
offsetThe offset of the start of the partition to erase.
Return values
0On success.
-1On error.

◆ flashrom_get_block()

int flashrom_get_block ( int  partid,
int  blockid,
uint8 buffer_out 
)

Get a logical block from the specified partition.

This function retrieves the specified block ID from the given partition. The newest version of the data is returned.

Parameters
partidThe partition ID to look in.
blockidThe logical block ID to look for.
buffer_outSpace to store the data. Must be at least 60 bytes.
Returns
0 on success, <0 on error.
See also
Error Values

◆ flashrom_get_ispcfg()

int flashrom_get_ispcfg ( flashrom_ispcfg_t out)

Retrieve DreamPassport's ISP configuration.

This function retrieves the console's ISP settings as set by DreamPassport, if they exist. You should check the valid_fields bitfield for the part of the struct you want before relying on the data.

Parameters
outStorage for the structure.
Return values
0On success.
-1On error (no settings found, or other errors).

◆ flashrom_get_pw_ispcfg()

int flashrom_get_pw_ispcfg ( flashrom_ispcfg_t out)

Retrieve PlanetWeb's ISP configuration.

This function retrieves the console's ISP settings as set by PlanetWeb (1.0 and 2.1 have been verified to work), if they exist. You should check the valid_fields bitfield for the part of the struct you want before relying on the data.

Parameters
outStorage for the structure.
Return values
0On success.
-1On error (i.e, no PlanetWeb settings found).

◆ flashrom_get_region()

int flashrom_get_region ( void  )

Retrieve the console's region code.

This function attempts to find the region of the Dreamcast. It may or may not work on 100% of Dreamcasts, apparently.

Returns
A region code (>=0), or error (<0).
See also
Region Settings
Error Values

◆ flashrom_get_syscfg()

int flashrom_get_syscfg ( flashrom_syscfg_t out)

Retrieve the current system configuration settings.

Parameters
outStorage for the configuration.
Returns
0 on success, <0 on error.
See also
Error Values

◆ flashrom_info()

int flashrom_info ( int  part,
int *  start_out,
int *  size_out 
)

Retrieve information about the given partition.

This function implements the FLASHROM_INFO syscall; given a partition ID, return two ints specifying the beginning and the size of the partition (respectively) inside the flashrom.

Parameters
partThe partition ID in question.
start_outBuffer for storing the start address.
size_outBuffer for storing the size of the partition.
Return values
0On success.
-1On error.

◆ flashrom_read()

int flashrom_read ( int  offset,
void *  buffer_out,
int  bytes 
)

Read data from the flashrom.

This function implements the FLASHROM_READ syscall; given a flashrom offset, an output buffer, and a count, this reads data from the flashrom.

Parameters
offsetThe offset to read from.
buffer_outSpace to read into.
bytesThe number of bytes to read.
Returns
The number of bytes read if successful, or -1 otherwise.

◆ flashrom_write()

int flashrom_write ( int  offset,
void *  buffer,
int  bytes 
)

Write data to the flashrom.

This function implements the FLASHROM_WRITE syscall; given a flashrom offset, an input buffer, and a count, this writes data to the flashrom.

Note
It is not possible to write ones to the flashrom over zeros. If you want to do this, you must save the old data in the flashrom, delete it out, and save the new data back.
Parameters
offsetThe offset to write at.
bufferThe data to write.
bytesThe number of bytes to write.
Returns
The number of bytes written if successful, -1 otherwise.