N64FlashcartMenu
Loading...
Searching...
No Matches
sc64_ll.h
Go to the documentation of this file.
1
7#ifndef FLASHCART_SC64_LL_H__
8#define FLASHCART_SC64_LL_H__
9
10
11#include <stddef.h>
12#include <stdint.h>
13
14
21typedef struct {
22 uint8_t BUFFER[8192];
23 uint8_t EEPROM[2048];
24 uint8_t DD_SECTOR[256];
25 uint8_t FLASHRAM[128];
27
28#define SC64_BUFFERS_BASE (0x1FFE0000UL)
29#define SC64_BUFFERS ((sc64_buffers_t *) SC64_BUFFERS_BASE)
30
32typedef enum {
33 SC64_OK,
34 SC64_ERROR_BAD_ARGUMENT,
35 SC64_ERROR_BAD_ADDRESS,
36 SC64_ERROR_BAD_CONFIG_ID,
37 SC64_ERROR_TIMEOUT,
38 SC64_ERROR_SD_CARD,
39 SC64_ERROR_UNKNOWN_CMD = -1
41
42typedef enum {
43 CFG_ID_BOOTLOADER_SWITCH,
44 CFG_ID_ROM_WRITE_ENABLE,
45 CFG_ID_ROM_SHADOW_ENABLE,
46 CFG_ID_DD_MODE,
47 CFG_ID_ISV_ADDRESS,
48 CFG_ID_BOOT_MODE,
49 CFG_ID_SAVE_TYPE,
50 CFG_ID_CIC_SEED,
51 CFG_ID_TV_TYPE,
52 CFG_ID_DD_SD_ENABLE,
53 CFG_ID_DD_DRIVE_TYPE,
54 CFG_ID_DD_DISK_STATE,
55 CFG_ID_BUTTON_STATE,
56 CFG_ID_BUTTON_MODE,
57 CFG_ID_ROM_EXTENDED_ENABLE,
58} sc64_cfg_id_t;
59
60typedef enum {
61 DD_MODE_DISABLED = 0,
62 DD_MODE_REGS = 1,
63 DD_MODE_IPL = 2,
64 DD_MODE_FULL = 3
65} sc64_dd_mode_t;
66
68typedef enum {
69 BOOT_MODE_MENU = 0,
70 BOOT_MODE_ROM = 1,
71 BOOT_MODE_DDIPL = 2,
72 BOOT_MODE_DIRECT_ROM = 3,
73 BOOT_MODE_DIRECT_DDIPL = 4,
75
77typedef enum {
78 SAVE_TYPE_NONE,
79 SAVE_TYPE_EEPROM_4KBIT,
80 SAVE_TYPE_EEPROM_16KBIT,
81 SAVE_TYPE_SRAM_256KBIT,
82 SAVE_TYPE_FLASHRAM_1MBIT,
83 SAVE_TYPE_SRAM_BANKED,
84 SAVE_TYPE_SRAM_1MBIT,
86
87typedef enum {
88 CIC_SEED_AUTO = 0xFFFF
89} sc64_cic_seed_t;
90
91typedef enum {
92 TV_TYPE_PAL = 0,
93 TV_TYPE_NTSC = 1,
94 TV_TYPE_MPAL = 2,
95 TV_TYPE_PASSTHROUGH = 3
96} sc64_tv_type_t;
97
98typedef enum {
99 DRIVE_TYPE_RETAIL,
100 DRIVE_TYPE_DEVELOPMENT,
101} sc64_drive_type_t;
102
103typedef enum {
104 DISK_STATE_EJECTED,
105 DISK_STATE_INSERTED,
106 DISK_STATE_CHANGED,
107} sc64_disk_state_t;
108
109typedef enum {
110 BUTTON_MODE_NONE,
111 BUTTON_MODE_N64_IRQ,
112 BUTTON_MODE_USB_PACKET,
113 BUTTON_MODE_DD_DISK_SWAP,
114} sc64_button_mode_t;
115
116typedef struct {
117 int count;
118 struct {
119 uint32_t thb_table;
120 uint32_t sector_table;
121 } disks[4];
123
124
125void sc64_ll_lock (void);
126sc64_error_t sc64_ll_get_version (uint16_t *major, uint16_t *minor, uint32_t *revision);
127sc64_error_t sc64_ll_get_config (sc64_cfg_id_t cfg, uint32_t *value);
128sc64_error_t sc64_ll_set_config (sc64_cfg_id_t cfg, uint32_t value);
129sc64_error_t sc64_ll_set_disk_mapping (sc64_disk_mapping_t *disk_mapping);
130sc64_error_t sc64_ll_writeback_pending (bool *pending);
131sc64_error_t sc64_ll_writeback_enable (void *address);
132sc64_error_t sc64_ll_flash_wait_busy (void);
133sc64_error_t sc64_ll_flash_get_erase_block_size (size_t *erase_block_size);
134sc64_error_t sc64_ll_flash_erase_block (void *address);
135 /* sc64 */
137
138
139#endif
sc64_boot_mode_t
The SC64 Boot Mode Enumeration.
Definition: sc64_ll.h:68
sc64_save_type_t
The SC64 Save Type Enumeration.
Definition: sc64_ll.h:77
sc64_error_t
The SC64 State Enumeration.
Definition: sc64_ll.h:32
The SC64 buffers structure.
Definition: sc64_ll.h:21
Definition: sc64_ll.h:116