#ifndef PS2_H #define PS2_H #include "libsys.h" // -------------------------------------------------- // Types // -------------------------------------------------- enum { ps2_type_unknown = 0, ps2_type_keyb, ps2_type_mouse }; typedef struct _sps2_if_t { uint32_t type; volatile uint32_t *pCTRL; volatile uint32_t *pDATA; } ps2_if_t; // -------------------------------------------------- // Constants // -------------------------------------------------- #define PS2_MODULE_PREFIX 0x1000000 #define PS2_SUCCESS LSYS_SUCCESS #define PS2_ERROR (LSYS_ERR_BASE | PS2_MODULE_PREFIX) #define PS2_ERR_TIMEOUT (PS2_ERROR | 0x0000001) #define PS2_ERR_PS2_PREFIX (PS2_ERROR | 0x0010000) // -------------------------------------------------- // Functions // -------------------------------------------------- uint32_t PS2_get_num_if(void); uint32_t PS2_init(ps2_if_t *pIF); void PS2_byte_write(ps2_if_t *pIF, uint8_t byte); uint32_t PS2_byte_read(ps2_if_t *pIF, uint32_t timeout_ms); int PS2_readchar(void const *pInst); void PS2_open(void const *pInst); void PS2_close(void const *pInst); uint32_t PS2_cmd(ps2_if_t *pIF, uint8_t cmd, uint32_t ack_timeout_ms); void PS2_flush(ps2_if_t *pIF); #endif // PS2_H