xref: /btstack/src/hci.h (revision 554588a5c790dab87f9d22bd88357d4fe2d3d9f9)
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>
1193b8dc03Smatthias.ringwald 
121f504dbdSmatthias.ringwald #include "hci_transport.h"
131f504dbdSmatthias.ringwald 
14475c8125Smatthias.ringwald typedef enum {
15475c8125Smatthias.ringwald     HCI_POWER_OFF = 0,
16475c8125Smatthias.ringwald     HCI_POWER_ON
17475c8125Smatthias.ringwald } HCI_POWER_MODE;
18475c8125Smatthias.ringwald 
1993b8dc03Smatthias.ringwald typedef struct {
2093b8dc03Smatthias.ringwald     uint8_t  ogf;
2193b8dc03Smatthias.ringwald     uint16_t ocf;
2293b8dc03Smatthias.ringwald     const char *format;
2393b8dc03Smatthias.ringwald } hci_cmd_t;
2493b8dc03Smatthias.ringwald 
25475c8125Smatthias.ringwald // set up HCI
26475c8125Smatthias.ringwald void hci_init(hci_transport_t *transport, void *config);
27475c8125Smatthias.ringwald 
28475c8125Smatthias.ringwald // power control
29475c8125Smatthias.ringwald int hci_power_control(HCI_POWER_MODE mode);
30475c8125Smatthias.ringwald 
311f504dbdSmatthias.ringwald // run the hci daemon loop
32475c8125Smatthias.ringwald void hci_run();
331f504dbdSmatthias.ringwald 
34*554588a5Smatthias.ringwald //
35*554588a5Smatthias.ringwald void hexdump(uint8_t *data, int size);
36*554588a5Smatthias.ringwald 
3793b8dc03Smatthias.ringwald // create hci command packet based on a template and a list of parameters
3893b8dc03Smatthias.ringwald void hci_create_cmd_packet(uint8_t *buffer, uint8_t *cmd_len, hci_cmd_t *cmd, ...);
3993b8dc03Smatthias.ringwald 
40*554588a5Smatthias.ringwald int hci_send_cmd_packet(uint8_t *buffer, int size);
41*554588a5Smatthias.ringwald 
4293b8dc03Smatthias.ringwald extern hci_cmd_t hci_inquiry;
4393b8dc03Smatthias.ringwald extern hci_cmd_t hci_reset;
4493b8dc03Smatthias.ringwald 
4593b8dc03Smatthias.ringwald #define HCI_INQUIRY_LAP 0x9E8B33L  // 0x9E8B33: General/Unlimited Inquiry Access Code (GIAC)
46