KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
flashrom.h File Reference

Dreamcast flashrom read/write support. More...

#include <sys/cdefs.h>
#include <arch/types.h>

Go to the source code of this file.

Data Structures

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

Macros

#define FLASHROM_PT_SYSTEM   0
 Factory settings (read-only, 8K)
 
#define FLASHROM_PT_RESERVED   1
 reserved (all 0s, 8K)
 
#define FLASHROM_PT_BLOCK_1   2
 Block allocated (16K)
 
#define FLASHROM_PT_SETTINGS   3
 Game settings (block allocated, 32K)
 
#define FLASHROM_PT_BLOCK_2   4
 Block allocated (64K)
 
#define FLASHROM_B1_SYSCFG   0x05
 System config (BLOCK_1)
 
#define FLASHROM_B1_PW_SETTINGS_1   0x80
 PlanetWeb settings (BLOCK_1)
 
#define FLASHROM_B1_PW_SETTINGS_2   0x81
 PlanetWeb settings (BLOCK_1)
 
#define FLASHROM_B1_PW_SETTINGS_3   0x82
 PlanetWeb settings (BLOCK_1)
 
#define FLASHROM_B1_PW_SETTINGS_4   0x83
 PlanetWeb settings (BLOCK_1)
 
#define FLASHROM_B1_PW_SETTINGS_5   0x84
 PlanetWeb settings (BLOCK_1)
 
#define FLASHROM_B1_PW_PPP1   0xC0
 PlanetWeb PPP settings (BLOCK_1)
 
#define FLASHROM_B1_PW_PPP2   0xC1
 PlanetWeb PPP settings (BLOCK_1)
 
#define FLASHROM_B1_PW_DNS   0xC2
 PlanetWeb DNS settings (BLOCK_1)
 
#define FLASHROM_B1_PW_EMAIL1   0xC3
 PlanetWeb Email settings (BLOCK_1)
 
#define FLASHROM_B1_PW_EMAIL2   0xC4
 PlanetWeb Email settings (BLOCK_1)
 
#define FLASHROM_B1_PW_EMAIL_PROXY   0xC5
 PlanetWeb Email/Proxy settings (BLOCK_1)
 
#define FLASHROM_B1_DK_PPP1   0xC6
 DreamKey PPP settings (also seen in PW)
 
#define FLASHROM_B1_DK_PPP2   0xC7
 DreamKey PPP settings (also seen in PW)
 
#define FLASHROM_B1_DK_DNS   0xC8
 DreamKey PPP settings (also seen in PW)
 
#define FLASHROM_B1_IP_SETTINGS   0xE0
 IP settings for BBA (BLOCK_1)
 
#define FLASHROM_B1_EMAIL   0xE2
 Email address (BLOCK_1)
 
#define FLASHROM_B1_SMTP   0xE4
 SMTP server setting (BLOCK_1)
 
#define FLASHROM_B1_POP3   0xE5
 POP3 server setting (BLOCK_1)
 
#define FLASHROM_B1_POP3LOGIN   0xE6
 POP3 login setting (BLOCK_1)
 
#define FLASHROM_B1_POP3PASSWD   0xE7
 POP3 password setting + proxy (BLOCK_1)
 
#define FLASHROM_B1_PPPLOGIN   0xE8
 PPP username + proxy (BLOCK_1)
 
#define FLASHROM_B1_PPPPASSWD   0xE9
 PPP passwd (BLOCK_1)
 
#define FLASHROM_B1_PPPMODEM   0xEB
 PPP modem settings.
 
#define FLASHROM_OFFSET_CRC   62
 Location of CRC in each block.
 
#define FLASHROM_ERR_NONE   0
 Success.
 
#define FLASHROM_ERR_NOT_FOUND   -1
 Block not found.
 
#define FLASHROM_ERR_NO_PARTITION   -2
 Partition not found.
 
#define FLASHROM_ERR_READ_PART   -3
 Error reading partition.
 
#define FLASHROM_ERR_BAD_MAGIC   -4
 Invalid block magic.
 
#define FLASHROM_ERR_BOGUS_PART   -5
 Bogus partition size.
 
#define FLASHROM_ERR_NOMEM   -6
 Memory allocation failure.
 
#define FLASHROM_ERR_READ_BITMAP   -7
 Error reading bitmap.
 
#define FLASHROM_ERR_EMPTY_PART   -8
 Empty partition.
 
#define FLASHROM_ERR_READ_BLOCK   -9
 Error reading block.
 
#define FLASHROM_LANG_JAPANESE   0
 Japanese language code.
 
#define FLASHROM_LANG_ENGLISH   1
 English language code.
 
#define FLASHROM_LANG_GERMAN   2
 German language code.
 
#define FLASHROM_LANG_FRENCH   3
 French language code.
 
#define FLASHROM_LANG_SPANISH   4
 Spanish language code.
 
