• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright 2009-2012 Broadcom Corporation
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 
19 /******************************************************************************
20  *
21  *  Filename:      bt_hci_bdroid.h
22  *
23  *  Description:   A wrapper header file of bt_hci_lib.h
24  *
25  *                 Contains definitions specific for interfacing with Bluedroid
26  *                 Bluetooth stack
27  *
28  ******************************************************************************/
29 
30 #pragma once
31 
32 #ifdef HAS_BDROID_BUILDCFG
33 #include "bdroid_buildcfg.h"
34 #endif
35 
36 /******************************************************************************
37  *  Constants & Macros
38  *****************************************************************************/
39 
40 #include <stdbool.h>
41 #include <stdint.h>
42 
43 #define HCI_ACL_MAX_SIZE 1024
44 #define HCI_MAX_FRAME_SIZE (HCI_ACL_MAX_SIZE + 4)
45 
46 /* Host/Controller lib internal event ID */
47 typedef enum {
48   HC_EVENT_LPM_IDLE_TIMEOUT,
49 } bthc_event_t;
50 
51 /* Message event mask across Host/Controller lib and stack */
52 #define MSG_EVT_MASK 0xFF00     /* eq. BT_EVT_MASK */
53 #define MSG_SUB_EVT_MASK 0x00FF /* eq. BT_SUB_EVT_MASK */
54 
55 /* Message event ID passed from Host/Controller lib to stack */
56 #define MSG_HC_TO_STACK_HCI_ERR 0x1300      /* eq. BT_EVT_TO_BTU_HCIT_ERR */
57 #define MSG_HC_TO_STACK_HCI_ACL 0x1100      /* eq. BT_EVT_TO_BTU_HCI_ACL */
58 #define MSG_HC_TO_STACK_HCI_SCO 0x1200      /* eq. BT_EVT_TO_BTU_HCI_SCO */
59 #define MSG_HC_TO_STACK_HCI_EVT 0x1000      /* eq. BT_EVT_TO_BTU_HCI_EVT */
60 #define MSG_HC_TO_STACK_L2C_SEG_XMIT 0x1900 /* BT_EVT_TO_BTU_L2C_SEG_XMIT */
61 
62 /* Message event ID passed from stack to vendor lib */
63 #define MSG_STACK_TO_HC_HCI_ACL 0x2100 /* eq. BT_EVT_TO_LM_HCI_ACL */
64 #define MSG_STACK_TO_HC_HCI_SCO 0x2200 /* eq. BT_EVT_TO_LM_HCI_SCO */
65 #define MSG_STACK_TO_HC_HCI_CMD 0x2000 /* eq. BT_EVT_TO_LM_HCI_CMD */
66 
67 /* Local Bluetooth Controller ID for BR/EDR */
68 #define LOCAL_BR_EDR_CONTROLLER_ID 0
69 
70 /******************************************************************************
71  *  Type definitions and return values
72  *****************************************************************************/
73 
74 typedef struct {
75   uint16_t event;
76   uint16_t len;
77   uint16_t offset;
78   uint16_t layer_specific;
79   uint8_t data[];
80 } HC_BT_HDR;
81 
82 #define BT_HC_HDR_SIZE (sizeof(HC_BT_HDR))
83 
84 /******************************************************************************
85  *  Extern variables and functions
86  *****************************************************************************/
87 
88 /******************************************************************************
89  *  Functions
90  *****************************************************************************/
91 
92 // Called when a buffer has been produced by the serial layer and should be
93 // processed by the HCI layer.
94 void bthc_rx_ready(void);
95 void bthc_tx(HC_BT_HDR* buf);
96 void bthc_idle_timeout(void);
97