libws libws
WSwan hardware library for the Wonderful toolchain
Loading...
Searching...
No Matches
eeprom.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include "hardware.h"
#include "util.h"

Go to the source code of this file.

Data Structures

struct  ws_eeprom_handle_t
 

Macros

#define WS_IEEP_SIZE_MONO   0x80
 
#define WS_IEEP_SIZE_COLOR   0x800
 
#define IEEP_ADDR_OWNER_NAME   0x60 /* 16 bytes */
 
#define IEEP_ADDR_OWNER_BIRTHDAY_YEAR   0x70 /* word */
 
#define IEEP_ADDR_OWNER_BIRTHDAY_MONTH   0x72 /* byte */
 
#define IEEP_ADDR_OWNER_BIRTHDAY_DAY   0x73 /* byte */
 
#define IEEP_ADDR_OWNER_GENDER   0x74 /* byte */
 
#define IEEP_ADDR_OWNER_BLOOD_TYPE   0x75 /* byte */
 
#define IEEP_ADDR_LAST_CART_PUBLISHER   0x76 /* byte */
 
#define IEEP_ADDR_LAST_CART_PLATFORM   0x77 /* byte */
 
#define IEEP_ADDR_LAST_CART_GAME_ID   0x78 /* byte */
 
#define IEEP_ADDR_CART_CHANGE_COUNT   0x7C /* byte */
 
#define IEEP_ADDR_NAME_CHANGE_COUNT   0x7D /* byte */
 
#define IEEP_ADDR_STARTUP_COUNT   0x7E /* word */
 
#define IEEP_ADDR_C_OPTIONS1   0x83 /* byte */
 
#define IEEP_C_OPTIONS1_CUSTOM_SPLASH   0x80
 
#define IEEP_C_OPTIONS1_WSC_HIGH_CONTRAST   0x40
 
#define IEEP_C_OPTIONS1_VOLUME(x)
 
#define IEEP_C_OPTIONS1_VOLUME_MASK   0x03
 
#define IEEP_ADDR_C_NAME_COLOR   0x84 /* byte */
 
#define IEEP_C_NAME_COLOR_BLACK   0x00 /* RGB(0, 0, 0) */
 
#define IEEP_C_NAME_COLOR_RED   0x01 /* RGB(15, 0, 0) */
 
#define IEEP_C_NAME_COLOR_ORANGE   0x02 /* RGB(15, 7, 0) */
 
#define IEEP_C_NAME_COLOR_YELLOW   0x03 /* RGB(15, 15, 0) */
 
#define IEEP_C_NAME_COLOR_LIME   0x04 /* RGB(7, 15, 0) */
 
#define IEEP_C_NAME_COLOR_GREEN   0x05 /* RGB(0, 15, 0) */
 
#define IEEP_C_NAME_COLOR_TEAL   0x06 /* RGB(0, 15, 7) */
 
#define IEEP_C_NAME_COLOR_CYAN   0x07 /* RGB(0, 15, 15) */
 
#define IEEP_C_NAME_COLOR_SEABLUE   0x08 /* RGB(0, 7, 15) */
 
#define IEEP_C_NAME_COLOR_BLUE   0x09 /* RGB(0, 0, 15) */
 
#define IEEP_C_NAME_COLOR_PURPLE   0x0A /* RGB(7, 0, 15) */
 
#define IEEP_C_NAME_COLOR_PINK   0x0B /* RGB(15, 0, 15) */
 
#define IEEP_C_NAME_COLOR_FUCHSIA   0x0C /* RGB(15, 0, 7) */
 
#define IEEP_C_NAME_COLOR_WHITE   0x0D /* RGB(15, 15, 15) */
 
#define IEEP_C_NAME_COLOR_GRAY   0x0E /* RGB(7, 7, 7) */
 

Functions

ws_eeprom_handle_t ws_eeprom_handle_internal (void)
 
static ws_eeprom_handle_t ws_eeprom_handle_cartridge (uint8_t bits)
 
uint16_t ws_eeprom_read_word (ws_eeprom_handle_t handle, uint16_t address)
 Read an aligned word from the EEPROM.
 
uint8_t ws_eeprom_read_byte (ws_eeprom_handle_t handle, uint16_t address)
 Read a byte from the EEPROM.
 
void ws_eeprom_read_data (ws_eeprom_handle_t handle, uint16_t address, uint8_t *data, uint16_t length)
 Read bytes from the EEPROM.
 
bool ws_eeprom_write_word (ws_eeprom_handle_t handle, uint16_t address, uint16_t value)
 Write a word to the EEPROM.
 
bool ws_eeprom_erase_word (ws_eeprom_handle_t handle, uint16_t address)
 Erase a word from the EEPROM, setting it to 0xFFFF.
 
bool ws_eeprom_write_lock (ws_eeprom_handle_t handle)
 Lock the EEPROM, preventing writes and erases.
 
bool ws_eeprom_write_unlock (ws_eeprom_handle_t handle)
 Unlock the EEPROM, allowing writes and erases.
 
void ws_ieep_read_owner_name (uint8_t *data)
 Read the owner name, as raw data.
 
void ws_ieep_read_owner_name_ascii (char *str)
 Read the owner name, as an ASCII string.
 
uint16_t ws_ieep_name_color_to_rgb (uint8_t value)
 Convert a given name color to its RGB value.
 
static void ws_ieep_protect_enable (void)
 Protect the non-cartridge area of the internal EEPROM.
 
static bool ws_ieep_protect_check (void)
 Check if the non-cartridge area of the internal EEPROM is currently protected.
 

Detailed Description

Functionality related to EEPROM.

Definition in file eeprom.h.