From 0c88518a1f879e4426f69feb05e64589aeeb56c8 Mon Sep 17 00:00:00 2001 From: icex2 Date: Wed, 16 Dec 2020 23:10:13 +0100 Subject: [PATCH] bio2: Add BIO2_BI2A_CMD_INIT command Turns out this is different from the generic CLEAR command used on other ACIO devices. Has further implications when initializing BIO2 boards for specific games, e.g. IIDX. --- src/main/bio2/bio2.h | 3 +++ src/main/bio2drv/bi2a-iidx.c | 2 +- src/main/bio2drv/bi2a-sdvx.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/bio2/bio2.h b/src/main/bio2/bio2.h index 9c24b5b..162239a 100644 --- a/src/main/bio2/bio2.h +++ b/src/main/bio2/bio2.h @@ -6,6 +6,9 @@ #include enum bio2_bi2a_cmd { + // Same as AC_IO_CMD_CLEAR but called differently + // with a parameter required to initialize the IO correctly + BIO2_BI2A_CMD_INIT = 0x0100, BIO2_BI2A_CMD_WATCHDOG = 0x0120, BIO2_BI2A_CMD_POLL = 0x0152, // For IIDX }; diff --git a/src/main/bio2drv/bi2a-iidx.c b/src/main/bio2drv/bi2a-iidx.c index d20056d..fb7554e 100644 --- a/src/main/bio2drv/bi2a-iidx.c +++ b/src/main/bio2drv/bi2a-iidx.c @@ -14,7 +14,7 @@ static bool bio2drv_bi2a_iidx_init_io(uint8_t node_id) struct ac_io_message msg; msg.addr = node_id + 1; - msg.cmd.code = ac_io_u16(AC_IO_CMD_CLEAR); + msg.cmd.code = ac_io_u16(BIO2_BI2A_CMD_INIT); msg.cmd.nbytes = 1; msg.cmd.count = 0x3B; diff --git a/src/main/bio2drv/bi2a-sdvx.c b/src/main/bio2drv/bi2a-sdvx.c index 87d2ff2..4f56266 100644 --- a/src/main/bio2drv/bi2a-sdvx.c +++ b/src/main/bio2drv/bi2a-sdvx.c @@ -15,7 +15,7 @@ static bool bio2drv_bi2a_sdvx_init_io(uint8_t node_id) struct ac_io_message msg; msg.addr = node_id + 1; - msg.cmd.code = ac_io_u16(AC_IO_CMD_CLEAR); + msg.cmd.code = ac_io_u16(BIO2_BI2A_CMD_INIT); msg.cmd.nbytes = 1; msg.cmd.count = 0x3B;