]> git.karo-electronics.de Git - oswald.git/blobdiff - metawatch/bt_hci.h
Here we are! MetaWatch support in Oswald!
[oswald.git] / metawatch / bt_hci.h
diff --git a/metawatch/bt_hci.h b/metawatch/bt_hci.h
new file mode 100644 (file)
index 0000000..deecc91
--- /dev/null
@@ -0,0 +1,92 @@
+#ifndef _BT_HCI_H
+#define _BT_HCI_H
+
+/* HCI Command OGF */
+#define HCI_LINK_CTRL_OGF 0x01
+#define HCI_LINK_POLICY_OGF 0x02
+#define HCI_HC_BB_OGF 0x03
+#define HCI_INFO_PARAM_OGF 0x04
+
+/* HCI Command OCF */
+#define HCI_DISCONN_OCF                        0x06
+#define HCI_ACCEPT_CONN_REQ_OCF                0x09
+#define HCI_RESET_OCF                  0x03
+#define HCI_W_SCAN_EN_OCF              0x1A
+#define HCI_R_COD_OCF                  0x23
+#define HCI_W_COD_OCF                  0x24
+#define HCI_H_BUF_SIZE_OCF             0x33
+#define HCI_H_NUM_COMPL_OCF            0x35
+#define HCI_R_BUF_SIZE_OCF             0x05
+#define HCI_R_BD_ADDR_OCF              0x09
+#define HCI_W_LOCAL_NAME_OCF           0x13
+#define HCI_PIN_CODE_REQ_REP_OCF       0x0D
+#define HCI_R_STORED_LINK_KEY_OCF      0x0D
+#define HCI_W_STORED_LINK_KEY_OCF      0x11
+#define HCI_LINK_KEY_REQ_REP_OCF       0x0B
+
+#define HCI_COMMAND_PACKET             0x01
+#define HCI_ACL_DATA_PACKET            0x02
+#define HCI_SCO_DATA_PACKET            0x03
+#define HCI_EVENT_PACKET               0x04
+
+#define HCI_EVENT_INQUIRY_COMPLETE                             0x01
+#define HCI_EVENT_INQUIRY_RESULT                               0x02
+#define HCI_EVENT_CONNECTION_COMPLETE                          0x03
+#define HCI_EVENT_CONNECTION_REQUEST                           0x04
+#define HCI_EVENT_DISCONNECTION_COMPLETE                       0x05
+#define HCI_EVENT_AUTHENTICATION_COMPLETE_EVENT                        0x06
+#define HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE                 0x07
+#define HCI_EVENT_ENCRYPTION_CHANGE                            0x08
+#define HCI_EVENT_CHANGE_CONNECTION_LINK_KEY_COMPLETE          0x09
+#define HCI_EVENT_MASTER_LINK_KEY_COMPLETE                     0x0A
+#define HCI_EVENT_READ_REMOTE_SUPPORTED_FEATURES_COMPLETE      0x0B
+#define HCI_EVENT_READ_REMOTE_VERSION_INFORMATION_COMPLETE     0x0C
+#define HCI_EVENT_QOS_SETUP_COMPLETE                           0x0D
+#define HCI_EVENT_COMMAND_COMPLETE                             0x0E
+#define HCI_EVENT_COMMAND_STATUS                               0x0F
+#define HCI_EVENT_HARDWARE_ERROR                               0x10
+#define HCI_EVENT_FLUSH_OCCURED                                        0x11
+#define HCI_EVENT_ROLE_CHANGE                                  0x12
+#define HCI_EVENT_NUMBER_OF_COMPLETED_PACKETS                  0x13
+#define HCI_EVENT_MODE_CHANGE_EVENT                            0x14
+#define HCI_EVENT_RETURN_LINK_KEYS                             0x15
+#define HCI_EVENT_PIN_CODE_REQUEST                             0x16
+#define HCI_EVENT_LINK_KEY_REQUEST                             0x17
+#define HCI_EVENT_LINK_KEY_NOTIFICATION                                0x18
+#define HCI_EVENT_DATA_BUFFER_OVERFLOW                         0x1A
+#define HCI_EVENT_MAX_SLOTS_CHANGED                            0x1B
+#define HCI_EVENT_READ_CLOCK_OFFSET_COMPLETE                   0x1C
+#define HCI_EVENT_PACKET_TYPE_CHANGED                          0x1D
+#define HCI_EVENT_PAGE_SCAN_REPETION_MODE_CHANGE               0x20
+#define HCI_EVENT_INQUIRY_RESULT_WITH_RSSI                     0x22
+#define HCI_EVENT_EXTENDED_INQUIRY_RESPONSE                    0x2F
+#define HCI_EVENT_LE_META                                      0x3E
+#define HCI_EVENT_VENDOR_SPECIFIC                              0xFF
+
+#define HCI_SUBEVENT_LE_CONNECTION_COMPLETE                    0x01
+#define HCI_SUBEVENT_LE_ADVERTISING_REPORT                     0x02
+#define HCI_SUBEVENT_LE_CONNECTION_UPDATE_COMPLETE             0x03
+#define HCI_SUBEVENT_LE_READ_REMOTE_USED_FEATURES_COMPLETE     0x04
+#define HCI_SUBEVENT_LE_LONG_TERM_KEY_REQUEST                  0x05
+
+#define HCI_LINK_TYPE_SCO      0x00
+#define HCI_LINK_TYPE_ACL      0x01
+#define HCI_LINK_TYPE_ESCO     0x02
+
+#define HCI_BB_SCAN_NOSCAN     0x00
+#define HCI_BB_SCAN_INQUIRY    0x01
+#define HCI_BB_SCAN_PAGE       0x02
+
+/* CC256x specific eHCILL */
+#define EHCILL_GO_TO_SLEEP_IND         0x30
+#define EHCILL_GO_TO_SLEEP_ACK         0x31
+#define EHCILL_WAKE_UP_IND             0x32
+#define EHCILL_WAKE_UP_ACK             0x33
+
+void bt_hci_init(void);
+void bt_hci_cmd(const uint8_t OGF, const uint8_t OCF, const uint8_t data_len, const void *data);
+void bt_acl_send(const uint16_t handle, const uint8_t PB, const uint8_t BC, const uint16_t channel, const uint16_t len, const void *dat);
+uint8_t *bt_hci_get_local_bdaddr(void);
+void bt_hci_ehcill_wake(void);
+#endif
+