Adapted to OBCP ENSMM

Dependents:   SimpleBLE-ObCP_ENSMM_V2019_Test_BLE_S SimpleBLE-ObCp_test-BLE_envoi SimpleBLE-ObCp_test-BLE Roller_catcher_Envoi ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ble_hci_const.h Source File

ble_hci_const.h

00001 /******************************************************************************
00002 *
00003 *  File Description 
00004 *  ---------------------
00005 * This file defines constants and functions for HCI layer.
00006 * See Bluetooth Core v 4.0, Vol. 2, Part E.
00007 * 
00008 *******************************************************************************/
00009 
00010 #ifndef __HCI_INTERNAL_H_
00011 #define __HCI_INTERNAL_H_
00012 
00013 #include "ble_compiler.h"
00014 #include "ble_hal_types.h"
00015 #include "ble_clock.h"
00016 #include "ble_link_layer.h"
00017 #include "ble_hci.h"
00018 
00019 #define DEFAULT_TIMEOUT (CLOCK_SECOND/10)
00020 
00021 /**
00022  * Maximum payload of HCI commands that can be sent. Change this value if needed.
00023  * This value can be up to 255.
00024  */
00025 #define HCI_MAX_PAYLOAD_SIZE 128
00026 
00027 /* HCI Packet types */
00028 #define HCI_COMMAND_PKT     0x01
00029 #define HCI_ACLDATA_PKT     0x02
00030 #define HCI_SCODATA_PKT     0x03
00031 #define HCI_EVENT_PKT       0x04
00032 #define HCI_VENDOR_PKT      0xff
00033 
00034 typedef __packed struct _hci_uart_pckt{
00035   uint8_t type;
00036   uint8_t data[VARIABLE_SIZE];
00037 } PACKED hci_uart_pckt;
00038 #define HCI_HDR_SIZE 1
00039 
00040 typedef __packed struct _hci_command_hdr{
00041   uint16_t opcode;      /* OCF & OGF */
00042   uint8_t  plen;
00043 } PACKED hci_command_hdr;
00044 #define HCI_COMMAND_HDR_SIZE    3
00045 
00046 typedef __packed struct _hci_event_pckt{
00047   uint8_t evt;
00048   uint8_t plen;
00049   uint8_t data[VARIABLE_SIZE];
00050 } PACKED hci_event_pckt;
00051 #define HCI_EVENT_HDR_SIZE  2
00052 
00053 typedef __packed struct _hci_acl_hdr{
00054   uint16_t handle;      /* Handle & Flags(PB, BC) */
00055   uint16_t dlen;
00056 } PACKED hci_acl_hdr;
00057 #define HCI_ACL_HDR_SIZE    4
00058 
00059 /* Link Control */
00060 #define OGF_LINK_CTL            0x01
00061 
00062 #define OCF_DISCONNECT          0x0006
00063 typedef __packed struct _disconnect_cp{
00064   uint16_t handle;
00065   uint8_t  reason;
00066 } PACKED disconnect_cp;
00067 #define DISCONNECT_CP_SIZE      3
00068 
00069 /* Host Controller and Baseband */
00070 #define OGF_HOST_CTL            0x03
00071 
00072 #define OCF_SET_EVENT_MASK      0x0001
00073 #define OCF_RESET               0x0003
00074 
00075 #define OCF_READ_TRANSMIT_POWER_LEVEL   0x002D
00076 typedef __packed struct _read_transmit_power_level_cp{
00077   uint16_t handle;
00078   uint8_t  type;
00079 } PACKED read_transmit_power_level_cp;
00080 #define READ_TRANSMIT_POWER_LEVEL_CP_SIZE 3
00081 typedef __packed struct _read_transmit_power_level_rp{
00082   uint8_t  status;
00083   uint16_t handle;
00084   int8_t   level;
00085 } PACKED read_transmit_power_level_rp;
00086 #define READ_TRANSMIT_POWER_LEVEL_RP_SIZE 4
00087 
00088 #define OCF_SET_CONTROLLER_TO_HOST_FC   0x0031
00089 #define OCF_HOST_BUFFER_SIZE            0x0033
00090 #define OCF_HOST_NUM_COMP_PKTS          0x0035
00091 
00092 /* Informational Parameters */
00093 #define OGF_INFO_PARAM                  0x04
00094 
00095 #define OCF_READ_LOCAL_VERSION          0x0001
00096 typedef __packed struct _read_local_version_rp{
00097   uint8_t  status;
00098   uint8_t  hci_version;
00099   uint16_t hci_revision;
00100   uint8_t  lmp_pal_version;
00101   uint16_t manufacturer_name;
00102   uint16_t lmp_pal_subversion;
00103 } PACKED read_local_version_rp;
00104 #define READ_LOCAL_VERSION_RP_SIZE      9
00105 
00106 #define OCF_READ_LOCAL_COMMANDS         0x0002
00107 #define OCF_READ_LOCAL_FEATURES         0x0003
00108 
00109 #define OCF_READ_BD_ADDR                0x0009
00110 typedef __packed struct _read_bd_addr_rp{
00111   uint8_t status;
00112   tBDAddr bdaddr;
00113 } PACKED read_bd_addr_rp;
00114 #define READ_BD_ADDR_RP_SIZE            7
00115 
00116 /* Status params */
00117 #define OGF_STATUS_PARAM                0x05
00118 
00119 #define OCF_READ_RSSI                   0x0005
00120 typedef __packed struct _read_rssi_cp{
00121   uint16_t handle;
00122 } PACKED read_rssi_cp;
00123 #define READ_RSSI_CP_SIZE               2
00124 typedef __packed struct _read_rssi_rp{
00125   uint8_t  status;
00126   uint16_t handle;
00127   int8_t   rssi;
00128 } PACKED read_rssi_rp;
00129 #define READ_RSSI_RP_SIZE               4
00130 
00131 
00132 /* LE commands */
00133 #define OGF_LE_CTL                      0x08
00134 
00135 #define OCF_LE_SET_EVENT_MASK           0x0001
00136 typedef __packed struct _le_set_event_mask_cp{
00137   uint8_t mask[8];
00138 } PACKED le_set_event_mask_cp;
00139 #define LE_SET_EVENT_MASK_CP_SIZE       8
00140 
00141 #define OCF_LE_READ_BUFFER_SIZE         0x0002
00142 typedef __packed struct _le_read_buffer_size_rp{
00143   uint8_t  status;
00144   uint16_t pkt_len;
00145   uint8_t  max_pkt;
00146 } PACKED le_read_buffer_size_rp;
00147 #define LE_READ_BUFFER_SIZE_RP_SIZE     4
00148 
00149 #define OCF_LE_READ_LOCAL_SUPPORTED_FEATURES    0x0003
00150 typedef __packed struct _le_read_local_supported_features_rp{
00151   uint8_t status;
00152   uint8_t features[8];
00153 } PACKED le_read_local_supported_features_rp;
00154 #define LE_READ_LOCAL_SUPPORTED_FEATURES_RP_SIZE 9
00155 
00156 #define OCF_LE_SET_RANDOM_ADDRESS       0x0005
00157 typedef __packed struct _le_set_random_address_cp{
00158   tBDAddr bdaddr;
00159 } PACKED le_set_random_address_cp;
00160 #define LE_SET_RANDOM_ADDRESS_CP_SIZE 6
00161 
00162 #define OCF_LE_SET_ADV_PARAMETERS   0x0006
00163 typedef __packed struct _le_set_adv_parameters_cp{
00164   uint16_t min_interval;
00165   uint16_t max_interval;
00166   uint8_t  advtype;
00167   uint8_t  own_bdaddr_type;
00168   uint8_t  direct_bdaddr_type;
00169   tBDAddr  direct_bdaddr;
00170   uint8_t  chan_map;
00171   uint8_t  filter;
00172 } PACKED le_set_adv_parameters_cp;
00173 #define LE_SET_ADV_PARAMETERS_CP_SIZE 15
00174 
00175 #define OCF_LE_READ_ADV_CHANNEL_TX_POWER    0x0007
00176 typedef __packed struct _le_read_adv_channel_tx_power_rp{
00177   uint8_t status;
00178   int8_t  level;
00179 } PACKED le_read_adv_channel_tx_power_rp;
00180 #define LE_READ_ADV_CHANNEL_TX_POWER_RP_SIZE 2
00181 
00182 #define OCF_LE_SET_ADV_DATA     0x0008
00183 typedef __packed struct _le_set_adv_data_cp{
00184   uint8_t length;
00185   uint8_t data[31];
00186 } PACKED le_set_adv_data_cp;
00187 #define LE_SET_ADV_DATA_CP_SIZE 32
00188 
00189 #define OCF_LE_SET_SCAN_RESPONSE_DATA       0x0009
00190 typedef __packed struct _le_set_scan_response_data_cp{
00191   uint8_t length;
00192   uint8_t data[31];
00193 } PACKED le_set_scan_response_data_cp;
00194 #define LE_SET_SCAN_RESPONSE_DATA_CP_SIZE 32
00195 
00196 #define OCF_LE_SET_ADVERTISE_ENABLE     0x000A
00197 typedef __packed struct _le_set_advertise_enable_cp{
00198   uint8_t enable;
00199 } PACKED le_set_advertise_enable_cp;
00200 #define LE_SET_ADVERTISE_ENABLE_CP_SIZE 1
00201 
00202 #define OCF_LE_SET_SCAN_PARAMETERS      0x000B
00203 typedef __packed struct _le_set_scan_parameters_cp{
00204   uint8_t  type;
00205   uint16_t interval;
00206   uint16_t window;
00207   uint8_t  own_bdaddr_type;
00208   uint8_t  filter;
00209 } PACKED le_set_scan_parameters_cp;
00210 #define LE_SET_SCAN_PARAMETERS_CP_SIZE 7
00211 
00212 #define OCF_LE_SET_SCAN_ENABLE          0x000C
00213 typedef __packed struct _le_set_scan_enable_cp{
00214   uint8_t enable;
00215   uint8_t filter_dup;
00216 } PACKED le_set_scan_enable_cp;
00217 #define LE_SET_SCAN_ENABLE_CP_SIZE 2
00218 
00219 #define OCF_LE_CREATE_CONN          0x000D
00220 typedef __packed struct _le_create_connection_cp{
00221   uint16_t interval;
00222   uint16_t window;
00223   uint8_t  initiator_filter;
00224   uint8_t  peer_bdaddr_type;
00225   tBDAddr  peer_bdaddr;
00226   uint8_t  own_bdaddr_type;
00227   uint16_t min_interval;
00228   uint16_t max_interval;
00229   uint16_t latency;
00230   uint16_t supervision_timeout;
00231   uint16_t min_ce_length;
00232   uint16_t max_ce_length;
00233 } PACKED le_create_connection_cp;
00234 #define LE_CREATE_CONN_CP_SIZE 25
00235 
00236 #define OCF_LE_CREATE_CONN_CANCEL       0x000E
00237 
00238 #define OCF_LE_READ_WHITE_LIST_SIZE     0x000F
00239 typedef __packed struct _le_read_white_list_size_rp{
00240   uint8_t status;
00241   uint8_t size;
00242 } PACKED le_read_white_list_size_rp;
00243 #define LE_READ_WHITE_LIST_SIZE_RP_SIZE 2
00244 
00245 #define OCF_LE_CLEAR_WHITE_LIST         0x0010
00246 
00247 #define OCF_LE_ADD_DEVICE_TO_WHITE_LIST     0x0011
00248 typedef __packed struct _le_add_device_to_white_list_cp{
00249   uint8_t bdaddr_type;
00250   tBDAddr bdaddr;
00251 } PACKED le_add_device_to_white_list_cp;
00252 #define LE_ADD_DEVICE_TO_WHITE_LIST_CP_SIZE 7
00253 
00254 #define OCF_LE_REMOVE_DEVICE_FROM_WHITE_LIST    0x0012
00255 typedef __packed struct _le_remove_device_from_white_list_cp{
00256   uint8_t bdaddr_type;
00257   tBDAddr bdaddr;
00258 } PACKED le_remove_device_from_white_list_cp;
00259 #define LE_REMOVE_DEVICE_FROM_WHITE_LIST_CP_SIZE 7
00260 
00261 #define OCF_LE_CONN_UPDATE          0x0013
00262 typedef __packed struct _le_connection_update_cp{
00263   uint16_t handle;
00264   uint16_t min_interval;
00265   uint16_t max_interval;
00266   uint16_t latency;
00267   uint16_t supervision_timeout;
00268   uint16_t min_ce_length;
00269   uint16_t max_ce_length;
00270 } PACKED le_connection_update_cp;
00271 #define LE_CONN_UPDATE_CP_SIZE 14
00272 
00273 #define OCF_LE_SET_HOST_CHANNEL_CLASSIFICATION  0x0014
00274 typedef __packed struct _le_set_host_channel_classification_cp{
00275   uint8_t map[5];
00276 } PACKED le_set_host_channel_classification_cp;
00277 #define LE_SET_HOST_CHANNEL_CLASSIFICATION_CP_SIZE 5
00278 
00279 #define OCF_LE_READ_CHANNEL_MAP         0x0015
00280 typedef __packed struct _le_read_channel_map_cp{
00281   uint16_t handle;
00282 } PACKED le_read_channel_map_cp;
00283 #define LE_READ_CHANNEL_MAP_CP_SIZE 2
00284 
00285 typedef __packed struct _le_read_channel_map_rp{
00286   uint8_t  status;
00287   uint16_t handle;
00288   uint8_t  map[5];
00289 } PACKED le_read_channel_map_rp;
00290 #define LE_READ_CHANNEL_MAP_RP_SIZE 8
00291 
00292 #define OCF_LE_READ_REMOTE_USED_FEATURES    0x0016
00293 typedef __packed struct _le_read_remote_used_features_cp{
00294   uint16_t handle;
00295 } PACKED le_read_remote_used_features_cp;
00296 #define LE_READ_REMOTE_USED_FEATURES_CP_SIZE 2
00297 
00298 #define OCF_LE_ENCRYPT              0x0017
00299 typedef __packed struct _le_encrypt_cp{
00300   uint8_t key[16];
00301   uint8_t plaintext[16];
00302 } PACKED le_encrypt_cp;
00303 #define LE_ENCRYPT_CP_SIZE 32
00304 
00305 typedef __packed struct _le_encrypt_rp{
00306   uint8_t status;
00307   uint8_t encdata[16];
00308 } PACKED le_encrypt_rp;
00309 #define LE_ENCRYPT_RP_SIZE 17
00310 
00311 #define OCF_LE_RAND             0x0018
00312 typedef __packed struct _le_rand_rp{
00313   uint8_t status;
00314   uint8_t random[8];
00315 } PACKED le_rand_rp;
00316 #define LE_RAND_RP_SIZE 9
00317 
00318 #define OCF_LE_START_ENCRYPTION         0x0019
00319 typedef __packed struct _le_start_encryption_cp{
00320   uint16_t handle;
00321   uint8_t  random[8];
00322   uint16_t diversifier;
00323   uint8_t  key[16];
00324 } PACKED le_start_encryption_cp;
00325 #define LE_START_ENCRYPTION_CP_SIZE 28
00326 
00327 #define OCF_LE_LTK_REPLY            0x001A
00328 typedef __packed struct _le_ltk_reply_cp{
00329   uint16_t handle;
00330   uint8_t  key[16];
00331 } PACKED le_ltk_reply_cp;
00332 #define LE_LTK_REPLY_CP_SIZE 18
00333 
00334 typedef __packed struct _le_ltk_reply_rp{
00335   uint8_t  status;
00336   uint16_t handle;
00337 } PACKED le_ltk_reply_rp;
00338 #define LE_LTK_REPLY_RP_SIZE 3
00339 
00340 #define OCF_LE_LTK_NEG_REPLY            0x001B
00341 typedef __packed struct _le_ltk_neg_reply_cp{
00342   uint16_t handle;
00343 } PACKED le_ltk_neg_reply_cp;
00344 #define LE_LTK_NEG_REPLY_CP_SIZE 2
00345 
00346 typedef __packed struct _le_ltk_neg_reply_rp{
00347   uint8_t  status;
00348   uint16_t handle;
00349 } PACKED le_ltk_neg_reply_rp;
00350 #define LE_LTK_NEG_REPLY_RP_SIZE 3
00351 
00352 #define OCF_LE_READ_SUPPORTED_STATES        0x001C
00353 typedef __packed struct _le_read_supported_states_rp{
00354   uint8_t status;
00355   uint8_t states[8];
00356 } PACKED le_read_supported_states_rp;
00357 #define LE_READ_SUPPORTED_STATES_RP_SIZE 9
00358 
00359 #define OCF_LE_RECEIVER_TEST            0x001D
00360 typedef __packed struct _le_receiver_test_cp{
00361   uint8_t frequency;
00362 } PACKED le_receiver_test_cp;
00363 #define LE_RECEIVER_TEST_CP_SIZE 1
00364 
00365 #define OCF_LE_TRANSMITTER_TEST         0x001E
00366 typedef __packed struct _le_transmitter_test_cp{
00367   uint8_t frequency;
00368   uint8_t length;
00369   uint8_t payload;
00370 } PACKED le_transmitter_test_cp;
00371 #define LE_TRANSMITTER_TEST_CP_SIZE 3
00372 
00373 #define OCF_LE_TEST_END             0x001F
00374 typedef __packed struct _le_test_end_rp{
00375   uint8_t  status;
00376   uint16_t num_pkts;
00377 } PACKED le_test_end_rp;
00378 #define LE_TEST_END_RP_SIZE 3
00379 
00380 /* Vendor specific commands */
00381 #define OGF_VENDOR_CMD      0x3f
00382 
00383 
00384 /*------------- Events -------------*/
00385 #define EVT_CONN_COMPLETE       0x03
00386 typedef __packed struct _evt_conn_complete{
00387   uint8_t  status;
00388   uint16_t handle;
00389   tBDAddr  bdaddr;
00390   uint8_t  link_type;
00391   uint8_t  encr_mode;
00392 } PACKED evt_conn_complete;
00393 #define EVT_CONN_COMPLETE_SIZE 13
00394 
00395 #define EVT_DISCONN_COMPLETE        0x05
00396 typedef __packed struct _evt_disconn_complete{
00397   uint8_t  status;
00398   uint16_t handle;
00399   uint8_t  reason;
00400 } PACKED evt_disconn_complete;
00401 #define EVT_DISCONN_COMPLETE_SIZE 4
00402 
00403 #define EVT_ENCRYPT_CHANGE      0x08
00404 typedef __packed struct _evt_encrypt_change{
00405   uint8_t  status;
00406   uint16_t handle;
00407   uint8_t  encrypt;
00408 } PACKED evt_encrypt_change;
00409 #define EVT_ENCRYPT_CHANGE_SIZE 5
00410 
00411 #define EVT_READ_REMOTE_VERSION_COMPLETE    0x0C
00412 
00413 #define EVT_CMD_COMPLETE        0x0E
00414 typedef __packed struct _evt_cmd_complete{
00415   uint8_t  ncmd;
00416   uint16_t opcode;
00417 } PACKED evt_cmd_complete;
00418 #define EVT_CMD_COMPLETE_SIZE 3
00419 
00420 #define EVT_CMD_STATUS          0x0F
00421 typedef __packed struct _evt_cmd_status{
00422   uint8_t  status;
00423   uint8_t  ncmd;
00424   uint16_t opcode;
00425 } PACKED evt_cmd_status;
00426 #define EVT_CMD_STATUS_SIZE 4
00427 
00428 #define EVT_HARDWARE_ERROR      0x10
00429 typedef __packed struct _evt_hardware_error{
00430   uint8_t code;
00431 } PACKED evt_hardware_error;
00432 #define EVT_HARDWARE_ERROR_SIZE 1
00433 
00434 #define EVT_NUM_COMP_PKTS       0x13
00435 typedef __packed struct _evt_num_comp_pkts{
00436   uint8_t num_hndl;
00437   /* variable length part */
00438 } PACKED evt_num_comp_pkts;
00439 #define EVT_NUM_COMP_PKTS_SIZE 1
00440 
00441 /* variable length part of evt_num_comp_pkts. */
00442 typedef __packed struct _evt_num_comp_pkts_param{
00443   uint16_t hndl;
00444   uint16_t num_comp_pkts;
00445 } PACKED evt_num_comp_pkts_param;
00446 #define EVT_NUM_COMP_PKTS_PARAM_SIZE 1
00447 
00448 #define EVT_DATA_BUFFER_OVERFLOW        0x1A
00449 typedef __packed struct _evt_data_buffer_overflow{
00450   uint8_t link_type;
00451 } PACKED evt_data_buffer_overflow;
00452 #define EVT_DATA_BUFFER_OVERFLOW_SIZE 1
00453 
00454 #define EVT_ENCRYPTION_KEY_REFRESH_COMPLETE 0x30
00455 typedef __packed struct _evt_encryption_key_refresh_complete{
00456   uint8_t  status;
00457   uint16_t handle;
00458 } PACKED evt_encryption_key_refresh_complete;
00459 #define EVT_ENCRYPTION_KEY_REFRESH_COMPLETE_SIZE 3
00460 
00461 #define EVT_LE_META_EVENT   0x3E
00462 typedef __packed struct _evt_le_meta_event{
00463   uint8_t subevent;
00464   uint8_t data[VARIABLE_SIZE];
00465 } PACKED evt_le_meta_event;
00466 #define EVT_LE_META_EVENT_SIZE 1
00467 
00468 #define EVT_LE_CONN_COMPLETE    0x01
00469 typedef __packed struct _evt_le_connection_complete{
00470   uint8_t  status;
00471   uint16_t handle;
00472   uint8_t  role;
00473   uint8_t  peer_bdaddr_type;
00474   tBDAddr  peer_bdaddr;
00475   uint16_t interval;
00476   uint16_t latency;
00477   uint16_t supervision_timeout;
00478   uint8_t  master_clock_accuracy;
00479 } PACKED evt_le_connection_complete;
00480 #define EVT_LE_CONN_COMPLETE_SIZE 18
00481 
00482 #define EVT_LE_ADVERTISING_REPORT   0x02
00483 typedef __packed struct _le_advertising_info{
00484   uint8_t evt_type;
00485   uint8_t bdaddr_type;
00486   tBDAddr bdaddr;
00487   uint8_t data_length;
00488   uint8_t data_RSSI[VARIABLE_SIZE]; // RSSI is last octect (signed integer).
00489 } PACKED le_advertising_info;
00490 #define LE_ADVERTISING_INFO_SIZE 9
00491 
00492 #define EVT_LE_CONN_UPDATE_COMPLETE 0x03
00493 typedef __packed struct _evt_le_connection_update_complete{
00494   uint8_t  status;
00495   uint16_t handle;
00496   uint16_t interval;
00497   uint16_t latency;
00498   uint16_t supervision_timeout;
00499 } PACKED evt_le_connection_update_complete;
00500 #define EVT_LE_CONN_UPDATE_COMPLETE_SIZE 9
00501 
00502 #define EVT_LE_READ_REMOTE_USED_FEATURES_COMPLETE   0x04
00503 typedef __packed struct _evt_le_read_remote_used_features_complete{
00504   uint8_t  status;
00505   uint16_t handle;
00506   uint8_t  features[8];
00507 } PACKED evt_le_read_remote_used_features_complete;
00508 #define EVT_LE_READ_REMOTE_USED_FEATURES_COMPLETE_SIZE 11
00509 
00510 #define EVT_LE_LTK_REQUEST  0x05
00511 typedef __packed struct _evt_le_long_term_key_request{
00512   uint16_t handle;
00513   uint8_t  random[8];
00514   uint16_t ediv;
00515 } PACKED evt_le_long_term_key_request;
00516 #define EVT_LE_LTK_REQUEST_SIZE 12
00517 
00518 /**
00519 * The event code in the @ref hci_event_pckt structure. If event code is EVT_VENDOR,
00520 * application can use @ref evt_blue_aci structure to parse the packet.
00521 */
00522 #define EVT_VENDOR  0xFF
00523 
00524 
00525 /* Command opcode pack/unpack */
00526 #define cmd_opcode_pack(ogf, ocf)   (uint16_t)((ocf & 0x03ff)|(ogf << 10))
00527 #define cmd_opcode_ogf(op)      (op >> 10)
00528 #define cmd_opcode_ocf(op)      (op & 0x03ff)
00529 
00530 
00531 struct hci_request {
00532   uint16_t ogf;
00533   uint16_t ocf;
00534   int      event;
00535   void     *cparam;
00536   int      clen;
00537   void     *rparam;
00538   int      rlen;
00539 };
00540 
00541 void hci_send_cmd(uint16_t ogf, uint16_t ocf, uint8_t plen, void *param);
00542 
00543 typedef enum {
00544   WAITING_TYPE,
00545   WAITING_OPCODE1,
00546   WAITING_OPCODE2,
00547   WAITING_EVENT_CODE,
00548   WAITING_HANDLE,
00549   WAITING_HANDLE_FLAG,
00550   WAITING_PARAM_LEN,
00551   WAITING_DATA_LEN1,
00552   WAITING_DATA_LEN2,
00553   WAITING_PAYLOAD
00554 }hci_state;
00555 
00556 typedef void (*hci_packet_complete_callback)(void *pckt, uint16_t len);
00557 
00558 /* HCI library functions. */
00559 void hci_init(void);
00560 
00561 int hci_send_req(struct hci_request *r, BOOL async);
00562 
00563 #endif /* __HCI_INTERNAL_H_ */