xref: /btstack/src/hci.h (revision 0a974e0c4482b3feeb23227e3c157e6c9aec941f)
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 {
20*0a974e0cSmatthias.ringwald     uint16_t    opcode;
2193b8dc03Smatthias.ringwald     const char *format;
2293b8dc03Smatthias.ringwald } hci_cmd_t;
2393b8dc03Smatthias.ringwald 
24475c8125Smatthias.ringwald // set up HCI
25475c8125Smatthias.ringwald void hci_init(hci_transport_t *transport, void *config);
26475c8125Smatthias.ringwald 
27475c8125Smatthias.ringwald // power control
28475c8125Smatthias.ringwald int hci_power_control(HCI_POWER_MODE mode);
29475c8125Smatthias.ringwald 
301f504dbdSmatthias.ringwald // run the hci daemon loop
31475c8125Smatthias.ringwald void hci_run();
321f504dbdSmatthias.ringwald 
33554588a5Smatthias.ringwald //
34554588a5Smatthias.ringwald void hexdump(uint8_t *data, int size);
35554588a5Smatthias.ringwald 
3693b8dc03Smatthias.ringwald // create hci command packet based on a template and a list of parameters
3793b8dc03Smatthias.ringwald void hci_create_cmd_packet(uint8_t *buffer, uint8_t *cmd_len, hci_cmd_t *cmd, ...);
3893b8dc03Smatthias.ringwald 
39554588a5Smatthias.ringwald int hci_send_cmd_packet(uint8_t *buffer, int size);
40554588a5Smatthias.ringwald 
4193b8dc03Smatthias.ringwald extern hci_cmd_t hci_inquiry;
4293b8dc03Smatthias.ringwald extern hci_cmd_t hci_reset;
4393b8dc03Smatthias.ringwald 
4493b8dc03Smatthias.ringwald #define HCI_INQUIRY_LAP 0x9E8B33L  // 0x9E8B33: General/Unlimited Inquiry Access Code (GIAC)
45