Airoha M0 BLE API  1.0.5.4
hci_cmd_evt_dat.h
1 /******************************************************************************
2 Copyright (c) Airoha 2016 - All rights reserved
3 
4 FILE NAME
5  hci_cmd_evt_dat.h
6 DESCRIPTION
7 NOTES
8 ********************************************************************************/
9 #ifndef __HCI_CMD_EVT_DATA_HH__
10 #define __HCI_CMD_EVT_DATA_HH__
11 #include "hci.h"
12 #include "platform.h"
13 
14 /******************************************************************************
15  * Typedefine
16  ******************************************************************************/
17 typedef void (*cmd_complte_cb)(uint8_t evt, uint8_t *parm, uint8_t len, void *reserved);
18 typedef void (*hci_init_cb)(bool is_success);
19 
20 #ifdef _MSC_VER
21 __pragma(pack(push, 1))
22 #define __attribute__(x)
23 #endif
24 
25 typedef struct
26 {
27  uint8_t numHciCmdPkt;
28  uint8_t cmdCode[2]; // little eddian
29  uint8_t status;
30  uint8_t cmdPara[1];
31 } __attribute__((packed)) HCI_EVT_CMD_COMPLETE_STRU;
32 
33 typedef struct
34 {
35  uint8_t status;
36  uint8_t numCmdPkts;
37  uint16_t cmdCode;
38 } __attribute__((packed)) HCI_LE_EVT_CMD_STATUS_STRU;
39 
40 typedef struct
41 {
42  uint8_t numHandles;
43  struct
44  {
45  uint16_t connHandle:12;
46  uint16_t numCmpPkts;
47  } __attribute__((packed)) pair[1];
48 } __attribute__((packed)) HCI_EVT_NUM_CMP_PKT_STRU;
49 
50 #ifdef _MSC_VER
51 __pragma(pack(pop))
52 #undef __attribute__
53 #endif
54 
55 
56 /******************************************************************************
57  * API
58  ******************************************************************************/
59 void hci_cmd_evt_dat_init(hci_init_cb cb, hci_dat_recv dat_cb, hci_evt_recv evt_cb, void *cdata[], uint8_t ccount);
60 void hci_dat_info_update(uint16_t max_packet_len, uint16_t packet_count);
61 void hci_send_cmd(uint16_t opcode, uint8_t *parm, uint8_t len, cmd_complte_cb cb);
62 void hci_send_cmd_ex(uint16_t opcode, uint8_t *parm, uint8_t len, cmd_complte_cb cb, void *reserved);
63 void hci_send_acl(uint16_t handle, uint8_t *dat, uint16_t len);
64 uint32_t hci_pending_acl(void);
65 void hci_pause_acl(bool is_pause);
66 
67 #endif