MT2523 API Reference  LinkIt SDK v4
bt_system.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2016 MediaTek Inc. All rights reserved.
4  *
5  * This software/firmware and related documentation ("MediaTek Software") are
6  * protected under relevant copyright laws. The information contained herein
7  * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
8  * Without the prior written permission of MediaTek and/or its licensors,
9  * any reproduction, modification, use or disclosure of MediaTek Software,
10  * and information contained herein, in whole or in part, shall be strictly prohibited.
11  * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
12  * if you have agreed to and been bound by the applicable license agreement with
13  * MediaTek ("License Agreement") and been granted explicit permission to do so within
14  * the License Agreement ("Permitted User"). If you are not a Permitted User,
15  * please cease any access or use of MediaTek Software immediately.
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
18  * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
19  * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
21  * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
22  * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
23  * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
24  * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
25  * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
26  * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
27  * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
28  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
29  * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
30  * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
31  * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
32  * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
33  */
34 
35 #ifndef __BT_SYSTEM_H__
36 #define __BT_SYSTEM_H__
37 
38 #include "bt_platform.h"
39 #include "bt_type.h"
40 
41 BT_EXTERN_C_BEGIN
42 
107 /* -------------- The buffer size of a single control block. --------------------- */
108 #define BT_CONTROL_BLOCK_SIZE_OF_TIMER (20)
109 #define BT_CONTROL_BLOCK_SIZE_OF_LE_CONNECTION (100)
110 #define BT_CONTROL_BLOCK_SIZE_OF_EDR_CONNECTION (56)
111 #define BT_CONTROL_BLOCK_SIZE_OF_RFCOMM (48)
112 #define BT_CONTROL_BLOCK_SIZE_OF_HFP (76)
113 #define BT_CONTROL_BLOCK_SIZE_OF_AVRCP (48)
114 #define BT_CONTROL_BLOCK_SIZE_OF_A2DP_SEP (16)
115 #define BT_CONTROL_BLOCK_SIZE_OF_A2DP (132)
116 #define BT_CONTROL_BLOCK_SIZE_OF_PBAPC (100)
117 #define BT_CONTROL_BLOCK_SIZE_OF_SPP (44)
118 #define BT_CONTROL_BLOCK_SIZE_OF_AWS (100)
119 #define BT_CONTROL_BLOCK_SIZE_OF_GATT (32)
124 typedef enum {
139 
144 typedef enum {
148 
149 #define BT_MEMORY_TX_BUFFER_AVAILABLE_IND (BT_MODULE_MM | 0x00010000)
150 #define BT_MEMORY_FREE_GARBAGE_IND (BT_MODULE_MM | 0x00010001)
167 typedef struct {
168  uint32_t size;
170 
181 void bt_memory_init_packet(bt_memory_packet_t type, char *buf, uint32_t size);
189 void bt_memory_init_control_block(bt_memory_control_block_t type, char *buf, uint32_t size);
190 
261 #define BT_PANIC (BT_MODULE_SYSTEM | 0x0003)
267 #define BT_PANIC_SOURCE_HOST 0
268 #define BT_PANIC_SOURCE_CONTROLLER 1
284 typedef struct {
285  uint8_t source;
286 } bt_panic_t;
287 
339 #define BT_POWER_ON_CNF (BT_MODULE_SYSTEM | 0x0001)
340 #define BT_POWER_OFF_CNF (BT_MODULE_SYSTEM | 0x0002)
355 typedef struct {
358 
362 typedef struct {
367 
384 bt_status_t bt_power_on(bt_bd_addr_ptr_t public_addr, bt_bd_addr_ptr_t random_addr);
385 
394 
403 
412 
418 void *bt_alloc_rx_buffer_from_external(uint32_t buffer_size);
419 
425 BT_EXTERN_C_END
426 
427 #endif
428 
AVRCP.
Definition: bt_system.h:129
const bt_bd_addr_t local_public_addr
The local public address of the device.
Definition: bt_system.h:356
uint8_t bt_max_tx_power_level
Maximum level of bt connection radio transmission power.
Definition: bt_system.h:364
A2DP.
Definition: bt_system.h:132
RFCOMM.
Definition: bt_system.h:128
void bt_memory_init_control_block(bt_memory_control_block_t type, char *buf, uint32_t size)
This function initializes a control block buffer for the Bluetooth stack.
uint8_t le_init_tx_power_level
Initial level of le connection radio transmission power.
Definition: bt_system.h:365
bt_status_t bt_power_on(bt_bd_addr_ptr_t public_addr, bt_bd_addr_ptr_t random_addr)
This function powers on the Bluetooth.
uint32_t size
The size of available TX buffer in bytes.
Definition: bt_system.h:168
uint8_t const * bt_bd_addr_ptr_t
A pointer to the bt_bd_addr_t.
Definition: bt_type.h:181
BR/EDR connection.
Definition: bt_system.h:127
uint8_t source
The source for the panic, such as BT_PANIC_SOURCE_HOST or BT_PANIC_SOURCE_CONTROLLER.
Definition: bt_system.h:285
bt_memory_control_block_t
Bluetooth memory control block types.
Definition: bt_system.h:124
GATT.
Definition: bt_system.h:136
Bluetooth LE connection.
Definition: bt_system.h:126
TX buffer availability indication.
Definition: bt_system.h:167
SPP.
Definition: bt_system.h:134
bt_status_t bt_power_off(void)
This function powers off the Bluetooth.
uint8_t bt_init_tx_power_level
Initial level of bt connection radio transmission power.
Definition: bt_system.h:363
uint32_t bt_msg_type_t
Define the message type.
Definition: bt_type.h:130
PBAPC.
Definition: bt_system.h:130
AWS.
Definition: bt_system.h:135
the Bluetooth panic event parameter.
Definition: bt_system.h:284
HFP.
Definition: bt_system.h:133
Timer.
Definition: bt_system.h:125
uint8_t bt_bd_addr_t[6]
Address type, defined in Bluetooth core specification version 4.2.
Definition: bt_type.h:180
RX packet buffer.
Definition: bt_system.h:146
int32_t bt_status_t
Define the status type, returned from the APIs, and defined as BT_STATUS_XXX.
Definition: bt_type.h:173
A2DP SEP.
Definition: bt_system.h:131
bt_status_t bt_app_event_callback(bt_msg_type_t msg, bt_status_t status, void *buf)
This function is a static callback for the application to listen to the event.
Power on confirmation structure.
Definition: bt_system.h:355
bt_status_t bt_config_tx_power_level(const bt_config_tx_power_t *tx_power_info)
This function configurates the radio transmission power level for bt and le connections.
This structure defines the detail information about config tx power level.
Definition: bt_system.h:362
void bt_memory_init_packet(bt_memory_packet_t type, char *buf, uint32_t size)
This function initializes a TX/RX packet buffer for the Bluetooth stack.
bt_memory_packet_t
Bluetooth memory buffer types for the Memory Management module.
Definition: bt_system.h:144
The total number of memory control block types.
Definition: bt_system.h:137
TX packet buffer.
Definition: bt_system.h:145
void * bt_alloc_rx_buffer_from_external(uint32_t buffer_size)
This function is for memory allocation from Rx buffer by application.