diff options
Diffstat (limited to 'tmk_core/protocol/adb.c')
-rw-r--r-- | tmk_core/protocol/adb.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/tmk_core/protocol/adb.c b/tmk_core/protocol/adb.c index bbff66df0..5c6c99b4f 100644 --- a/tmk_core/protocol/adb.c +++ b/tmk_core/protocol/adb.c | |||
@@ -60,6 +60,7 @@ static inline void place_bit1(void); | |||
60 | static inline void send_byte(uint8_t data); | 60 | static inline void send_byte(uint8_t data); |
61 | static inline uint16_t wait_data_lo(uint16_t us); | 61 | static inline uint16_t wait_data_lo(uint16_t us); |
62 | static inline uint16_t wait_data_hi(uint16_t us); | 62 | static inline uint16_t wait_data_hi(uint16_t us); |
63 | static inline uint16_t adb_host_dev_recv(uint8_t device); | ||
63 | 64 | ||
64 | 65 | ||
65 | void adb_host_init(void) | 66 | void adb_host_init(void) |
@@ -121,12 +122,33 @@ bool adb_host_psw(void) | |||
121 | // | 122 | // |
122 | // [from Apple IIgs Hardware Reference Second Edition] | 123 | // [from Apple IIgs Hardware Reference Second Edition] |
123 | 124 | ||
125 | enum { | ||
126 | ADDR_KEYB = 0x20, | ||
127 | ADDR_MOUSE = 0x30 | ||
128 | }; | ||
129 | |||
124 | uint16_t adb_host_kbd_recv(void) | 130 | uint16_t adb_host_kbd_recv(void) |
125 | { | 131 | { |
132 | return adb_host_dev_recv(ADDR_KEYB); | ||
133 | } | ||
134 | |||
135 | #ifdef ADB_MOUSE_ENABLE | ||
136 | void adb_mouse_init(void) { | ||
137 | return; | ||
138 | } | ||
139 | |||
140 | uint16_t adb_host_mouse_recv(void) | ||
141 | { | ||
142 | return adb_host_dev_recv(ADDR_MOUSE); | ||
143 | } | ||
144 | #endif | ||
145 | |||
146 | static inline uint16_t adb_host_dev_recv(uint8_t device) | ||
147 | { | ||
126 | uint16_t data = 0; | 148 | uint16_t data = 0; |
127 | cli(); | 149 | cli(); |
128 | attention(); | 150 | attention(); |
129 | send_byte(0x2C); // Addr:Keyboard(0010), Cmd:Talk(11), Register0(00) | 151 | send_byte(device|0x0C); // Addr:Keyboard(0010)/Mouse(0011), Cmd:Talk(11), Register0(00) |
130 | place_bit0(); // Stopbit(0) | 152 | place_bit0(); // Stopbit(0) |
131 | if (!wait_data_hi(500)) { // Service Request(310us Adjustable Keyboard): just ignored | 153 | if (!wait_data_hi(500)) { // Service Request(310us Adjustable Keyboard): just ignored |
132 | sei(); | 154 | sei(); |