HW layer for the Nucleo board, it only work with old BLE_API
Dependents: Hello_BLE F446RE-BLE
Fork of X_NUCLEO_IDB0XA1 by
BlueNRG_HCI/includes/hci_const.h@90:26c0c9807ab4, 2015-07-22 (annotated)
- Committer:
- Wolfgang Betz
- Date:
- Wed Jul 22 11:25:50 2015 +0200
- Revision:
- 90:26c0c9807ab4
Preparing ble_wb
- new gitmodule for BLE_API
- updating ReadMe.txt
- synching X_NUCLEO_IDB0XA1 with mbed
- synching test application
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Wolfgang Betz |
90:26c0c9807ab4 | 1 | /****************************************************************************** |
Wolfgang Betz |
90:26c0c9807ab4 | 2 | * |
Wolfgang Betz |
90:26c0c9807ab4 | 3 | * File Description |
Wolfgang Betz |
90:26c0c9807ab4 | 4 | * --------------------- |
Wolfgang Betz |
90:26c0c9807ab4 | 5 | * This file defines constants and functions for HCI layer. |
Wolfgang Betz |
90:26c0c9807ab4 | 6 | * See Bluetooth Core v 4.0, Vol. 2, Part E. |
Wolfgang Betz |
90:26c0c9807ab4 | 7 | * |
Wolfgang Betz |
90:26c0c9807ab4 | 8 | *******************************************************************************/ |
Wolfgang Betz |
90:26c0c9807ab4 | 9 | |
Wolfgang Betz |
90:26c0c9807ab4 | 10 | #ifndef __HCI_INTERNAL_H_ |
Wolfgang Betz |
90:26c0c9807ab4 | 11 | #define __HCI_INTERNAL_H_ |
Wolfgang Betz |
90:26c0c9807ab4 | 12 | |
Wolfgang Betz |
90:26c0c9807ab4 | 13 | #include "compiler.h" |
Wolfgang Betz |
90:26c0c9807ab4 | 14 | #include "hal_types.h" |
Wolfgang Betz |
90:26c0c9807ab4 | 15 | #include "clock.h" |
Wolfgang Betz |
90:26c0c9807ab4 | 16 | #include "link_layer.h" |
Wolfgang Betz |
90:26c0c9807ab4 | 17 | |
Wolfgang Betz |
90:26c0c9807ab4 | 18 | #include "hci.h" |
Wolfgang Betz |
90:26c0c9807ab4 | 19 | |
Wolfgang Betz |
90:26c0c9807ab4 | 20 | #define DEFAULT_TIMEOUT (CLOCK_SECOND/10) |
Wolfgang Betz |
90:26c0c9807ab4 | 21 | |
Wolfgang Betz |
90:26c0c9807ab4 | 22 | /** |
Wolfgang Betz |
90:26c0c9807ab4 | 23 | * Maximum payload of HCI commands that can be sent. Change this value if needed. |
Wolfgang Betz |
90:26c0c9807ab4 | 24 | * This value can be up to 255. |
Wolfgang Betz |
90:26c0c9807ab4 | 25 | */ |
Wolfgang Betz |
90:26c0c9807ab4 | 26 | #define HCI_MAX_PAYLOAD_SIZE 128 |
Wolfgang Betz |
90:26c0c9807ab4 | 27 | |
Wolfgang Betz |
90:26c0c9807ab4 | 28 | /* HCI Packet types */ |
Wolfgang Betz |
90:26c0c9807ab4 | 29 | #define HCI_COMMAND_PKT 0x01 |
Wolfgang Betz |
90:26c0c9807ab4 | 30 | #define HCI_ACLDATA_PKT 0x02 |
Wolfgang Betz |
90:26c0c9807ab4 | 31 | #define HCI_SCODATA_PKT 0x03 |
Wolfgang Betz |
90:26c0c9807ab4 | 32 | #define HCI_EVENT_PKT 0x04 |
Wolfgang Betz |
90:26c0c9807ab4 | 33 | #define HCI_VENDOR_PKT 0xff |
Wolfgang Betz |
90:26c0c9807ab4 | 34 | |
Wolfgang Betz |
90:26c0c9807ab4 | 35 | typedef __packed struct _hci_uart_pckt{ |
Wolfgang Betz |
90:26c0c9807ab4 | 36 | uint8_t type; |
Wolfgang Betz |
90:26c0c9807ab4 | 37 | uint8_t data[VARIABLE_SIZE]; |
Wolfgang Betz |
90:26c0c9807ab4 | 38 | } PACKED hci_uart_pckt; |
Wolfgang Betz |
90:26c0c9807ab4 | 39 | #define HCI_HDR_SIZE 1 |
Wolfgang Betz |
90:26c0c9807ab4 | 40 | |
Wolfgang Betz |
90:26c0c9807ab4 | 41 | typedef __packed struct _hci_command_hdr{ |
Wolfgang Betz |
90:26c0c9807ab4 | 42 | uint16_t opcode; /* OCF & OGF */ |
Wolfgang Betz |
90:26c0c9807ab4 | 43 | uint8_t plen; |
Wolfgang Betz |
90:26c0c9807ab4 | 44 | } PACKED hci_command_hdr; |
Wolfgang Betz |
90:26c0c9807ab4 | 45 | #define HCI_COMMAND_HDR_SIZE 3 |
Wolfgang Betz |
90:26c0c9807ab4 | 46 | |
Wolfgang Betz |
90:26c0c9807ab4 | 47 | typedef __packed struct _hci_event_pckt{ |
Wolfgang Betz |
90:26c0c9807ab4 | 48 | uint8_t evt; |
Wolfgang Betz |
90:26c0c9807ab4 | 49 | uint8_t plen; |
Wolfgang Betz |
90:26c0c9807ab4 | 50 | uint8_t data[VARIABLE_SIZE]; |
Wolfgang Betz |
90:26c0c9807ab4 | 51 | } PACKED hci_event_pckt; |
Wolfgang Betz |
90:26c0c9807ab4 | 52 | #define HCI_EVENT_HDR_SIZE 2 |
Wolfgang Betz |
90:26c0c9807ab4 | 53 | |
Wolfgang Betz |
90:26c0c9807ab4 | 54 | typedef __packed struct _hci_acl_hdr{ |
Wolfgang Betz |
90:26c0c9807ab4 | 55 | uint16_t handle; /* Handle & Flags(PB, BC) */ |
Wolfgang Betz |
90:26c0c9807ab4 | 56 | uint16_t dlen; |
Wolfgang Betz |
90:26c0c9807ab4 | 57 | } PACKED hci_acl_hdr; |
Wolfgang Betz |
90:26c0c9807ab4 | 58 | #define HCI_ACL_HDR_SIZE 4 |
Wolfgang Betz |
90:26c0c9807ab4 | 59 | |
Wolfgang Betz |
90:26c0c9807ab4 | 60 | /* Link Control */ |
Wolfgang Betz |
90:26c0c9807ab4 | 61 | #define OGF_LINK_CTL 0x01 |
Wolfgang Betz |
90:26c0c9807ab4 | 62 | |
Wolfgang Betz |
90:26c0c9807ab4 | 63 | #define OCF_DISCONNECT 0x0006 |
Wolfgang Betz |
90:26c0c9807ab4 | 64 | typedef __packed struct _disconnect_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 65 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 66 | uint8_t reason; |
Wolfgang Betz |
90:26c0c9807ab4 | 67 | } PACKED disconnect_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 68 | #define DISCONNECT_CP_SIZE 3 |
Wolfgang Betz |
90:26c0c9807ab4 | 69 | |
Wolfgang Betz |
90:26c0c9807ab4 | 70 | /* Host Controller and Baseband */ |
Wolfgang Betz |
90:26c0c9807ab4 | 71 | #define OGF_HOST_CTL 0x03 |
Wolfgang Betz |
90:26c0c9807ab4 | 72 | |
Wolfgang Betz |
90:26c0c9807ab4 | 73 | #define OCF_SET_EVENT_MASK 0x0001 |
Wolfgang Betz |
90:26c0c9807ab4 | 74 | #define OCF_RESET 0x0003 |
Wolfgang Betz |
90:26c0c9807ab4 | 75 | |
Wolfgang Betz |
90:26c0c9807ab4 | 76 | #define OCF_READ_TRANSMIT_POWER_LEVEL 0x002D |
Wolfgang Betz |
90:26c0c9807ab4 | 77 | typedef __packed struct _read_transmit_power_level_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 78 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 79 | uint8_t type; |
Wolfgang Betz |
90:26c0c9807ab4 | 80 | } PACKED read_transmit_power_level_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 81 | #define READ_TRANSMIT_POWER_LEVEL_CP_SIZE 3 |
Wolfgang Betz |
90:26c0c9807ab4 | 82 | typedef __packed struct _read_transmit_power_level_rp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 83 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 84 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 85 | int8_t level; |
Wolfgang Betz |
90:26c0c9807ab4 | 86 | } PACKED read_transmit_power_level_rp; |
Wolfgang Betz |
90:26c0c9807ab4 | 87 | #define READ_TRANSMIT_POWER_LEVEL_RP_SIZE 4 |
Wolfgang Betz |
90:26c0c9807ab4 | 88 | |
Wolfgang Betz |
90:26c0c9807ab4 | 89 | #define OCF_SET_CONTROLLER_TO_HOST_FC 0x0031 |
Wolfgang Betz |
90:26c0c9807ab4 | 90 | #define OCF_HOST_BUFFER_SIZE 0x0033 |
Wolfgang Betz |
90:26c0c9807ab4 | 91 | #define OCF_HOST_NUM_COMP_PKTS 0x0035 |
Wolfgang Betz |
90:26c0c9807ab4 | 92 | |
Wolfgang Betz |
90:26c0c9807ab4 | 93 | /* Informational Parameters */ |
Wolfgang Betz |
90:26c0c9807ab4 | 94 | #define OGF_INFO_PARAM 0x04 |
Wolfgang Betz |
90:26c0c9807ab4 | 95 | |
Wolfgang Betz |
90:26c0c9807ab4 | 96 | #define OCF_READ_LOCAL_VERSION 0x0001 |
Wolfgang Betz |
90:26c0c9807ab4 | 97 | typedef __packed struct _read_local_version_rp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 98 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 99 | uint8_t hci_version; |
Wolfgang Betz |
90:26c0c9807ab4 | 100 | uint16_t hci_revision; |
Wolfgang Betz |
90:26c0c9807ab4 | 101 | uint8_t lmp_pal_version; |
Wolfgang Betz |
90:26c0c9807ab4 | 102 | uint16_t manufacturer_name; |
Wolfgang Betz |
90:26c0c9807ab4 | 103 | uint16_t lmp_pal_subversion; |
Wolfgang Betz |
90:26c0c9807ab4 | 104 | } PACKED read_local_version_rp; |
Wolfgang Betz |
90:26c0c9807ab4 | 105 | #define READ_LOCAL_VERSION_RP_SIZE 9 |
Wolfgang Betz |
90:26c0c9807ab4 | 106 | |
Wolfgang Betz |
90:26c0c9807ab4 | 107 | #define OCF_READ_LOCAL_COMMANDS 0x0002 |
Wolfgang Betz |
90:26c0c9807ab4 | 108 | #define OCF_READ_LOCAL_FEATURES 0x0003 |
Wolfgang Betz |
90:26c0c9807ab4 | 109 | |
Wolfgang Betz |
90:26c0c9807ab4 | 110 | #define OCF_READ_BD_ADDR 0x0009 |
Wolfgang Betz |
90:26c0c9807ab4 | 111 | typedef __packed struct _read_bd_addr_rp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 112 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 113 | tBDAddr bdaddr; |
Wolfgang Betz |
90:26c0c9807ab4 | 114 | } PACKED read_bd_addr_rp; |
Wolfgang Betz |
90:26c0c9807ab4 | 115 | #define READ_BD_ADDR_RP_SIZE 7 |
Wolfgang Betz |
90:26c0c9807ab4 | 116 | |
Wolfgang Betz |
90:26c0c9807ab4 | 117 | /* Status params */ |
Wolfgang Betz |
90:26c0c9807ab4 | 118 | #define OGF_STATUS_PARAM 0x05 |
Wolfgang Betz |
90:26c0c9807ab4 | 119 | |
Wolfgang Betz |
90:26c0c9807ab4 | 120 | #define OCF_READ_RSSI 0x0005 |
Wolfgang Betz |
90:26c0c9807ab4 | 121 | typedef __packed struct _read_rssi_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 122 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 123 | } PACKED read_rssi_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 124 | #define READ_RSSI_CP_SIZE 2 |
Wolfgang Betz |
90:26c0c9807ab4 | 125 | typedef __packed struct _read_rssi_rp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 126 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 127 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 128 | int8_t rssi; |
Wolfgang Betz |
90:26c0c9807ab4 | 129 | } PACKED read_rssi_rp; |
Wolfgang Betz |
90:26c0c9807ab4 | 130 | #define READ_RSSI_RP_SIZE 4 |
Wolfgang Betz |
90:26c0c9807ab4 | 131 | |
Wolfgang Betz |
90:26c0c9807ab4 | 132 | |
Wolfgang Betz |
90:26c0c9807ab4 | 133 | /* LE commands */ |
Wolfgang Betz |
90:26c0c9807ab4 | 134 | #define OGF_LE_CTL 0x08 |
Wolfgang Betz |
90:26c0c9807ab4 | 135 | |
Wolfgang Betz |
90:26c0c9807ab4 | 136 | #define OCF_LE_SET_EVENT_MASK 0x0001 |
Wolfgang Betz |
90:26c0c9807ab4 | 137 | typedef __packed struct _le_set_event_mask_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 138 | uint8_t mask[8]; |
Wolfgang Betz |
90:26c0c9807ab4 | 139 | } PACKED le_set_event_mask_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 140 | #define LE_SET_EVENT_MASK_CP_SIZE 8 |
Wolfgang Betz |
90:26c0c9807ab4 | 141 | |
Wolfgang Betz |
90:26c0c9807ab4 | 142 | #define OCF_LE_READ_BUFFER_SIZE 0x0002 |
Wolfgang Betz |
90:26c0c9807ab4 | 143 | typedef __packed struct _le_read_buffer_size_rp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 144 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 145 | uint16_t pkt_len; |
Wolfgang Betz |
90:26c0c9807ab4 | 146 | uint8_t max_pkt; |
Wolfgang Betz |
90:26c0c9807ab4 | 147 | } PACKED le_read_buffer_size_rp; |
Wolfgang Betz |
90:26c0c9807ab4 | 148 | #define LE_READ_BUFFER_SIZE_RP_SIZE 4 |
Wolfgang Betz |
90:26c0c9807ab4 | 149 | |
Wolfgang Betz |
90:26c0c9807ab4 | 150 | #define OCF_LE_READ_LOCAL_SUPPORTED_FEATURES 0x0003 |
Wolfgang Betz |
90:26c0c9807ab4 | 151 | typedef __packed struct _le_read_local_supported_features_rp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 152 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 153 | uint8_t features[8]; |
Wolfgang Betz |
90:26c0c9807ab4 | 154 | } PACKED le_read_local_supported_features_rp; |
Wolfgang Betz |
90:26c0c9807ab4 | 155 | #define LE_READ_LOCAL_SUPPORTED_FEATURES_RP_SIZE 9 |
Wolfgang Betz |
90:26c0c9807ab4 | 156 | |
Wolfgang Betz |
90:26c0c9807ab4 | 157 | #define OCF_LE_SET_RANDOM_ADDRESS 0x0005 |
Wolfgang Betz |
90:26c0c9807ab4 | 158 | typedef __packed struct _le_set_random_address_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 159 | tBDAddr bdaddr; |
Wolfgang Betz |
90:26c0c9807ab4 | 160 | } PACKED le_set_random_address_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 161 | #define LE_SET_RANDOM_ADDRESS_CP_SIZE 6 |
Wolfgang Betz |
90:26c0c9807ab4 | 162 | |
Wolfgang Betz |
90:26c0c9807ab4 | 163 | #define OCF_LE_SET_ADV_PARAMETERS 0x0006 |
Wolfgang Betz |
90:26c0c9807ab4 | 164 | typedef __packed struct _le_set_adv_parameters_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 165 | uint16_t min_interval; |
Wolfgang Betz |
90:26c0c9807ab4 | 166 | uint16_t max_interval; |
Wolfgang Betz |
90:26c0c9807ab4 | 167 | uint8_t advtype; |
Wolfgang Betz |
90:26c0c9807ab4 | 168 | uint8_t own_bdaddr_type; |
Wolfgang Betz |
90:26c0c9807ab4 | 169 | uint8_t direct_bdaddr_type; |
Wolfgang Betz |
90:26c0c9807ab4 | 170 | tBDAddr direct_bdaddr; |
Wolfgang Betz |
90:26c0c9807ab4 | 171 | uint8_t chan_map; |
Wolfgang Betz |
90:26c0c9807ab4 | 172 | uint8_t filter; |
Wolfgang Betz |
90:26c0c9807ab4 | 173 | } PACKED le_set_adv_parameters_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 174 | #define LE_SET_ADV_PARAMETERS_CP_SIZE 15 |
Wolfgang Betz |
90:26c0c9807ab4 | 175 | |
Wolfgang Betz |
90:26c0c9807ab4 | 176 | #define OCF_LE_READ_ADV_CHANNEL_TX_POWER 0x0007 |
Wolfgang Betz |
90:26c0c9807ab4 | 177 | typedef __packed struct _le_read_adv_channel_tx_power_rp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 178 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 179 | int8_t level; |
Wolfgang Betz |
90:26c0c9807ab4 | 180 | } PACKED le_read_adv_channel_tx_power_rp; |
Wolfgang Betz |
90:26c0c9807ab4 | 181 | #define LE_READ_ADV_CHANNEL_TX_POWER_RP_SIZE 2 |
Wolfgang Betz |
90:26c0c9807ab4 | 182 | |
Wolfgang Betz |
90:26c0c9807ab4 | 183 | #define OCF_LE_SET_ADV_DATA 0x0008 |
Wolfgang Betz |
90:26c0c9807ab4 | 184 | typedef __packed struct _le_set_adv_data_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 185 | uint8_t length; |
Wolfgang Betz |
90:26c0c9807ab4 | 186 | uint8_t data[31]; |
Wolfgang Betz |
90:26c0c9807ab4 | 187 | } PACKED le_set_adv_data_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 188 | #define LE_SET_ADV_DATA_CP_SIZE 32 |
Wolfgang Betz |
90:26c0c9807ab4 | 189 | |
Wolfgang Betz |
90:26c0c9807ab4 | 190 | #define OCF_LE_SET_SCAN_RESPONSE_DATA 0x0009 |
Wolfgang Betz |
90:26c0c9807ab4 | 191 | typedef __packed struct _le_set_scan_response_data_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 192 | uint8_t length; |
Wolfgang Betz |
90:26c0c9807ab4 | 193 | uint8_t data[31]; |
Wolfgang Betz |
90:26c0c9807ab4 | 194 | } PACKED le_set_scan_response_data_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 195 | #define LE_SET_SCAN_RESPONSE_DATA_CP_SIZE 32 |
Wolfgang Betz |
90:26c0c9807ab4 | 196 | |
Wolfgang Betz |
90:26c0c9807ab4 | 197 | #define OCF_LE_SET_ADVERTISE_ENABLE 0x000A |
Wolfgang Betz |
90:26c0c9807ab4 | 198 | typedef __packed struct _le_set_advertise_enable_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 199 | uint8_t enable; |
Wolfgang Betz |
90:26c0c9807ab4 | 200 | } PACKED le_set_advertise_enable_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 201 | #define LE_SET_ADVERTISE_ENABLE_CP_SIZE 1 |
Wolfgang Betz |
90:26c0c9807ab4 | 202 | |
Wolfgang Betz |
90:26c0c9807ab4 | 203 | #define OCF_LE_SET_SCAN_PARAMETERS 0x000B |
Wolfgang Betz |
90:26c0c9807ab4 | 204 | typedef __packed struct _le_set_scan_parameters_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 205 | uint8_t type; |
Wolfgang Betz |
90:26c0c9807ab4 | 206 | uint16_t interval; |
Wolfgang Betz |
90:26c0c9807ab4 | 207 | uint16_t window; |
Wolfgang Betz |
90:26c0c9807ab4 | 208 | uint8_t own_bdaddr_type; |
Wolfgang Betz |
90:26c0c9807ab4 | 209 | uint8_t filter; |
Wolfgang Betz |
90:26c0c9807ab4 | 210 | } PACKED le_set_scan_parameters_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 211 | #define LE_SET_SCAN_PARAMETERS_CP_SIZE 7 |
Wolfgang Betz |
90:26c0c9807ab4 | 212 | |
Wolfgang Betz |
90:26c0c9807ab4 | 213 | #define OCF_LE_SET_SCAN_ENABLE 0x000C |
Wolfgang Betz |
90:26c0c9807ab4 | 214 | typedef __packed struct _le_set_scan_enable_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 215 | uint8_t enable; |
Wolfgang Betz |
90:26c0c9807ab4 | 216 | uint8_t filter_dup; |
Wolfgang Betz |
90:26c0c9807ab4 | 217 | } PACKED le_set_scan_enable_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 218 | #define LE_SET_SCAN_ENABLE_CP_SIZE 2 |
Wolfgang Betz |
90:26c0c9807ab4 | 219 | |
Wolfgang Betz |
90:26c0c9807ab4 | 220 | #define OCF_LE_CREATE_CONN 0x000D |
Wolfgang Betz |
90:26c0c9807ab4 | 221 | typedef __packed struct _le_create_connection_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 222 | uint16_t interval; |
Wolfgang Betz |
90:26c0c9807ab4 | 223 | uint16_t window; |
Wolfgang Betz |
90:26c0c9807ab4 | 224 | uint8_t initiator_filter; |
Wolfgang Betz |
90:26c0c9807ab4 | 225 | uint8_t peer_bdaddr_type; |
Wolfgang Betz |
90:26c0c9807ab4 | 226 | tBDAddr peer_bdaddr; |
Wolfgang Betz |
90:26c0c9807ab4 | 227 | uint8_t own_bdaddr_type; |
Wolfgang Betz |
90:26c0c9807ab4 | 228 | uint16_t min_interval; |
Wolfgang Betz |
90:26c0c9807ab4 | 229 | uint16_t max_interval; |
Wolfgang Betz |
90:26c0c9807ab4 | 230 | uint16_t latency; |
Wolfgang Betz |
90:26c0c9807ab4 | 231 | uint16_t supervision_timeout; |
Wolfgang Betz |
90:26c0c9807ab4 | 232 | uint16_t min_ce_length; |
Wolfgang Betz |
90:26c0c9807ab4 | 233 | uint16_t max_ce_length; |
Wolfgang Betz |
90:26c0c9807ab4 | 234 | } PACKED le_create_connection_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 235 | #define LE_CREATE_CONN_CP_SIZE 25 |
Wolfgang Betz |
90:26c0c9807ab4 | 236 | |
Wolfgang Betz |
90:26c0c9807ab4 | 237 | #define OCF_LE_CREATE_CONN_CANCEL 0x000E |
Wolfgang Betz |
90:26c0c9807ab4 | 238 | |
Wolfgang Betz |
90:26c0c9807ab4 | 239 | #define OCF_LE_READ_WHITE_LIST_SIZE 0x000F |
Wolfgang Betz |
90:26c0c9807ab4 | 240 | typedef __packed struct _le_read_white_list_size_rp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 241 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 242 | uint8_t size; |
Wolfgang Betz |
90:26c0c9807ab4 | 243 | } PACKED le_read_white_list_size_rp; |
Wolfgang Betz |
90:26c0c9807ab4 | 244 | #define LE_READ_WHITE_LIST_SIZE_RP_SIZE 2 |
Wolfgang Betz |
90:26c0c9807ab4 | 245 | |
Wolfgang Betz |
90:26c0c9807ab4 | 246 | #define OCF_LE_CLEAR_WHITE_LIST 0x0010 |
Wolfgang Betz |
90:26c0c9807ab4 | 247 | |
Wolfgang Betz |
90:26c0c9807ab4 | 248 | #define OCF_LE_ADD_DEVICE_TO_WHITE_LIST 0x0011 |
Wolfgang Betz |
90:26c0c9807ab4 | 249 | typedef __packed struct _le_add_device_to_white_list_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 250 | uint8_t bdaddr_type; |
Wolfgang Betz |
90:26c0c9807ab4 | 251 | tBDAddr bdaddr; |
Wolfgang Betz |
90:26c0c9807ab4 | 252 | } PACKED le_add_device_to_white_list_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 253 | #define LE_ADD_DEVICE_TO_WHITE_LIST_CP_SIZE 7 |
Wolfgang Betz |
90:26c0c9807ab4 | 254 | |
Wolfgang Betz |
90:26c0c9807ab4 | 255 | #define OCF_LE_REMOVE_DEVICE_FROM_WHITE_LIST 0x0012 |
Wolfgang Betz |
90:26c0c9807ab4 | 256 | typedef __packed struct _le_remove_device_from_white_list_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 257 | uint8_t bdaddr_type; |
Wolfgang Betz |
90:26c0c9807ab4 | 258 | tBDAddr bdaddr; |
Wolfgang Betz |
90:26c0c9807ab4 | 259 | } PACKED le_remove_device_from_white_list_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 260 | #define LE_REMOVE_DEVICE_FROM_WHITE_LIST_CP_SIZE 7 |
Wolfgang Betz |
90:26c0c9807ab4 | 261 | |
Wolfgang Betz |
90:26c0c9807ab4 | 262 | #define OCF_LE_CONN_UPDATE 0x0013 |
Wolfgang Betz |
90:26c0c9807ab4 | 263 | typedef __packed struct _le_connection_update_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 264 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 265 | uint16_t min_interval; |
Wolfgang Betz |
90:26c0c9807ab4 | 266 | uint16_t max_interval; |
Wolfgang Betz |
90:26c0c9807ab4 | 267 | uint16_t latency; |
Wolfgang Betz |
90:26c0c9807ab4 | 268 | uint16_t supervision_timeout; |
Wolfgang Betz |
90:26c0c9807ab4 | 269 | uint16_t min_ce_length; |
Wolfgang Betz |
90:26c0c9807ab4 | 270 | uint16_t max_ce_length; |
Wolfgang Betz |
90:26c0c9807ab4 | 271 | } PACKED le_connection_update_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 272 | #define LE_CONN_UPDATE_CP_SIZE 14 |
Wolfgang Betz |
90:26c0c9807ab4 | 273 | |
Wolfgang Betz |
90:26c0c9807ab4 | 274 | #define OCF_LE_SET_HOST_CHANNEL_CLASSIFICATION 0x0014 |
Wolfgang Betz |
90:26c0c9807ab4 | 275 | typedef __packed struct _le_set_host_channel_classification_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 276 | uint8_t map[5]; |
Wolfgang Betz |
90:26c0c9807ab4 | 277 | } PACKED le_set_host_channel_classification_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 278 | #define LE_SET_HOST_CHANNEL_CLASSIFICATION_CP_SIZE 5 |
Wolfgang Betz |
90:26c0c9807ab4 | 279 | |
Wolfgang Betz |
90:26c0c9807ab4 | 280 | #define OCF_LE_READ_CHANNEL_MAP 0x0015 |
Wolfgang Betz |
90:26c0c9807ab4 | 281 | typedef __packed struct _le_read_channel_map_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 282 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 283 | } PACKED le_read_channel_map_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 284 | #define LE_READ_CHANNEL_MAP_CP_SIZE 2 |
Wolfgang Betz |
90:26c0c9807ab4 | 285 | |
Wolfgang Betz |
90:26c0c9807ab4 | 286 | typedef __packed struct _le_read_channel_map_rp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 287 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 288 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 289 | uint8_t map[5]; |
Wolfgang Betz |
90:26c0c9807ab4 | 290 | } le_read_channel_map_rp; |
Wolfgang Betz |
90:26c0c9807ab4 | 291 | #define LE_READ_CHANNEL_MAP_RP_SIZE 8 |
Wolfgang Betz |
90:26c0c9807ab4 | 292 | |
Wolfgang Betz |
90:26c0c9807ab4 | 293 | #define OCF_LE_READ_REMOTE_USED_FEATURES 0x0016 |
Wolfgang Betz |
90:26c0c9807ab4 | 294 | typedef __packed struct _le_read_remote_used_features_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 295 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 296 | } PACKED le_read_remote_used_features_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 297 | #define LE_READ_REMOTE_USED_FEATURES_CP_SIZE 2 |
Wolfgang Betz |
90:26c0c9807ab4 | 298 | |
Wolfgang Betz |
90:26c0c9807ab4 | 299 | #define OCF_LE_ENCRYPT 0x0017 |
Wolfgang Betz |
90:26c0c9807ab4 | 300 | typedef __packed struct _le_encrypt_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 301 | uint8_t key[16]; |
Wolfgang Betz |
90:26c0c9807ab4 | 302 | uint8_t plaintext[16]; |
Wolfgang Betz |
90:26c0c9807ab4 | 303 | } PACKED le_encrypt_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 304 | #define LE_ENCRYPT_CP_SIZE 32 |
Wolfgang Betz |
90:26c0c9807ab4 | 305 | |
Wolfgang Betz |
90:26c0c9807ab4 | 306 | typedef __packed struct _le_encrypt_rp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 307 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 308 | uint8_t encdata[16]; |
Wolfgang Betz |
90:26c0c9807ab4 | 309 | } PACKED le_encrypt_rp; |
Wolfgang Betz |
90:26c0c9807ab4 | 310 | #define LE_ENCRYPT_RP_SIZE 17 |
Wolfgang Betz |
90:26c0c9807ab4 | 311 | |
Wolfgang Betz |
90:26c0c9807ab4 | 312 | #define OCF_LE_RAND 0x0018 |
Wolfgang Betz |
90:26c0c9807ab4 | 313 | typedef __packed struct _le_rand_rp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 314 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 315 | uint8_t random[8]; |
Wolfgang Betz |
90:26c0c9807ab4 | 316 | } PACKED le_rand_rp; |
Wolfgang Betz |
90:26c0c9807ab4 | 317 | #define LE_RAND_RP_SIZE 9 |
Wolfgang Betz |
90:26c0c9807ab4 | 318 | |
Wolfgang Betz |
90:26c0c9807ab4 | 319 | #define OCF_LE_START_ENCRYPTION 0x0019 |
Wolfgang Betz |
90:26c0c9807ab4 | 320 | typedef __packed struct _le_start_encryption_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 321 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 322 | uint8_t random[8]; |
Wolfgang Betz |
90:26c0c9807ab4 | 323 | uint16_t diversifier; |
Wolfgang Betz |
90:26c0c9807ab4 | 324 | uint8_t key[16]; |
Wolfgang Betz |
90:26c0c9807ab4 | 325 | } PACKED le_start_encryption_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 326 | #define LE_START_ENCRYPTION_CP_SIZE 28 |
Wolfgang Betz |
90:26c0c9807ab4 | 327 | |
Wolfgang Betz |
90:26c0c9807ab4 | 328 | #define OCF_LE_LTK_REPLY 0x001A |
Wolfgang Betz |
90:26c0c9807ab4 | 329 | typedef __packed struct _le_ltk_reply_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 330 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 331 | uint8_t key[16]; |
Wolfgang Betz |
90:26c0c9807ab4 | 332 | } PACKED le_ltk_reply_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 333 | #define LE_LTK_REPLY_CP_SIZE 18 |
Wolfgang Betz |
90:26c0c9807ab4 | 334 | |
Wolfgang Betz |
90:26c0c9807ab4 | 335 | typedef __packed struct _le_ltk_reply_rp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 336 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 337 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 338 | } PACKED le_ltk_reply_rp; |
Wolfgang Betz |
90:26c0c9807ab4 | 339 | #define LE_LTK_REPLY_RP_SIZE 3 |
Wolfgang Betz |
90:26c0c9807ab4 | 340 | |
Wolfgang Betz |
90:26c0c9807ab4 | 341 | #define OCF_LE_LTK_NEG_REPLY 0x001B |
Wolfgang Betz |
90:26c0c9807ab4 | 342 | typedef __packed struct _le_ltk_neg_reply_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 343 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 344 | } PACKED le_ltk_neg_reply_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 345 | #define LE_LTK_NEG_REPLY_CP_SIZE 2 |
Wolfgang Betz |
90:26c0c9807ab4 | 346 | |
Wolfgang Betz |
90:26c0c9807ab4 | 347 | typedef __packed struct _le_ltk_neg_reply_rp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 348 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 349 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 350 | } PACKED le_ltk_neg_reply_rp; |
Wolfgang Betz |
90:26c0c9807ab4 | 351 | #define LE_LTK_NEG_REPLY_RP_SIZE 3 |
Wolfgang Betz |
90:26c0c9807ab4 | 352 | |
Wolfgang Betz |
90:26c0c9807ab4 | 353 | #define OCF_LE_READ_SUPPORTED_STATES 0x001C |
Wolfgang Betz |
90:26c0c9807ab4 | 354 | typedef __packed struct _le_read_supported_states_rp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 355 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 356 | uint8_t states[8]; |
Wolfgang Betz |
90:26c0c9807ab4 | 357 | } PACKED le_read_supported_states_rp; |
Wolfgang Betz |
90:26c0c9807ab4 | 358 | #define LE_READ_SUPPORTED_STATES_RP_SIZE 9 |
Wolfgang Betz |
90:26c0c9807ab4 | 359 | |
Wolfgang Betz |
90:26c0c9807ab4 | 360 | #define OCF_LE_RECEIVER_TEST 0x001D |
Wolfgang Betz |
90:26c0c9807ab4 | 361 | typedef __packed struct _le_receiver_test_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 362 | uint8_t frequency; |
Wolfgang Betz |
90:26c0c9807ab4 | 363 | } PACKED le_receiver_test_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 364 | #define LE_RECEIVER_TEST_CP_SIZE 1 |
Wolfgang Betz |
90:26c0c9807ab4 | 365 | |
Wolfgang Betz |
90:26c0c9807ab4 | 366 | #define OCF_LE_TRANSMITTER_TEST 0x001E |
Wolfgang Betz |
90:26c0c9807ab4 | 367 | typedef __packed struct _le_transmitter_test_cp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 368 | uint8_t frequency; |
Wolfgang Betz |
90:26c0c9807ab4 | 369 | uint8_t length; |
Wolfgang Betz |
90:26c0c9807ab4 | 370 | uint8_t payload; |
Wolfgang Betz |
90:26c0c9807ab4 | 371 | } PACKED le_transmitter_test_cp; |
Wolfgang Betz |
90:26c0c9807ab4 | 372 | #define LE_TRANSMITTER_TEST_CP_SIZE 3 |
Wolfgang Betz |
90:26c0c9807ab4 | 373 | |
Wolfgang Betz |
90:26c0c9807ab4 | 374 | #define OCF_LE_TEST_END 0x001F |
Wolfgang Betz |
90:26c0c9807ab4 | 375 | typedef __packed struct _le_test_end_rp{ |
Wolfgang Betz |
90:26c0c9807ab4 | 376 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 377 | uint16_t num_pkts; |
Wolfgang Betz |
90:26c0c9807ab4 | 378 | } PACKED le_test_end_rp; |
Wolfgang Betz |
90:26c0c9807ab4 | 379 | #define LE_TEST_END_RP_SIZE 3 |
Wolfgang Betz |
90:26c0c9807ab4 | 380 | |
Wolfgang Betz |
90:26c0c9807ab4 | 381 | /* Vendor specific commands */ |
Wolfgang Betz |
90:26c0c9807ab4 | 382 | #define OGF_VENDOR_CMD 0x3f |
Wolfgang Betz |
90:26c0c9807ab4 | 383 | |
Wolfgang Betz |
90:26c0c9807ab4 | 384 | |
Wolfgang Betz |
90:26c0c9807ab4 | 385 | /*------------- Events -------------*/ |
Wolfgang Betz |
90:26c0c9807ab4 | 386 | #define EVT_CONN_COMPLETE 0x03 |
Wolfgang Betz |
90:26c0c9807ab4 | 387 | typedef __packed struct _evt_conn_complete{ |
Wolfgang Betz |
90:26c0c9807ab4 | 388 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 389 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 390 | tBDAddr bdaddr; |
Wolfgang Betz |
90:26c0c9807ab4 | 391 | uint8_t link_type; |
Wolfgang Betz |
90:26c0c9807ab4 | 392 | uint8_t encr_mode; |
Wolfgang Betz |
90:26c0c9807ab4 | 393 | } PACKED evt_conn_complete; |
Wolfgang Betz |
90:26c0c9807ab4 | 394 | #define EVT_CONN_COMPLETE_SIZE 13 |
Wolfgang Betz |
90:26c0c9807ab4 | 395 | |
Wolfgang Betz |
90:26c0c9807ab4 | 396 | #define EVT_DISCONN_COMPLETE 0x05 |
Wolfgang Betz |
90:26c0c9807ab4 | 397 | typedef __packed struct _evt_disconn_complete{ |
Wolfgang Betz |
90:26c0c9807ab4 | 398 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 399 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 400 | uint8_t reason; |
Wolfgang Betz |
90:26c0c9807ab4 | 401 | } PACKED evt_disconn_complete; |
Wolfgang Betz |
90:26c0c9807ab4 | 402 | #define EVT_DISCONN_COMPLETE_SIZE 4 |
Wolfgang Betz |
90:26c0c9807ab4 | 403 | |
Wolfgang Betz |
90:26c0c9807ab4 | 404 | #define EVT_ENCRYPT_CHANGE 0x08 |
Wolfgang Betz |
90:26c0c9807ab4 | 405 | typedef __packed struct _evt_encrypt_change{ |
Wolfgang Betz |
90:26c0c9807ab4 | 406 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 407 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 408 | uint8_t encrypt; |
Wolfgang Betz |
90:26c0c9807ab4 | 409 | } PACKED evt_encrypt_change; |
Wolfgang Betz |
90:26c0c9807ab4 | 410 | #define EVT_ENCRYPT_CHANGE_SIZE 5 |
Wolfgang Betz |
90:26c0c9807ab4 | 411 | |
Wolfgang Betz |
90:26c0c9807ab4 | 412 | #define EVT_READ_REMOTE_VERSION_COMPLETE 0x0C |
Wolfgang Betz |
90:26c0c9807ab4 | 413 | |
Wolfgang Betz |
90:26c0c9807ab4 | 414 | #define EVT_CMD_COMPLETE 0x0E |
Wolfgang Betz |
90:26c0c9807ab4 | 415 | typedef __packed struct _evt_cmd_complete{ |
Wolfgang Betz |
90:26c0c9807ab4 | 416 | uint8_t ncmd; |
Wolfgang Betz |
90:26c0c9807ab4 | 417 | uint16_t opcode; |
Wolfgang Betz |
90:26c0c9807ab4 | 418 | } PACKED evt_cmd_complete; |
Wolfgang Betz |
90:26c0c9807ab4 | 419 | #define EVT_CMD_COMPLETE_SIZE 3 |
Wolfgang Betz |
90:26c0c9807ab4 | 420 | |
Wolfgang Betz |
90:26c0c9807ab4 | 421 | #define EVT_CMD_STATUS 0x0F |
Wolfgang Betz |
90:26c0c9807ab4 | 422 | typedef __packed struct _evt_cmd_status{ |
Wolfgang Betz |
90:26c0c9807ab4 | 423 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 424 | uint8_t ncmd; |
Wolfgang Betz |
90:26c0c9807ab4 | 425 | uint16_t opcode; |
Wolfgang Betz |
90:26c0c9807ab4 | 426 | } PACKED evt_cmd_status; |
Wolfgang Betz |
90:26c0c9807ab4 | 427 | #define EVT_CMD_STATUS_SIZE 4 |
Wolfgang Betz |
90:26c0c9807ab4 | 428 | |
Wolfgang Betz |
90:26c0c9807ab4 | 429 | #define EVT_HARDWARE_ERROR 0x10 |
Wolfgang Betz |
90:26c0c9807ab4 | 430 | typedef __packed struct _evt_hardware_error{ |
Wolfgang Betz |
90:26c0c9807ab4 | 431 | uint8_t code; |
Wolfgang Betz |
90:26c0c9807ab4 | 432 | } PACKED evt_hardware_error; |
Wolfgang Betz |
90:26c0c9807ab4 | 433 | #define EVT_HARDWARE_ERROR_SIZE 1 |
Wolfgang Betz |
90:26c0c9807ab4 | 434 | |
Wolfgang Betz |
90:26c0c9807ab4 | 435 | #define EVT_NUM_COMP_PKTS 0x13 |
Wolfgang Betz |
90:26c0c9807ab4 | 436 | typedef __packed struct _evt_num_comp_pkts{ |
Wolfgang Betz |
90:26c0c9807ab4 | 437 | uint8_t num_hndl; |
Wolfgang Betz |
90:26c0c9807ab4 | 438 | /* variable length part */ |
Wolfgang Betz |
90:26c0c9807ab4 | 439 | } PACKED evt_num_comp_pkts; |
Wolfgang Betz |
90:26c0c9807ab4 | 440 | #define EVT_NUM_COMP_PKTS_SIZE 1 |
Wolfgang Betz |
90:26c0c9807ab4 | 441 | |
Wolfgang Betz |
90:26c0c9807ab4 | 442 | /* variable length part of evt_num_comp_pkts. */ |
Wolfgang Betz |
90:26c0c9807ab4 | 443 | typedef __packed struct _evt_num_comp_pkts_param{ |
Wolfgang Betz |
90:26c0c9807ab4 | 444 | uint16_t hndl; |
Wolfgang Betz |
90:26c0c9807ab4 | 445 | uint16_t num_comp_pkts; |
Wolfgang Betz |
90:26c0c9807ab4 | 446 | } PACKED evt_num_comp_pkts_param; |
Wolfgang Betz |
90:26c0c9807ab4 | 447 | #define EVT_NUM_COMP_PKTS_PARAM_SIZE 1 |
Wolfgang Betz |
90:26c0c9807ab4 | 448 | |
Wolfgang Betz |
90:26c0c9807ab4 | 449 | #define EVT_DATA_BUFFER_OVERFLOW 0x1A |
Wolfgang Betz |
90:26c0c9807ab4 | 450 | typedef __packed struct _evt_data_buffer_overflow{ |
Wolfgang Betz |
90:26c0c9807ab4 | 451 | uint8_t link_type; |
Wolfgang Betz |
90:26c0c9807ab4 | 452 | } PACKED evt_data_buffer_overflow; |
Wolfgang Betz |
90:26c0c9807ab4 | 453 | #define EVT_DATA_BUFFER_OVERFLOW_SIZE 1 |
Wolfgang Betz |
90:26c0c9807ab4 | 454 | |
Wolfgang Betz |
90:26c0c9807ab4 | 455 | #define EVT_ENCRYPTION_KEY_REFRESH_COMPLETE 0x30 |
Wolfgang Betz |
90:26c0c9807ab4 | 456 | typedef __packed struct _evt_encryption_key_refresh_complete{ |
Wolfgang Betz |
90:26c0c9807ab4 | 457 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 458 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 459 | } PACKED evt_encryption_key_refresh_complete; |
Wolfgang Betz |
90:26c0c9807ab4 | 460 | #define EVT_ENCRYPTION_KEY_REFRESH_COMPLETE_SIZE 3 |
Wolfgang Betz |
90:26c0c9807ab4 | 461 | |
Wolfgang Betz |
90:26c0c9807ab4 | 462 | #define EVT_LE_META_EVENT 0x3E |
Wolfgang Betz |
90:26c0c9807ab4 | 463 | typedef __packed struct _evt_le_meta_event{ |
Wolfgang Betz |
90:26c0c9807ab4 | 464 | uint8_t subevent; |
Wolfgang Betz |
90:26c0c9807ab4 | 465 | uint8_t data[VARIABLE_SIZE]; |
Wolfgang Betz |
90:26c0c9807ab4 | 466 | } PACKED evt_le_meta_event; |
Wolfgang Betz |
90:26c0c9807ab4 | 467 | #define EVT_LE_META_EVENT_SIZE 1 |
Wolfgang Betz |
90:26c0c9807ab4 | 468 | |
Wolfgang Betz |
90:26c0c9807ab4 | 469 | #define EVT_LE_CONN_COMPLETE 0x01 |
Wolfgang Betz |
90:26c0c9807ab4 | 470 | typedef __packed struct _evt_le_connection_complete{ |
Wolfgang Betz |
90:26c0c9807ab4 | 471 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 472 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 473 | uint8_t role; |
Wolfgang Betz |
90:26c0c9807ab4 | 474 | uint8_t peer_bdaddr_type; |
Wolfgang Betz |
90:26c0c9807ab4 | 475 | tBDAddr peer_bdaddr; |
Wolfgang Betz |
90:26c0c9807ab4 | 476 | uint16_t interval; |
Wolfgang Betz |
90:26c0c9807ab4 | 477 | uint16_t latency; |
Wolfgang Betz |
90:26c0c9807ab4 | 478 | uint16_t supervision_timeout; |
Wolfgang Betz |
90:26c0c9807ab4 | 479 | uint8_t master_clock_accuracy; |
Wolfgang Betz |
90:26c0c9807ab4 | 480 | } PACKED evt_le_connection_complete; |
Wolfgang Betz |
90:26c0c9807ab4 | 481 | #define EVT_LE_CONN_COMPLETE_SIZE 18 |
Wolfgang Betz |
90:26c0c9807ab4 | 482 | |
Wolfgang Betz |
90:26c0c9807ab4 | 483 | #define EVT_LE_ADVERTISING_REPORT 0x02 |
Wolfgang Betz |
90:26c0c9807ab4 | 484 | typedef __packed struct _le_advertising_info{ |
Wolfgang Betz |
90:26c0c9807ab4 | 485 | uint8_t evt_type; |
Wolfgang Betz |
90:26c0c9807ab4 | 486 | uint8_t bdaddr_type; |
Wolfgang Betz |
90:26c0c9807ab4 | 487 | tBDAddr bdaddr; |
Wolfgang Betz |
90:26c0c9807ab4 | 488 | uint8_t data_length; |
Wolfgang Betz |
90:26c0c9807ab4 | 489 | uint8_t data_RSSI[VARIABLE_SIZE]; // RSSI is last octect (signed integer). |
Wolfgang Betz |
90:26c0c9807ab4 | 490 | } PACKED le_advertising_info; |
Wolfgang Betz |
90:26c0c9807ab4 | 491 | #define LE_ADVERTISING_INFO_SIZE 9 |
Wolfgang Betz |
90:26c0c9807ab4 | 492 | |
Wolfgang Betz |
90:26c0c9807ab4 | 493 | #define EVT_LE_CONN_UPDATE_COMPLETE 0x03 |
Wolfgang Betz |
90:26c0c9807ab4 | 494 | typedef __packed struct _evt_le_connection_update_complete{ |
Wolfgang Betz |
90:26c0c9807ab4 | 495 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 496 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 497 | uint16_t interval; |
Wolfgang Betz |
90:26c0c9807ab4 | 498 | uint16_t latency; |
Wolfgang Betz |
90:26c0c9807ab4 | 499 | uint16_t supervision_timeout; |
Wolfgang Betz |
90:26c0c9807ab4 | 500 | } PACKED evt_le_connection_update_complete; |
Wolfgang Betz |
90:26c0c9807ab4 | 501 | #define EVT_LE_CONN_UPDATE_COMPLETE_SIZE 9 |
Wolfgang Betz |
90:26c0c9807ab4 | 502 | |
Wolfgang Betz |
90:26c0c9807ab4 | 503 | #define EVT_LE_READ_REMOTE_USED_FEATURES_COMPLETE 0x04 |
Wolfgang Betz |
90:26c0c9807ab4 | 504 | typedef __packed struct _evt_le_read_remote_used_features_complete{ |
Wolfgang Betz |
90:26c0c9807ab4 | 505 | uint8_t status; |
Wolfgang Betz |
90:26c0c9807ab4 | 506 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 507 | uint8_t features[8]; |
Wolfgang Betz |
90:26c0c9807ab4 | 508 | } PACKED evt_le_read_remote_used_features_complete; |
Wolfgang Betz |
90:26c0c9807ab4 | 509 | #define EVT_LE_READ_REMOTE_USED_FEATURES_COMPLETE_SIZE 11 |
Wolfgang Betz |
90:26c0c9807ab4 | 510 | |
Wolfgang Betz |
90:26c0c9807ab4 | 511 | #define EVT_LE_LTK_REQUEST 0x05 |
Wolfgang Betz |
90:26c0c9807ab4 | 512 | typedef __packed struct _evt_le_long_term_key_request{ |
Wolfgang Betz |
90:26c0c9807ab4 | 513 | uint16_t handle; |
Wolfgang Betz |
90:26c0c9807ab4 | 514 | uint8_t random[8]; |
Wolfgang Betz |
90:26c0c9807ab4 | 515 | uint16_t ediv; |
Wolfgang Betz |
90:26c0c9807ab4 | 516 | } PACKED evt_le_long_term_key_request; |
Wolfgang Betz |
90:26c0c9807ab4 | 517 | #define EVT_LE_LTK_REQUEST_SIZE 12 |
Wolfgang Betz |
90:26c0c9807ab4 | 518 | |
Wolfgang Betz |
90:26c0c9807ab4 | 519 | /** |
Wolfgang Betz |
90:26c0c9807ab4 | 520 | * The event code in the @ref hci_event_pckt structure. If event code is EVT_VENDOR, |
Wolfgang Betz |
90:26c0c9807ab4 | 521 | * application can use @ref evt_blue_aci structure to parse the packet. |
Wolfgang Betz |
90:26c0c9807ab4 | 522 | */ |
Wolfgang Betz |
90:26c0c9807ab4 | 523 | #define EVT_VENDOR 0xFF |
Wolfgang Betz |
90:26c0c9807ab4 | 524 | |
Wolfgang Betz |
90:26c0c9807ab4 | 525 | |
Wolfgang Betz |
90:26c0c9807ab4 | 526 | /* Command opcode pack/unpack */ |
Wolfgang Betz |
90:26c0c9807ab4 | 527 | #define cmd_opcode_pack(ogf, ocf) (uint16_t)((ocf & 0x03ff)|(ogf << 10)) |
Wolfgang Betz |
90:26c0c9807ab4 | 528 | #define cmd_opcode_ogf(op) (op >> 10) |
Wolfgang Betz |
90:26c0c9807ab4 | 529 | #define cmd_opcode_ocf(op) (op & 0x03ff) |
Wolfgang Betz |
90:26c0c9807ab4 | 530 | |
Wolfgang Betz |
90:26c0c9807ab4 | 531 | |
Wolfgang Betz |
90:26c0c9807ab4 | 532 | struct hci_request { |
Wolfgang Betz |
90:26c0c9807ab4 | 533 | uint16_t ogf; |
Wolfgang Betz |
90:26c0c9807ab4 | 534 | uint16_t ocf; |
Wolfgang Betz |
90:26c0c9807ab4 | 535 | int event; |
Wolfgang Betz |
90:26c0c9807ab4 | 536 | void *cparam; |
Wolfgang Betz |
90:26c0c9807ab4 | 537 | int clen; |
Wolfgang Betz |
90:26c0c9807ab4 | 538 | void *rparam; |
Wolfgang Betz |
90:26c0c9807ab4 | 539 | int rlen; |
Wolfgang Betz |
90:26c0c9807ab4 | 540 | }; |
Wolfgang Betz |
90:26c0c9807ab4 | 541 | |
Wolfgang Betz |
90:26c0c9807ab4 | 542 | void hci_send_cmd(uint16_t ogf, uint16_t ocf, uint8_t plen, void *param); |
Wolfgang Betz |
90:26c0c9807ab4 | 543 | |
Wolfgang Betz |
90:26c0c9807ab4 | 544 | typedef enum { |
Wolfgang Betz |
90:26c0c9807ab4 | 545 | WAITING_TYPE, |
Wolfgang Betz |
90:26c0c9807ab4 | 546 | WAITING_OPCODE1, |
Wolfgang Betz |
90:26c0c9807ab4 | 547 | WAITING_OPCODE2, |
Wolfgang Betz |
90:26c0c9807ab4 | 548 | WAITING_EVENT_CODE, |
Wolfgang Betz |
90:26c0c9807ab4 | 549 | WAITING_HANDLE, |
Wolfgang Betz |
90:26c0c9807ab4 | 550 | WAITING_HANDLE_FLAG, |
Wolfgang Betz |
90:26c0c9807ab4 | 551 | WAITING_PARAM_LEN, |
Wolfgang Betz |
90:26c0c9807ab4 | 552 | WAITING_DATA_LEN1, |
Wolfgang Betz |
90:26c0c9807ab4 | 553 | WAITING_DATA_LEN2, |
Wolfgang Betz |
90:26c0c9807ab4 | 554 | WAITING_PAYLOAD |
Wolfgang Betz |
90:26c0c9807ab4 | 555 | }hci_state; |
Wolfgang Betz |
90:26c0c9807ab4 | 556 | |
Wolfgang Betz |
90:26c0c9807ab4 | 557 | typedef void (*hci_packet_complete_callback)(void *pckt, uint16_t len); |
Wolfgang Betz |
90:26c0c9807ab4 | 558 | |
Wolfgang Betz |
90:26c0c9807ab4 | 559 | /* HCI library functions. */ |
Wolfgang Betz |
90:26c0c9807ab4 | 560 | void hci_init(void); |
Wolfgang Betz |
90:26c0c9807ab4 | 561 | |
Wolfgang Betz |
90:26c0c9807ab4 | 562 | int hci_send_req(struct hci_request *r, BOOL async); |
Wolfgang Betz |
90:26c0c9807ab4 | 563 | |
Wolfgang Betz |
90:26c0c9807ab4 | 564 | #endif /* __HCI_INTERNAL_H_ */ |