N64FlashcartMenu
Loading...
Searching...
No Matches
sc64_internal.h
1
7#ifndef FLASHCART_SC64_INTERNAL_H__
8#define FLASHCART_SC64_INTERNAL_H__
9
10
11#include <stddef.h>
12#include <stdint.h>
13
19typedef struct {
20 uint8_t BUFFER[8192];
21 uint8_t EEPROM[2048];
22 uint8_t DD_SECTOR[256];
23 uint8_t FLASHRAM[128];
25
26#define SC64_BUFFERS_BASE (0x1FFE0000UL)
27#define SC64_BUFFERS ((sc64_buffers_t *) SC64_BUFFERS_BASE)
28
29
30typedef enum {
31 SC64_OK,
32 SC64_ERROR_BAD_ARGUMENT,
33 SC64_ERROR_BAD_ADDRESS,
34 SC64_ERROR_BAD_CONFIG_ID,
35 SC64_ERROR_TIMEOUT,
36 SC64_ERROR_SD_CARD,
37 SC64_ERROR_UNKNOWN_CMD = -1
38} sc64_error_t;
39
40typedef enum {
41 CFG_BOOTLOADER_SWITCH,
42 CFG_ROM_WRITE_ENABLE,
43 CFG_ROM_SHADOW_ENABLE,
44 CFG_DD_MODE,
45 CFG_ISV_ADDRESS,
46 CFG_BOOT_MODE,
47 CFG_SAVE_TYPE,
48 CFG_CIC_SEED,
49 CFG_TV_TYPE,
50 CFG_DD_SD_ENABLE,
51 CFG_DD_DRIVE_TYPE,
52 CFG_DD_DISK_STATE,
53 CFG_BUTTON_STATE,
54 CFG_BUTTON_MODE,
55 CFG_ROM_EXTENDED_ENABLE,
56} sc64_cfg_t;
57
58typedef enum {
59 DD_MODE_DISABLED = 0,
60 DD_MODE_REGS = 1,
61 DD_MODE_IPL = 2,
62 DD_MODE_FULL = 3
63} sc64_dd_mode_t;
64
65typedef enum {
66 BOOT_MODE_MENU = 0,
67 BOOT_MODE_ROM = 1,
68 BOOT_MODE_DDIPL = 2,
69 BOOT_MODE_DIRECT_ROM = 3,
70 BOOT_MODE_DIRECT_DDIPL = 4,
71} sc64_boot_mode_t;
72
73typedef enum {
74 SAVE_TYPE_NONE,
75 SAVE_TYPE_EEPROM_4K,
76 SAVE_TYPE_EEPROM_16K,
77 SAVE_TYPE_SRAM,
78 SAVE_TYPE_FLASHRAM,
79 SAVE_TYPE_SRAM_BANKED,
80 SAVE_TYPE_SRAM_128K,
81} sc64_save_type_t;
82
83typedef enum {
84 CIC_SEED_AUTO = 0xFFFF
85} sc64_cic_seed_t;
86
87typedef enum {
88 TV_TYPE_PAL = 0,
89 TV_TYPE_NTSC = 1,
90 TV_TYPE_MPAL = 2,
91 TV_TYPE_PASSTHROUGH = 3
92} sc64_tv_type_t;
93
94typedef enum {
95 DRIVE_TYPE_RETAIL,
96 DRIVE_TYPE_DEVELOPMENT,
97} sc64_drive_type_t;
98
99typedef enum {
100 DISK_STATE_EJECTED,
101 DISK_STATE_INSERTED,
102 DISK_STATE_CHANGED,
103} sc64_disk_state_t;
104
105typedef enum {
106 BUTTON_MODE_NONE,
107 BUTTON_MODE_N64_IRQ,
108 BUTTON_MODE_USB_PACKET,
109 BUTTON_MODE_DD_DISK_SWAP,
110} sc64_button_mode_t;
111
112
113void sc64_lock (void);
114sc64_error_t sc64_get_version (uint16_t *major, uint16_t *minor, uint32_t *revision);
115sc64_error_t sc64_get_config (sc64_cfg_t cfg, uint32_t *value);
116sc64_error_t sc64_set_config (sc64_cfg_t cfg, uint32_t value);
117sc64_error_t sc64_writeback_pending (bool *pending);
118sc64_error_t sc64_writeback_enable (void *address);
119sc64_error_t sc64_flash_wait_busy (void);
120sc64_error_t sc64_flash_get_erase_block_size (size_t *erase_block_size);
121sc64_error_t sc64_flash_erase_block (void *address);
122 /* sc64 */
124
125#endif
Definition: sc64_internal.h:19