]> git.friedersdorff.com Git - max/tmk_keyboard.git/blobdiff - tmk_core/protocol/ibmpc.h
Merge remote-tracking branch 'tmk/master'
[max/tmk_keyboard.git] / tmk_core / protocol / ibmpc.h
index 47e71e27e60288607b425bf29f4bd7b499db8787..64bc2c8ad428040842d98a9a96e249a24b2c8bf0 100644 (file)
@@ -70,28 +70,39 @@ POSSIBILITY OF SUCH DAMAGE.
 #define IBMPC_RESEND      0xFE
 #define IBMPC_SET_LED     0xED
 
-#define IBMPC_PROTOCOL_AT   0
-#define IBMPC_PROTOCOL_XT   1
-
-// TODO: error numbers
+#define IBMPC_PROTOCOL_NO       0
+#define IBMPC_PROTOCOL_AT       0x10
+#define IBMPC_PROTOCOL_AT_Z150  0x11
+#define IBMPC_PROTOCOL_XT       0x20
+#define IBMPC_PROTOCOL_XT_IBM   0x21
+#define IBMPC_PROTOCOL_XT_CLONE 0x22
+#define IBMPC_PROTOCOL_XT_ERROR 0x23
+
+// Error numbers
 #define IBMPC_ERR_NONE        0
 #define IBMPC_ERR_RECV        0x00
 #define IBMPC_ERR_SEND        0x10
 #define IBMPC_ERR_TIMEOUT     0x20
 #define IBMPC_ERR_FULL        0x40
+#define IBMPC_ERR_ILLEGAL     0x80
+#define IBMPC_ERR_FF          0xF0
 
 #define IBMPC_LED_SCROLL_LOCK 0
 #define IBMPC_LED_NUM_LOCK    1
 #define IBMPC_LED_CAPS_LOCK   2
 
 
+extern volatile uint16_t ibmpc_isr_debug;
 extern volatile uint8_t ibmpc_protocol;
 extern volatile uint8_t ibmpc_error;
 
 void ibmpc_host_init(void);
+void ibmpc_host_enable(void);
+void ibmpc_host_disable(void);
 int16_t ibmpc_host_send(uint8_t data);
 int16_t ibmpc_host_recv_response(void);
 int16_t ibmpc_host_recv(void);
+void ibmpc_host_isr_clear(void);
 void ibmpc_host_set_led(uint8_t usb_led);
 
 
@@ -102,12 +113,6 @@ void ibmpc_host_set_led(uint8_t usb_led);
 /*
  * Clock
  */
-static inline void clock_init(void)
-{
-    IBMPC_CLOCK_PORT &= ~(1<<IBMPC_CLOCK_BIT);
-    IBMPC_CLOCK_DDR  |=  (1<<IBMPC_CLOCK_BIT);
-}
-
 static inline void clock_lo(void)
 {
     IBMPC_CLOCK_PORT &= ~(1<<IBMPC_CLOCK_BIT);
@@ -132,12 +137,6 @@ static inline bool clock_in(void)
 /*
  * Data
  */
-static inline void data_init(void)
-{
-    IBMPC_DATA_DDR  &= ~(1<<IBMPC_DATA_BIT);
-    IBMPC_DATA_PORT |=  (1<<IBMPC_DATA_BIT);
-}
-
 static inline void data_lo(void)
 {
     IBMPC_DATA_PORT &= ~(1<<IBMPC_DATA_BIT);
@@ -189,11 +188,17 @@ static inline void idle(void)
     data_hi();
 }
 
-/* inhibit device to send */
+/* inhibit device to send(AT), soft reset(XT) */
 static inline void inhibit(void)
 {
     clock_lo();
     data_hi();
 }
 
+/* inhibit device to send(XT) */
+static inline void inhibit_xt(void)
+{
+    clock_hi();
+    data_lo();
+}
 #endif