xref: /btstack/src/hci.h (revision 02ea9861adb72eb7d0cba8d04d752df236f0e067)
11f504dbdSmatthias.ringwald /*
21f504dbdSmatthias.ringwald  *  hci.h
31f504dbdSmatthias.ringwald  *
41f504dbdSmatthias.ringwald  *  Created by Matthias Ringwald on 4/29/09.
51f504dbdSmatthias.ringwald  *
61f504dbdSmatthias.ringwald  */
71f504dbdSmatthias.ringwald 
81f504dbdSmatthias.ringwald #pragma once
91f504dbdSmatthias.ringwald 
1093b8dc03Smatthias.ringwald #include <stdint.h>
11*02ea9861Smatthias.ringwald #include <stdlib.h>
1293b8dc03Smatthias.ringwald 
131f504dbdSmatthias.ringwald #include "hci_transport.h"
141f504dbdSmatthias.ringwald 
15475c8125Smatthias.ringwald typedef enum {
16475c8125Smatthias.ringwald     HCI_POWER_OFF = 0,
17475c8125Smatthias.ringwald     HCI_POWER_ON
18475c8125Smatthias.ringwald } HCI_POWER_MODE;
19475c8125Smatthias.ringwald 
2093b8dc03Smatthias.ringwald typedef struct {
210a974e0cSmatthias.ringwald     uint16_t    opcode;
2293b8dc03Smatthias.ringwald     const char *format;
2393b8dc03Smatthias.ringwald } hci_cmd_t;
2493b8dc03Smatthias.ringwald 
25*02ea9861Smatthias.ringwald typedef uint8_t bd_addr_t[6];
26*02ea9861Smatthias.ringwald 
27475c8125Smatthias.ringwald // set up HCI
28475c8125Smatthias.ringwald void hci_init(hci_transport_t *transport, void *config);
29475c8125Smatthias.ringwald 
30475c8125Smatthias.ringwald // power control
31475c8125Smatthias.ringwald int hci_power_control(HCI_POWER_MODE mode);
32475c8125Smatthias.ringwald 
331f504dbdSmatthias.ringwald // run the hci daemon loop
34475c8125Smatthias.ringwald void hci_run();
351f504dbdSmatthias.ringwald 
36554588a5Smatthias.ringwald //
37554588a5Smatthias.ringwald void hexdump(uint8_t *data, int size);
38554588a5Smatthias.ringwald 
39*02ea9861Smatthias.ringwald // create and send hci command packet based on a template and a list of parameters
40*02ea9861Smatthias.ringwald int hci_send_cmd(hci_cmd_t *cmd, ...);
41554588a5Smatthias.ringwald 
4293b8dc03Smatthias.ringwald extern hci_cmd_t hci_inquiry;
4393b8dc03Smatthias.ringwald extern hci_cmd_t hci_reset;
44*02ea9861Smatthias.ringwald extern hci_cmd_t hci_create_connection;
45*02ea9861Smatthias.ringwald extern hci_cmd_t hci_host_buffer_size;
46*02ea9861Smatthias.ringwald extern hci_cmd_t hci_write_page_timeout;
4793b8dc03Smatthias.ringwald 
4893b8dc03Smatthias.ringwald #define HCI_INQUIRY_LAP 0x9E8B33L  // 0x9E8B33: General/Unlimited Inquiry Access Code (GIAC)
49