2012-12-06 15:15:58 +04:00
|
|
|
#ifndef HW_ESCC_H
|
2016-06-29 16:29:06 +03:00
|
|
|
#define HW_ESCC_H
|
2012-12-06 15:15:58 +04:00
|
|
|
|
2018-02-14 09:35:58 +03:00
|
|
|
#include "chardev/char-fe.h"
|
|
|
|
#include "chardev/char-serial.h"
|
2019-08-12 08:23:31 +03:00
|
|
|
#include "hw/sysbus.h"
|
2018-02-14 09:35:58 +03:00
|
|
|
#include "ui/input.h"
|
2020-09-03 23:43:22 +03:00
|
|
|
#include "qom/object.h"
|
2018-02-14 09:35:58 +03:00
|
|
|
|
2009-01-12 20:38:28 +03:00
|
|
|
/* escc.c */
|
2013-07-24 23:30:40 +04:00
|
|
|
#define TYPE_ESCC "escc"
|
2009-01-12 20:38:28 +03:00
|
|
|
#define ESCC_SIZE 4
|
|
|
|
|
2020-09-16 21:25:19 +03:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(ESCCState, ESCC)
|
2018-02-14 09:35:58 +03:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
escc_chn_a, escc_chn_b,
|
|
|
|
} ESCCChnID;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
escc_serial, escc_kbd, escc_mouse,
|
|
|
|
} ESCCChnType;
|
|
|
|
|
|
|
|
#define ESCC_SERIO_QUEUE_SIZE 256
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint8_t data[ESCC_SERIO_QUEUE_SIZE];
|
|
|
|
int rptr, wptr, count;
|
|
|
|
} ESCCSERIOQueue;
|
|
|
|
|
|
|
|
#define ESCC_SERIAL_REGS 16
|
|
|
|
typedef struct ESCCChannelState {
|
|
|
|
qemu_irq irq;
|
|
|
|
uint32_t rxint, txint, rxint_under_svc, txint_under_svc;
|
|
|
|
struct ESCCChannelState *otherchn;
|
|
|
|
uint32_t reg;
|
|
|
|
uint8_t wregs[ESCC_SERIAL_REGS], rregs[ESCC_SERIAL_REGS];
|
|
|
|
ESCCSERIOQueue queue;
|
|
|
|
CharBackend chr;
|
|
|
|
int e0_mode, led_mode, caps_lock_mode, num_lock_mode;
|
|
|
|
int disabled;
|
|
|
|
int clock;
|
|
|
|
uint32_t vmstate_dummy;
|
|
|
|
ESCCChnID chn; /* this channel, A (base+4) or B (base+0) */
|
|
|
|
ESCCChnType type;
|
|
|
|
uint8_t rx, tx;
|
|
|
|
QemuInputHandlerState *hs;
|
2023-06-23 21:30:07 +03:00
|
|
|
char *sunkbd_layout;
|
2018-02-14 09:35:58 +03:00
|
|
|
} ESCCChannelState;
|
|
|
|
|
2020-09-03 23:43:22 +03:00
|
|
|
struct ESCCState {
|
2018-02-14 09:35:58 +03:00
|
|
|
SysBusDevice parent_obj;
|
|
|
|
|
|
|
|
struct ESCCChannelState chn[2];
|
|
|
|
uint32_t it_shift;
|
2019-05-26 01:50:04 +03:00
|
|
|
bool bit_swap;
|
2018-02-14 09:35:58 +03:00
|
|
|
MemoryRegion mmio;
|
|
|
|
uint32_t disabled;
|
|
|
|
uint32_t frequency;
|
2020-09-03 23:43:22 +03:00
|
|
|
};
|
2012-12-06 15:15:58 +04:00
|
|
|
|
|
|
|
#endif
|