BLE_API wrapper library for STMicroelectronics' BlueNRG Bluetooth Low Energy expansion board shield

Fork of X_NUCLEO_IDB0XA1 by ST Expansion SW Team

Committer:
Wolfgang Betz
Date:
Wed Oct 07 08:39:04 2015 +0200
Revision:
132:51056160fa4a
Child:
219:9981f62cdb1a
Andrea's version as of mail from 10/06/2015 05:56 PM

From: Andrea PALMIERI <andrea.palmieri@st.com>
To: Wolfgang BETZ <wolfgang.betz@st.com>, Rohit Grover <rohit.grover@arm.com>,
Antonio VILEI <antonio.vilei@st.com>, Mihail Stoyanov
<Mihail.Stoyanov@arm.com>
CC: Nicola CAPOVILLA <nicola.capovilla@st.com>, Silvio Lucio OLIVA
<silvio.oliva@st.com>, "jonathan.austin@arm.com" <jonathan.austin@arm.com>
Content-Class: urn:content-classes:message
Date: Tue, 6 Oct 2015 17:56:34 +0200
Subject: RE: Arduino Compatibility of X-NUCLEO-IDB04A1

Who changed what in which revision?

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