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
20typedef struct {
21 uint8_t BUFFER[8192];
22 uint8_t EEPROM[2048];
23 uint8_t DD_SECTOR[256];
24 uint8_t FLASHRAM[128];
26
27#define SC64_BUFFERS_BASE (0x1FFE0000UL)
28#define SC64_BUFFERS ((sc64_buffers_t *) SC64_BUFFERS_BASE)
29
30
31typedef enum {
32 SC64_OK,
33 SC64_ERROR_BAD_ARGUMENT,
34 SC64_ERROR_BAD_ADDRESS,
35 SC64_ERROR_BAD_CONFIG_ID,
36 SC64_ERROR_TIMEOUT,
37 SC64_ERROR_SD_CARD,
38 SC64_ERROR_UNKNOWN_CMD = -1
39} sc64_error_t;
40
41typedef enum {
42 CFG_ID_BOOTLOADER_SWITCH,
43 CFG_ID_ROM_WRITE_ENABLE,
44 CFG_ID_ROM_SHADOW_ENABLE,
45 CFG_ID_DD_MODE,
46 CFG_ID_ISV_ADDRESS,
47 CFG_ID_BOOT_MODE,
48 CFG_ID_SAVE_TYPE,
49 CFG_ID_CIC_SEED,
50 CFG_ID_TV_TYPE,
51 CFG_ID_DD_SD_ENABLE,
52 CFG_ID_DD_DRIVE_TYPE,
53 CFG_ID_DD_DISK_STATE,
54 CFG_ID_BUTTON_STATE,
55 CFG_ID_BUTTON_MODE,
56 CFG_ID_ROM_EXTENDED_ENABLE,
57} sc64_cfg_id_t;
58
59typedef enum {
60 DD_MODE_DISABLED = 0,
61 DD_MODE_REGS = 1,
62 DD_MODE_IPL = 2,
63 DD_MODE_FULL = 3
64} sc64_dd_mode_t;
65
66typedef enum {
67 BOOT_MODE_MENU = 0,
68 BOOT_MODE_ROM = 1,
69 BOOT_MODE_DDIPL = 2,
70 BOOT_MODE_DIRECT_ROM = 3,
71 BOOT_MODE_DIRECT_DDIPL = 4,
72} sc64_boot_mode_t;
73
74typedef enum {
75 SAVE_TYPE_NONE,
76 SAVE_TYPE_EEPROM_4K,
77 SAVE_TYPE_EEPROM_16K,
78 SAVE_TYPE_SRAM,
79 SAVE_TYPE_FLASHRAM,
80 SAVE_TYPE_SRAM_BANKED,
81 SAVE_TYPE_SRAM_128K,
82} sc64_save_type_t;
83
84typedef enum {
85 CIC_SEED_AUTO = 0xFFFF
86} sc64_cic_seed_t;
87
88typedef enum {
89 TV_TYPE_PAL = 0,
90 TV_TYPE_NTSC = 1,
91 TV_TYPE_MPAL = 2,
92 TV_TYPE_PASSTHROUGH = 3
93} sc64_tv_type_t;
94
95typedef enum {
96 DRIVE_TYPE_RETAIL,
97 DRIVE_TYPE_DEVELOPMENT,
98} sc64_drive_type_t;
99
100typedef enum {
101 DISK_STATE_EJECTED,
102 DISK_STATE_INSERTED,
103 DISK_STATE_CHANGED,
104} sc64_disk_state_t;
105
106typedef enum {
107 BUTTON_MODE_NONE,
108 BUTTON_MODE_N64_IRQ,
109 BUTTON_MODE_USB_PACKET,
110 BUTTON_MODE_DD_DISK_SWAP,
111} sc64_button_mode_t;
112
113
114void sc64_ll_lock (void);
115sc64_error_t sc64_ll_get_version (uint16_t *major, uint16_t *minor, uint32_t *revision);
116sc64_error_t sc64_ll_get_config (sc64_cfg_id_t cfg, uint32_t *value);
117sc64_error_t sc64_ll_set_config (sc64_cfg_id_t cfg, uint32_t value);
118sc64_error_t sc64_ll_writeback_pending (bool *pending);
119sc64_error_t sc64_ll_writeback_enable (void *address);
120sc64_error_t sc64_ll_flash_wait_busy (void);
121sc64_error_t sc64_ll_flash_get_erase_block_size (size_t *erase_block_size);
122sc64_error_t sc64_ll_flash_erase_block (void *address);
123 /* sc64 */
125
126
127#endif
Definition: sc64_ll.h:20