From ded325925749bfc575ae5af8b28cb5f43d5f8705 Mon Sep 17 00:00:00 2001 From: Oliver Ruiz Dorantes Date: Thu, 31 Jul 2008 19:51:16 +0000 Subject: [PATCH] Patch by Fredrik Ekdahl. Fix tabs and whitespaces git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26701 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/bluetooth/HCI/btHCI.h | 40 +- headers/os/bluetooth/HCI/btHCI_acl.h | 12 +- headers/os/bluetooth/HCI/btHCI_command.h | 598 ++++++++++----------- headers/os/bluetooth/HCI/btHCI_event.h | 282 +++++----- headers/os/bluetooth/HCI/btHCI_module.h | 25 +- headers/os/bluetooth/HCI/btHCI_transport.h | 64 ++- 6 files changed, 523 insertions(+), 498 deletions(-) diff --git a/headers/os/bluetooth/HCI/btHCI.h b/headers/os/bluetooth/HCI/btHCI.h index 3a4bbb3ed2..244e80ed5b 100644 --- a/headers/os/bluetooth/HCI/btHCI.h +++ b/headers/os/bluetooth/HCI/btHCI.h @@ -13,29 +13,29 @@ typedef int32 hci_id; typedef enum { H2 = 2, H3, H4, H5 } transport_type; -typedef enum { BT_COMMAND = 0, - BT_EVENT, - BT_ACL, - BT_SCO, - BT_ESCO, - // more packet types - HCI_NUM_PACKET_TYPES //max - } bt_packet_t; - +typedef enum { BT_COMMAND = 0, + BT_EVENT, + BT_ACL, + BT_SCO, + BT_ESCO, + // more packets here + HCI_NUM_PACKET_TYPES +} bt_packet_t; /* packets sizes */ -#define HCI_MAX_ACL_SIZE 1024 -#define HCI_MAX_SCO_SIZE 255 -#define HCI_MAX_EVENT_SIZE 260 -#define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4) +#define HCI_MAX_ACL_SIZE 1024 +#define HCI_MAX_SCO_SIZE 255 +#define HCI_MAX_EVENT_SIZE 260 +#define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4) /* fields sizes */ -#define HCI_LAP_SIZE 3 /* LAP */ -#define HCI_LINK_KEY_SIZE 16 /* link key */ -#define HCI_PIN_SIZE 16 /* PIN */ -#define HCI_EVENT_MASK_SIZE 8 /* event mask */ -#define HCI_CLASS_SIZE 3 /* class */ -#define HCI_FEATURES_SIZE 8 /* LMP features */ -#define HCI_DEVICE_NAME_SIZE 248 /* unit name size */ +#define HCI_LAP_SIZE 3 /* LAP */ +#define HCI_LINK_KEY_SIZE 16 /* link key */ +#define HCI_PIN_SIZE 16 /* PIN */ +#define HCI_EVENT_MASK_SIZE 8 /* event mask */ +#define HCI_CLASS_SIZE 3 /* class */ +#define HCI_FEATURES_SIZE 8 /* LMP features */ +#define HCI_DEVICE_NAME_SIZE 248 /* unit name size */ #endif + diff --git a/headers/os/bluetooth/HCI/btHCI_acl.h b/headers/os/bluetooth/HCI/btHCI_acl.h index 88a444445a..e39d569afb 100644 --- a/headers/os/bluetooth/HCI/btHCI_acl.h +++ b/headers/os/bluetooth/HCI/btHCI_acl.h @@ -11,7 +11,7 @@ #include #include -#define HCI_ACL_HDR_SIZE 4 +#define HCI_ACL_HDR_SIZE 4 struct hci_acl_header { uint16 handle; /* Handle & Flags(PB, BC) */ @@ -19,7 +19,7 @@ struct hci_acl_header { } __attribute__ ((packed)) ; /* ACL handle and flags pack/unpack */ -#define pack_acl_handle_flags(h, pb, bc) (((h) & 0x0fff) | (((pb) & 3) << 12) | (((bc) & 3) << 14)) +#define pack_acl_handle_flags(h, pb, bc) (((h) & 0x0fff) | (((pb) & 3) << 12) | (((bc) & 3) << 14)) #define get_acl_handle(h) ((h) & 0x0fff) #define get_acl_pb_flag(h) (((h) & 0x3000) >> 12) #define get_acl_bc_flag(h) (((h) & 0xc000) >> 14) @@ -32,8 +32,8 @@ struct hci_acl_header { /* BC flag values */ #define HCI_ACL_POINT2POINT 0x0 /* only Host controller to Host */ -#define HCI_ACL_BROADCAST_ACTIVE 0x1 /* both directions */ -#define HCI_ACL_BROADCAST_PICONET 0x2 /* both directions */ - /* 11 - reserved for future use */ - +#define HCI_ACL_BROADCAST_ACTIVE 0x1 /* both directions */ +#define HCI_ACL_BROADCAST_PICONET 0x2 /* both directions */ + /* 11 - reserved for future use */ + #endif diff --git a/headers/os/bluetooth/HCI/btHCI_command.h b/headers/os/bluetooth/HCI/btHCI_command.h index 3fcf5decb6..c32e8e9a3a 100644 --- a/headers/os/bluetooth/HCI/btHCI_command.h +++ b/headers/os/bluetooth/HCI/btHCI_command.h @@ -14,8 +14,8 @@ #define HCI_COMMAND_HDR_SIZE 3 struct hci_command_header { - uint16 opcode; /* OCF & OGF */ - uint8 clen; + uint16 opcode; /* OCF & OGF */ + uint8 clen; } __attribute__ ((packed)); @@ -28,313 +28,313 @@ struct hci_command_header { /* - Informational Parameters Command definition - */ #define OGF_INFORMATIONAL_PARAM 0x04 - #define OCF_READ_LOCAL_VERSION 0x0001 - struct hci_rp_read_loc_version { - uint8 status; - uint8 hci_ver; - uint16 hci_rev; - uint8 lmp_ver; - uint16 manufacturer; - uint16 lmp_subver; - } __attribute__ ((packed)); - - #define OCF_READ_LOCAL_FEATURES 0x0003 - struct hci_rp_read_loc_features { - uint8 status; - uint8 features[8]; - } __attribute__ ((packed)); - - #define OCF_READ_BUFFER_SIZE 0x0005 - struct hci_rp_read_buffer_size { - uint8 status; - uint16 acl_mtu; - uint8 sco_mtu; - uint16 acl_max_pkt; - uint16 sco_max_pkt; - } __attribute__ ((packed)); - - #define OCF_READ_BD_ADDR 0x0009 - struct hci_rp_read_bd_addr { - uint8 status; - bdaddr_t bdaddr; - } __attribute__ ((packed)); - -/* - Host Controller and Baseband Command definition - */ -#define OGF_CONTROL_BASEBAND 0x03 + #define OCF_READ_LOCAL_VERSION 0x0001 + struct hci_rp_read_loc_version { + uint8 status; + uint8 hci_ver; + uint16 hci_rev; + uint8 lmp_ver; + uint16 manufacturer; + uint16 lmp_subver; + } __attribute__ ((packed)); - #define OCF_RESET 0x0003 + #define OCF_READ_LOCAL_FEATURES 0x0003 + struct hci_rp_read_loc_features { + uint8 status; + uint8 features[8]; + } __attribute__ ((packed)); + + #define OCF_READ_BUFFER_SIZE 0x0005 + struct hci_rp_read_buffer_size { + uint8 status; + uint16 acl_mtu; + uint8 sco_mtu; + uint16 acl_max_pkt; + uint16 sco_max_pkt; + } __attribute__ ((packed)); + + #define OCF_READ_BD_ADDR 0x0009 + struct hci_rp_read_bd_addr { + uint8 status; + bdaddr_t bdaddr; + } __attribute__ ((packed)); + +/* - Host Controller and Baseband Command definition - */ +#define OGF_CONTROL_BASEBAND 0x03 + + #define OCF_RESET 0x0003 /*struct hci_reset { - void no_fields; - } __attribute__ ((packed));*/ - - #define OCF_SET_EVENT_FLT 0x0005 - struct hci_cp_set_event_flt { - uint8 flt_type; - uint8 cond_type; - uint8 condition[0]; - } __attribute__ ((packed)); - - #define OCF_READ_STORED_LINK_KEY 0x000D - struct hci_read_stored_link_key { - bdaddr_t bdaddr; - uint8 all_keys_flag; - } __attribute__ ((packed)); - struct hci_read_stored_link_key_reply { - uint8 status; - uint16 max_num_keys; - uint16 num_keys_read; - } __attribute__ ((packed)); - - #define OCF_WRITE_STORED_LINK_KEY 0x0011 - struct hci_write_stored_link_key { - uint8 num_keys_to_write; - // these are repeated "num_keys_write" times - bdaddr_t bdaddr; - uint8 key[HCI_LINK_KEY_SIZE]; - } __attribute__ ((packed)); - struct hci_write_stored_link_key_reply { - uint8 status; - uint8 num_keys_written; - } __attribute__ ((packed)); - - - #define OCF_WRITE_LOCAL_NAME 0x0013 - #define OCF_READ_LOCAL_NAME 0x0014 - struct hci_rp_read_local_name { - uint8 status; - char local_name[HCI_DEVICE_NAME_SIZE]; - } __attribute__ ((packed)); - - #define OCF_WRITE_CA_TIMEOUT 0x0016 - #define OCF_WRITE_PG_TIMEOUT 0x0018 - - #define OCF_WRITE_SCAN_ENABLE 0x001A - #define HCI_SCAN_DISABLED 0x00 - #define HCI_SCAN_INQUIRY 0x01 - #define HCI_SCAN_PAGE 0x02 - #define HCI_SCAN_INQUIRY_PAGE 0x03 - struct hci_write_scan_enable { - uint8 scan; - } __attribute__ ((packed)); - - #define OCF_READ_AUTH_ENABLE 0x001F - #define OCF_WRITE_AUTH_ENABLE 0x0020 - #define HCI_AUTH_DISABLED 0x00 - #define HCI_AUTH_ENABLED 0x01 - struct hci_write_authentication_enable { - uint8 authentication; - } __attribute__ ((packed)); - - #define OCF_READ_ENCRYPT_MODE 0x0021 - #define OCF_WRITE_ENCRYPT_MODE 0x0022 - #define HCI_ENCRYPT_DISABLED 0x00 - #define HCI_ENCRYPT_P2P 0x01 - #define HCI_ENCRYPT_BOTH 0x02 - struct hci_write_encryption_mode_enable { - uint8 encryption; - } __attribute__ ((packed)); - - /* Filter types */ - #define HCI_FLT_CLEAR_ALL 0x00 - #define HCI_FLT_INQ_RESULT 0x01 - #define HCI_FLT_CONN_SETUP 0x02 - - /* CONN_SETUP Condition types */ - #define HCI_CONN_SETUP_ALLOW_ALL 0x00 - #define HCI_CONN_SETUP_ALLOW_CLASS 0x01 - #define HCI_CONN_SETUP_ALLOW_BDADDR 0x02 - - /* CONN_SETUP Conditions */ - #define HCI_CONN_SETUP_AUTO_OFF 0x01 - #define HCI_CONN_SETUP_AUTO_ON 0x02 - - #define OCF_READ_CLASS_OF_DEV 0x0023 - - struct hci_read_dev_class_reply { - uint8 status; - uint8 dev_class[3]; - } __attribute__ ((packed)); - - #define OCF_WRITE_CLASS_OF_DEV 0x0024 - struct hci_write_dev_class { - uint8 dev_class[3]; - } __attribute__ ((packed)); - - #define OCF_READ_VOICE_SETTING 0x0025 - struct hci_rp_read_voice_setting { - uint8 status; - uint16 voice_setting; - } __attribute__ ((packed)); - - #define OCF_WRITE_VOICE_SETTING 0x0026 - struct hci_cp_write_voice_setting { - uint16 voice_setting; - } __attribute__ ((packed)); - - #define OCF_HOST_BUFFER_SIZE 0x0033 - struct hci_cp_host_buffer_size { - uint16 acl_mtu; - uint8 sco_mtu; - uint16 acl_max_pkt; - uint16 sco_max_pkt; - } __attribute__ ((packed)); - - /* Link Control Command definition */ - #define OGF_LINK_CONTROL 0x01 + void no_fields; + } __attribute__ ((packed));*/ + + #define OCF_SET_EVENT_FLT 0x0005 + struct hci_cp_set_event_flt { + uint8 flt_type; + uint8 cond_type; + uint8 condition[0]; + } __attribute__ ((packed)); + + #define OCF_READ_STORED_LINK_KEY 0x000D + struct hci_read_stored_link_key { + bdaddr_t bdaddr; + uint8 all_keys_flag; + } __attribute__ ((packed)); + struct hci_read_stored_link_key_reply { + uint8 status; + uint16 max_num_keys; + uint16 num_keys_read; + } __attribute__ ((packed)); + + #define OCF_WRITE_STORED_LINK_KEY 0x0011 + struct hci_write_stored_link_key { + uint8 num_keys_to_write; + // these are repeated "num_keys_write" times + bdaddr_t bdaddr; + uint8 key[HCI_LINK_KEY_SIZE]; + } __attribute__ ((packed)); + struct hci_write_stored_link_key_reply { + uint8 status; + uint8 num_keys_written; + } __attribute__ ((packed)); + + + #define OCF_WRITE_LOCAL_NAME 0x0013 + #define OCF_READ_LOCAL_NAME 0x0014 + struct hci_rp_read_local_name { + uint8 status; + char local_name[HCI_DEVICE_NAME_SIZE]; + } __attribute__ ((packed)); + + #define OCF_WRITE_CA_TIMEOUT 0x0016 + #define OCF_WRITE_PG_TIMEOUT 0x0018 + + #define OCF_WRITE_SCAN_ENABLE 0x001A + #define HCI_SCAN_DISABLED 0x00 + #define HCI_SCAN_INQUIRY 0x01 + #define HCI_SCAN_PAGE 0x02 + #define HCI_SCAN_INQUIRY_PAGE 0x03 + struct hci_write_scan_enable { + uint8 scan; + } __attribute__ ((packed)); + + #define OCF_READ_AUTH_ENABLE 0x001F + #define OCF_WRITE_AUTH_ENABLE 0x0020 + #define HCI_AUTH_DISABLED 0x00 + #define HCI_AUTH_ENABLED 0x01 + struct hci_write_authentication_enable { + uint8 authentication; + } __attribute__ ((packed)); + + #define OCF_READ_ENCRYPT_MODE 0x0021 + #define OCF_WRITE_ENCRYPT_MODE 0x0022 + #define HCI_ENCRYPT_DISABLED 0x00 + #define HCI_ENCRYPT_P2P 0x01 + #define HCI_ENCRYPT_BOTH 0x02 + struct hci_write_encryption_mode_enable { + uint8 encryption; + } __attribute__ ((packed)); + + /* Filter types */ + #define HCI_FLT_CLEAR_ALL 0x00 + #define HCI_FLT_INQ_RESULT 0x01 + #define HCI_FLT_CONN_SETUP 0x02 + + /* CONN_SETUP Condition types */ + #define HCI_CONN_SETUP_ALLOW_ALL 0x00 + #define HCI_CONN_SETUP_ALLOW_CLASS 0x01 + #define HCI_CONN_SETUP_ALLOW_BDADDR 0x02 + + /* CONN_SETUP Conditions */ + #define HCI_CONN_SETUP_AUTO_OFF 0x01 + #define HCI_CONN_SETUP_AUTO_ON 0x02 + + #define OCF_READ_CLASS_OF_DEV 0x0023 + + struct hci_read_dev_class_reply { + uint8 status; + uint8 dev_class[3]; + } __attribute__ ((packed)); + + #define OCF_WRITE_CLASS_OF_DEV 0x0024 + struct hci_write_dev_class { + uint8 dev_class[3]; + } __attribute__ ((packed)); + + #define OCF_READ_VOICE_SETTING 0x0025 + struct hci_rp_read_voice_setting { + uint8 status; + uint16 voice_setting; + } __attribute__ ((packed)); + + #define OCF_WRITE_VOICE_SETTING 0x0026 + struct hci_cp_write_voice_setting { + uint16 voice_setting; + } __attribute__ ((packed)); + + #define OCF_HOST_BUFFER_SIZE 0x0033 + struct hci_cp_host_buffer_size { + uint16 acl_mtu; + uint8 sco_mtu; + uint16 acl_max_pkt; + uint16 sco_max_pkt; + } __attribute__ ((packed)); + + /* Link Control Command definition */ + #define OGF_LINK_CONTROL 0x01 - #define OCF_INQUIRY 0x0001 - struct hci_cp_inquiry { - uint8 lap[3]; - uint8 length; - uint8 num_rsp; - } __attribute__ ((packed)); - - #define OCF_INQUIRY_CANCEL 0x0002 + #define OCF_INQUIRY 0x0001 + struct hci_cp_inquiry { + uint8 lap[3]; + uint8 length; + uint8 num_rsp; + } __attribute__ ((packed)); + + #define OCF_INQUIRY_CANCEL 0x0002 - #define OCF_CREATE_CONN 0x0005 - struct hci_cp_create_conn { - bdaddr_t bdaddr; - uint16 pkt_type; - uint8 pscan_rep_mode; - uint8 pscan_mode; - uint16 clock_offset; - uint8 role_switch; - } __attribute__ ((packed)); - - #define OCF_DISCONNECT 0x0006 - struct hci_disconnect { - uint16 handle; - uint8 reason; - } __attribute__ ((packed)); - - #define OCF_ADD_SCO 0x0007 - struct hci_cp_add_sco { - uint16 handle; - uint16 pkt_type; - } __attribute__ ((packed)); + #define OCF_CREATE_CONN 0x0005 + struct hci_cp_create_conn { + bdaddr_t bdaddr; + uint16 pkt_type; + uint8 pscan_rep_mode; + uint8 pscan_mode; + uint16 clock_offset; + uint8 role_switch; + } __attribute__ ((packed)); + + #define OCF_DISCONNECT 0x0006 + struct hci_disconnect { + uint16 handle; + uint8 reason; + } __attribute__ ((packed)); + + #define OCF_ADD_SCO 0x0007 + struct hci_cp_add_sco { + uint16 handle; + uint16 pkt_type; + } __attribute__ ((packed)); - #define OCF_ACCEPT_CONN_REQ 0x0009 - struct hci_cp_accept_conn_req { - bdaddr_t bdaddr; - uint8 role; - } __attribute__ ((packed)); - - #define OCF_REJECT_CONN_REQ 0x000a - struct hci_cp_reject_conn_req { - bdaddr_t bdaddr; - uint8 reason; - } __attribute__ ((packed)); - - #define OCF_LINK_KEY_REPLY 0x000B - struct hci_cp_link_key_reply { - bdaddr_t bdaddr; - uint8 link_key[16]; - } __attribute__ ((packed)); - - #define OCF_LINK_KEY_NEG_REPLY 0x000C - struct hci_cp_link_key_neg_reply { - bdaddr_t bdaddr; - } __attribute__ ((packed)); - - #define OCF_PIN_CODE_REPLY 0x000D - struct hci_cp_pin_code_reply { - bdaddr_t bdaddr; - uint8 pin_len; - uint8 pin_code[HCI_PIN_SIZE]; - } __attribute__ ((packed)); - - #define OCF_PIN_CODE_NEG_REPLY 0x000E - struct hci_cp_pin_code_neg_reply { - bdaddr_t bdaddr; - } __attribute__ ((packed)); - - #define OCF_CHANGE_CONN_PTYPE 0x000F - struct hci_cp_change_conn_ptype { - uint16 handle; - uint16 pkt_type; - } __attribute__ ((packed)); - - #define OCF_AUTH_REQUESTED 0x0011 - struct hci_cp_auth_requested { - uint16 handle; - } __attribute__ ((packed)); - - #define OCF_SET_CONN_ENCRYPT 0x0013 - struct hci_cp_set_conn_encrypt { - uint16 handle; - uint8 encrypt; - } __attribute__ ((packed)); - - #define OCF_CHANGE_CONN_LINK_KEY 0x0015 - struct hci_cp_change_conn_link_key { - uint16 handle; - } __attribute__ ((packed)); - - #define OCF_REMOTE_NAME_REQUEST 0x0019 - struct hci_remote_name_request { - bdaddr_t bdaddr; - uint8 pscan_rep_mode; - uint8 reserved; - uint16 clock_offset; - } __attribute__ ((packed)); - - #define OCF_READ_REMOTE_FEATURES 0x001B - struct hci_cp_read_rmt_features { - uint16 handle; - } __attribute__ ((packed)); - - #define OCF_READ_REMOTE_VERSION 0x001D - struct hci_cp_read_rmt_version { - uint16 handle; - } __attribute__ ((packed)); - - + #define OCF_ACCEPT_CONN_REQ 0x0009 + struct hci_cp_accept_conn_req { + bdaddr_t bdaddr; + uint8 role; + } __attribute__ ((packed)); + + #define OCF_REJECT_CONN_REQ 0x000a + struct hci_cp_reject_conn_req { + bdaddr_t bdaddr; + uint8 reason; + } __attribute__ ((packed)); + + #define OCF_LINK_KEY_REPLY 0x000B + struct hci_cp_link_key_reply { + bdaddr_t bdaddr; + uint8 link_key[16]; + } __attribute__ ((packed)); + + #define OCF_LINK_KEY_NEG_REPLY 0x000C + struct hci_cp_link_key_neg_reply { + bdaddr_t bdaddr; + } __attribute__ ((packed)); + + #define OCF_PIN_CODE_REPLY 0x000D + struct hci_cp_pin_code_reply { + bdaddr_t bdaddr; + uint8 pin_len; + uint8 pin_code[HCI_PIN_SIZE]; + } __attribute__ ((packed)); + + #define OCF_PIN_CODE_NEG_REPLY 0x000E + struct hci_cp_pin_code_neg_reply { + bdaddr_t bdaddr; + } __attribute__ ((packed)); + + #define OCF_CHANGE_CONN_PTYPE 0x000F + struct hci_cp_change_conn_ptype { + uint16 handle; + uint16 pkt_type; + } __attribute__ ((packed)); + + #define OCF_AUTH_REQUESTED 0x0011 + struct hci_cp_auth_requested { + uint16 handle; + } __attribute__ ((packed)); + + #define OCF_SET_CONN_ENCRYPT 0x0013 + struct hci_cp_set_conn_encrypt { + uint16 handle; + uint8 encrypt; + } __attribute__ ((packed)); + + #define OCF_CHANGE_CONN_LINK_KEY 0x0015 + struct hci_cp_change_conn_link_key { + uint16 handle; + } __attribute__ ((packed)); + + #define OCF_REMOTE_NAME_REQUEST 0x0019 + struct hci_remote_name_request { + bdaddr_t bdaddr; + uint8 pscan_rep_mode; + uint8 reserved; + uint16 clock_offset; + } __attribute__ ((packed)); + + #define OCF_READ_REMOTE_FEATURES 0x001B + struct hci_cp_read_rmt_features { + uint16 handle; + } __attribute__ ((packed)); + + #define OCF_READ_REMOTE_VERSION 0x001D + struct hci_cp_read_rmt_version { + uint16 handle; + } __attribute__ ((packed)); + + /* Link Policy Command definition */ -#define OGF_LINK_POLICY 0x02 +#define OGF_LINK_POLICY 0x02 - #define OCF_ROLE_DISCOVERY 0x0009 - struct hci_cp_role_discovery { - uint16 handle; - } __attribute__ ((packed)); - struct hci_rp_role_discovery { - uint8 status; - uint16 handle; - uint8 role; - } __attribute__ ((packed)); - - #define OCF_READ_LINK_POLICY 0x000C - struct hci_cp_read_link_policy { - uint16 handle; - } __attribute__ ((packed)); - struct hci_rp_read_link_policy { - uint8 status; - uint16 handle; - uint16 policy; - } __attribute__ ((packed)); - - #define OCF_SWITCH_ROLE 0x000B - struct hci_cp_switch_role { - bdaddr_t bdaddr; - uint8 role; - } __attribute__ ((packed)); - - #define OCF_WRITE_LINK_POLICY 0x000D - struct hci_cp_write_link_policy { - uint16 handle; - uint16 policy; - } __attribute__ ((packed)); - struct hci_rp_write_link_policy { - uint8 status; - uint16 handle; - } __attribute__ ((packed)); - + #define OCF_ROLE_DISCOVERY 0x0009 + struct hci_cp_role_discovery { + uint16 handle; + } __attribute__ ((packed)); + struct hci_rp_role_discovery { + uint8 status; + uint16 handle; + uint8 role; + } __attribute__ ((packed)); + + #define OCF_READ_LINK_POLICY 0x000C + struct hci_cp_read_link_policy { + uint16 handle; + } __attribute__ ((packed)); + struct hci_rp_read_link_policy { + uint8 status; + uint16 handle; + uint16 policy; + } __attribute__ ((packed)); + + #define OCF_SWITCH_ROLE 0x000B + struct hci_cp_switch_role { + bdaddr_t bdaddr; + uint8 role; + } __attribute__ ((packed)); + + #define OCF_WRITE_LINK_POLICY 0x000D + struct hci_cp_write_link_policy { + uint16 handle; + uint16 policy; + } __attribute__ ((packed)); + struct hci_rp_write_link_policy { + uint8 status; + uint16 handle; + } __attribute__ ((packed)); + /* Status params */ -#define OGF_STATUS_PARAM 0x05 - +#define OGF_STATUS_PARAM 0x05 + /* Testing commands */ -#define OGF_TESTING_CMD 0x3E +#define OGF_TESTING_CMD 0x3E /* Vendor specific commands */ -#define OGF_VENDOR_CMD 0x3F +#define OGF_VENDOR_CMD 0x3F #endif diff --git a/headers/os/bluetooth/HCI/btHCI_event.h b/headers/os/bluetooth/HCI/btHCI_event.h index 5d9744a115..64d8cf7969 100644 --- a/headers/os/bluetooth/HCI/btHCI_event.h +++ b/headers/os/bluetooth/HCI/btHCI_event.h @@ -11,232 +11,248 @@ #include #include -#define HCI_EVENT_HDR_SIZE 2 +#define HCI_EVENT_HDR_SIZE 2 struct hci_event_header { - uint8 ecode; - uint8 elen; + uint8 ecode; + uint8 elen; } __attribute__ ((packed)); /* ---- HCI Events ---- */ -#define HCI_EVENT_INQUIRY_COMPLETE 0x01 +#define HCI_EVENT_INQUIRY_COMPLETE 0x01 -#define HCI_EVENT_INQUIRY_RESULT 0x02 +#define HCI_EVENT_INQUIRY_RESULT 0x02 struct inquiry_info { - bdaddr_t bdaddr; - uint8 pscan_rep_mode; - uint8 pscan_period_mode; - uint8 pscan_mode; - uint8 dev_class[3]; - uint16 clock_offset; + bdaddr_t bdaddr; + uint8 pscan_rep_mode; + uint8 pscan_period_mode; + uint8 pscan_mode; + uint8 dev_class[3]; + uint16 clock_offset; } __attribute__ ((packed)); -#define HCI_EVENT_CONN_COMPLETE 0x03 +#define HCI_EVENT_CONN_COMPLETE 0x03 struct hci_ev_conn_complete { - uint8 status; - uint16 handle; - bdaddr_t bdaddr; - uint8 link_type; - uint8 encrypt_mode; + uint8 status; + uint16 handle; + bdaddr_t bdaddr; + uint8 link_type; + uint8 encrypt_mode; } __attribute__ ((packed)); -#define HCI_EVENT_CONN_REQUEST 0x04 +#define HCI_EVENT_CONN_REQUEST 0x04 struct hci_ev_conn_request { - bdaddr_t bdaddr; - uint8 dev_class[3]; - uint8 link_type; + bdaddr_t bdaddr; + uint8 dev_class[3]; + uint8 link_type; } __attribute__ ((packed)); +<<<<<<< .mine +#define HCI_EVENT_DISCONNECTION_COMPLETE 0x05 +struct hci_ev_disconnection_complete_reply { + uint8 status; + uint16 handle; + uint8 reason; +======= #define HCI_EVENT_DISCONNECTION_COMPLETE 0x05 struct hci_ev_disconnection_complete_reply { uint8 status; uint16 handle; uint8 reason; +>>>>>>> .r26700 } __attribute__ ((packed)); -#define HCI_EVENT_AUTH_COMPLETE 0x06 +#define HCI_EVENT_AUTH_COMPLETE 0x06 struct hci_ev_auth_complete { - uint8 status; - uint16 handle; + uint8 status; + uint16 handle; } __attribute__ ((packed)); +<<<<<<< .mine +#define HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE 0x07 +struct hci_ev_remote_name_request_complete_reply { + uint8 status; + bdaddr_t bdaddr; + char remote_name[248]; +======= #define HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE 0x07 struct hci_ev_remote_name_request_complete_reply { uint8 status; bdaddr_t bdaddr; char remote_name[248]; +>>>>>>> .r26700 } __attribute__ ((packed)); -#define HCI_EVENT_ENCRYPT_CHANGE 0x08 +#define HCI_EVENT_ENCRYPT_CHANGE 0x08 struct hci_ev_encrypt_change { - uint8 status; - uint16 handle; - uint8 encrypt; + uint8 status; + uint16 handle; + uint8 encrypt; } __attribute__ ((packed)); -#define HCI_EVENT_CHANGE_CONN_LINK_KEY_COMPLETE 0x09 +#define HCI_EVENT_CHANGE_CONN_LINK_KEY_COMPLETE 0x09 struct hci_ev_change_conn_link_key_complete { - uint8 status; - uint16 handle; + uint8 status; + uint16 handle; } __attribute__ ((packed)); -#define HCI_EVENT_MASTER_LINK_KEY_COMPL 0x0a +#define HCI_EVENT_MASTER_LINK_KEY_COMPL 0x0a struct hci_ev_master_link_key_complete { - uint8 status; /* 0x00 - success */ - uint16 handle; /* Connection handle */ - uint8 key_flag; /* Key flag */ + uint8 status; /* 0x00 - success */ + uint16 handle; /* Connection handle */ + uint8 key_flag; /* Key flag */ } __attribute__ ((packed)); -#define HCI_EVENT_RMT_FEATURES 0x0B +#define HCI_EVENT_RMT_FEATURES 0x0B struct hci_ev_rmt_features { - uint8 status; - uint16 handle; - uint8 features[8]; + uint8 status; + uint16 handle; + uint8 features[8]; } __attribute__ ((packed)); -#define HCI_EVENT_RMT_VERSION 0x0C +#define HCI_EVENT_RMT_VERSION 0x0C struct hci_ev_rmt_version { - uint8 status; - uint16 handle; - uint8 lmp_ver; - uint16 manufacturer; - uint16 lmp_subver; + uint8 status; + uint16 handle; + uint8 lmp_ver; + uint16 manufacturer; + uint16 lmp_subver; } __attribute__ ((packed)); -#define HCI_EVENT_QOS_SETUP_COMPLETE 0x0D +#define HCI_EVENT_QOS_SETUP_COMPLETE 0x0D struct hci_qos { - uint8 service_type; - uint32 token_rate; - uint32 peak_bandwidth; - uint32 latency; - uint32 delay_variation; + uint8 service_type; + uint32 token_rate; + uint32 peak_bandwidth; + uint32 latency; + uint32 delay_variation; } __attribute__ ((packed)); struct hci_ev_qos_setup_complete { - uint8 status; - uint16 handle; - struct hci_qos qos; + uint8 status; + uint16 handle; + struct hci_qos qos; } __attribute__ ((packed)); -#define HCI_EVENT_CMD_COMPLETE 0x0E +#define HCI_EVENT_CMD_COMPLETE 0x0E struct hci_ev_cmd_complete { - uint8 ncmd; - uint16 opcode; + uint8 ncmd; + uint16 opcode; } __attribute__ ((packed)); -#define HCI_EVENT_CMD_STATUS 0x0F +#define HCI_EVENT_CMD_STATUS 0x0F struct hci_ev_cmd_status { - uint8 status; - uint8 ncmd; - uint16 opcode; + uint8 status; + uint8 ncmd; + uint16 opcode; } __attribute__ ((packed)); -#define HCI_EVENT_HARDWARE_ERROR 0x10 +#define HCI_EVENT_HARDWARE_ERROR 0x10 struct hci_ev_hardware_error { - uint8 hardware_code; /* hardware error code */ + uint8 hardware_code; /* hardware error code */ } __attribute__ ((packed)) ; -#define HCI_EVENT_FLUSH_OCCUR 0x11 +#define HCI_EVENT_FLUSH_OCCUR 0x11 struct hci_ev_flush_occur { - uint16 handle; /* connection handle */ + uint16 handle; /* connection handle */ } __attribute__ ((packed)) ; -#define HCI_EVENT_ROLE_CHANGE 0x12 +#define HCI_EVENT_ROLE_CHANGE 0x12 struct hci_ev_role_change { - uint8 status; - bdaddr_t bdaddr; - uint8 role; + uint8 status; + bdaddr_t bdaddr; + uint8 role; } __attribute__ ((packed)); -#define HCI_EVENT_NUM_COMP_PKTS 0x13 - struct handle_and_number { - uint16 handle; - uint16 num_completed; - } __attribute__ ((packed)); - - struct hci_ev_num_comp_pkts { - uint8 num_hndl; - // struct handle_and_number; hardcoded... - } __attribute__ ((packed)); +#define HCI_EVENT_NUM_COMP_PKTS 0x13 +struct handle_and_number { + uint16 handle; + uint16 num_completed; +} __attribute__ ((packed)); -#define HCI_EVENT_MODE_CHANGE 0x14 +struct hci_ev_num_comp_pkts { + uint8 num_hndl; + // struct handle_and_number; hardcoded... +} __attribute__ ((packed)); + +#define HCI_EVENT_MODE_CHANGE 0x14 struct hci_ev_mode_change { - uint8 status; - uint16 handle; - uint8 mode; - uint16 interval; + uint8 status; + uint16 handle; + uint8 mode; + uint16 interval; } __attribute__ ((packed)); -#define HCI_EVENT_RETURN_LINK_KEYS 0x15 +#define HCI_EVENT_RETURN_LINK_KEYS 0x15 struct link_key_info { bdaddr_t bdaddr; uint8 link_key[HCI_LINK_KEY_SIZE]; } __attribute__ ((packed)) ; struct hci_ev_return_link_keys { - uint8 num_keys; /* # of keys */ + uint8 num_keys; /* # of keys */ struct link_key_info link_keys; /* As much as num_keys param */ } __attribute__ ((packed)) ; -#define HCI_EVENT_PIN_CODE_REQ 0x16 +#define HCI_EVENT_PIN_CODE_REQ 0x16 struct hci_ev_pin_code_req { bdaddr_t bdaddr; } __attribute__ ((packed)); -#define HCI_EVENT_LINK_KEY_REQ 0x17 +#define HCI_EVENT_LINK_KEY_REQ 0x17 struct hci_ev_link_key_req { bdaddr_t bdaddr; } __attribute__ ((packed)); -#define HCI_EVENT_LINK_KEY_NOTIFY 0x18 +#define HCI_EVENT_LINK_KEY_NOTIFY 0x18 struct hci_ev_link_key_notify { bdaddr_t bdaddr; uint8 link_key[16]; uint8 key_type; } __attribute__ ((packed)); -#define HCI_EVENT_LOOPBACK_COMMAND 0x19 +#define HCI_EVENT_LOOPBACK_COMMAND 0x19 struct hci_ev_loopback_command { uint8 command[0]; /* depends of command */ } __attribute__ ((packed)) ; -#define HCI_EVENT_DATA_BUFFER_OVERFLOW 0x1a +#define HCI_EVENT_DATA_BUFFER_OVERFLOW 0x1a struct hci_ev_data_buffer_overflow { uint8 link_type; /* Link type */ } __attribute__ ((packed)) ; -#define HCI_EVENT_MAX_SLOT_CHANGE 0x1b +#define HCI_EVENT_MAX_SLOT_CHANGE 0x1b struct hci_ev_max_slot_change { - uint16 handle; /* connection handle */ + uint16 handle; /* connection handle */ uint8 lmp_max_slots; /* Max. # of slots allowed */ } __attribute__ ((packed)) ; -#define HCI_EVENT_READ_CLOCK_OFFSET_COMPL 0x1c +#define HCI_EVENT_READ_CLOCK_OFFSET_COMPL 0x1c struct hci_ev_read_clock_offset_compl { - uint8 status; /* 0x00 - success */ - uint16 handle; /* Connection handle */ + uint8 status; /* 0x00 - success */ + uint16 handle; /* Connection handle */ uint16 clock_offset; /* Clock offset */ } __attribute__ ((packed)) ; -#define HCI_EVENT_CON_PKT_TYPE_CHANGED 0x1d +#define HCI_EVENT_CON_PKT_TYPE_CHANGED 0x1d struct hci_ev_con_pkt_type_changed { - uint8 status; /* 0x00 - success */ + uint8 status; /* 0x00 - success */ uint16 handle; /* connection handle */ uint16 pkt_type; /* packet type */ } __attribute__ ((packed)); -#define HCI_EVENT_QOS_VIOLATION 0x1e +#define HCI_EVENT_QOS_VIOLATION 0x1e struct hci_ev_qos_violation { uint16 handle; /* connection handle */ } __attribute__ ((packed)) ; -#define HCI_EVENT_PAGE_SCAN_REP_MODE_CHANGE 0x20 +#define HCI_EVENT_PAGE_SCAN_REP_MODE_CHANGE 0x20 struct hci_ev_page_scan_rep_mode_change { - bdaddr_t bdaddr; /* destination address */ - uint8 page_scan_rep_mode; /* page scan repetition mode */ + bdaddr_t bdaddr; /* destination address */ + uint8 page_scan_rep_mode; /* page scan repetition mode */ } __attribute__ ((packed)); /* Events Beyond Bluetooth 1.1 */ -#define HCI_EVENT_FLOW_SPECIFICATION 0x21 +#define HCI_EVENT_FLOW_SPECIFICATION 0x21 struct hci_ev_flow_specification { uint8 status; uint16 handle; @@ -249,46 +265,46 @@ struct hci_ev_flow_specification { uint32 access_latency; } __attribute__ ((packed)); -#define HCI_EVENT_INQUIRY_RESULT_WITH_RSSI 0x22 +#define HCI_EVENT_INQUIRY_RESULT_WITH_RSSI 0x22 struct hci_ev_inquiry_info_with_rssi { bdaddr_t bdaddr; - uint8 pscan_rep_mode; - uint8 pscan_period_mode; - uint8 dev_class[3]; - uint16 clock_offset; - int8 rssi; + uint8 pscan_rep_mode; + uint8 pscan_period_mode; + uint8 dev_class[3]; + uint16 clock_offset; + int8 rssi; } __attribute__ ((packed)); -#define HCI_EVENT_REMOTE_EXTENDED_FEATURES 0x23 -struct hci_ev_remote_extended_features { - uint8 status; - uint16 handle; - uint8 page_number; - uint8 maximun_page_number; - uint64 extended_lmp_features; +#define HCI_EVENT_REMOTE_EXTENDED_FEATURES 0x23 +struct hci_ev_remote_extended_features { + uint8 status; + uint16 handle; + uint8 page_number; + uint8 maximun_page_number; + uint64 extended_lmp_features; } __attribute__ ((packed)); #define HCI_EVENT_SYNCHRONOUS_CONNECTION_COMPLETED 0x2C -struct hci_ev_sychronous_connection_completed { - uint8 status; - uint16 handle; - bdaddr_t bdaddr; - uint8 link_type; - uint8 transmission_interval; - uint8 retransmission_window; - uint16 rx_packet_length; - uint16 tx_packet_length; - uint8 air_mode; +struct hci_ev_sychronous_connection_completed { + uint8 status; + uint16 handle; + bdaddr_t bdaddr; + uint8 link_type; + uint8 transmission_interval; + uint8 retransmission_window; + uint16 rx_packet_length; + uint16 tx_packet_length; + uint8 air_mode; } __attribute__ ((packed)); #define HCI_EVENT_SYNCHRONOUS_CONNECTION_CHANGED 0x2D -struct hci_ev_sychronous_connection_changed { - uint8 status; - uint16 handle; - uint8 transmission_interval; - uint8 retransmission_window; - uint16 rx_packet_length; - uint16 tx_packet_length; +struct hci_ev_sychronous_connection_changed { + uint8 status; + uint16 handle; + uint8 transmission_interval; + uint8 retransmission_window; + uint16 rx_packet_length; + uint16 tx_packet_length; } __attribute__ ((packed)); // TODO: Define remaining Bluetooth 2.1 events structures diff --git a/headers/os/bluetooth/HCI/btHCI_module.h b/headers/os/bluetooth/HCI/btHCI_module.h index 22897d0e80..3ed39a4939 100644 --- a/headers/os/bluetooth/HCI/btHCI_module.h +++ b/headers/os/bluetooth/HCI/btHCI_module.h @@ -19,21 +19,20 @@ /* TODO: Possible definition of a bus manager of whatever is gonna be on the top */ typedef struct bt_hci_module_info { - - /* registration */ - status_t (*RegisterDriver)(bt_hci_transport* desc, hci_id *id /*out*/, - bt_hci_device* cookie /*out*/ ); - status_t (*UnregisterDriver)(hci_id id); - - /* Transferences to be called from drivers */ + /* registration */ + status_t (*RegisterDriver)(bt_hci_transport* desc, hci_id *id /*out*/, + bt_hci_device* cookie /*out*/ ); + status_t (*UnregisterDriver)(hci_id id); - status_t (*PostACL)(hci_id id, net_buffer* nbuf); - status_t (*PostSCO)(hci_id id, net_buffer* nbuf); - - /* Management */ - bt_hci_device* (*GetHciDevice)(hci_id id); + /* Transferences to be called from drivers */ + + status_t (*PostACL)(hci_id id, net_buffer* nbuf); + status_t (*PostSCO)(hci_id id, net_buffer* nbuf); + + /* Management */ + bt_hci_device* (*GetHciDevice)(hci_id id); } bt_hci_module_info ; -#endif \ No newline at end of file +#endif diff --git a/headers/os/bluetooth/HCI/btHCI_transport.h b/headers/os/bluetooth/HCI/btHCI_transport.h index c268ddc175..db31ef7fd5 100644 --- a/headers/os/bluetooth/HCI/btHCI_transport.h +++ b/headers/os/bluetooth/HCI/btHCI_transport.h @@ -13,59 +13,68 @@ #include #include +<<<<<<< .mine +typedef enum { ANCILLYANT = (1<<0), + RUNNING = (1<<1), + LEAVING = (1<<2), + SENDING = (1<<3), + PROCESSING = (1<<4) + } bt_transport_status_t; +======= typedef enum { ANCILLYANT = (1<<0), RUNNING = (1<<1), LEAVING = (1<<2), SENDING = (1<<3), PROCESSING = (1<<4) } bt_transport_status_t; +>>>>>>> .r26700 typedef uint8 bt_stat_t; typedef struct bt_hci_statistics { - + bt_stat_t acceptedTX; bt_stat_t rejectedTX; bt_stat_t successfulTX; - bt_stat_t errorTX; + bt_stat_t errorTX; bt_stat_t acceptedRX; bt_stat_t rejectedRX; bt_stat_t successfulRX; - bt_stat_t errorRX; + bt_stat_t errorRX; bt_stat_t commandTX; bt_stat_t eventRX; bt_stat_t aclTX; - bt_stat_t aclRX; + bt_stat_t aclRX; bt_stat_t scoTX; - bt_stat_t scoRX; + bt_stat_t scoRX; bt_stat_t escoTX; bt_stat_t escoRX; - + bt_stat_t bytesRX; bt_stat_t bytesTX; - + } bt_hci_statistics; - + /* TODO: Possible Hooks which drivers will have to provide */ typedef struct bt_hci_transport { - status_t (*SendCommand)(hci_id hci_dev, net_buffer* snbuf); - status_t (*SendPacket)(hci_id hci_dev, net_buffer* nbuf ); - status_t (*SendSCO)(hci_id hci_dev, net_buffer* nbuf ); - status_t (*DeliverStatistics)(bt_hci_statistics* statistics); - - transport_type kind; - char name[B_OS_NAME_LENGTH]; - + status_t (*SendCommand)(hci_id hci_dev, net_buffer* snbuf); + status_t (*SendPacket)(hci_id hci_dev, net_buffer* nbuf ); + status_t (*SendSCO)(hci_id hci_dev, net_buffer* nbuf ); + status_t (*DeliverStatistics)(bt_hci_statistics* statistics); + + transport_type kind; + char name[B_OS_NAME_LENGTH]; + } bt_hci_transport; typedef struct bt_hci_device { - - transport_type kind; - char realName[B_OS_NAME_LENGTH]; - + + transport_type kind; + char realName[B_OS_NAME_LENGTH]; + } bt_hci_device; @@ -83,17 +92,18 @@ typedef struct bt_hci_device { #define BT_IOCTLS_OFFSET 3000 enum { - ISSUE_BT_COMMAND = B_DEVICE_OP_CODES_END + BT_IOCTLS_OFFSET , + ISSUE_BT_COMMAND = B_DEVICE_OP_CODES_END + BT_IOCTLS_OFFSET, BT_UP, GET_STATICS, - GET_NOTIFICATION_PORT, - GET_HCI_ID + GET_NOTIFICATION_PORT, + GET_HCI_ID, + BT_UP }; -#define PACK_PORTCODE(type,hid,data) ((type&0xFF)<<24|(hid&0xFF)<<16|(data&0xFFFF)) -#define GET_PORTCODE_TYPE(code) ((code&0xFF000000)>>24) -#define GET_PORTCODE_HID(code) ((code&0x00FF0000)>>16) -#define GET_PORTCODE_DATA(code) ((code&0x0000FFFF)) +#define PACK_PORTCODE(type,hid,data) ((type&0xFF)<<24|(hid&0xFF)<<16|(data&0xFFFF)) +#define GET_PORTCODE_TYPE(code) ((code&0xFF000000)>>24) +#define GET_PORTCODE_HID(code) ((code&0x00FF0000)>>16) +#define GET_PORTCODE_DATA(code) ((code&0x0000FFFF)) /* Port drivers can use to send information (1 for all for at moment refer to ioctl GET_NOTIFICATION_PORT)*/