|
KallistiOS git master
Independent SDK for the Sega Dreamcast
|
Definitions for the NAOMI MIE-JVS bridge Maple device. More...
#include <kos/cdefs.h>#include <stdint.h>#include <stdbool.h>#include <stddef.h>#include <kos/regfield.h>#include <dc/maple.h>#include <dc/maple/controller.h>Go to the source code of this file.
Data Structures | |
| struct | mie_jvs_coin_slot_t |
| Parsed JVS coin slot state. More... | |
| struct | mie_jvs_player_sw_t |
| One player JVS switch bank. More... | |
| struct | mie_jvs_panel_dip_t |
| Panel DIP switch bank. More... | |
| struct | mie_jvs_system_t |
| JVS SWINP system switch byte. More... | |
| struct | mie_jvs_panel_t |
| Cabinet panel switches. More... | |
| struct | mie_jvs_inputs_t |
| Decoded JVS input state. More... | |
| struct | mie_state_t |
| MIE device status. More... | |
| struct | mie_analog_axis_calib_t |
| Per-axis JVS analog calibration data. More... | |
| struct | mie_analog_calib_t |
| Wheel and pedal calibration set. More... | |
Macros | |
| #define | MIE_JVS_PLAYER_SLOTS 2 |
| Max player switch banks. | |
| #define | MIE_JVS_ANALOG_CHANNELS 8 |
| Number of JVS analog channels. | |
| #define | MIE_JVS_ANALOG_RAW_MASK (GENMASK(6, 0) | GENMASK(15, 8)) |
| #define | MIE_JVS_COIN_SLOTS 2 |
| Max JVS coin slots. | |
| #define | MIE_JVS_PANEL_DIP_COUNT 4 |
| Number of cabinet DIP switches. | |
| #define | MIE_JVS_OUTPUT_COUNT 24 |
| Max JVS general purpose outputs. | |
| #define | MIE_EEPROM_SIZE 128 |
| MIE on-board EEPROM size in bytes. | |
| #define | MIE_ID_SIZE 64 |
| MIE board identifier buffer size. | |
| #define | MIE_JVS_SW1_BIT BIT(8) |
| Push switch 2. | |
| #define | MIE_JVS_SW2_BIT BIT(9) |
| Push switch 1. | |
| #define | MIE_JVS_RIGHT_BIT BIT(10) |
| Right switch (JVS SW3). | |
| #define | MIE_JVS_LEFT_BIT BIT(11) |
| Left switch (JVS SW4). | |
| #define | MIE_JVS_DOWN_BIT BIT(12) |
| Down switch (JVS SW5). | |
| #define | MIE_JVS_UP_BIT BIT(13) |
| Up switch (JVS SW6). | |
| #define | MIE_JVS_SERVICE_BIT BIT(14) |
| Service switch (JVS SW7). | |
| #define | MIE_JVS_START_BIT BIT(15) |
| Start switch (JVS SW8). | |
| #define | MIE_JVS_SW9_BIT BIT(0) |
| Push switch 3. | |
| #define | MIE_JVS_SW10_BIT BIT(1) |
| Push switch 4. | |
| #define | MIE_JVS_SW11_BIT BIT(2) |
| Push switch 5. | |
| #define | MIE_JVS_SW12_BIT BIT(3) |
| Push switch 6. | |
| #define | MIE_JVS_SW13_BIT BIT(4) |
| Push switch 7. | |
| #define | MIE_JVS_SW14_BIT BIT(5) |
| Push switch 8. | |
| #define | MIE_JVS_SW15_BIT BIT(6) |
| Push switch 9. | |
| #define | MIE_JVS_SW16_BIT BIT(7) |
| Push switch 10. | |
| #define | MIE_JVS_COIN_INSERT_BIT BIT(0) |
| Coin slot insert edge for MIE_JVS_IN_COIN*. | |
| #define | MIE_JVS_PANEL_DIP1_BIT BIT(0) |
| Panel DIP switch 1. | |
| #define | MIE_JVS_PANEL_DIP2_BIT BIT(1) |
| Panel DIP switch 2. | |
| #define | MIE_JVS_PANEL_DIP3_BIT BIT(2) |
| Panel DIP switch 3. | |
| #define | MIE_JVS_PANEL_DIP4_BIT BIT(3) |
| Panel DIP switch 4. | |
| #define | MIE_JVS_PANEL_TEST_BIT BIT(0) |
| Panel test switch (PSW1). | |
| #define | MIE_JVS_PANEL_SERVICE_BIT BIT(1) |
| Panel service switch (PSW2). | |
| #define | MIE_JVS_SYS_TILT3_BIT BIT(4) |
| Tilt switch 3. | |
| #define | MIE_JVS_SYS_TILT2_BIT BIT(5) |
| Tilt switch 2. | |
| #define | MIE_JVS_SYS_TILT1_BIT BIT(6) |
| Tilt switch 1. | |
| #define | MIE_JVS_SYS_TEST_BIT BIT(7) |
| Test switch. | |
| #define | MIE_JVS_COIN_STUFF 0x4000 |
| Coin chute stuffed. | |
| #define | MIE_JVS_COIN_COUNTER_BREAK 0x8000 |
| Coin counter fault. | |
| #define | MIE_JVS_COIN_BUSY (MIE_JVS_COIN_STUFF | MIE_JVS_COIN_COUNTER_BREAK) |
| #define | MIE_JVS_COIN_DEC_LIMIT 0x1000 |
| Auto COINDEC when meter exceeds this. | |
| #define | MIE_JVS_OUTPUT_MASK(index) |
Bit mask for JVS output index index (output 0 = bit 31). | |
| #define | MIE_JVS_OUTPUT_ALL GENMASK(31, 32 - MIE_JVS_OUTPUT_COUNT) |
| All MIE_JVS_OUTPUT_COUNT outputs enabled. | |
| #define | MIE_JVS_OUTPUT_MASK_COUNT(count) |
Bitmask for the first count JVS outputs (output 0 = bit 31). | |
Typedefs | |
| typedef void(* | mie_cont_map_fn_t) (const mie_jvs_inputs_t *jvs, cont_state_t *cont) |
| JVS inputs to Dreamcast controller mapper. | |
| typedef void(* | mie_btn_callback_t) (uint32_t btns) |
| Mapped controller button callback type. | |
| typedef void(* | mie_jvs_callback_t) (mie_jvs_input_t input, uint32_t mask) |
| Native JVS input callback type. | |
Enumerations | |
| enum | mie_jvs_input_t { MIE_JVS_IN_SYSTEM , MIE_JVS_IN_P1 , MIE_JVS_IN_P2 , MIE_JVS_IN_PANEL_DIP , MIE_JVS_IN_PANEL_PSW , MIE_JVS_IN_COIN1 , MIE_JVS_IN_COIN2 } |
| Native JVS input source for mie_jvs_callback(). More... | |
| enum | mie_analog_calib_step_t { MIE_ANALOG_CALIB_IDLE = 0 , MIE_ANALOG_CALIB_WHEEL , MIE_ANALOG_CALIB_WHEEL_CENTER , MIE_ANALOG_CALIB_ACCEL , MIE_ANALOG_CALIB_BRAKE } |
| Interactive calibration step. More... | |
| enum | mie_port0_mode_t { MIE_PORT0_UNKNOWN = 0 , MIE_PORT0_JVS , MIE_PORT0_MAPLE } |
| NAOMI port A wiring mode. More... | |
Functions | |
| mie_port0_mode_t | mie_port0_mode (void) |
| Query NAOMI port A wiring mode. | |
| uint16_t | mie_get_coin_meter (uint8_t slot) |
| Read cached coin slot meter. | |
| bool | mie_read_coin_input (mie_jvs_coin_slot_t *out, int max_slots) |
| Copy cached coin slot state from the last poll. | |
| bool | mie_coin_decrease (uint8_t slot, uint16_t amount, bool block) |
| Send JVS COINDEC (0x30) for a coin slot. | |
| bool | mie_coin_add (uint8_t slot, uint16_t amount, bool block) |
| Send JVS COINADD (0x35) for a coin slot. | |
| uint8_t | mie_jvs_driver_outputs (void) |
| Number of JVS outputs reported by the I/O board. | |
| bool | mie_jvs_set_outputs (uint32_t outputs, bool block) |
| Set all JVS general purpose outputs at once. | |
| bool | mie_jvs_set_output (uint8_t index, bool on, bool block) |
| Set a single JVS general purpose output. | |
| uint32_t | mie_jvs_get_outputs (void) |
| Get the cached JVS general purpose output state. | |
| int | mie_btn_callback (uint32_t btns, mie_btn_callback_t cb) |
| Set an automatic mapped button press callback. | |
| int | mie_jvs_callback (mie_jvs_input_t input, uint32_t mask, mie_jvs_callback_t cb) |
| Set an automatic native JVS input callback. | |
| void | mie_set_cont_map (mie_cont_map_fn_t fn) |
| Install a custom JVS-to-controller mapper. | |
| char * | mie_get_id (char *dst) |
| Read the MIE board identifier string. | |
| bool | mie_get_eeprom (void *dst) |
| Read the MIE on-board EEPROM. | |
| bool | mie_set_eeprom (uint8_t *eeprom) |
| Write the MIE on-board EEPROM. | |
| uint16_t | mie_eeprom_crc16 (const uint8_t *buf, size_t size) |
| Compute Sega NAOMI EEPROM CRC-16. | |
| void | mie_eeprom_fix_crc (uint8_t *eeprom) |
| Recompute NAOMI EEPROM CRC fields in a 128-byte buffer. | |
| const mie_analog_calib_t * | mie_analog_calib_get (void) |
| Get the active driver calibration. | |
| void | mie_analog_calib_set (const mie_analog_calib_t *calib) |
| Install a calibration set. | |
| bool | mie_analog_calib_valid (void) |
| Check whether the active calibration has usable ranges. | |
| void | mie_analog_calib_reset (void) |
| Clear the active calibration and any running session. | |
| void | mie_analog_calib_start (void) |
| Start the interactive calibration session. | |
| void | mie_analog_calib_cancel (void) |
| Cancel a running calibration session. | |
| bool | mie_analog_calib_active (void) |
| Check whether a calibration session is running. | |
| mie_analog_calib_step_t | mie_analog_calib_current (void) |
| Query the current calibration step. | |
| bool | mie_analog_calib_capture (void) |
| Confirm the current step and advance the session. | |
| int | mie_analog_norm_wheel (uint16_t raw) |
| Normalize a raw JVS wheel value. | |
| int | mie_analog_norm_accel (uint16_t raw) |
| Normalize a raw JVS accelerator value. | |
| int | mie_analog_norm_brake (uint16_t raw) |
| Normalize a raw JVS brake value. | |
| bool | mie_init_fw (const char *fw_path) |
| Initialize MIE/JVS, uploading Z80 firmware when needed. | |
Definitions for the NAOMI MIE-JVS bridge Maple device.
This file contains the public API for the MIE (Maple I/O Emulator) driver for NAOMI and NAOMI 2, which bridges the Maple bus to a JVS I/O board.