2018-11-08 20:44:34 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "jvs/jvs-bus.h"
|
|
|
|
|
|
|
|
struct io3_switch_state {
|
|
|
|
/* Note: this struct is host-endian. The IO3 emulator handles the conversion
|
|
|
|
to protocol-endian. */
|
|
|
|
|
|
|
|
uint8_t system;
|
|
|
|
uint16_t p1;
|
|
|
|
uint16_t p2;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct io3_ops {
|
|
|
|
void (*reset)(void *ctx);
|
|
|
|
void (*write_gpio)(void *ctx, uint32_t state);
|
|
|
|
void (*read_switches)(void *ctx, struct io3_switch_state *out);
|
2019-05-03 21:57:12 +02:00
|
|
|
void (*read_analogs)(void *ctx, uint16_t *analogs, uint8_t nanalogs);
|
2024-05-12 19:39:56 +02:00
|
|
|
void (*read_rotarys)(void *ctx, uint16_t *rotaries, uint8_t nrotaries);
|
2019-08-03 23:41:39 +02:00
|
|
|
void (*read_coin_counter)(void *ctx, uint8_t slot_no, uint16_t *out);
|
2018-11-08 20:44:34 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct io3 {
|
|
|
|
struct jvs_node jvs;
|
|
|
|
uint8_t addr;
|
|
|
|
const struct io3_ops *ops;
|
|
|
|
void *ops_ctx;
|
|
|
|
};
|
|
|
|
|
|
|
|
void io3_init(
|
|
|
|
struct io3 *io3,
|
|
|
|
struct jvs_node *next,
|
|
|
|
const struct io3_ops *ops,
|
|
|
|
void *ops_ctx);
|
2019-11-03 19:00:55 +01:00
|
|
|
|
|
|
|
struct jvs_node *io3_to_jvs_node(struct io3 *io3);
|