blob: 84a407bed379d4d77dc8f694e265c1a6ab291350 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
/******************************************************************************
*
* Copyright (C) 2009-2012 Broadcom Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************/
/******************************************************************************
*
* Filename: bt_hci_bdroid.h
*
* Description: A wrapper header file of bt_hci_lib.h
*
* Contains definitions specific for interfacing with Bluedroid
* Bluetooth stack
*
******************************************************************************/
#ifndef BT_HCI_BDROID_H
#define BT_HCI_BDROID_H
#include "bt_hci_lib.h"
/******************************************************************************
** Constants & Macros
******************************************************************************/
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
#ifndef BTHC_LINUX_BASE_POLICY
#define BTHC_LINUX_BASE_POLICY SCHED_NORMAL
#endif
#if (BTHC_LINUX_BASE_POLICY != SCHED_NORMAL)
#ifndef BTHC_LINUX_BASE_PRIORITY
#define BTHC_LINUX_BASE_PRIORITY 30
#endif
#ifndef BTHC_USERIAL_READ_THREAD_PRIORITY
#define BTHC_USERIAL_READ_THREAD_PRIORITY (BTHC_LINUX_BASE_PRIORITY)
#endif
#ifndef BTHC_MAIN_THREAD_PRIORITY
#define BTHC_MAIN_THREAD_PRIORITY (BTHC_LINUX_BASE_PRIORITY-1)
#endif
#endif // (BTHC_LINUX_BASE_POLICY != SCHED_NORMAL)
#ifndef BTHC_USERIAL_READ_MEM_SIZE
#define BTHC_USERIAL_READ_MEM_SIZE (1024)
#endif
#ifndef BTSNOOPDISP_INCLUDED
#define BTSNOOPDISP_INCLUDED TRUE
#endif
/* Host/Controller lib internal event ID */
#define HC_EVENT_PRELOAD 0x0001
#define HC_EVENT_POSTLOAD 0x0002
#define HC_EVENT_RX 0x0004
#define HC_EVENT_TX 0x0008
#define HC_EVENT_LPM_ENABLE 0x0010
#define HC_EVENT_LPM_DISABLE 0x0020
#define HC_EVENT_LPM_WAKE_DEVICE 0x0040
#define HC_EVENT_LPM_ALLOW_SLEEP 0x0080
#define HC_EVENT_LPM_IDLE_TIMEOUT 0x0100
#define HC_EVENT_EXIT 0x0200
/* Message event mask across Host/Controller lib and stack */
#define MSG_EVT_MASK 0xFF00 /* eq. BT_EVT_MASK */
#define MSG_SUB_EVT_MASK 0x00FF /* eq. BT_SUB_EVT_MASK */
/* Message event ID passed from Host/Controller lib to stack */
#define MSG_HC_TO_STACK_HCI_ERR 0x1300 /* eq. BT_EVT_TO_BTU_HCIT_ERR */
#define MSG_HC_TO_STACK_HCI_ACL 0x1100 /* eq. BT_EVT_TO_BTU_HCI_ACL */
#define MSG_HC_TO_STACK_HCI_SCO 0x1200 /* eq. BT_EVT_TO_BTU_HCI_SCO */
#define MSG_HC_TO_STACK_HCI_EVT 0x1000 /* eq. BT_EVT_TO_BTU_HCI_EVT */
#define MSG_HC_TO_STACK_L2C_SEG_XMIT 0x1900 /* eq. BT_EVT_TO_BTU_L2C_SEG_XMIT */
/* Message event ID passed from stack to vendor lib */
#define MSG_STACK_TO_HC_HCI_ACL 0x2100 /* eq. BT_EVT_TO_LM_HCI_ACL */
#define MSG_STACK_TO_HC_HCI_SCO 0x2200 /* eq. BT_EVT_TO_LM_HCI_SCO */
#define MSG_STACK_TO_HC_HCI_CMD 0x2000 /* eq. BT_EVT_TO_LM_HCI_CMD */
/* Local Bluetooth Controller ID for BR/EDR */
#define LOCAL_BR_EDR_CONTROLLER_ID 0
/******************************************************************************
** Type definitions and return values
******************************************************************************/
typedef struct
{
uint16_t event;
uint16_t len;
uint16_t offset;
uint16_t layer_specific;
} HC_BT_HDR;
#define BT_HC_HDR_SIZE (sizeof(HC_BT_HDR))
typedef struct _hc_buffer_hdr
{
struct _hc_buffer_hdr *p_next; /* next buffer in the queue */
uint8_t reserved1;
uint8_t reserved2;
uint8_t reserved3;
uint8_t reserved4;
} HC_BUFFER_HDR_T;
#define BT_HC_BUFFER_HDR_SIZE (sizeof(HC_BUFFER_HDR_T))
/******************************************************************************
** Extern variables and functions
******************************************************************************/
extern bt_hc_callbacks_t *bt_hc_cbacks;
/******************************************************************************
** Functions
******************************************************************************/
/*******************************************************************************
**
** Function bthc_signal_event
**
** Description Perform context switch to bt_hc main thread
**
** Returns None
**
*******************************************************************************/
extern void bthc_signal_event(uint16_t event);
#endif /* BT_HCI_BDROID_H */
|