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