mirror of
https://github.com/Polprzewodnikowy/SummerCart64.git
synced 2024-11-25 07:06:52 +01:00
removed separate event id
This commit is contained in:
parent
d1823be902
commit
c2ae1e2587
@ -46,12 +46,12 @@ class SC64:
|
|||||||
__DDIPL_ROM_LENGTH = 0x400000
|
__DDIPL_ROM_LENGTH = 0x400000
|
||||||
|
|
||||||
__DEBUG_ID_TEXT = 0x01
|
__DEBUG_ID_TEXT = 0x01
|
||||||
__DEBUG_ID_EVENT = 0xFE
|
__EVENT_ID_FSD_READ = 0xF0
|
||||||
|
__EVENT_ID_FSD_WRITE = 0xF1
|
||||||
__EVENT_ID_FSD_READ = 0
|
__EVENT_ID_FSD_LOAD = 0xF2
|
||||||
__EVENT_ID_FSD_WRITE = 1
|
__EVENT_ID_FSD_STORE = 0xF3
|
||||||
__EVENT_ID_DD_BLOCK = 2
|
__EVENT_ID_DD_BLOCK = 0xF4
|
||||||
__EVENT_ID_IS_VIEWER = 3
|
__EVENT_ID_IS_VIEWER = 0xF5
|
||||||
|
|
||||||
__DD_DRIVE_ID_RETAIL = 3
|
__DD_DRIVE_ID_RETAIL = 3
|
||||||
__DD_DRIVE_ID_DEVELOPMENT = 4
|
__DD_DRIVE_ID_DEVELOPMENT = 4
|
||||||
@ -599,20 +599,6 @@ class SC64:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def __debug_process_event(self, event_data: bytes) -> None:
|
|
||||||
id = int.from_bytes(event_data[0:4], byteorder="big")
|
|
||||||
data = event_data[4:]
|
|
||||||
|
|
||||||
if (id == self.__EVENT_ID_FSD_READ):
|
|
||||||
self.__debug_process_fsd_read(data)
|
|
||||||
elif (id == self.__EVENT_ID_FSD_WRITE):
|
|
||||||
self.__debug_process_fsd_write(data)
|
|
||||||
elif (id == self.__EVENT_ID_DD_BLOCK):
|
|
||||||
self.__debug_process_dd_block(data)
|
|
||||||
elif (id == self.__EVENT_ID_IS_VIEWER):
|
|
||||||
self.__debug_process_is_viewer(data)
|
|
||||||
|
|
||||||
|
|
||||||
def debug_init(self, fsd_file: str = None, disk_file: str = None, dd_turbo: bool = False) -> None:
|
def debug_init(self, fsd_file: str = None, disk_file: str = None, dd_turbo: bool = False) -> None:
|
||||||
if (fsd_file):
|
if (fsd_file):
|
||||||
self.__fsd_file = open(fsd_file, "rb+")
|
self.__fsd_file = open(fsd_file, "rb+")
|
||||||
@ -654,8 +640,14 @@ class SC64:
|
|||||||
else:
|
else:
|
||||||
if (id == self.__DEBUG_ID_TEXT):
|
if (id == self.__DEBUG_ID_TEXT):
|
||||||
print(data.decode(encoding="ascii", errors="backslashreplace"), end="")
|
print(data.decode(encoding="ascii", errors="backslashreplace"), end="")
|
||||||
elif (id == self.__DEBUG_ID_EVENT):
|
elif (id == self.__EVENT_ID_FSD_READ):
|
||||||
self.__debug_process_event(data)
|
self.__debug_process_fsd_read(data)
|
||||||
|
elif (id == self.__EVENT_ID_FSD_WRITE):
|
||||||
|
self.__debug_process_fsd_write(data)
|
||||||
|
elif (id == self.__EVENT_ID_DD_BLOCK):
|
||||||
|
self.__debug_process_dd_block(data)
|
||||||
|
elif (id == self.__EVENT_ID_IS_VIEWER):
|
||||||
|
self.__debug_process_is_viewer(data)
|
||||||
else:
|
else:
|
||||||
print(f"\033[35mGot unknown id: {id}, length: {length}\033[0m", file=sys.stderr)
|
print(f"\033[35mGot unknown id: {id}, length: {length}\033[0m", file=sys.stderr)
|
||||||
|
|
||||||
|
@ -66,8 +66,6 @@ static bool tx_word (uint32_t data) {
|
|||||||
#define USB_DMA_TOKEN (0x444D4100)
|
#define USB_DMA_TOKEN (0x444D4100)
|
||||||
#define USB_ERR_TOKEN (0x45525200)
|
#define USB_ERR_TOKEN (0x45525200)
|
||||||
|
|
||||||
#define DEBUG_ID_EVENT (0xFE)
|
|
||||||
|
|
||||||
|
|
||||||
enum state {
|
enum state {
|
||||||
STATE_IDLE,
|
STATE_IDLE,
|
||||||
@ -84,7 +82,6 @@ struct process {
|
|||||||
uint32_t args[2];
|
uint32_t args[2];
|
||||||
bool error;
|
bool error;
|
||||||
bool dma_in_progress;
|
bool dma_in_progress;
|
||||||
bool queried;
|
|
||||||
|
|
||||||
bool event_pending;
|
bool event_pending;
|
||||||
bool event_callback_pending;
|
bool event_callback_pending;
|
||||||
@ -183,7 +180,6 @@ void process_usb (void) {
|
|||||||
p.counter = 0;
|
p.counter = 0;
|
||||||
p.error = false;
|
p.error = false;
|
||||||
p.dma_in_progress = false;
|
p.dma_in_progress = false;
|
||||||
p.queried = false;
|
|
||||||
p.state = STATE_ARGS;
|
p.state = STATE_ARGS;
|
||||||
} else {
|
} else {
|
||||||
p.cmd = '!';
|
p.cmd = '!';
|
||||||
@ -220,9 +216,9 @@ void process_usb (void) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Q':
|
case 'Q':
|
||||||
if (!p.queried) {
|
if (p.counter == 0) {
|
||||||
cfg_query(p.args);
|
cfg_query(p.args);
|
||||||
p.queried = true;
|
p.counter += 1;
|
||||||
}
|
}
|
||||||
if (tx_word(p.args[1])) {
|
if (tx_word(p.args[1])) {
|
||||||
p.state = STATE_RESPONSE;
|
p.state = STATE_RESPONSE;
|
||||||
@ -317,18 +313,15 @@ void process_usb (void) {
|
|||||||
if ((p.counter == 0) && tx_word(USB_DMA_TOKEN | '@')) {
|
if ((p.counter == 0) && tx_word(USB_DMA_TOKEN | '@')) {
|
||||||
p.counter += 1;
|
p.counter += 1;
|
||||||
}
|
}
|
||||||
if ((p.counter == 1) && tx_word((DEBUG_ID_EVENT << 24) | (sizeof(p.event.id) + p.event_data_length))) {
|
if ((p.counter == 1) && tx_word(((p.event.id & 0xFF) << 24) | p.event_data_length)) {
|
||||||
p.counter += 1;
|
p.counter += 1;
|
||||||
}
|
}
|
||||||
if ((p.counter == 2) && tx_word(p.event.id)) {
|
if (p.counter >= 2) {
|
||||||
p.counter += 1;
|
while (((p.counter - 2) < p.event_data_length) && tx_byte(p.event_data[p.counter - 2])) {
|
||||||
}
|
|
||||||
if (p.counter >= 3) {
|
|
||||||
while (((p.counter - 3) < p.event_data_length) && tx_byte(p.event_data[p.counter - 3])) {
|
|
||||||
p.counter += 1;
|
p.counter += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((p.counter == (p.event_data_length + 3)) && tx_word(USB_CMP_TOKEN | 'H')) {
|
if ((p.counter == (p.event_data_length + 2)) && tx_word(USB_CMP_TOKEN | 'H')) {
|
||||||
if (p.event.callback != NULL) {
|
if (p.event.callback != NULL) {
|
||||||
p.event_callback_pending = true;
|
p.event_callback_pending = true;
|
||||||
}
|
}
|
||||||
|
@ -6,17 +6,12 @@
|
|||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
INT_DBG_ID_IS_VIEWER = 0,
|
EVENT_ID_FSD_READ = 0xF0,
|
||||||
INT_DBG_ID_DD_BLOCK = 1,
|
EVENT_ID_FSD_WRITE = 0xF1,
|
||||||
INT_DBG_ID_FSD_READ = 2,
|
EVENT_ID_FSD_LOAD = 0xF2,
|
||||||
INT_DBG_ID_FSD_WRITE = 3,
|
EVENT_ID_FSD_STORE = 0xF3,
|
||||||
} internal_debug_id_t;
|
EVENT_ID_DD_BLOCK = 0xF4,
|
||||||
|
EVENT_ID_IS_VIEWER = 0xF5,
|
||||||
typedef enum {
|
|
||||||
EVENT_ID_FSD_READ = 0,
|
|
||||||
EVENT_ID_FSD_WRITE = 1,
|
|
||||||
EVENT_ID_DD_BLOCK = 2,
|
|
||||||
EVENT_ID_IS_VIEWER = 3,
|
|
||||||
} usb_event_id_t;
|
} usb_event_id_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
Loading…
Reference in New Issue
Block a user