bt_common_config.h
11.9 KB
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
#ifndef _BT_COMMON_CONFIG_H_
#define _BT_COMMON_CONFIG_H_
#include "kal_general_types.h"
//VIRTUAL_PORTS_NUM will be defined in make file and option.mak
/* SPP port context buffer attributions */
#define SPP_RX_CREDIT (6)
/* SPP High water mark value, must be larger than one packet size */
#if (SPP_RX_CREDIT < 2)
#error For High Water Mark check, SPP_RX_CREDIT must be larger than 2
#endif
#if defined (__BTMODULE_MT6260__) || defined (__BTMODULE_MT6601__) || defined (__BTMODULE_MT6611__) || defined (__BTMODULE_MT6612__) || defined (__BTMODULE_MT6616__) || defined (__BTMODULE_MT6622__) || defined (__BTMODULE_MT6626__) || defined (__BTMODULE_MT6236__)|| defined(__BTMODULE_MT6256__) || defined(__BTMODULE_MT6276__) || defined(__BTMODULE_MT6255__)
#define SPP_PACKET_SIZE 990*SPP_RX_CREDIT
#else
#define SPP_PACKET_SIZE 330*SPP_RX_CREDIT
#endif
/* customer shoulde malloc tx/rx buffer for spp data transmission */
#define SPP_MIN_RX_BUFSIZE SPP_PACKET_SIZE
#define SPP_MIN_TX_BUFSIZE SPP_PACKET_SIZE
/* note. SPP_PACKET_SIZE should larger then 1.5K */
//If DUMP_DATA_FROM_SPP_SRV 1: The received data from SPP server will be dumped in catcher log
#define DUMP_DATA_FROM_SPP_SRV 0
//If DUMP_DATA_FROM_SPP_CLI 1: The received data from SPP client will be dumped in catcher log
#define DUMP_DATA_FROM_SPP_CLI 0
/* Define the Number of SPP Servers ports*/
#if defined (__BT_SPP_CLI_NO_SCO__) || defined (__BT_SPP_CLI_WITH_SCO__)
#define NUM_SPP_SERVERS 4
#else
#define NUM_SPP_SERVERS 1
#endif
/* spp client port for sdk service */
#define NUM_SPP_CLIENTS 1
/* Add the assert check for NUM_SPP_SERVERS */
#if (NUM_SPP_SERVERS > 4)
#error The number of NUM_SPP_SERVERS should not be larger than 4
#endif
#if defined (__BT_SPP_CLI_NO_SCO__) || defined (__BT_SPP_CLI_WITH_SCO__)
#define BT_SPP_VIRTUAL_PORTS_NUM VIRTUAL_PORTS_NUM+NUM_SPP_SERVERS-1
/* define spp context buffer size to manage spp port: */
#define SPP_CONTEXT_BUFFER_SIZE 4400
/* define spp server sdp context buffer size for storing service record */
#define SPP_SRV_SDP_CONTEXT_BUFFER_SIZE 600
#else
#define BT_SPP_VIRTUAL_PORTS_NUM VIRTUAL_PORTS_NUM
/* define spp context buffer size to manage spp port: */
#define SPP_CONTEXT_BUFFER_SIZE 1400
/* define spp server sdp context buffer size for storing service record */
#define SPP_SRV_SDP_CONTEXT_BUFFER_SIZE 100
#endif
#ifdef MULTI_RF_CHANNEL
/* number of RFCOMM channels registered in each spp port*/
extern int spp_ch_number[];
/*
* Define the total Number of SPP Servers = sum of spp_ch_number + NUM_SPP_SCO_SRVS
* YOU SHOULD MODIFY THIS NUMBER VERY CAREFULLY!!
*/
#define TOTAL_NUM_SPP_SERVERS 1
#endif
/*
* The BTGet_Report_RSSI_Timer_Period(),BTGet_Decide_Report_RSSI_Sniff_Mode(),BTGet_Decide_SPP_SCO_Enter_Sniff_Mode()
* and CUSTOM_SPP_SCO_XXX definitions are used by SPP if __BT_SPP_CLI_WITH_SCO__ or __BT_SPP_SRV_WITH_SCO__ is defined
*/
extern kal_uint16 BTGet_Report_RSSI_Timer_Period(void);
extern kal_uint8 BTGet_Decide_Report_RSSI_Sniff_Mode(void);
extern kal_uint8 BTGet_Decide_SPP_SCO_Enter_Sniff_Mode(void);
/* Define how many number of ms to ask the rssi value periodly: Currently, default value is 3000ms defined as follows */
#define CUSTOM_SPP_SCO_READ_RSSI_TIMER_PERIOD_IN_MS 2000
/* 0: Not report RSSI value in sniff mode; 1: report RSSI value in sniff mode */
#define CUSTOM_SPP_SCO_REPORT_RSSI_VALUE_IN_SNIFF_MODE 1
/* 0: Not enable the functionality of entering sniff mode if SPP with SCO is connected then in idle state */
#define CUSTOM_SPP_SCO_ENABLE_ENTER_SNIFF_FEATURE 0
/*
* If the BtStack supports the capability for MOD_MMI to get a RSSI value of its connected ACL link via sending message
* Then: Set CUSTOM_MMI_BT_READ_RSSI as 1; otherwise as 0
* If the CUSTOM_MMI_BT_READ_RSSI is changed, please clean and remake btstack,btadp,btprofiles and custom
*/
#define CUSTOM_MMI_BT_READ_RSSI 1
/********************************/
/* Configuration for HFP */
/********************************/
#ifdef __BT_HFG_PROFILE__
/*---------------------------------------------------------------------------
* HFG_FEATURE_THREE_WAY_CALLS constant
* Three way calls. This value can be used when defining the capabilities
* of the audio gateway application.
*/
#ifndef HFG_FEATURE_THREE_WAY_CALLS
#define HFG_FEATURE_THREE_WAY_CALLS 0x00000001
#endif
/*---------------------------------------------------------------------------
* HFG_FEATURE_ECHO_NOISE constant
* Echo canceling and/or noise reduction function. This value can be used
* when defining the capabilities of the audio gateway application.
*/
#ifndef HFG_FEATURE_ECHO_NOISE
#define HFG_FEATURE_ECHO_NOISE 0x00000002
#endif
/*---------------------------------------------------------------------------
* HFG_FEATURE_VOICE_RECOGNITION constant
* Voice recognition function. This value can be used when defining the
* capabilities of the audio gateway application.
*/
#ifndef HFG_FEATURE_VOICE_RECOGNITION
#define HFG_FEATURE_VOICE_RECOGNITION 0x00000004
#endif
/*---------------------------------------------------------------------------
* HFG_FEATURE_RING_TONE constant
* In-band ring tone. This value can be used when defining the capabilities
* of the audio gateway application.
*/
#ifndef HFG_FEATURE_RING_TONE
#define HFG_FEATURE_RING_TONE 0x00000008
#endif
/*---------------------------------------------------------------------------
* HFG_FEATURE_VOICE_TAG constant
* Attach a phone number to a voice tag. This value can be used when defining
* the capabilities of the audio gateway application.
*/
#ifndef HFG_FEATURE_VOICE_TAG
#define HFG_FEATURE_VOICE_TAG 0x00000010
#endif
/*---------------------------------------------------------------------------
* HFG_FEATURE_REJECT constant
* Reject a call. This value can be used when defining the capabilities
* of the audio gateway application.
*/
#ifndef HFG_FEATURE_REJECT
#define HFG_FEATURE_REJECT 0x00000020
#endif
/*---------------------------------------------------------------------------
* HFG_FEATURE_ENHANCED_CALL_STATUS constant
* This device is capable of supporting enhanced call status features
* like call listing and call held indications.
*/
#ifndef HFG_FEATURE_ENHANCED_CALL_STATUS
#define HFG_FEATURE_ENHANCED_CALL_STATUS 0x00000040
#endif
/*---------------------------------------------------------------------------
* HFG_FEATURE_ENHANCED_CALL_CTRL constant
* This device is capable of supporting enhanced call control features
* like call specifying specific lines to put on hold.
*/
#ifndef HFG_FEATURE_ENHANCED_CALL_CTRL
#define HFG_FEATURE_ENHANCED_CALL_CTRL 0x00000080
#endif
/*---------------------------------------------------------------------------
* HFG_FEATURE_EXTENDED_ERRORS constant
* This device is capable of sending extended error codes.
*/
#ifndef HFG_FEATURE_EXTENDED_ERRORS
#define HFG_FEATURE_EXTENDED_ERRORS 0x00000100
#endif
#endif /*__BT_HFG_PROFILE__*/
/********************************/
/* End of configuration for HFP */
/********************************/
/********************************/
/* Configuration for HID */
/********************************/
#ifdef __BT_HIDD_PROFILE__
#ifndef CUSTOM_HID_DESCRIPTOR_LEN
#define CUSTOM_HID_DESCRIPTOR_LEN 154
#if CUSTOM_HID_DESCRIPTOR_LEN > 65535
#error "CUSTOM_HID_DESCRIPTOR_LEN must be less than 65535"
#endif
#endif
#ifndef CUSTOM_HID_DESCRIPTOR
#define CUSTOM_HID_DESCRIPTOR \
0x05,01,0x09,0x06,0xA1, \
0x01,0x85,0x01,0x05,0x07, \
0x19,0xE0,0x29,0xE7,0x15, \
0x00,0x25,0x01,0x75,0x01, \
0x95,0x08,0x81,0x02,0x95, \
0x01,0x75,0x08,0x81,0x03, \
0x95,0x05,0x75,0x01,0x05, \
0x08,0x19,0x01,0x29,0x05, \
0x91,0x02,0x95,0x01,0x75, \
0x03,0x91,0x03,0x95,0x06, \
0x75,0x08,0x15,0x00,0x25,\
0x65,0x05,0x07,0x19,0x00,\
0x29,0x65,0x81,0x00,0xC0,\
0x05,0x01,0x09,0x02,0xA1,\
0x01,0x85,0x02,0x09,0x01,\
0xA1,0x00,0x05,0x09,0x19,\
0x01,0x29,0x03,0x15,0x00,\
0x25,0x01,0x95,0x03,0x75,\
0x01,0x81,0x02,0x95,0x01,\
0x75,0x05,0x81,0x03,0x05,\
0x01,0x09,0x30,0x09,0x31,\
0x15,0x81,0x25,0x7F,0x75,\
0x08,0x95,0x02,0x81,0x06,\
0xC0,0xC0,0x05,0x0c,0x09,\
0x01,0xa1,0x01,0x85,0x03,\
0x15,0x00,0x25,0x01,0x75,\
0x01,0x95,0x06,0x09,0xCD,\
0x09,0xE9,0x09,0xEA,0x09,\
0xB5,0x09,0xB6,0x09,0xB7,\
0x81,0x02,0x95,0x01,0x75,\
0x02,0x81,0x03,0xC0
#endif
#endif
/********************************/
/* End of configuration for HID */
/********************************/
extern kal_bool bt_custom_read_address_from_nvram(void);
// for radiomod.c to get the default flowcontrol of the BB chip
kal_uint8 BtRadio_Get_Deafult_Flowcontrol_Setting(void);
/*
* The return value will be used as page timeout when we page other device or request name of other device,
* the measurement is slot, 1 slot=0.000625s,for example: 0x3800 slots = 8.96s
* Specification value range:0x0001-0xFFFF,default vaue is 5.12s
*/
kal_uint32 BTGet_Custom_Page_Timeout(void);
#ifdef __MTK_BT_DUAL_PCM_SWITCH_SUPPORT__
void BtRadio_HW_Set_Switch_PCM(kal_uint8 pcm_slect);
#endif
/************************************************************************
************************************************************************/
//Modem_Only project
//Below API just provided when BLUETOOTH_SUPPORT = NONE,if not, occure redefined error
#if (!defined (__BTMTK__))
void BtRadio_PCM_GPIOSetup(kal_uint8 enable);
kal_bool BtRadio_Get_PCM_ShortSync(void);
kal_bool BtRadio_Get_PCM_LSBFirst(void);
kal_bool BtRadio_Get_PCM_SignExtension(void);
#endif
/*
* terrence,2013/06/26,BT dialer feature:Low power solution
* API used by MTK
*/
#ifdef __BT_DIALER_SUPPORT__
kal_bool Custom_BTDialer_LowPower_Support(void);
kal_uint8 Custom_BTDialer_TXPower_Level(void);
#endif
/*
* terrence,2013/08/02,Class of device setting
*return:
*--kal_true:use cod
*--kal_false:do not use cod
*parameter:cod value setting by custom
*/
kal_bool Custom_Config_Get_BT_COD(kal_uint32 * cod);
void Custom_Config_Set_BT_COD(kal_uint32 cod, kal_bool use_custom_cod);
#ifndef __BT_DISABLE_SSP_SUPPORT__
/**
* get current SSP setting.
*
* @param void
*
* @return
* @retval KAL_TRUE support SSP
* @retval KAL_FALSE not support
*
* @authors mawei
* @date 2013/9/16
*/
kal_bool Custom_Config_Get_BT_SSP_Support(void);
#endif
kal_uint8* Custom_BTPairing_AutoAccept_Pincode(kal_uint8 * pin_size);
kal_bool BTParing_Fixed_PinCode_Only_Support(void);
/************************************************************************
************************************************************************/
//carefully!!!! usually custom should not change sniff parameter
void Custom_Set_BT_Sniff_Parameter(kal_int8 sniff_level);
kal_int8 Custom_Get_BT_Sniff_Parameter(void);
/************************************************************************
************************************************************************/
/************************************************************************
************************************************************************/
//Pairing method
typedef enum
{
PIN_AND_SSP = 0, //Pairing need UI and user should confirm,normal case for product,such as phone/mid,we support both pin and ssp
FIXED_PIN_ONLY, //Pairing no need UI,auto accept pairing ,only adopt FIXED PIN CODE method
FIXED_PIN_AND_SSP_JUST_WORK //Pairing no need UI,auto accept pairing ,adopt FIXED PIN CODE and JUST WORK of SSP
}Pairing_Type;
//terrence,2013/12/31,unify pairing method config
void Custom_Set_BT_Pairing_Method(Pairing_Type config_type);
Pairing_Type Custom_Get_BT_Pairing_Method(void);
kal_bool BTParing_Fixed_PinCode_Only_Support(void);
kal_bool Custom_BTPairing_AutoAccept_Support(void);
kal_uint8* Custom_BTPairing_AutoAccept_Pincode(kal_uint8 * pin_size);
/************************************************************************
************************************************************************/
#endif /* _BT_COMMON_CONFIG_H_ */