#define FLASHROM_LANG_ITALIAN   5
 Italian language code.
 
#define FLASHROM_REGION_UNKNOWN   0
 Unknown region.
 
#define FLASHROM_REGION_JAPAN   1
 Japanese region.
 
#define FLASHROM_REGION_US   2
 US/Canada region.
 
#define FLASHROM_REGION_EUROPE   3
 European region.
 
#define FLASHROM_ISP_DIALUP   0
 Dialup ISP.
 
#define FLASHROM_ISP_DHCP   1
 DHCP-based ethernet.
 
#define FLASHROM_ISP_PPPOE   2
 PPPoE-based ethernet.
 
#define FLASHROM_ISP_STATIC   3
 Static IP-based ethernet.
 
#define FLASHROM_ISP_IP   (1 << 0)
 Static IP address.
 
#define FLASHROM_ISP_NETMASK   (1 << 1)
 Netmask.
 
#define FLASHROM_ISP_BROADCAST   (1 << 2)
 Broadcast address.
 
#define FLASHROM_ISP_GATEWAY   (1 << 3)
 Gateway address.
 
#define FLASHROM_ISP_DNS   (1 << 4)
 DNS servers.
 
#define FLASHROM_ISP_HOSTNAME   (1 << 5)
 Hostname.
 
#define FLASHROM_ISP_EMAIL   (1 << 6)
 Email address.
 
#define FLASHROM_ISP_SMTP   (1 << 7)
 SMTP server.
 
#define FLASHROM_ISP_POP3   (1 << 8)
 POP3 server.
 
#define FLASHROM_ISP_POP3_USER   (1 << 9)
 POP3 username.
 
#define FLASHROM_ISP_POP3_PASS   (1 << 10)
 POP3 password.
 
#define FLASHROM_ISP_PROXY_HOST   (1 << 11)
 Proxy hostname.
 
#define FLASHROM_ISP_PROXY_PORT   (1 << 12)
 Proxy port.
 
#define FLASHROM_ISP_PPP_USER   (1 << 13)
 PPP username.
 
#define FLASHROM_ISP_PPP_PASS   (1 << 14)
 PPP password.
 
#define FLASHROM_ISP_OUT_PREFIX   (1 << 15)
 Outside dial prefix.
 
#define FLASHROM_ISP_CW_PREFIX   (1 << 16)
 Call waiting prefix.
 
#define FLASHROM_ISP_REAL_NAME   (1 << 17)
 Real name.
 
#define FLASHROM_ISP_MODEM_INIT   (1 << 18)
 Modem init string.
 
#define FLASHROM_ISP_AREA_CODE   (1 << 19)
 Area code.
 
#define FLASHROM_ISP_LD_PREFIX   (1 << 20)
 Long distance prefix.
 
#define FLASHROM_ISP_PHONE1   (1 << 21)
 Phone number 1.
 
#define FLASHROM_ISP_PHONE2   (1 << 22)
 Phone number 2.
 
#define FLASHROM_ISP_DIAL_AREACODE   (1 << 0)
 Dial area code before number.
 
#define FLASHROM_ISP_USE_PROXY   (1 << 1)
 Proxy enabled.
 
#define FLASHROM_ISP_PULSE_DIAL   (1 << 2)
 Pulse dialing (instead of tone)
 
#define FLASHROM_ISP_BLIND_DIAL   (1 << 3)
 Blind dial (don't wait for tone)
 

Functions

int flashrom_info (uint32_t part_id, uint32_t *start_offset, size_t *size_out)
 Retrieve information about the given partition.
 
int flashrom_read (uint32_t offset, void *buffer_out, size_t bytes)
 Read data from the flashrom.
 
int flashrom_write (uint32_t offset, const void *buffer, size_t bytes)
 Write data to the flashrom.
 
int flashrom_delete (uint32_t offset)
 Delete data from the flashrom.
 
int flashrom_get_block (uint32_t part_id, uint32_t block_id, uint8_t *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

Dreamcast flashrom read/write support.

This file provides wrappers for the BIOS flashrom syscalls and utilities to facilitate the use of flashrom data. Since writing to the flashrom can be risky and potentially destructive, extreme caution is advised when using these functions.

The Dreamcast flashrom stores important system data including user settings, ISP configurations, and game-specific settings. This file contains functions to read, write, and manage this data.

Writing to the flashrom should be done with caution:

  • Always back up existing data before making changes.
  • Verify the data you are writing is correct.
  • Avoid frequent writes to minimize wear on the flashrom memory cells.

Flashrom Structure

The flashrom is divided into several partitions and logical blocks:

  • Partitions: Defined sections of the flashrom used for different types of data.
  • Logical Blocks: Subsections within partitions that store specific settings.
Author
Megan Potter
Lawrence Sebald

Macro Definition Documentation

◆ FLASHROM_OFFSET_CRC

#define FLASHROM_OFFSET_CRC   62

Location of CRC in each block.