forked from arti/vt1200
Distils public docs into reference/keyboard-mouse/PROTOCOL.md for the level-1 Keyboard (27) / Mouse (26) device tests: - keyboard: 4800 8N1 RS-423, self-test via FD -> 01 00 00 00 (errors 3D/3E) - mouse: 4800 8O1 RS-232, self-test via 'T' -> 4-byte report (errors 3D/3E, >=0x20 fatal) - separate ports: DUART2 A=keyboard, B=mouse (NOT daisy-chained) MAME already has an LK201 device (src/mame/dec/lk201.cpp/.h) but no DEC mouse.
28 lines
912 B
C
28 lines
912 B
C
#ifndef UART_H
|
|
#define UART_H
|
|
|
|
/* This implements an LK201-style UART with a 4-byte TX buffer and flow control
|
|
* via locking. */
|
|
|
|
typedef void (*serial_cb)(uint8_t c);
|
|
|
|
int uart_init(void);
|
|
int uart_set_rx_callback(serial_cb serial_cb);
|
|
|
|
/* These return the number of bytes written. When unlocked, the functions block
|
|
* until all bytes have been written, but when locked, they return once the TX
|
|
* buffer is full. */
|
|
int uart_write_byte(unsigned char out_char);
|
|
int uart_write(const unsigned char buf[], size_t count);
|
|
|
|
/* Lock the UART LK201-style. Let the TX buffer fill up. */
|
|
void uart_lock(void);
|
|
/* Unlock the UART and flush the TX buffer, blocking until it is empty. */
|
|
void uart_unlock(void);
|
|
/* Returns true if an overflow occurred since the keyboard was last locked. */
|
|
bool uart_overflow_get(void);
|
|
/* Flush the TX buffer and block until it is empty. */
|
|
void uart_flush(void);
|
|
|
|
#endif /* UART_H */
|