mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-02 13:30:59 +02:00
Update IDF to 9a26296
This commit is contained in:
@ -76,4 +76,6 @@ period_ms_t osi_alarm_get_remaining_ms(const osi_alarm_t *alarm);
|
||||
// t1 and t2 should be no greater than the time of MAX ticks
|
||||
period_ms_t osi_alarm_time_diff(period_ms_t t1, period_ms_t t2);
|
||||
|
||||
uint32_t osi_time_get_os_boottime_ms(void);
|
||||
|
||||
#endif /*_ALARM_H_*/
|
||||
|
@ -20,7 +20,7 @@
|
||||
#define _ALLOCATOR_H_
|
||||
|
||||
#include <stddef.h>
|
||||
//#include <stdlib.h>
|
||||
#include <stdlib.h>
|
||||
#include "sdkconfig.h"
|
||||
|
||||
typedef void *(*alloc_fn)(size_t size);
|
||||
@ -52,7 +52,7 @@ void osi_mem_dbg_show(void);
|
||||
({ \
|
||||
void *p; \
|
||||
\
|
||||
p = calloc(1, (size)); \
|
||||
p = malloc((size)); \
|
||||
osi_mem_dbg_record(p, size, __func__, __LINE__); \
|
||||
(void *)p; \
|
||||
})
|
||||
@ -67,14 +67,15 @@ void osi_mem_dbg_show(void);
|
||||
})
|
||||
|
||||
#define osi_free(ptr) \
|
||||
({ \
|
||||
osi_mem_dbg_clean(ptr, __func__, __LINE__); \
|
||||
free((ptr)); \
|
||||
})
|
||||
do { \
|
||||
void *tmp_point = (void *)(ptr); \
|
||||
osi_mem_dbg_clean(tmp_point, __func__, __LINE__); \
|
||||
free(tmp_point); \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
|
||||
#define osi_malloc(size) calloc(1, (size))
|
||||
#define osi_malloc(size) malloc((size))
|
||||
#define osi_calloc(size) calloc(1, (size))
|
||||
#define osi_free(p) free((p))
|
||||
|
||||
|
@ -24,10 +24,10 @@
|
||||
#ifndef AVCT_INT_H
|
||||
#define AVCT_INT_H
|
||||
|
||||
#include "gki.h"
|
||||
#include "avct_api.h"
|
||||
#include "avct_defs.h"
|
||||
#include "l2c_api.h"
|
||||
#include "fixed_queue.h"
|
||||
|
||||
/*****************************************************************************
|
||||
** constants
|
||||
@ -81,7 +81,7 @@ typedef struct {
|
||||
BT_HDR *p_rx_msg; /* Message being reassembled */
|
||||
UINT16 conflict_lcid; /* L2CAP channel LCID */
|
||||
BD_ADDR peer_addr; /* BD address of peer */
|
||||
BUFFER_Q tx_q; /* Transmit data buffer queue */
|
||||
fixed_queue_t *tx_q; /* Transmit data buffer queue */
|
||||
BOOLEAN cong; /* TRUE, if congested */
|
||||
} tAVCT_LCB;
|
||||
|
||||
|
@ -24,12 +24,12 @@
|
||||
#ifndef AVDT_INT_H
|
||||
#define AVDT_INT_H
|
||||
|
||||
#include "gki.h"
|
||||
#include "avdt_api.h"
|
||||
#include "avdtc_api.h"
|
||||
#include "avdt_defs.h"
|
||||
#include "l2c_api.h"
|
||||
#include "btm_api.h"
|
||||
#include "fixed_queue.h"
|
||||
|
||||
#if (AVRC_INCLUDED == TRUE)
|
||||
|
||||
@ -425,8 +425,8 @@ typedef union {
|
||||
typedef struct {
|
||||
BD_ADDR peer_addr; /* BD address of peer */
|
||||
TIMER_LIST_ENT timer_entry; /* CCB timer list entry */
|
||||
BUFFER_Q cmd_q; /* Queue for outgoing command messages */
|
||||
BUFFER_Q rsp_q; /* Queue for outgoing response and reject messages */
|
||||
fixed_queue_t *cmd_q; /* Queue for outgoing command messages */
|
||||
fixed_queue_t *rsp_q; /* Queue for outgoing response and reject messages */
|
||||
tAVDT_CTRL_CBACK *proc_cback; /* Procedure callback function */
|
||||
tAVDT_CTRL_CBACK *p_conn_cback; /* Connection/disconnection callback function */
|
||||
void *p_proc_data; /* Pointer to data storage for procedure */
|
||||
@ -453,7 +453,7 @@ typedef struct {
|
||||
BT_HDR *p_buf;
|
||||
UINT32 time_stamp;
|
||||
#if AVDT_MULTIPLEXING == TRUE
|
||||
BUFFER_Q frag_q; /* Queue for outgoing media fragments. p_buf should be 0 */
|
||||
fixed_queue_t *frag_q; /* Queue for outgoing media fragments. p_buf should be 0 */
|
||||
UINT8 *p_data;
|
||||
UINT32 data_len;
|
||||
#endif
|
||||
@ -500,7 +500,7 @@ typedef struct {
|
||||
BOOLEAN cong; /* Whether media transport channel is congested */
|
||||
UINT8 close_code; /* Error code received in close response */
|
||||
#if AVDT_MULTIPLEXING == TRUE
|
||||
BUFFER_Q frag_q; /* Queue for outgoing media fragments */
|
||||
fixed_queue_t *frag_q; /* Queue for outgoing media fragments */
|
||||
UINT32 frag_off; /* length of already received media fragments */
|
||||
UINT32 frag_org_len; /* original length before fragmentation of receiving media packet */
|
||||
UINT8 *p_next_frag; /* next fragment to send */
|
||||
@ -673,7 +673,7 @@ extern void avdt_scb_chk_snd_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
|
||||
extern void avdt_scb_clr_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
|
||||
extern void avdt_scb_tc_timer(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
|
||||
extern void avdt_scb_clr_vars(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
|
||||
extern void avdt_scb_queue_frags(tAVDT_SCB *p_scb, UINT8 **pp_data, UINT32 *p_data_len, BUFFER_Q *pq);
|
||||
extern void avdt_scb_queue_frags(tAVDT_SCB *p_scb, UINT8 **pp_data, UINT32 *p_data_len, fixed_queue_t *pq);
|
||||
|
||||
/* msg function declarations */
|
||||
extern BOOLEAN avdt_msg_send(tAVDT_CCB *p_ccb, BT_HDR *p_msg);
|
||||
|
@ -22,8 +22,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "bt_trace.h"
|
||||
|
||||
#include "osi_arch.h"
|
||||
#include "bt_target.h"
|
||||
|
||||
#define UNUSED(x) (void)(x)
|
||||
|
||||
@ -32,6 +31,20 @@
|
||||
#endif
|
||||
/*Timer Related Defination*/
|
||||
|
||||
//by Snake.T
|
||||
typedef void (TIMER_CBACK)(void *p_tle);
|
||||
typedef struct _tle {
|
||||
struct _tle *p_next;
|
||||
struct _tle *p_prev;
|
||||
TIMER_CBACK *p_cback;
|
||||
INT32 ticks;
|
||||
INT32 ticks_initial;
|
||||
TIMER_PARAM_TYPE param;
|
||||
TIMER_PARAM_TYPE data;
|
||||
UINT16 event;
|
||||
UINT8 in_use;
|
||||
} TIMER_LIST_ENT;
|
||||
|
||||
#define alarm_timer_t uint32_t
|
||||
#define alarm_timer_setfn(timer, cb, data) \
|
||||
do { \
|
||||
@ -45,23 +58,6 @@ do { \
|
||||
#define alarm_timer_now() (0)
|
||||
|
||||
|
||||
/*Thread and locker related defination*/
|
||||
#define RTOS_SUPPORT
|
||||
#ifdef RTOS_SUPPORT
|
||||
#define pthread_mutex_t osi_mutex_t
|
||||
#define pthread_mutex_init(mutex, a) osi_mutex_new(mutex)
|
||||
#define pthread_mutex_destroy(mutex) osi_mutex_free(mutex)
|
||||
#define pthread_mutex_lock osi_mutex_lock
|
||||
#define pthread_mutex_unlock osi_mutex_unlock
|
||||
#else
|
||||
#define pthread_mutex_t uint8_t
|
||||
#define pthread_mutex_init(x1, x2)
|
||||
#define pthread_mutex_destroy(mutex)
|
||||
#define pthread_mutex_lock(mutex)
|
||||
#define pthread_mutex_unlock(mutex)
|
||||
#endif
|
||||
|
||||
|
||||
/*Bluetooth Address*/
|
||||
typedef struct {
|
||||
uint8_t address[6];
|
||||
|
@ -37,8 +37,6 @@
|
||||
#include "sdkconfig.h"
|
||||
#include "bt_types.h" /* This must be defined AFTER buildcfg.h */
|
||||
|
||||
/* Include common GKI definitions used by this platform */
|
||||
#include "gki_target.h"
|
||||
#include "dyn_mem.h" /* defines static and/or dynamic memory for components */
|
||||
|
||||
#if CONFIG_CLASSIC_BT_ENABLED
|
||||
@ -177,15 +175,6 @@
|
||||
#define BTA_DISABLE_DELAY 200 /* in milliseconds */
|
||||
#endif
|
||||
|
||||
// If the next wakeup time is less than this threshold, we should acquire
|
||||
// a wakelock instead of setting a wake alarm so we're not bouncing in
|
||||
// and out of suspend frequently.
|
||||
// in millisecond
|
||||
// TODO(zachoverflow): reinstate in alarm code
|
||||
#ifndef GKI_TIMER_INTERVAL_FOR_WAKELOCK
|
||||
#define GKI_TIMER_INTERVAL_FOR_WAKELOCK 3000
|
||||
#endif
|
||||
|
||||
#ifndef BTA_SYS_TIMER_PERIOD
|
||||
#define BTA_SYS_TIMER_PERIOD 100
|
||||
#endif
|
||||
@ -266,66 +255,63 @@
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** GKI Buffer Pools
|
||||
** Buffer Size
|
||||
**
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BT_DEFAULT_BUFFER_SIZE
|
||||
#define BT_DEFAULT_BUFFER_SIZE (4096 + 16)
|
||||
#endif
|
||||
|
||||
#ifndef BT_SMALL_BUFFER_SIZE
|
||||
#define BT_SMALL_BUFFER_SIZE 660
|
||||
#endif
|
||||
|
||||
/* Receives HCI events from the lower-layer. */
|
||||
#ifndef HCI_CMD_POOL_ID
|
||||
#define HCI_CMD_POOL_ID GKI_POOL_ID_2
|
||||
#endif
|
||||
|
||||
#ifndef HCI_CMD_POOL_BUF_SIZE
|
||||
#define HCI_CMD_POOL_BUF_SIZE GKI_BUF2_SIZE
|
||||
#endif
|
||||
|
||||
/* Receives ACL data packets from thelower-layer. */
|
||||
#ifndef HCI_ACL_POOL_ID
|
||||
#define HCI_ACL_POOL_ID GKI_POOL_ID_3
|
||||
#endif
|
||||
|
||||
/* Maximum number of buffers available for ACL receive data. */
|
||||
#ifndef HCI_ACL_BUF_MAX
|
||||
#define HCI_ACL_BUF_MAX GKI_BUF3_MAX
|
||||
#endif
|
||||
|
||||
/* Receives SCO data packets from the lower-layer. */
|
||||
#ifndef HCI_SCO_POOL_ID
|
||||
#define HCI_SCO_POOL_ID GKI_POOL_ID_6
|
||||
#ifndef HCI_CMD_BUF_SIZE
|
||||
#define HCI_CMD_BUF_SIZE BT_SMALL_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
/* Sends SDP data packets. */
|
||||
#ifndef SDP_POOL_ID
|
||||
#define SDP_POOL_ID 3
|
||||
#ifndef SDP_DATA_BUF_SIZE
|
||||
#define SDP_DATA_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
/* Sends RFCOMM command packets. */
|
||||
#ifndef RFCOMM_CMD_POOL_ID
|
||||
#define RFCOMM_CMD_POOL_ID GKI_POOL_ID_2
|
||||
#ifndef RFCOMM_CMD_BUF_SIZE
|
||||
#define RFCOMM_CMD_BUF_SIZE BT_SMALL_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
/* Sends RFCOMM data packets. */
|
||||
#ifndef RFCOMM_DATA_POOL_ID
|
||||
#define RFCOMM_DATA_POOL_ID GKI_POOL_ID_3
|
||||
#endif
|
||||
|
||||
#ifndef RFCOMM_DATA_POOL_BUF_SIZE
|
||||
#define RFCOMM_DATA_POOL_BUF_SIZE GKI_BUF3_SIZE
|
||||
#ifndef RFCOMM_DATA_BUF_SIZE
|
||||
#define RFCOMM_DATA_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
/* Sends L2CAP packets to the peer and HCI messages to the controller. */
|
||||
#ifndef L2CAP_CMD_POOL_ID
|
||||
#define L2CAP_CMD_POOL_ID GKI_POOL_ID_2
|
||||
#ifndef L2CAP_CMD_BUF_SIZE
|
||||
#define L2CAP_CMD_BUF_SIZE BT_SMALL_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
#ifndef L2CAP_USER_TX_BUF_SIZE
|
||||
#define L2CAP_USER_TX_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
#ifndef L2CAP_USER_RX_BUF_SIZE
|
||||
#define L2CAP_USER_RX_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
/* Sends L2CAP segmented packets in ERTM mode */
|
||||
#ifndef L2CAP_FCR_TX_POOL_ID
|
||||
#define L2CAP_FCR_TX_POOL_ID HCI_ACL_POOL_ID
|
||||
#ifndef L2CAP_FCR_TX_BUF_SIZE
|
||||
#define L2CAP_FCR_TX_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
/* Receives L2CAP segmented packets in ERTM mode */
|
||||
#ifndef L2CAP_FCR_RX_POOL_ID
|
||||
#define L2CAP_FCR_RX_POOL_ID HCI_ACL_POOL_ID
|
||||
#ifndef L2CAP_FCR_RX_BUF_SIZE
|
||||
#define L2CAP_FCR_RX_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
#ifndef L2CAP_FCR_ERTM_BUF_SIZE
|
||||
#define L2CAP_FCR_ERTM_BUF_SIZE (10240 + 24)
|
||||
#endif
|
||||
|
||||
/* Number of ACL buffers to assign to LE
|
||||
@ -335,114 +321,72 @@
|
||||
#endif
|
||||
|
||||
/* Used by BTM when it sends HCI commands to the controller. */
|
||||
#ifndef BTM_CMD_POOL_ID
|
||||
#define BTM_CMD_POOL_ID GKI_POOL_ID_2
|
||||
#ifndef BTM_CMD_BUF_SIZE
|
||||
#define BTM_CMD_BUF_SIZE BT_SMALL_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
#ifndef OBX_LRG_DATA_POOL_SIZE
|
||||
#define OBX_LRG_DATA_POOL_SIZE GKI_BUF4_SIZE
|
||||
#ifndef OBX_LRG_DATA_BUF_SIZE
|
||||
#define OBX_LRG_DATA_BUF_SIZE (8080 + 26)
|
||||
#endif
|
||||
|
||||
#ifndef OBX_LRG_DATA_POOL_ID
|
||||
#define OBX_LRG_DATA_POOL_ID GKI_POOL_ID_4
|
||||
#endif
|
||||
/* Used to send data to L2CAP. */
|
||||
#ifndef GAP_DATA_POOL_ID
|
||||
#define GAP_DATA_POOL_ID GKI_POOL_ID_3
|
||||
#endif
|
||||
|
||||
#ifndef SPP_DB_SIZE
|
||||
#define SPP_DB_SIZE GKI_BUF3_SIZE
|
||||
#ifndef GAP_DATA_BUF_SIZE
|
||||
#define GAP_DATA_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
/* BNEP data and protocol messages. */
|
||||
#ifndef BNEP_POOL_ID
|
||||
#define BNEP_POOL_ID GKI_POOL_ID_3
|
||||
#ifndef BNEP_BUF_SIZE
|
||||
#define BNEP_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
/* RPC pool for temporary trace message buffers. */
|
||||
#ifndef RPC_SCRATCH_POOL_ID
|
||||
#define RPC_SCRATCH_POOL_ID GKI_POOL_ID_2
|
||||
/* AVDTP buffer size for protocol messages */
|
||||
#ifndef AVDT_CMD_BUF_SIZE
|
||||
#define AVDT_CMD_BUF_SIZE BT_SMALL_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
/* AVDTP pool for protocol messages */
|
||||
#ifndef AVDT_CMD_POOL_ID
|
||||
#define AVDT_CMD_POOL_ID GKI_POOL_ID_2
|
||||
/* AVDTP buffer size for media packets in case of fragmentation */
|
||||
#ifndef AVDT_DATA_BUF_SIZE
|
||||
#define AVDT_DATA_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
/* AVDTP pool size for media packets in case of fragmentation */
|
||||
#ifndef AVDT_DATA_POOL_SIZE
|
||||
#define AVDT_DATA_POOL_SIZE GKI_BUF3_SIZE
|
||||
#ifndef PAN_BUF_SIZE
|
||||
#define PAN_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
#ifndef PAN_POOL_ID
|
||||
#define PAN_POOL_ID GKI_POOL_ID_3
|
||||
/* Maximum amount of the shared buffer to allocate for PAN */
|
||||
#define PAN_POOL_MAX (GKI_BUF3_MAX / 4)
|
||||
/* Maximum number of buffers to allocate for PAN */
|
||||
#ifndef PAN_BUF_MAX
|
||||
#define PAN_BUF_MAX 100
|
||||
#endif
|
||||
|
||||
/* AVCTP pool for protocol messages */
|
||||
#ifndef AVCT_CMD_POOL_ID
|
||||
#define AVCT_CMD_POOL_ID GKI_POOL_ID_1
|
||||
/* AVCTP buffer size for protocol messages */
|
||||
#ifndef AVCT_CMD_BUF_SIZE
|
||||
#define AVCT_CMD_BUF_SIZE 288
|
||||
#endif
|
||||
|
||||
/* AVRCP pool for protocol messages */
|
||||
#ifndef AVRC_CMD_POOL_ID
|
||||
#define AVRC_CMD_POOL_ID GKI_POOL_ID_1
|
||||
/* AVRCP buffer size for protocol messages */
|
||||
#ifndef AVRC_CMD_BUF_SIZE
|
||||
#define AVRC_CMD_BUF_SIZE 288
|
||||
#endif
|
||||
|
||||
/* AVRCP pool size for protocol messages */
|
||||
#ifndef AVRC_CMD_POOL_SIZE
|
||||
#define AVRC_CMD_POOL_SIZE GKI_BUF1_SIZE
|
||||
/* AVRCP Metadata buffer size for protocol messages */
|
||||
#ifndef AVRC_META_CMD_BUF_SIZE
|
||||
#define AVRC_META_CMD_BUF_SIZE BT_SMALL_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
/* AVRCP Metadata pool for protocol messages */
|
||||
#ifndef AVRC_META_CMD_POOL_ID
|
||||
#define AVRC_META_CMD_POOL_ID GKI_POOL_ID_2
|
||||
#ifndef BTA_HL_LRG_DATA_BUF_SIZE
|
||||
#define BTA_HL_LRG_DATA_BUF_SIZE (10240 + 24)
|
||||
#endif
|
||||
|
||||
/* AVRCP Metadata pool size for protocol messages */
|
||||
#ifndef AVRC_META_CMD_POOL_SIZE
|
||||
#define AVRC_META_CMD_POOL_SIZE GKI_BUF2_SIZE
|
||||
/* GATT Server Database buffer size */
|
||||
#ifndef GATT_DB_BUF_SIZE
|
||||
#define GATT_DB_BUF_SIZE 128
|
||||
#endif
|
||||
|
||||
|
||||
/* AVRCP buffer size for browsing channel messages */
|
||||
#ifndef AVRC_BROWSE_POOL_SIZE
|
||||
#define AVRC_BROWSE_POOL_SIZE GKI_MAX_BUF_SIZE
|
||||
/* GATT Data sending buffer size */
|
||||
#ifndef GATT_DATA_BUF_SIZE
|
||||
#define GATT_DATA_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
#ifndef BTA_HL_LRG_DATA_POOL_ID
|
||||
#define BTA_HL_LRG_DATA_POOL_ID GKI_POOL_ID_7
|
||||
#endif
|
||||
|
||||
/* GATT Server Database pool ID */
|
||||
#ifndef GATT_DB_POOL_ID
|
||||
#define GATT_DB_POOL_ID GKI_POOL_ID_8
|
||||
#endif
|
||||
|
||||
/* GATT Data sending buffer pool ID, use default ACL pool for fix channel data */
|
||||
#ifndef GATT_BUF_POOL_ID
|
||||
#define GATT_BUF_POOL_ID HCI_ACL_POOL_ID
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Lower Layer Interface
|
||||
**
|
||||
******************************************************************************/
|
||||
|
||||
/* Macro for allocating buffer for HCI commands */
|
||||
#ifndef HCI_GET_CMD_BUF
|
||||
#if (!defined(HCI_USE_VARIABLE_SIZE_CMD_BUF) || (HCI_USE_VARIABLE_SIZE_CMD_BUF == FALSE))
|
||||
/* Allocate fixed-size buffer from HCI_CMD_POOL (default case) */
|
||||
#define HCI_GET_CMD_BUF(paramlen) ((BT_HDR *)GKI_getpoolbuf (HCI_CMD_POOL_ID))
|
||||
#else
|
||||
/* Allocate smallest possible buffer (for platforms with limited RAM) */
|
||||
#define HCI_GET_CMD_BUF(paramlen) ((BT_HDR *)GKI_getbuf ((UINT16)(BT_HDR_SIZE + HCIC_PREAMBLE_SIZE + (paramlen))))
|
||||
#endif
|
||||
#endif /* HCI_GET_CMD_BUF */
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** HCI Services (H4)
|
||||
@ -1267,68 +1211,41 @@
|
||||
#define PORT_CREDIT_RX_LOW 8
|
||||
#endif
|
||||
|
||||
/* if application like BTA, Java or script test engine is running on other than BTU thread, */
|
||||
/* PORT_SCHEDULE_LOCK shall be defined as GKI_sched_lock() or GKI_disable() */
|
||||
#ifndef PORT_SCHEDULE_LOCK
|
||||
#define PORT_SCHEDULE_LOCK GKI_disable()
|
||||
#endif
|
||||
|
||||
/* if application like BTA, Java or script test engine is running on other than BTU thread, */
|
||||
/* PORT_SCHEDULE_LOCK shall be defined as GKI_sched_unlock() or GKI_enable() */
|
||||
#ifndef PORT_SCHEDULE_UNLOCK
|
||||
#define PORT_SCHEDULE_UNLOCK GKI_enable()
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** OBEX
|
||||
**
|
||||
******************************************************************************/
|
||||
#define OBX_14_INCLUDED FALSE
|
||||
|
||||
/* The maximum number of registered servers. */
|
||||
#ifndef OBX_NUM_SERVERS
|
||||
#define OBX_NUM_SERVERS 12
|
||||
/*
|
||||
* Buffer size to reassemble the SDU.
|
||||
* It will allow buffers to be used that are larger than the L2CAP_MAX_MTU.
|
||||
*/
|
||||
#ifndef OBX_USER_RX_BUF_SIZE
|
||||
#define OBX_USER_RX_BUF_SIZE OBX_LRG_DATA_BUF_SIZE
|
||||
#endif
|
||||
|
||||
/* The maximum number of active clients. */
|
||||
#ifndef OBX_NUM_CLIENTS
|
||||
#define OBX_NUM_CLIENTS 8
|
||||
/*
|
||||
* Buffer size to hold the SDU.
|
||||
* It will allow buffers to be used that are larger than the L2CAP_MAX_MTU.
|
||||
*/
|
||||
#ifndef OBX_USER_TX_BUF_SIZE
|
||||
#define OBX_USER_TX_BUF_SIZE OBX_LRG_DATA_BUF_SIZE
|
||||
#endif
|
||||
|
||||
/* This option is application when OBX_14_INCLUDED=TRUE
|
||||
Pool ID where to reassemble the SDU.
|
||||
This Pool will allow buffers to be used that are larger than
|
||||
the L2CAP_MAX_MTU. */
|
||||
#ifndef OBX_USER_RX_POOL_ID
|
||||
#define OBX_USER_RX_POOL_ID OBX_LRG_DATA_POOL_ID
|
||||
/* Buffer size used to hold MPS segments during SDU reassembly. */
|
||||
#ifndef OBX_FCR_RX_BUF_SIZE
|
||||
#define OBX_FCR_RX_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
/* This option is application when OBX_14_INCLUDED=TRUE
|
||||
Pool ID where to hold the SDU.
|
||||
This Pool will allow buffers to be used that are larger than
|
||||
the L2CAP_MAX_MTU. */
|
||||
#ifndef OBX_USER_TX_POOL_ID
|
||||
#define OBX_USER_TX_POOL_ID OBX_LRG_DATA_POOL_ID
|
||||
#endif
|
||||
|
||||
/* This option is application when OBX_14_INCLUDED=TRUE
|
||||
GKI Buffer Pool ID used to hold MPS segments during SDU reassembly
|
||||
*/
|
||||
#ifndef OBX_FCR_RX_POOL_ID
|
||||
#define OBX_FCR_RX_POOL_ID HCI_ACL_POOL_ID
|
||||
#endif
|
||||
|
||||
/* This option is application when OBX_14_INCLUDED=TRUE
|
||||
GKI Buffer Pool ID used to hold MPS segments used in (re)transmissions.
|
||||
L2CAP_DEFAULT_ERM_POOL_ID is specified to use the HCI ACL data pool.
|
||||
Note: This pool needs to have enough buffers to hold two times the window size negotiated
|
||||
in the L2CA_SetFCROptions (2 * tx_win_size) to allow for retransmissions.
|
||||
The size of each buffer must be able to hold the maximum MPS segment size passed in
|
||||
L2CA_SetFCROptions plus BT_HDR (8) + HCI preamble (4) + L2CAP_MIN_OFFSET (11 - as of BT 2.1 + EDR Spec).
|
||||
*/
|
||||
#ifndef OBX_FCR_TX_POOL_ID
|
||||
#define OBX_FCR_TX_POOL_ID HCI_ACL_POOL_ID
|
||||
/*
|
||||
* Buffer size used to hold MPS segments used in (re)transmissions.
|
||||
* The size of each buffer must be able to hold the maximum MPS segment size
|
||||
* passed in L2CA_SetFCROptions plus BT_HDR (8) + HCI preamble (4) +
|
||||
* L2CAP_MIN_OFFSET (11 - as of BT 2.1 + EDR Spec).
|
||||
*/
|
||||
#ifndef OBX_FCR_TX_BUF_SIZE
|
||||
#define OBX_FCR_TX_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
/* This option is application when OBX_14_INCLUDED=TRUE
|
||||
@ -1623,16 +1540,12 @@ Range: 2 octets
|
||||
**
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef HID_DEV_SUBCLASS
|
||||
#define HID_DEV_SUBCLASS COD_MINOR_POINTING
|
||||
#ifndef HID_CONTROL_BUF_SIZE
|
||||
#define HID_CONTROL_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
#ifndef HID_CONTROL_POOL_ID
|
||||
#define HID_CONTROL_POOL_ID 2
|
||||
#endif
|
||||
|
||||
#ifndef HID_INTERRUPT_POOL_ID
|
||||
#define HID_INTERRUPT_POOL_ID 2
|
||||
#ifndef HID_INTERRUPT_BUF_SIZE
|
||||
#define HID_INTERRUPT_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
@ -1767,33 +1680,31 @@ Range: 2 octets
|
||||
#define MCA_NUM_MDLS 4
|
||||
#endif
|
||||
|
||||
/* Pool ID where to reassemble the SDU. */
|
||||
#ifndef MCA_USER_RX_POOL_ID
|
||||
#define MCA_USER_RX_POOL_ID HCI_ACL_POOL_ID
|
||||
/* Buffer size to reassemble the SDU. */
|
||||
#ifndef MCA_USER_RX_BUF_SIZE
|
||||
#define MCA_USER_RX_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
/* Pool ID where to hold the SDU. */
|
||||
#ifndef MCA_USER_TX_POOL_ID
|
||||
#define MCA_USER_TX_POOL_ID HCI_ACL_POOL_ID
|
||||
/* Buffer size to hold the SDU. */
|
||||
#ifndef MCA_USER_TX_BUF_SIZE
|
||||
#define MCA_USER_TX_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
/*
|
||||
GKI Buffer Pool ID used to hold MPS segments during SDU reassembly
|
||||
*/
|
||||
#ifndef MCA_FCR_RX_POOL_ID
|
||||
#define MCA_FCR_RX_POOL_ID HCI_ACL_POOL_ID
|
||||
* Buffer size used to hold MPS segments during SDU reassembly
|
||||
*/
|
||||
#ifndef MCA_FCR_RX_BUF_SIZE
|
||||
#define MCA_FCR_RX_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
/*
|
||||
GKI Buffer Pool ID used to hold MPS segments used in (re)transmissions.
|
||||
L2CAP_DEFAULT_ERM_POOL_ID is specified to use the HCI ACL data pool.
|
||||
Note: This pool needs to have enough buffers to hold two times the window size negotiated
|
||||
in the tL2CAP_FCR_OPTIONS (2 * tx_win_size) to allow for retransmissions.
|
||||
The size of each buffer must be able to hold the maximum MPS segment size passed in
|
||||
tL2CAP_FCR_OPTIONS plus BT_HDR (8) + HCI preamble (4) + L2CAP_MIN_OFFSET (11 - as of BT 2.1 + EDR Spec).
|
||||
*/
|
||||
#ifndef MCA_FCR_TX_POOL_ID
|
||||
#define MCA_FCR_TX_POOL_ID HCI_ACL_POOL_ID
|
||||
* Default buffer size used to hold MPS segments used in (re)transmissions.
|
||||
* The size of each buffer must be able to hold the maximum MPS segment size
|
||||
* passed in tL2CAP_FCR_OPTIONS plus BT_HDR (8) + HCI preamble (4) +
|
||||
* L2CAP_MIN_OFFSET (11 - as of BT 2.1 + EDR Spec).
|
||||
*/
|
||||
#ifndef MCA_FCR_TX_BUF_SIZE
|
||||
#define MCA_FCR_TX_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
/* MCAP control channel FCR Option:
|
||||
|
@ -404,6 +404,8 @@ typedef void (tBTA_START_ADV_CMPL_CBACK) (tBTA_STATUS status);
|
||||
|
||||
typedef tBTM_SET_PKT_DATA_LENGTH_CBACK tBTA_SET_PKT_DATA_LENGTH_CBACK;
|
||||
|
||||
typedef tBTM_SET_LOCAL_PRIVACY_CBACK tBTA_SET_LOCAL_PRIVACY_CBACK;
|
||||
|
||||
/* advertising channel map */
|
||||
#define BTA_BLE_ADV_CHNL_37 BTM_BLE_ADV_CHNL_37
|
||||
#define BTA_BLE_ADV_CHNL_38 BTM_BLE_ADV_CHNL_38
|
||||
@ -2035,11 +2037,11 @@ extern void BTA_DmSetRandAddress(BD_ADDR rand_addr);
|
||||
** Description Enable/disable privacy on the local device
|
||||
**
|
||||
** Parameters: privacy_enable - enable/disabe privacy on remote device.
|
||||
**
|
||||
** set_local_privacy_cback -callback to be called with result
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmBleConfigLocalPrivacy(BOOLEAN privacy_enable);
|
||||
extern void BTA_DmBleConfigLocalPrivacy(BOOLEAN privacy_enable, tBTA_SET_LOCAL_PRIVACY_CBACK *set_local_privacy_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -2208,7 +2210,7 @@ extern void BTA_BleDisableAdvInstance(UINT8 inst_id);
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmBleUpdateConnectionParams(BD_ADDR bd_addr, UINT16 min_int,
|
||||
UINT16 max_int, UINT16 latency, UINT16 timeout, tBTA_UPDATE_CONN_PARAM_CBACK *update_conn_param_cb);
|
||||
UINT16 max_int, UINT16 latency, UINT16 timeout);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -304,7 +304,7 @@ extern void bta_av_co_video_stop(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type);
|
||||
** the audio codec
|
||||
**
|
||||
** Returns NULL if data is not ready.
|
||||
** Otherwise, a GKI buffer (BT_HDR*) containing the audio data.
|
||||
** Otherwise, a buffer (BT_HDR*) containing the audio data.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void *bta_av_co_audio_src_data_path(tBTA_AV_CODEC codec_type,
|
||||
|
@ -1157,12 +1157,12 @@ extern void BTA_GATTC_Broadcast(tBTA_GATTC_IF client_if, BOOLEAN start);
|
||||
** only once per connection.
|
||||
**
|
||||
** Parameters conn_id: connection ID.
|
||||
** mtu: desired MTU size to use.
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_GATTC_ConfigureMTU (UINT16 conn_id, UINT16 mtu);
|
||||
extern void BTA_GATTC_ConfigureMTU (UINT16 conn_id);
|
||||
|
||||
/*******************************************************************************
|
||||
** BTA GATT Server API
|
||||
@ -1409,10 +1409,10 @@ extern void BTA_SetAttributeValue(UINT16 attr_handle, UINT16 length, UINT8 *valu
|
||||
** length - the value length which has been set to the attribute.
|
||||
** value - the pointer to the value
|
||||
**
|
||||
** Returns None
|
||||
** Returns tBTA_GATT_STATUS
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_GetAttributeValue(UINT16 attr_handle, UINT16 *length, UINT8 **value);
|
||||
extern tBTA_GATT_STATUS BTA_GetAttributeValue(UINT16 attr_handle, UINT16 *length, UINT8 **value);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
36
tools/sdk/include/bluedroid/bta_gatt_common.h
Normal file
36
tools/sdk/include/bluedroid/bta_gatt_common.h
Normal file
@ -0,0 +1,36 @@
|
||||
/******************************************************************************
|
||||
* Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD
|
||||
*
|
||||
* 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.
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This file contains the action functions for gatts and gattc.
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "bt_types.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
extern void BTA_GATT_SetLocalMTU(uint16_t mtu);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -29,7 +29,7 @@
|
||||
#include "bta_gatt_api.h"
|
||||
#include "bta_gattc_ci.h"
|
||||
#include "bta_gattc_co.h"
|
||||
#include "gki.h"
|
||||
#include "fixed_queue.h"
|
||||
|
||||
/*****************************************************************************
|
||||
** Constants and data types
|
||||
@ -184,7 +184,6 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 mtu;
|
||||
} tBTA_GATTC_API_CFG_MTU;
|
||||
|
||||
typedef struct {
|
||||
@ -302,7 +301,7 @@ typedef struct {
|
||||
|
||||
tBTA_GATTC_CACHE *p_srvc_cache;
|
||||
tBTA_GATTC_CACHE *p_cur_srvc;
|
||||
BUFFER_Q cache_buffer; /* buffer queue used for storing the cache data */
|
||||
fixed_queue_t *cache_buffer; /* buffer queue used for storing the cache data */
|
||||
UINT8 *p_free; /* starting point to next available byte */
|
||||
UINT16 free_byte; /* number of available bytes in server cache buffer */
|
||||
UINT8 update_count; /* indication received */
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "bta_gatt_api.h"
|
||||
#include "gatt_api.h"
|
||||
|
||||
#include "gki.h"
|
||||
|
||||
/*****************************************************************************
|
||||
** Constants and data types
|
||||
@ -230,7 +229,7 @@ extern void bta_gatts_add_include_srvc(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS
|
||||
extern void bta_gatts_add_char(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_msg);
|
||||
extern void bta_gatts_add_char_descr(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_msg);
|
||||
extern void bta_gatts_set_attr_value(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_msg);
|
||||
extern void bta_gatts_get_attr_value(UINT16 attr_handle, UINT16 *length, UINT8 **value);
|
||||
extern tGATT_STATUS bta_gatts_get_attr_value(UINT16 attr_handle, UINT16 *length, UINT8 **value);
|
||||
extern void bta_gatts_delete_service(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_msg);
|
||||
extern void bta_gatts_start_service(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_msg);
|
||||
extern void bta_gatts_stop_service(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_msg);
|
||||
|
@ -25,7 +25,7 @@
|
||||
#define BTA_SYS_H
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "gki.h"
|
||||
#include "bt_defs.h"
|
||||
|
||||
/*****************************************************************************
|
||||
** Constants and data types
|
||||
|
@ -11,9 +11,11 @@
|
||||
// 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.
|
||||
|
||||
#ifndef __BTC_BLE_STORAGE_H__
|
||||
#define __BTC_BLE_STORAGE_H__
|
||||
#include "bt_types.h"
|
||||
#include "bt_target.h"
|
||||
#include "esp_gap_ble_api.h"
|
||||
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
#define BTC_LE_LOCAL_KEY_IR (1<<0)
|
||||
@ -77,9 +79,12 @@ typedef struct
|
||||
|
||||
extern btc_dm_pairing_cb_t pairing_cb;
|
||||
extern btc_dm_local_key_cb_t ble_local_key_cb;
|
||||
extern btc_bonded_devices_t bonded_devices;
|
||||
|
||||
bt_status_t btc_storage_load_bonded_ble_devices(void);
|
||||
|
||||
bt_status_t btc_get_bonded_ble_devices_list(esp_ble_bond_dev_t *bond_dev);
|
||||
|
||||
bt_status_t btc_in_fetch_bonded_ble_devices(int add);
|
||||
|
||||
void btc_dm_remove_ble_bonding_keys(void);
|
||||
@ -102,14 +107,16 @@ bt_status_t btc_storage_get_ble_bonding_key(bt_bdaddr_t *remote_bd_addr,
|
||||
char *key_value,
|
||||
int key_length);
|
||||
|
||||
bool btc_storage_compare_address_key_value(uint8_t key_type, void *key_value, int key_length);
|
||||
|
||||
bool btc_storage_compare_address_key_value(bt_bdaddr_t *remote_bd_addr,
|
||||
uint8_t key_type, void *key_value, int key_length);
|
||||
bt_status_t btc_storage_add_ble_local_key(char *key,
|
||||
uint8_t key_type,
|
||||
uint8_t key_length);
|
||||
|
||||
bt_status_t btc_storage_remove_ble_bonding_keys(bt_bdaddr_t *remote_bd_addr);
|
||||
|
||||
bt_status_t btc_storage_clear_bond_devices(void);
|
||||
|
||||
bt_status_t btc_storage_remove_ble_local_keys(void);
|
||||
|
||||
bt_status_t btc_storage_get_ble_local_key(uint8_t key_type,
|
||||
@ -119,6 +126,8 @@ bt_status_t btc_storage_get_ble_local_key(uint8_t key_type,
|
||||
bt_status_t btc_storage_get_remote_addr_type(bt_bdaddr_t *remote_bd_addr,
|
||||
int *addr_type);
|
||||
|
||||
int btc_storage_get_num_ble_bond_devices(void);
|
||||
|
||||
bt_status_t btc_storage_set_remote_addr_type(bt_bdaddr_t *remote_bd_addr,
|
||||
uint8_t addr_type);
|
||||
|
||||
@ -126,4 +135,5 @@ void btc_dm_load_ble_local_keys(void);
|
||||
|
||||
void btc_dm_get_ble_local_keys(tBTA_DM_BLE_LOCAL_KEY_MASK *p_key_mask, BT_OCTET16 er,
|
||||
tBTA_BLE_LOCAL_ID_KEYS *p_id_keys);
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
#endif ///__BTC_BLE_STORAGE_H__
|
@ -20,6 +20,8 @@
|
||||
|
||||
#include "bt_types.h"
|
||||
|
||||
#define BTC_LE_DEV_TYPE "DevType"
|
||||
|
||||
typedef struct btc_config_section_iter_t btc_config_section_iter_t;
|
||||
|
||||
bool btc_config_init(void);
|
||||
@ -35,6 +37,7 @@ bool btc_config_set_str(const char *section, const char *key, const char *value)
|
||||
bool btc_config_get_bin(const char *section, const char *key, uint8_t *value, size_t *length);
|
||||
bool btc_config_set_bin(const char *section, const char *key, const uint8_t *value, size_t length);
|
||||
bool btc_config_remove(const char *section, const char *key);
|
||||
bool btc_config_remove_section(const char *section);
|
||||
|
||||
size_t btc_config_get_bin_length(const char *section, const char *key);
|
||||
|
||||
@ -49,7 +52,7 @@ int btc_config_clear(void);
|
||||
|
||||
// TODO(zachoverflow): Eww...we need to move these out. These are peer specific, not config general.
|
||||
bool btc_get_address_type(const BD_ADDR bd_addr, int *p_addr_type);
|
||||
bool btc_compare_address_key_value(char *key_type, void *key_value, int key_length);
|
||||
bool btc_compare_address_key_value(const char *section, char *key_type, void *key_value, int key_length);
|
||||
bool btc_get_device_type(const BD_ADDR bd_addr, int *p_device_type);
|
||||
|
||||
#endif
|
||||
|
@ -40,6 +40,9 @@ typedef enum {
|
||||
BTC_GAP_BLE_PASSKEY_REPLY_EVT,
|
||||
BTC_GAP_BLE_CONFIRM_REPLY_EVT,
|
||||
BTC_GAP_BLE_DISCONNECT_EVT,
|
||||
BTC_GAP_BLE_REMOVE_BOND_DEV_EVT,
|
||||
BTC_GAP_BLE_CLEAR_BOND_DEV_EVT,
|
||||
BTC_GAP_BLE_GET_BOND_DEV_EVT,
|
||||
} btc_gap_ble_act_t;
|
||||
|
||||
/* btc_ble_gap_args_t */
|
||||
@ -89,44 +92,50 @@ typedef union {
|
||||
uint8_t *raw_scan_rsp;
|
||||
uint32_t raw_scan_rsp_len;
|
||||
} cfg_scan_rsp_data_raw;
|
||||
|
||||
//BTC_GAP_BLE_SET_ENCRYPTION_EVT
|
||||
struct set_encryption_args {
|
||||
esp_bd_addr_t bd_addr;
|
||||
esp_ble_sec_act_t sec_act;
|
||||
} set_encryption;
|
||||
|
||||
//BTC_GAP_BLE_SET_SECURITY_PARAM_EVT
|
||||
struct set_security_param_args {
|
||||
esp_ble_sm_param_t param_type;
|
||||
uint8_t len;
|
||||
uint8_t *value;
|
||||
} set_security_param;
|
||||
|
||||
//BTC_GAP_BLE_SECURITY_RSP_EVT
|
||||
struct enc_rsp_args {
|
||||
esp_bd_addr_t bd_addr;
|
||||
bool accept;
|
||||
} sec_rsp;
|
||||
|
||||
//BTC_GAP_BLE_PASSKEY_REPLY_EVT
|
||||
struct enc_passkey_reply_args {
|
||||
esp_bd_addr_t bd_addr;
|
||||
bool accept;
|
||||
uint32_t passkey;
|
||||
} enc_passkey_replay;
|
||||
|
||||
//BTC_GAP_BLE_CONFIRM_REPLY_EVT
|
||||
struct enc_comfirm_reply_args {
|
||||
esp_bd_addr_t bd_addr;
|
||||
bool accept;
|
||||
} enc_comfirm_replay;
|
||||
|
||||
//BTC_GAP_BLE_DISCONNECT_EVT
|
||||
struct disconnect_args {
|
||||
esp_bd_addr_t remote_device;
|
||||
} disconnect;
|
||||
|
||||
//BTC_GAP_BLE_REMOVE_BOND_DEV_EVT
|
||||
struct remove_bond_device_args {
|
||||
esp_bd_addr_t bd_addr;
|
||||
} remove_bond_device;
|
||||
} btc_ble_gap_args_t;
|
||||
|
||||
void btc_gap_ble_call_handler(btc_msg_t *msg);
|
||||
void btc_gap_ble_cb_handler(btc_msg_t *msg);
|
||||
|
||||
void btc_gap_ble_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
void btc_gap_ble_arg_deep_free(btc_msg_t *msg);
|
||||
void btc_gap_ble_cb_deep_free(btc_msg_t *msg);
|
||||
void btc_gap_ble_cb_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
void btc_gap_callback_init(void);
|
||||
|
||||
#endif /* __BTC_GAP_BLE_H__ */
|
||||
|
@ -68,7 +68,6 @@ typedef union {
|
||||
//BTC_GATTC_ACT_CFG_MTU,
|
||||
struct cfg_mtu_arg {
|
||||
uint16_t conn_id;
|
||||
uint16_t mtu;
|
||||
} cfg_mtu;
|
||||
//BTC_GATTC_ACT_SEARCH_SERVICE,
|
||||
struct search_srvc_arg {
|
||||
|
@ -147,7 +147,7 @@ typedef union {
|
||||
void btc_gatts_call_handler(btc_msg_t *msg);
|
||||
void btc_gatts_cb_handler(btc_msg_t *msg);
|
||||
void btc_gatts_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
void btc_gatts_get_attr_value(uint16_t attr_handle, uint16_t *length, uint8_t **value);
|
||||
esp_gatt_status_t btc_gatts_get_attr_value(uint16_t attr_handle, uint16_t *length, uint8_t **value);
|
||||
|
||||
|
||||
#endif /* __BTC_GATTS_H__ */
|
||||
|
@ -26,6 +26,7 @@ typedef enum {
|
||||
BTC_MAIN_ACT_DEINIT,
|
||||
BTC_MAIN_ACT_ENABLE,
|
||||
BTC_MAIN_ACT_DISABLE,
|
||||
BTC_GATT_ACT_SET_LOCAL_MTU,
|
||||
} btc_main_act_t;
|
||||
|
||||
typedef enum {
|
||||
@ -60,5 +61,13 @@ bt_status_t btc_init_bluetooth(future_t *future);
|
||||
void btc_deinit_bluetooth(future_t *future);
|
||||
#endif
|
||||
|
||||
/* btc_ble_gattc_args_t */
|
||||
typedef union {
|
||||
//BTC_GATT_ACT_SET_LOCAL_MTU,
|
||||
struct set_mtu_arg {
|
||||
uint16_t mtu;
|
||||
} set_mtu;
|
||||
} btc_ble_main_args_t;
|
||||
|
||||
void btc_main_call_handler(btc_msg_t *msg);
|
||||
#endif /* __BTC_BT_MAIN_H__ */
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "bta_api.h"
|
||||
#include "gki.h"
|
||||
#include "btc_av_api.h"
|
||||
|
||||
#if (BTA_AV_INCLUDED == TRUE)
|
||||
@ -174,9 +173,9 @@ extern BOOLEAN btc_media_task_aa_tx_flush_req(void);
|
||||
**
|
||||
** Function btc_media_aa_readbuf
|
||||
**
|
||||
** Description Read an audio GKI buffer from the BTC media TX queue
|
||||
** Description Read an audio buffer from the BTC media TX queue
|
||||
**
|
||||
** Returns pointer on a GKI aa buffer ready to send
|
||||
** Returns pointer on a aa buffer ready to send
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BT_HDR *btc_media_aa_readbuf(void);
|
||||
@ -198,7 +197,7 @@ UINT8 btc_media_sink_enque_buf(BT_HDR *p_buf);
|
||||
**
|
||||
** Function btc_media_aa_writebuf
|
||||
**
|
||||
** Description Enqueue a Advance Audio media GKI buffer to be processed by btc media task.
|
||||
** Description Enqueue a Advance Audio media buffer to be processed by btc media task.
|
||||
**
|
||||
** Returns TRUE is success
|
||||
**
|
||||
@ -209,7 +208,7 @@ extern void btc_media_aa_writebuf(BT_HDR *pBuf, UINT32 timestamp, UINT16 seq_num
|
||||
**
|
||||
** Function btc_media_av_writebuf
|
||||
**
|
||||
** Description Enqueue a video media GKI buffer to be processed by btc media task.
|
||||
** Description Enqueue a video media buffer to be processed by btc media task.
|
||||
**
|
||||
** Returns TRUE is success
|
||||
**
|
||||
|
@ -110,7 +110,6 @@ typedef struct tBAUD_REG_tag {
|
||||
UINT8 ExplicitBaudRate3;
|
||||
} tBAUD_REG;
|
||||
|
||||
#include "gki.h"
|
||||
|
||||
extern const tBAUD_REG baud_rate_regs[];
|
||||
|
||||
|
@ -69,7 +69,9 @@ enum {
|
||||
BTM_REPEATED_ATTEMPTS, /* 19 repeated attempts for LE security requests */
|
||||
BTM_MODE4_LEVEL4_NOT_SUPPORTED, /* 20 Secure Connections Only Mode can't be supported */
|
||||
BTM_PEER_LE_DATA_LEN_UNSUPPORTED, /* 21 peer setting data length is unsupported*/
|
||||
BTM_CONTROL_LE_DATA_LEN_UNSUPPORTED /* 22 controller setting data length is unsupported*/
|
||||
BTM_CONTROL_LE_DATA_LEN_UNSUPPORTED,/* 22 controller setting data length is unsupported*/
|
||||
BTM_SET_PRIVACY_SUCCESS, /* 23 enable/disable local privacy success */
|
||||
BTM_SET_PRIVACY_FAIL, /* 24 enable/disable local privacy failed*/
|
||||
};
|
||||
|
||||
typedef uint8_t tBTM_STATUS;
|
||||
@ -175,6 +177,8 @@ typedef void (tBTM_UPDATE_CONN_PARAM_CBACK) (UINT8 status, BD_ADDR bd_addr, tBTM
|
||||
|
||||
typedef void (tBTM_SET_PKT_DATA_LENGTH_CBACK) (UINT8 status, tBTM_LE_SET_PKT_DATA_LENGTH_PARAMS *data_length_params);
|
||||
|
||||
typedef void (tBTM_SET_LOCAL_PRIVACY_CBACK) (UINT8 status);
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** DEVICE DISCOVERY - Inquiry, Remote Name, Discovery, Class of Device
|
||||
@ -1412,6 +1416,7 @@ typedef UINT8 tBTM_IO_CAP;
|
||||
#define BTM_BLE_INITIATOR_KEY_SIZE 15
|
||||
#define BTM_BLE_RESPONDER_KEY_SIZE 15
|
||||
#define BTM_BLE_MAX_KEY_SIZE 16
|
||||
#define BTM_BLE_MIN_KEY_SIZE 7
|
||||
|
||||
typedef UINT8 tBTM_AUTH_REQ;
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
#include "bt_defs.h"
|
||||
#include "btm_api.h"
|
||||
#include "gki.h"
|
||||
#include "bt_common_types.h"
|
||||
|
||||
#define CHANNEL_MAP_LEN 5
|
||||
@ -164,12 +163,12 @@ typedef UINT8 tBTM_BLE_SFP;
|
||||
|
||||
/* default connection interval min */
|
||||
#ifndef BTM_BLE_CONN_INT_MIN_DEF
|
||||
#define BTM_BLE_CONN_INT_MIN_DEF 24 /* recommended min: 30ms = 24 * 1.25 */
|
||||
#define BTM_BLE_CONN_INT_MIN_DEF 10 /* recommended min: 12.5 ms = 10 * 1.25 */
|
||||
#endif
|
||||
|
||||
/* default connection interval max */
|
||||
#ifndef BTM_BLE_CONN_INT_MAX_DEF
|
||||
#define BTM_BLE_CONN_INT_MAX_DEF 40 /* recommended max: 50 ms = 56 * 1.25 */
|
||||
#define BTM_BLE_CONN_INT_MAX_DEF 12 /* recommended max: 15 ms = 12 * 1.25 */
|
||||
#endif
|
||||
|
||||
/* default slave latency */
|
||||
@ -861,6 +860,20 @@ tBTM_BLE_SCAN_SETUP_CBACK bta_ble_scan_setup_cb;
|
||||
extern "C" {
|
||||
#endif
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleRegiseterConnParamCallback
|
||||
**
|
||||
** Description register connection parameters update callback func
|
||||
**
|
||||
** Parameters: update_conn_param_cb
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTM_BleRegiseterConnParamCallback(tBTM_UPDATE_CONN_PARAM_CBACK *update_conn_param_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_SecAddBleDevice
|
||||
@ -1596,7 +1609,7 @@ tBTM_STATUS BTM_BleBroadcast(BOOLEAN start);
|
||||
**
|
||||
*******************************************************************************/
|
||||
//extern
|
||||
BOOLEAN BTM_BleConfigPrivacy(BOOLEAN enable);
|
||||
BOOLEAN BTM_BleConfigPrivacy(BOOLEAN enable, tBTM_SET_LOCAL_PRIVACY_CBACK *set_local_privacy_cabck);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -27,7 +27,7 @@
|
||||
#define BTM_BLE_INT_H
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "gki.h"
|
||||
#include "fixed_queue.h"
|
||||
#include "hcidefs.h"
|
||||
#include "btm_ble_api.h"
|
||||
#include "btm_int.h"
|
||||
@ -185,6 +185,7 @@ typedef struct {
|
||||
tBTM_BLE_ADDR_CBACK *p_generate_cback;
|
||||
void *p;
|
||||
TIMER_LIST_ENT raddr_timer_ent;
|
||||
tBTM_SET_LOCAL_PRIVACY_CBACK *set_local_privacy_cback;
|
||||
} tBTM_LE_RANDOM_CB;
|
||||
|
||||
#define BTM_BLE_MAX_BG_CONN_DEV_NUM 10
|
||||
@ -315,7 +316,7 @@ typedef struct {
|
||||
UINT8 white_list_avail_size;
|
||||
tBTM_BLE_WL_STATE wl_state;
|
||||
|
||||
BUFFER_Q conn_pending_q;
|
||||
fixed_queue_t *conn_pending_q;
|
||||
tBTM_BLE_CONN_ST conn_state;
|
||||
|
||||
/* random address management control block */
|
||||
@ -362,6 +363,7 @@ BOOLEAN btm_ble_send_extended_scan_params(UINT8 scan_type, UINT32 scan_int,
|
||||
UINT8 scan_filter_policy);
|
||||
void btm_ble_stop_inquiry(void);
|
||||
void btm_ble_init (void);
|
||||
void btm_ble_free (void);
|
||||
void btm_ble_connected (UINT8 *bda, UINT16 handle, UINT8 enc_mode, UINT8 role, tBLE_ADDR_TYPE addr_type, BOOLEAN addr_matched);
|
||||
void btm_ble_read_remote_features_complete(UINT8 *p);
|
||||
void btm_ble_write_adv_enable_complete(UINT8 *p);
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
#include "bt_defs.h"
|
||||
#include "bt_target.h"
|
||||
#include "gki.h"
|
||||
#include "hcidefs.h"
|
||||
|
||||
#include "rfcdefs.h"
|
||||
@ -115,7 +114,6 @@ UINT8 conn_addr_type; /* local device address type for this co
|
||||
BD_ADDR active_remote_addr; /* remote address used on this connection */
|
||||
UINT8 active_remote_addr_type; /* local device address type for this connection */
|
||||
BD_FEATURES peer_le_features; /* Peer LE Used features mask for the device */
|
||||
tBTM_UPDATE_CONN_PARAM_CBACK *update_conn_param_cb;
|
||||
tBTM_SET_PKT_DATA_LENGTH_CBACK *p_set_pkt_data_cback;
|
||||
tBTM_LE_SET_PKT_DATA_LENGTH_PARAMS data_length_params;
|
||||
#endif
|
||||
@ -367,7 +365,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
tBTM_ESCO_INFO esco; /* Current settings */
|
||||
#if BTM_SCO_HCI_INCLUDED == TRUE
|
||||
BUFFER_Q xmit_data_q; /* SCO data transmitting queue */
|
||||
fixed_queue_t *xmit_data_q; /* SCO data transmitting queue */
|
||||
#endif
|
||||
tBTM_SCO_CB *p_conn_cb; /* Callback for when connected */
|
||||
tBTM_SCO_CB *p_disc_cb; /* Callback for when disconnect */
|
||||
@ -865,15 +863,21 @@ typedef struct {
|
||||
UINT8 busy_level; /* the current busy level */
|
||||
BOOLEAN is_paging; /* TRUE, if paging is in progess */
|
||||
BOOLEAN is_inquiry; /* TRUE, if inquiry is in progess */
|
||||
BUFFER_Q page_queue;
|
||||
fixed_queue_t *page_queue;
|
||||
BOOLEAN paging;
|
||||
BOOLEAN discing;
|
||||
BUFFER_Q sec_pending_q; /* pending sequrity requests in tBTM_SEC_QUEUE_ENTRY format */
|
||||
fixed_queue_t *sec_pending_q; /* pending sequrity requests in tBTM_SEC_QUEUE_ENTRY format */
|
||||
#if (!defined(BT_TRACE_VERBOSE) || (BT_TRACE_VERBOSE == FALSE))
|
||||
char state_temp_buffer[BTM_STATE_BUFFER_SIZE];
|
||||
#endif
|
||||
} tBTM_CB;
|
||||
|
||||
typedef struct{
|
||||
//connection parameters update callback
|
||||
tBTM_UPDATE_CONN_PARAM_CBACK *update_conn_param_cb;
|
||||
}tBTM_CallbackFunc;
|
||||
|
||||
extern tBTM_CallbackFunc conn_param_update_cb;
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
@ -892,6 +896,7 @@ extern tBTM_CB *btm_cb_ptr;
|
||||
********************************************
|
||||
*/
|
||||
void btm_init (void);
|
||||
void btm_free (void);
|
||||
|
||||
/* Internal functions provided by btm_inq.c
|
||||
*******************************************
|
||||
|
@ -28,7 +28,7 @@
|
||||
#define BTU_H
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "gki.h"
|
||||
#include "bt_defs.h"
|
||||
|
||||
// HACK(zachoverflow): temporary dark magic
|
||||
#define BTU_POST_TO_TASK_NO_GOOD_HORRIBLE_HACK 0x1700 // didn't look used in bt_types...here goes nothing
|
||||
|
@ -136,7 +136,7 @@ esp_err_t esp_avrc_ct_deinit(void);
|
||||
* @param[in] tl : transaction label, 0 to 15, consecutive commands should use different values.
|
||||
* @param[in] key_code : passthrough command code, e.g. ESP_AVRC_PT_CMD_PLAY, ESP_AVRC_PT_CMD_STOP, etc.
|
||||
* @param[in] key_state : passthrough command key state, ESP_AVRC_PT_CMD_STATE_PRESSED or
|
||||
* ESP_AVRC_PT_CMD_STATE_PRESSED
|
||||
* ESP_AVRC_PT_CMD_STATE_RELEASED
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
|
@ -22,6 +22,12 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ESP_BLUEDROID_STATUS_CHECK(status) \
|
||||
if (esp_bluedroid_get_status() != (status)) { \
|
||||
return ESP_ERR_INVALID_STATE; \
|
||||
}
|
||||
|
||||
|
||||
/* relate to BT_STATUS_xxx in bt_def.h */
|
||||
/// Status Return Value
|
||||
typedef enum {
|
||||
@ -44,6 +50,7 @@ typedef enum {
|
||||
ESP_BT_STATUS_TIMEOUT, /* relate to BT_STATUS_TIMEOUT in bt_def.h */
|
||||
ESP_BT_STATUS_PEER_LE_DATA_LEN_UNSUPPORTED, /* relate to BTM_PEER_LE_DATA_LEN_UNSUPPORTED in btm_api.h */
|
||||
ESP_BT_STATUS_CONTROL_LE_DATA_LEN_UNSUPPORTED,/* relate to BTM_CONTROL_LE_DATA_LEN_UNSUPPORTED in btm_api.h */
|
||||
ESP_BT_STATUS_ERR_ILLEGAL_PARAMETER_FMT, /* relate to HCI_ERR_ILLEGAL_PARAMETER_FMT in hcidefs.h */
|
||||
} esp_bt_status_t;
|
||||
|
||||
|
||||
@ -107,6 +114,7 @@ typedef enum {
|
||||
#define ESP_BLE_CSR_KEY_MASK (1 << 2) /* relate to BTM_BLE_CSR_KEY_MASK in btm_api.h */
|
||||
/// Used to exchange the link key(this key just used in the BLE & BR/EDR coexist mode) in the init key & response key
|
||||
#define ESP_BLE_LINK_KEY_MASK (1 << 3) /* relate to BTM_BLE_LINK_KEY_MASK in btm_api.h */
|
||||
typedef uint8_t esp_ble_key_mask_t; /* the key mask type */
|
||||
|
||||
/// Minimum of the application id
|
||||
#define ESP_APP_ID_MIN 0x0000
|
||||
|
@ -93,6 +93,11 @@ typedef enum {
|
||||
ESP_GAP_BLE_SET_STATIC_RAND_ADDR_EVT, /*!< When set the static rand address complete, the event comes */
|
||||
ESP_GAP_BLE_UPDATE_CONN_PARAMS_EVT, /*!< When update connection parameters complete, the event comes */
|
||||
ESP_GAP_BLE_SET_PKT_LENGTH_COMPLETE_EVT, /*!< When set pkt lenght complete, the event comes */
|
||||
ESP_GAP_BLE_SET_LOCAL_PRIVACY_COMPLETE_EVT, /*!< When Enable/disable privacy on the local device complete, the event comes */
|
||||
ESP_GAP_BLE_REMOVE_BOND_DEV_COMPLETE_EVT, /*!< When remove the bond device complete, the event comes */
|
||||
ESP_GAP_BLE_CLEAR_BOND_DEV_COMPLETE_EVT, /*!< When clear the bond device clear complete, the event comes */
|
||||
ESP_GAP_BLE_GET_BOND_DEV_COMPLETE_EVT, /*!< When get the bond device list complete, the event comes */
|
||||
ESP_GAP_BLE_EVT_MAX,
|
||||
} esp_gap_ble_cb_event_t;
|
||||
|
||||
/// Advertising data maximum length
|
||||
@ -293,7 +298,7 @@ typedef struct
|
||||
uint16_t ediv; /*!< The ediv value*/
|
||||
uint8_t sec_level; /*!< The security level of the security link*/
|
||||
uint8_t key_size; /*!< The key size(7~16) of the security link*/
|
||||
}esp_ble_penc_keys_t; /*!< The key type*/
|
||||
} esp_ble_penc_keys_t; /*!< The key type*/
|
||||
|
||||
/**
|
||||
* @brief BLE CSRK keys
|
||||
@ -303,7 +308,7 @@ typedef struct
|
||||
uint32_t counter; /*!< The counter */
|
||||
esp_bt_octet16_t csrk; /*!< The csrk key */
|
||||
uint8_t sec_level; /*!< The security level */
|
||||
}esp_ble_pcsrk_keys_t; /*!< The pcsrk key type */
|
||||
} esp_ble_pcsrk_keys_t; /*!< The pcsrk key type */
|
||||
|
||||
/**
|
||||
* @brief BLE pid keys
|
||||
@ -313,7 +318,7 @@ typedef struct
|
||||
esp_bt_octet16_t irk; /*!< The irk value */
|
||||
esp_ble_addr_type_t addr_type; /*!< The address type */
|
||||
esp_bd_addr_t static_addr; /*!< The static address */
|
||||
}esp_ble_pid_keys_t; /*!< The pid key type */
|
||||
} esp_ble_pid_keys_t; /*!< The pid key type */
|
||||
|
||||
/**
|
||||
* @brief BLE Encryption reproduction keys
|
||||
@ -324,7 +329,7 @@ typedef struct
|
||||
uint16_t div; /*!< The div value */
|
||||
uint8_t key_size; /*!< The key size of the security link */
|
||||
uint8_t sec_level; /*!< The security level of the security link */
|
||||
}esp_ble_lenc_keys_t; /*!< The key type */
|
||||
} esp_ble_lenc_keys_t; /*!< The key type */
|
||||
|
||||
/**
|
||||
* @brief BLE SRK keys
|
||||
@ -334,8 +339,8 @@ typedef struct
|
||||
uint32_t counter; /*!< The counter value */
|
||||
uint16_t div; /*!< The div value */
|
||||
uint8_t sec_level; /*!< The security level of the security link */
|
||||
esp_bt_octet16_t csrk; /*!< The csrk key value */
|
||||
}esp_ble_lcsrk_keys; /*!< The csrk key type */
|
||||
esp_bt_octet16_t csrk; /*!< The csrk key value */
|
||||
} esp_ble_lcsrk_keys; /*!< The csrk key type */
|
||||
|
||||
/**
|
||||
* @brief Structure associated with ESP_KEY_NOTIF_EVT
|
||||
@ -352,7 +357,7 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
esp_bd_addr_t bd_addr; /*!< peer address */
|
||||
}esp_ble_sec_req_t; /*!< BLE security request type*/
|
||||
} esp_ble_sec_req_t; /*!< BLE security request type*/
|
||||
|
||||
/**
|
||||
* @brief union type of the security key value
|
||||
@ -364,7 +369,27 @@ typedef union
|
||||
esp_ble_pid_keys_t pid_key; /*!< peer device ID key */
|
||||
esp_ble_lenc_keys_t lenc_key; /*!< local encryption reproduction keys LTK = = d1(ER,DIV,0)*/
|
||||
esp_ble_lcsrk_keys lcsrk_key; /*!< local device CSRK = d1(ER,DIV,1)*/
|
||||
}esp_ble_key_value_t; /*!< ble key value type*/
|
||||
} esp_ble_key_value_t; /*!< ble key value type*/
|
||||
|
||||
/**
|
||||
* @brief struct type of the bond key informatuon value
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
esp_ble_key_mask_t key_mask; /*!< the key mask to indicate witch key is present */
|
||||
esp_ble_penc_keys_t penc_key; /*!< received peer encryption key */
|
||||
esp_ble_pcsrk_keys_t pcsrk_key; /*!< received peer device SRK */
|
||||
esp_ble_pid_keys_t pid_key; /*!< peer device ID key */
|
||||
} esp_ble_bond_key_info_t; /*!< ble bond key information value type */
|
||||
|
||||
/**
|
||||
* @brief struct type of the bond device value
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
esp_bd_addr_t bd_addr; /*!< peer address */
|
||||
esp_ble_bond_key_info_t bond_key; /*!< the bond key information */
|
||||
} esp_ble_bond_dev_t; /*!< the ble bond device type */
|
||||
|
||||
|
||||
/**
|
||||
@ -375,7 +400,7 @@ typedef struct
|
||||
esp_bd_addr_t bd_addr; /*!< peer address */
|
||||
esp_ble_key_type_t key_type; /*!< key type of the security link */
|
||||
esp_ble_key_value_t p_key_value; /*!< the pointer to the key value */
|
||||
}esp_ble_key_t; /*!< the union to the ble key value type*/
|
||||
} esp_ble_key_t; /*!< the union to the ble key value type*/
|
||||
|
||||
/**
|
||||
* @brief structure type of the ble local id keys value
|
||||
@ -384,7 +409,7 @@ typedef struct {
|
||||
esp_bt_octet16_t ir; /*!< the 16 bits of the ir value */
|
||||
esp_bt_octet16_t irk; /*!< the 16 bits of the ir key value */
|
||||
esp_bt_octet16_t dhk; /*!< the 16 bits of the dh key value */
|
||||
}esp_ble_local_id_keys_t; /*!< the structure of the ble local id keys value type*/
|
||||
} esp_ble_local_id_keys_t; /*!< the structure of the ble local id keys value type*/
|
||||
|
||||
|
||||
/**
|
||||
@ -400,7 +425,7 @@ typedef struct
|
||||
uint8_t fail_reason; /*!< The HCI reason/error code for when success=FALSE */
|
||||
esp_ble_addr_type_t addr_type; /*!< Peer device address type */
|
||||
esp_bt_dev_type_t dev_type; /*!< Device type */
|
||||
}esp_ble_auth_cmpl_t; /*!< The ble authentication complite cb type */
|
||||
} esp_ble_auth_cmpl_t; /*!< The ble authentication complite cb type */
|
||||
|
||||
/**
|
||||
* @brief union associated with ble security
|
||||
@ -412,7 +437,7 @@ typedef union
|
||||
esp_ble_key_t ble_key; /*!< BLE SMP keys used when pairing */
|
||||
esp_ble_local_id_keys_t ble_id_keys; /*!< BLE IR event */
|
||||
esp_ble_auth_cmpl_t auth_cmpl; /*!< Authentication complete indication. */
|
||||
}esp_ble_sec_t; /*!< Ble secutity type */
|
||||
} esp_ble_sec_t; /*!< Ble secutity type */
|
||||
|
||||
/// Sub Event of ESP_GAP_BLE_SCAN_RESULT_EVT
|
||||
typedef enum {
|
||||
@ -539,6 +564,33 @@ typedef union {
|
||||
esp_bt_status_t status; /*!< Indicate the set pkt data length operation success status */
|
||||
esp_ble_pkt_data_length_params_t params; /*!< pkt data length value */
|
||||
} pkt_data_lenth_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_PKT_LENGTH_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_SET_LOCAL_PRIVACY_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_local_privacy_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate the set local privacy operation success status */
|
||||
} local_privacy_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_LOCAL_PRIVACY_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_REMOVE_BOND_DEV_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_remove_bond_dev_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate the remove bond device operation success status */
|
||||
esp_bd_addr_t bd_addr; /*!< The device address which has been remove from the bond list */
|
||||
}remove_bond_dev_cmpl; /*!< Event parameter of ESP_GAP_BLE_REMOVE_BOND_DEV_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_CLEAR_BOND_DEV_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_clear_bond_dev_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate the clear bond device operation success status */
|
||||
}clear_bond_dev_cmpl; /*!< Event parameter of ESP_GAP_BLE_CLEAR_BOND_DEV_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_GET_BOND_DEV_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_get_bond_dev_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate the get bond device operation success status */
|
||||
uint8_t dev_num; /*!< Indicate the get number device in the bond list */
|
||||
esp_ble_bond_dev_t *bond_dev; /*!< the pointer to the bond device Structure */
|
||||
}get_bond_dev_cmpl; /*!< Event parameter of ESP_GAP_BLE_GET_BOND_DEV_COMPLETE_EVT */
|
||||
} esp_ble_gap_cb_param_t;
|
||||
|
||||
/**
|
||||
@ -814,6 +866,38 @@ esp_err_t esp_ble_passkey_reply(esp_bd_addr_t bd_addr, bool accept, uint32_t pas
|
||||
*/
|
||||
esp_err_t esp_ble_confirm_reply(esp_bd_addr_t bd_addr, bool accept);
|
||||
|
||||
/**
|
||||
* @brief Removes a device from the security database list of
|
||||
* peer device. It manages unpairing event while connected.
|
||||
*
|
||||
* @param[in] bd_addr : BD address of the peer device
|
||||
*
|
||||
* @return - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_remove_bond_device(esp_bd_addr_t bd_addr);
|
||||
|
||||
/**
|
||||
* @brief Removes all of the device from the security database list of
|
||||
* peer device. It manages unpairing event while connected.
|
||||
*
|
||||
* @return - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_clear_bond_device_list(void);
|
||||
|
||||
/**
|
||||
* @brief Get the device from the security database list of peer device.
|
||||
* It will return the device bonded information from the ESP_GAP_BLE_GET_BOND_DEV_COMPLETE_EVT event.
|
||||
*
|
||||
* @return - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_get_bond_device_list(void);
|
||||
|
||||
/**
|
||||
* @brief This function is to disconnect the physical connection of the peer device
|
||||
*
|
||||
|
46
tools/sdk/include/bluedroid/esp_gatt_common_api.h
Normal file
46
tools/sdk/include/bluedroid/esp_gatt_common_api.h
Normal file
@ -0,0 +1,46 @@
|
||||
// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// 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.
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "esp_bt_defs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Maximum Transmission Unit used in GATT
|
||||
#define ESP_GATT_DEF_BLE_MTU_SIZE 23 /* relate to GATT_DEF_BLE_MTU_SIZE in gatt_api.h */
|
||||
|
||||
// Maximum Transmission Unit allowed in GATT
|
||||
#define ESP_GATT_MAX_MTU_SIZE 517 /* relate to GATT_MAX_MTU_SIZE in gatt_api.h */
|
||||
|
||||
/**
|
||||
* @brief This function is called to set local MTU,
|
||||
* the function is called before BLE connection.
|
||||
*
|
||||
* @param[in] mtu: the size of MTU.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*
|
||||
*/
|
||||
extern esp_err_t esp_ble_gatt_set_local_mtu (uint16_t mtu);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -68,11 +68,6 @@ typedef enum {
|
||||
ESP_GATTC_DISCONNECT_EVT = 41, /*!< When the ble physical connection disconnected, the event comes */
|
||||
} esp_gattc_cb_event_t;
|
||||
|
||||
/// Maximum Transmission Unit used in GATT
|
||||
#define ESP_GATT_DEF_BLE_MTU_SIZE 23
|
||||
|
||||
/// Maximum Transmission Unit allowed in GATT
|
||||
#define ESP_GATT_MAX_MTU_SIZE 517
|
||||
|
||||
/**
|
||||
* @brief Gatt client callback parameters union
|
||||
@ -355,18 +350,19 @@ esp_err_t esp_ble_gattc_close (esp_gatt_if_t gattc_if, uint16_t conn_id);
|
||||
|
||||
/**
|
||||
* @brief Configure the MTU size in the GATT channel. This can be done
|
||||
* only once per connection.
|
||||
* only once per connection. Before using, use esp_ble_gatt_set_local_mtu()
|
||||
* to configure the local MTU size.
|
||||
*
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] conn_id: connection ID.
|
||||
* @param[in] mtu: desired MTU size to use.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gattc_config_mtu (esp_gatt_if_t gattc_if, uint16_t conn_id, uint16_t mtu);
|
||||
esp_err_t esp_ble_gattc_send_mtu_req (esp_gatt_if_t gattc_if, uint16_t conn_id);
|
||||
|
||||
|
||||
/**
|
||||
@ -634,7 +630,7 @@ esp_err_t esp_ble_gattc_execute_write (esp_gatt_if_t gattc_if, uint16_t conn_id,
|
||||
* - other: failed
|
||||
*
|
||||
*/
|
||||
esp_gatt_status_t esp_ble_gattc_register_for_notify (esp_gatt_if_t gattc_if,
|
||||
esp_err_t esp_ble_gattc_register_for_notify (esp_gatt_if_t gattc_if,
|
||||
esp_bd_addr_t server_bda,
|
||||
esp_gatt_srvc_id_t *srvc_id,
|
||||
esp_gatt_id_t *char_id);
|
||||
@ -653,7 +649,7 @@ esp_gatt_status_t esp_ble_gattc_register_for_notify (esp_gatt_if_t gattc_if,
|
||||
* - other: failed
|
||||
*
|
||||
*/
|
||||
esp_gatt_status_t esp_ble_gattc_unregister_for_notify (esp_gatt_if_t gattc_if,
|
||||
esp_err_t esp_ble_gattc_unregister_for_notify (esp_gatt_if_t gattc_if,
|
||||
esp_bd_addr_t server_bda,
|
||||
esp_gatt_srvc_id_t *srvc_id,
|
||||
esp_gatt_id_t *char_id);
|
||||
|
@ -514,11 +514,11 @@ esp_err_t esp_ble_gatts_set_attr_value(uint16_t attr_handle, uint16_t length, co
|
||||
* @param[out] value: Pointer to attribute value payload, the value cannot be modified by user
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - ESP_GATT_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gatts_get_attr_value(uint16_t attr_handle, uint16_t *length, const uint8_t **value);
|
||||
esp_gatt_status_t esp_ble_gatts_get_attr_value(uint16_t attr_handle, uint16_t *length, const uint8_t **value);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -20,8 +20,10 @@
|
||||
#define _FIXED_QUEUE_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "list.h"
|
||||
|
||||
struct fixed_queue_t;
|
||||
|
||||
typedef struct fixed_queue_t fixed_queue_t;
|
||||
//typedef struct reactor_t reactor_t;
|
||||
|
||||
@ -38,10 +40,14 @@ fixed_queue_t *fixed_queue_new(size_t capacity);
|
||||
// blocked on it) results in undefined behaviour.
|
||||
void fixed_queue_free(fixed_queue_t *queue, fixed_queue_free_cb free_cb);
|
||||
|
||||
// Returns a value indicating whether the given |queue| is empty. |queue| may
|
||||
// not be NULL.
|
||||
// Returns a value indicating whether the given |queue| is empty. If |queue|
|
||||
// is NULL, the return value is true.
|
||||
bool fixed_queue_is_empty(fixed_queue_t *queue);
|
||||
|
||||
// Returns the length of the |queue|. If |queue| is NULL, the return value
|
||||
// is 0.
|
||||
size_t fixed_queue_length(fixed_queue_t *queue);
|
||||
|
||||
// Returns the maximum number of elements this queue may hold. |queue| may
|
||||
// not be NULL.
|
||||
size_t fixed_queue_capacity(fixed_queue_t *queue);
|
||||
@ -66,12 +72,33 @@ bool fixed_queue_try_enqueue(fixed_queue_t *queue, void *data);
|
||||
// the caller. If the queue is empty, this function returns NULL immediately.
|
||||
// Otherwise, the next element in the queue is returned. |queue| may not be
|
||||
// NULL.
|
||||
//void *fixed_queue_try_dequeue(fixed_queue_t *queue);
|
||||
void *fixed_queue_try_dequeue(fixed_queue_t *queue);
|
||||
|
||||
// Returns the first element from |queue|, if present, without dequeuing it.
|
||||
// This function will never block the caller. Returns NULL if there are no elements
|
||||
// in the queue. |queue| may not be NULL.
|
||||
//void *fixed_queue_try_peek(fixed_queue_t *queue);
|
||||
// This function will never block the caller. Returns NULL if there are no
|
||||
// elements in the queue or |queue| is NULL.
|
||||
void *fixed_queue_try_peek_first(fixed_queue_t *queue);
|
||||
|
||||
// Returns the last element from |queue|, if present, without dequeuing it.
|
||||
// This function will never block the caller. Returns NULL if there are no
|
||||
// elements in the queue or |queue| is NULL.
|
||||
void *fixed_queue_try_peek_last(fixed_queue_t *queue);
|
||||
|
||||
// Tries to remove a |data| element from the middle of the |queue|. This
|
||||
// function will never block the caller. If the queue is empty or NULL, this
|
||||
// function returns NULL immediately. |data| may not be NULL. If the |data|
|
||||
// element is found in the queue, a pointer to the removed data is returned,
|
||||
// otherwise NULL.
|
||||
void *fixed_queue_try_remove_from_queue(fixed_queue_t *queue, void *data);
|
||||
|
||||
// Returns the iterateable list with all entries in the |queue|. This function
|
||||
// will never block the caller. |queue| may not be NULL.
|
||||
//
|
||||
// NOTE: The return result of this function is not thread safe: the list could
|
||||
// be modified by another thread, and the result would be unpredictable.
|
||||
// TODO: The usage of this function should be refactored, and the function
|
||||
// itself should be removed.
|
||||
list_t *fixed_queue_get_list(fixed_queue_t *queue);
|
||||
|
||||
// This function returns a valid file descriptor. Callers may perform one
|
||||
// operation on the fd: select(2). If |select| indicates that the file
|
||||
@ -99,4 +126,6 @@ void fixed_queue_unregister_dequeue(fixed_queue_t *queue);
|
||||
|
||||
void fixed_queue_process(fixed_queue_t *queue);
|
||||
|
||||
list_t *fixed_queue_get_list(fixed_queue_t *queue);
|
||||
|
||||
#endif
|
||||
|
@ -18,9 +18,8 @@
|
||||
|
||||
#ifndef __FUTURE_H__
|
||||
#define __FUTURE_H__
|
||||
// #pragma once
|
||||
|
||||
#include "osi_arch.h"
|
||||
#include "semaphore.h"
|
||||
|
||||
struct future {
|
||||
bool ready_can_be_called;
|
||||
|
@ -21,8 +21,8 @@
|
||||
#define GAP_INT_H
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "fixed_queue.h"
|
||||
#include "gap_api.h"
|
||||
#include "gki.h"
|
||||
#include "gatt_api.h"
|
||||
#define GAP_MAX_BLOCKS 2 /* Concurrent GAP commands pending at a time*/
|
||||
/* Define the Generic Access Profile control structure */
|
||||
@ -71,8 +71,8 @@ typedef struct {
|
||||
UINT16 rem_mtu_size;
|
||||
|
||||
BOOLEAN is_congested;
|
||||
BUFFER_Q tx_queue; /* Queue of buffers waiting to be sent */
|
||||
BUFFER_Q rx_queue; /* Queue of buffers waiting to be read */
|
||||
fixed_queue_t *tx_queue; /* Queue of buffers waiting to be sent */
|
||||
fixed_queue_t *rx_queue; /* Queue of buffers waiting to be read */
|
||||
|
||||
UINT32 rx_queue_size; /* Total data count in rx_queue */
|
||||
|
||||
@ -119,7 +119,7 @@ typedef struct {
|
||||
UINT16 cl_op_uuid;
|
||||
BOOLEAN in_use;
|
||||
BOOLEAN connected;
|
||||
BUFFER_Q pending_req_q;
|
||||
fixed_queue_t *pending_req_q;
|
||||
|
||||
} tGAP_CLCB;
|
||||
|
||||
|
@ -943,7 +943,7 @@ tGATT_STATUS GATTS_GetAttributeValue(UINT16 attr_handle, UINT16 *length, UINT8 *
|
||||
** Returns GATT_SUCCESS if command started successfully.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tGATT_STATUS GATTC_ConfigureMTU (UINT16 conn_id, UINT16 mtu);
|
||||
extern tGATT_STATUS GATTC_ConfigureMTU (UINT16 conn_id);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -20,12 +20,11 @@
|
||||
#define GATT_INT_H
|
||||
|
||||
#include "bt_target.h"
|
||||
|
||||
|
||||
#include "bt_trace.h"
|
||||
#include "gatt_api.h"
|
||||
#include "btm_ble_api.h"
|
||||
#include "btu.h"
|
||||
#include "fixed_queue.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@ -222,7 +221,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
void *p_attr_list; /* pointer to the first attribute, either tGATT_ATTR16 or tGATT_ATTR128 */
|
||||
UINT8 *p_free_mem; /* Pointer to free memory */
|
||||
BUFFER_Q svc_buffer; /* buffer queue used for service database */
|
||||
fixed_queue_t *svc_buffer; /* buffer queue used for service database */
|
||||
UINT32 mem_free; /* Memory still available */
|
||||
UINT16 end_handle; /* Last handle number */
|
||||
UINT16 next_handle; /* Next usable handle value */
|
||||
@ -285,7 +284,7 @@ typedef struct {
|
||||
BT_HDR *p_rsp_msg;
|
||||
UINT32 trans_id;
|
||||
tGATT_READ_MULTI multi_req;
|
||||
BUFFER_Q multi_rsp_q;
|
||||
fixed_queue_t *multi_rsp_q;
|
||||
UINT16 handle;
|
||||
UINT8 op_code;
|
||||
UINT8 status;
|
||||
@ -357,7 +356,7 @@ typedef struct{
|
||||
typedef struct{
|
||||
//only store prepare write packets which need
|
||||
//to be responded by stack (not by application)
|
||||
BUFFER_Q queue;
|
||||
fixed_queue_t *queue;
|
||||
|
||||
//store the total number of prepare write packets
|
||||
//including that should be responded by stack or by application
|
||||
@ -369,7 +368,7 @@ typedef struct{
|
||||
}tGATT_PREPARE_WRITE_RECORD;
|
||||
|
||||
typedef struct {
|
||||
BUFFER_Q pending_enc_clcb; /* pending encryption channel q */
|
||||
fixed_queue_t *pending_enc_clcb; /* pending encryption channel q */
|
||||
tGATT_SEC_ACTION sec_act;
|
||||
BD_ADDR peer_bda;
|
||||
tBT_TRANSPORT transport;
|
||||
@ -389,7 +388,7 @@ typedef struct {
|
||||
tGATT_SR_CMD sr_cmd;
|
||||
#endif ///GATTS_INCLUDED == TRUE
|
||||
UINT16 indicate_handle;
|
||||
BUFFER_Q pending_ind_q;
|
||||
fixed_queue_t *pending_ind_q;
|
||||
|
||||
TIMER_LIST_ENT conf_timer_ent; /* peer confirm to indication timer */
|
||||
|
||||
@ -498,7 +497,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
tGATT_TCB tcb[GATT_MAX_PHY_CHANNEL];
|
||||
BUFFER_Q sign_op_queue;
|
||||
fixed_queue_t *sign_op_queue;
|
||||
|
||||
tGATT_SR_REG sr_reg[GATT_MAX_SR_PROFILES];
|
||||
UINT16 next_handle; /* next available handle */
|
||||
@ -510,8 +509,8 @@ typedef struct {
|
||||
tGATT_SRV_LIST_INFO srv_list_info;
|
||||
tGATT_SRV_LIST_ELEM srv_list[GATT_MAX_SR_PROFILES];
|
||||
#endif ///GATTS_INCLUDED == TRUE
|
||||
BUFFER_Q srv_chg_clt_q; /* service change clients queue */
|
||||
BUFFER_Q pending_new_srv_start_q; /* pending new service start queue */
|
||||
fixed_queue_t *srv_chg_clt_q; /* service change clients queue */
|
||||
fixed_queue_t *pending_new_srv_start_q; /* pending new service start queue */
|
||||
tGATT_REG cl_rcb[GATT_MAX_APPS];
|
||||
tGATT_CLCB clcb[GATT_CL_MAX_LCB]; /* connection link control block*/
|
||||
tGATT_SCCB sccb[GATT_MAX_SCCB]; /* sign complete callback function GATT_MAX_SCCB <= GATT_CL_MAX_LCB */
|
||||
@ -538,6 +537,9 @@ typedef struct {
|
||||
|
||||
} tGATT_CB;
|
||||
|
||||
typedef struct{
|
||||
UINT16 local_mtu;
|
||||
} tGATT_DEFAULT;
|
||||
|
||||
#define GATT_SIZE_OF_SRV_CHG_HNDL_RANGE 4
|
||||
|
||||
@ -545,6 +547,8 @@ typedef struct {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern tGATT_DEFAULT gatt_default;
|
||||
|
||||
/* Global GATT data */
|
||||
#if GATT_DYNAMIC_MEMORY == FALSE
|
||||
extern tGATT_CB gatt_cb;
|
||||
@ -742,4 +746,6 @@ extern void gatts_update_srv_list_elem(UINT8 i_sreg, UINT16 handle, BOOLEAN is_p
|
||||
extern tBT_UUID *gatts_get_service_uuid (tGATT_SVC_DB *p_db);
|
||||
|
||||
extern void gatt_reset_bgdev_list(void);
|
||||
extern uint16_t gatt_get_local_mtu(void);
|
||||
extern void gatt_set_local_mtu(uint16_t mtu);
|
||||
#endif
|
||||
|
@ -1,132 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _GKI_H_
|
||||
#define _GKI_H_
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "bt_types.h"
|
||||
#include "gki_common.h"
|
||||
#include "gki_int.h"
|
||||
#include "allocator.h"
|
||||
|
||||
#define ALIGN_POOL(pl_size) ( (((pl_size) + 3) / sizeof(UINT32)) * sizeof(UINT32))
|
||||
#define BUFFER_HDR_SIZE (sizeof(BUFFER_HDR_T)) /* Offset past header */
|
||||
#define BUFFER_PADDING_SIZE (sizeof(BUFFER_HDR_T) + sizeof(UINT32)) /* Header + Magic Number */
|
||||
#define MAGIC_NO 0xDDBADDBA
|
||||
|
||||
#define BUF_STATUS_FREE 0
|
||||
#define BUF_STATUS_UNLINKED 1
|
||||
#define BUF_STATUS_QUEUED 2
|
||||
|
||||
/* Timer list entry callback type
|
||||
*/
|
||||
typedef void (TIMER_CBACK)(void *p_tle);
|
||||
#ifndef TIMER_PARAM_TYPE
|
||||
#define TIMER_PARAM_TYPE UINT32
|
||||
#endif
|
||||
/* Define a timer list entry
|
||||
*/
|
||||
typedef struct _tle {
|
||||
struct _tle *p_next;
|
||||
struct _tle *p_prev;
|
||||
TIMER_CBACK *p_cback;
|
||||
INT32 ticks;
|
||||
INT32 ticks_initial;
|
||||
TIMER_PARAM_TYPE param;
|
||||
TIMER_PARAM_TYPE data;
|
||||
UINT16 event;
|
||||
UINT8 in_use;
|
||||
} TIMER_LIST_ENT;
|
||||
|
||||
/***********************************************************************
|
||||
** This queue is a general purpose buffer queue, for application use.
|
||||
*/
|
||||
typedef struct {
|
||||
void *_p_first;
|
||||
void *_p_last;
|
||||
UINT16 _count;
|
||||
} BUFFER_Q;
|
||||
|
||||
#define GKI_PUBLIC_POOL 0 /* General pool accessible to GKI_getbuf() */
|
||||
#define GKI_RESTRICTED_POOL 1 /* Inaccessible pool to GKI_getbuf() */
|
||||
|
||||
/***********************************************************************
|
||||
** Function prototypes
|
||||
*/
|
||||
|
||||
/* To get and release buffers, change owner and get size
|
||||
*/
|
||||
void *GKI_getbuf_func(UINT16);
|
||||
void *GKI_getpoolbuf_func(UINT8);
|
||||
void GKI_freebuf(void *);
|
||||
UINT16 GKI_get_buf_size (void *);
|
||||
void *GKI_getpoolbuf (UINT8);
|
||||
UINT16 GKI_poolcount (UINT8);
|
||||
UINT16 GKI_poolfreecount (UINT8);
|
||||
UINT16 GKI_poolutilization (UINT8);
|
||||
|
||||
#ifdef CONFIG_BLUEDROID_MEM_DEBUG
|
||||
|
||||
#define GKI_getbuf(_size) \
|
||||
({ \
|
||||
BUFFER_HDR_T *header = osi_malloc((_size) + BUFFER_HDR_SIZE); \
|
||||
header->status = BUF_STATUS_UNLINKED; \
|
||||
header->p_next = NULL; \
|
||||
header->Type = 0; \
|
||||
header->size = (_size); \
|
||||
(void *)(header + 1); \
|
||||
})
|
||||
|
||||
#define GKI_getpoolbuf(_pool_id) \
|
||||
({ \
|
||||
(void *)GKI_getbuf(gki_cb.com.pool_size[(_pool_id)]); \
|
||||
})
|
||||
|
||||
#else
|
||||
#define GKI_getbuf GKI_getbuf_func
|
||||
#define GKI_getpoolbuf GKI_getpoolbuf_func
|
||||
|
||||
#endif /* CONFIG_BLUEDROID_MEM_DEBUG */
|
||||
|
||||
/* User buffer queue management
|
||||
*/
|
||||
void *GKI_dequeue (BUFFER_Q *);
|
||||
void GKI_enqueue (BUFFER_Q *, void *);
|
||||
void *GKI_getfirst (BUFFER_Q *);
|
||||
void *GKI_getlast (BUFFER_Q *);
|
||||
void *GKI_getnext (void *);
|
||||
void GKI_init_q (BUFFER_Q *);
|
||||
UINT16 GKI_queue_length(BUFFER_Q *);
|
||||
BOOLEAN GKI_queue_is_empty(BUFFER_Q *);
|
||||
void *GKI_remove_from_queue (BUFFER_Q *, void *);
|
||||
UINT16 GKI_get_pool_bufsize (UINT8);
|
||||
|
||||
/* Timer management
|
||||
*/
|
||||
void GKI_delay(UINT32);
|
||||
|
||||
/* Disable Interrupts, Enable Interrupts
|
||||
*/
|
||||
void GKI_enable(void);
|
||||
void GKI_disable(void);
|
||||
|
||||
/* os timer operation */
|
||||
UINT32 GKI_get_os_tick_count(void);
|
||||
|
||||
#endif /*_GKI_H_*/
|
@ -1,65 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _GKI_COMMON_H_
|
||||
#define _GKI_COMMON_H_
|
||||
|
||||
#include "gki.h"
|
||||
|
||||
typedef struct _buffer_hdr {
|
||||
struct _buffer_hdr *p_next; /* next buffer in the queue */
|
||||
UINT8 q_id; /* id of the queue */
|
||||
UINT8 status; /* FREE, UNLINKED or QUEUED */
|
||||
UINT8 Type;
|
||||
UINT16 size;
|
||||
} BUFFER_HDR_T;
|
||||
|
||||
typedef struct _free_queue {
|
||||
BUFFER_HDR_T *_p_first; /* first buffer in the queue */
|
||||
BUFFER_HDR_T *_p_last; /* last buffer in the queue */
|
||||
UINT16 size; /* size of the buffers in the pool */
|
||||
UINT16 total; /* toatal number of buffers */
|
||||
UINT16 cur_cnt; /* number of buffers currently allocated */
|
||||
UINT16 max_cnt; /* maximum number of buffers allocated at any time */
|
||||
} FREE_QUEUE_T;
|
||||
|
||||
/* Put all GKI variables into one control block
|
||||
*/
|
||||
typedef struct {
|
||||
/* Define the buffer pool management variables
|
||||
*/
|
||||
FREE_QUEUE_T freeq[GKI_NUM_TOTAL_BUF_POOLS];
|
||||
|
||||
UINT16 pool_buf_size[GKI_NUM_TOTAL_BUF_POOLS];
|
||||
|
||||
/* Define the buffer pool start addresses
|
||||
*/
|
||||
UINT8 *pool_start[GKI_NUM_TOTAL_BUF_POOLS]; /* array of pointers to the start of each buffer pool */
|
||||
UINT8 *pool_end[GKI_NUM_TOTAL_BUF_POOLS]; /* array of pointers to the end of each buffer pool */
|
||||
UINT16 pool_size[GKI_NUM_TOTAL_BUF_POOLS]; /* actual size of the buffers in a pool */
|
||||
|
||||
/* Define the buffer pool access control variables */
|
||||
UINT16 pool_access_mask; /* Bits are set if the corresponding buffer pool is a restricted pool */
|
||||
} tGKI_COM_CB;
|
||||
|
||||
/* Internal GKI function prototypes
|
||||
*/
|
||||
void gki_buffer_init(void);
|
||||
void gki_buffer_cleanup(void);
|
||||
|
||||
#endif /*_GKI_COMMON_H_*/
|
@ -1,244 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _GKI_TARGET_H_
|
||||
#define _GKI_TARGET_H_
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Buffer configuration
|
||||
**
|
||||
******************************************************************************/
|
||||
|
||||
/* The size of the buffers in pool 0. */
|
||||
#ifndef GKI_BUF0_SIZE
|
||||
#define GKI_BUF0_SIZE 64
|
||||
#endif
|
||||
|
||||
/* The number of buffers in buffer pool 0. */
|
||||
#ifndef GKI_BUF0_MAX
|
||||
#define GKI_BUF0_MAX 96
|
||||
#endif
|
||||
|
||||
/* The ID of buffer pool 0. */
|
||||
#ifndef GKI_POOL_ID_0
|
||||
#define GKI_POOL_ID_0 0
|
||||
#endif
|
||||
|
||||
/* The size of the buffers in pool 1. */
|
||||
#ifndef GKI_BUF1_SIZE
|
||||
#define GKI_BUF1_SIZE 288
|
||||
#endif
|
||||
|
||||
/* The number of buffers in buffer pool 1. */
|
||||
#ifndef GKI_BUF1_MAX
|
||||
#define GKI_BUF1_MAX 52
|
||||
#endif
|
||||
|
||||
/* The ID of buffer pool 1. */
|
||||
#ifndef GKI_POOL_ID_1
|
||||
#define GKI_POOL_ID_1 1
|
||||
#endif
|
||||
|
||||
/* The size of the buffers in pool 2. */
|
||||
#ifndef GKI_BUF2_SIZE
|
||||
#define GKI_BUF2_SIZE 660
|
||||
#endif
|
||||
|
||||
/* The number of buffers in buffer pool 2. */
|
||||
#ifndef GKI_BUF2_MAX
|
||||
#define GKI_BUF2_MAX 90
|
||||
#endif
|
||||
|
||||
/* The ID of buffer pool 2. */
|
||||
#ifndef GKI_POOL_ID_2
|
||||
#define GKI_POOL_ID_2 2
|
||||
#endif
|
||||
|
||||
/* The size of the buffers in pool 3. */
|
||||
#ifndef GKI_BUF3_SIZE
|
||||
#define GKI_BUF3_SIZE (4096+16)
|
||||
#endif
|
||||
|
||||
/* The number of buffers in buffer pool 3. */
|
||||
#ifndef GKI_BUF3_MAX
|
||||
#define GKI_BUF3_MAX 400
|
||||
#endif
|
||||
|
||||
/* The ID of buffer pool 3. */
|
||||
#ifndef GKI_POOL_ID_3
|
||||
#define GKI_POOL_ID_3 3
|
||||
#endif
|
||||
|
||||
/* The size of the largest PUBLIC fixed buffer in system. */
|
||||
#ifndef GKI_MAX_BUF_SIZE
|
||||
#define GKI_MAX_BUF_SIZE GKI_BUF3_SIZE
|
||||
#endif
|
||||
|
||||
/* The pool ID of the largest PUBLIC fixed buffer in system. */
|
||||
#ifndef GKI_MAX_BUF_SIZE_POOL_ID
|
||||
#define GKI_MAX_BUF_SIZE_POOL_ID GKI_POOL_ID_3
|
||||
#endif
|
||||
|
||||
/* Pool 4 is used for BluetoothSocket L2CAP connections */
|
||||
/* The size of the buffers in pool 4. */
|
||||
#ifndef GKI_BUF4_SIZE
|
||||
#define GKI_BUF4_SIZE (8080+26)
|
||||
#endif
|
||||
|
||||
/* The number of buffers in buffer pool 4. */
|
||||
#ifndef GKI_BUF4_MAX
|
||||
#define GKI_BUF4_MAX (OBX_NUM_SERVERS + OBX_NUM_CLIENTS)
|
||||
#endif
|
||||
|
||||
/* The ID of buffer pool 4. */
|
||||
#ifndef GKI_POOL_ID_4
|
||||
#define GKI_POOL_ID_4 4
|
||||
#endif
|
||||
|
||||
/* The number of fixed GKI buffer pools.
|
||||
eL2CAP requires Pool ID 5
|
||||
If BTM_SCO_HCI_INCLUDED is FALSE, Pool ID 6 is unnecessary, otherwise set to 7
|
||||
If BTA_HL_INCLUDED is FALSE then Pool ID 7 is uncessary and set the following to 7, otherwise set to 8
|
||||
If BLE_INCLUDED is FALSE then Pool ID 8 is uncessary and set the following to 8, otherwise set to 9
|
||||
POOL_ID 9 is a public pool meant for large buffer needs such as SDP_DB
|
||||
*/
|
||||
#ifndef GKI_NUM_FIXED_BUF_POOLS
|
||||
#define GKI_NUM_FIXED_BUF_POOLS 10
|
||||
#endif
|
||||
|
||||
/* The buffer pool usage mask. */
|
||||
#ifndef GKI_DEF_BUFPOOL_PERM_MASK
|
||||
/* Setting POOL_ID 9 as a public pool meant for large buffers such as SDP_DB */
|
||||
#define GKI_DEF_BUFPOOL_PERM_MASK 0xfdf0
|
||||
#endif
|
||||
|
||||
/* The following is intended to be a reserved pool for L2CAP
|
||||
Flow control and retransmissions and intentionally kept out
|
||||
of order */
|
||||
|
||||
/* The number of buffers in buffer pool 5. */
|
||||
#ifndef GKI_BUF5_MAX
|
||||
#define GKI_BUF5_MAX 64
|
||||
#endif
|
||||
|
||||
/* The ID of buffer pool 5. */
|
||||
#ifndef GKI_POOL_ID_5
|
||||
#define GKI_POOL_ID_5 5
|
||||
#endif
|
||||
|
||||
/* The size of the buffers in pool 5
|
||||
** Special pool used by L2CAP retransmissions only. This size based on segment
|
||||
** that will fit into both DH5 and 2-DH3 packet types after accounting for GKI
|
||||
** header. 13 bytes of max headers allows us a 339 payload max. (in btui_app.txt)
|
||||
** Note: 748 used for insight scriptwrapper with CAT-2 scripts.
|
||||
*/
|
||||
#ifndef GKI_BUF5_SIZE
|
||||
#define GKI_BUF5_SIZE 748
|
||||
#endif
|
||||
|
||||
/* The following is intended to be a reserved pool for SCO
|
||||
over HCI data and intentionally kept out of order */
|
||||
|
||||
/* The ID of buffer pool 6. */
|
||||
#ifndef GKI_POOL_ID_6
|
||||
#define GKI_POOL_ID_6 6
|
||||
#endif
|
||||
|
||||
/* The size of the buffers in pool 6,
|
||||
BUF_SIZE = max SCO data 255 + sizeof(BT_HDR) = 8 + SCO packet header 3 + padding 2 = 268 */
|
||||
#ifndef GKI_BUF6_SIZE
|
||||
#define GKI_BUF6_SIZE 268
|
||||
#endif
|
||||
|
||||
/* The number of buffers in buffer pool 6. */
|
||||
#ifndef GKI_BUF6_MAX
|
||||
#define GKI_BUF6_MAX 60
|
||||
#endif
|
||||
|
||||
|
||||
/* The following pool is a dedicated pool for HDP
|
||||
If a shared pool is more desirable then
|
||||
1. set BTA_HL_LRG_DATA_POOL_ID to the desired Gki Pool ID
|
||||
2. make sure that the shared pool size is larger than 9472
|
||||
3. adjust GKI_NUM_FIXED_BUF_POOLS accordingly since
|
||||
POOL ID 7 is not needed
|
||||
*/
|
||||
|
||||
/* The ID of buffer pool 7. */
|
||||
#ifndef GKI_POOL_ID_7
|
||||
#define GKI_POOL_ID_7 7
|
||||
#endif
|
||||
|
||||
/* The size of the buffers in pool 7 */
|
||||
#ifndef GKI_BUF7_SIZE
|
||||
#define GKI_BUF7_SIZE (10240 + 24)
|
||||
#endif
|
||||
|
||||
/* The number of buffers in buffer pool 7. */
|
||||
#ifndef GKI_BUF7_MAX
|
||||
#define GKI_BUF7_MAX 2
|
||||
#endif
|
||||
|
||||
/* The following pool is a dedicated pool for GATT
|
||||
If a shared pool is more desirable then
|
||||
1. set GATT_DB_POOL_ID to the desired Gki Pool ID
|
||||
2. make sure that the shared pool size fit a common GATT database needs
|
||||
3. adjust GKI_NUM_FIXED_BUF_POOLS accordingly since
|
||||
POOL ID 8 is not needed
|
||||
*/
|
||||
|
||||
/* The ID of buffer pool 8. */
|
||||
#ifndef GKI_POOL_ID_8
|
||||
#define GKI_POOL_ID_8 8
|
||||
#endif
|
||||
|
||||
/* The size of the buffers in pool 8 */
|
||||
#ifndef GKI_BUF8_SIZE
|
||||
#define GKI_BUF8_SIZE 128
|
||||
#endif
|
||||
|
||||
/* The number of buffers in buffer pool 8. */
|
||||
#ifndef GKI_BUF8_MAX
|
||||
#define GKI_BUF8_MAX 30
|
||||
#endif
|
||||
|
||||
/* The following pool is meant for large allocations such as SDP_DB */
|
||||
#ifndef GKI_POOL_ID_9
|
||||
#define GKI_POOL_ID_9 9
|
||||
#endif
|
||||
|
||||
#ifndef GKI_BUF9_SIZE
|
||||
#define GKI_BUF9_SIZE 8192
|
||||
#endif
|
||||
|
||||
#ifndef GKI_BUF9_MAX
|
||||
#define GKI_BUF9_MAX 5
|
||||
#endif
|
||||
|
||||
/* The number of fixed and dynamic buffer pools */
|
||||
#ifndef GKI_NUM_TOTAL_BUF_POOLS
|
||||
#define GKI_NUM_TOTAL_BUF_POOLS 10
|
||||
#endif
|
||||
|
||||
int gki_init(void);
|
||||
void gki_clean_up(void);
|
||||
|
||||
//void LogMsg (UINT32 trace_set_mask, const char *fmt_str, ...);
|
||||
|
||||
#endif /*_GKI_TARGET_H_*/
|
@ -77,9 +77,6 @@ typedef struct hci_t {
|
||||
// Do the postload sequence (call after the rest of the BT stack initializes).
|
||||
void (*do_postload)(void);
|
||||
|
||||
// Set the queue to receive ACL data in
|
||||
void (*set_data_queue)(fixed_queue_t *queue);
|
||||
|
||||
// Send a command through the HCI layer
|
||||
void (*transmit_command)(
|
||||
BT_HDR *command,
|
||||
|
@ -306,10 +306,10 @@ typedef struct {
|
||||
typedef struct {
|
||||
UINT8 preferred_mode;
|
||||
UINT8 allowed_modes;
|
||||
UINT8 user_rx_pool_id;
|
||||
UINT8 user_tx_pool_id;
|
||||
UINT8 fcr_rx_pool_id;
|
||||
UINT8 fcr_tx_pool_id;
|
||||
UINT16 user_rx_buf_size;
|
||||
UINT16 user_tx_buf_size;
|
||||
UINT16 fcr_rx_buf_size;
|
||||
UINT16 fcr_tx_buf_size;
|
||||
|
||||
} tL2CAP_ERTM_INFO;
|
||||
|
||||
|
@ -27,10 +27,10 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "btm_api.h"
|
||||
#include "gki.h"
|
||||
#include "l2c_api.h"
|
||||
#include "l2cdefs.h"
|
||||
#include "list.h"
|
||||
#include "fixed_queue.h"
|
||||
|
||||
#define L2CAP_MIN_MTU 48 /* Minimum acceptable MTU is 48 bytes */
|
||||
|
||||
@ -176,9 +176,9 @@ typedef struct {
|
||||
|
||||
UINT16 rx_sdu_len; /* Length of the SDU being received */
|
||||
BT_HDR *p_rx_sdu; /* Buffer holding the SDU being received */
|
||||
BUFFER_Q waiting_for_ack_q; /* Buffers sent and waiting for peer to ack */
|
||||
BUFFER_Q srej_rcv_hold_q; /* Buffers rcvd but held pending SREJ rsp */
|
||||
BUFFER_Q retrans_q; /* Buffers being retransmitted */
|
||||
fixed_queue_t *waiting_for_ack_q; /* Buffers sent and waiting for peer to ack */
|
||||
fixed_queue_t *srej_rcv_hold_q; /* Buffers rcvd but held pending SREJ rsp */
|
||||
fixed_queue_t *retrans_q; /* Buffers being retransmitted */
|
||||
|
||||
TIMER_LIST_ENT ack_timer; /* Timer delaying RR */
|
||||
TIMER_LIST_ENT mon_retrans_timer; /* Timer Monitor or Retransmission */
|
||||
@ -241,6 +241,9 @@ typedef struct {
|
||||
} tL2C_RCB;
|
||||
|
||||
|
||||
#ifndef L2CAP_CBB_DEFAULT_DATA_RATE_BUFF_QUOTA
|
||||
#define L2CAP_CBB_DEFAULT_DATA_RATE_BUFF_QUOTA 100
|
||||
#endif
|
||||
/* Define a channel control block (CCB). There may be many channel control blocks
|
||||
** between the same two Bluetooth devices (i.e. on the same link).
|
||||
** Each CCB has unique local and remote CIDs. All channel control blocks on
|
||||
@ -279,7 +282,7 @@ typedef struct t_l2c_ccb {
|
||||
tL2CAP_CH_CFG_BITS peer_cfg_bits; /* Store what peer wants to configure */
|
||||
tL2CAP_CFG_INFO peer_cfg; /* Peer's saved configuration options */
|
||||
|
||||
BUFFER_Q xmit_hold_q; /* Transmit data hold queue */
|
||||
fixed_queue_t *xmit_hold_q; /* Transmit data hold queue */
|
||||
BOOLEAN cong_sent; /* Set when congested status sent */
|
||||
UINT16 buff_quota; /* Buffer quota before sending congestion */
|
||||
|
||||
@ -379,8 +382,8 @@ typedef struct t_l2c_linkcb {
|
||||
UINT8 peer_chnl_mask[L2CAP_FIXED_CHNL_ARRAY_SIZE];
|
||||
#if (L2CAP_UCD_INCLUDED == TRUE)
|
||||
UINT16 ucd_mtu; /* peer MTU on UCD */
|
||||
BUFFER_Q ucd_out_sec_pending_q; /* Security pending outgoing UCD packet */
|
||||
BUFFER_Q ucd_in_sec_pending_q; /* Security pending incoming UCD packet */
|
||||
fixed_queue_t *ucd_out_sec_pending_q; /* Security pending outgoing UCD packet */
|
||||
fixed_queue_t *ucd_in_sec_pending_q; /* Security pending incoming UCD packet */
|
||||
#endif
|
||||
|
||||
BT_HDR *p_hcit_rcv_acl; /* Current HCIT ACL buf being rcvd */
|
||||
@ -402,14 +405,24 @@ typedef struct t_l2c_linkcb {
|
||||
#define L2C_BLE_NEW_CONN_PARAM 0x2 /* new connection parameter to be set */
|
||||
#define L2C_BLE_UPDATE_PENDING 0x4 /* waiting for connection update finished */
|
||||
#define L2C_BLE_NOT_DEFAULT_PARAM 0x8 /* not using default connection parameters */
|
||||
#define L2C_BLE_UPDATE_PARAM_FULL 0x10 /* update connection parameters full, can not update */
|
||||
UINT8 conn_update_mask;
|
||||
|
||||
UINT16 min_interval; /* parameters as requested by peripheral */
|
||||
UINT16 max_interval;
|
||||
UINT16 conn_int;
|
||||
UINT16 latency;
|
||||
UINT16 timeout;
|
||||
|
||||
/* cache connection parameters that wait to update */
|
||||
UINT16 waiting_update_conn_min_interval;
|
||||
UINT16 waiting_update_conn_max_interval;
|
||||
UINT16 waiting_update_conn_latency;
|
||||
UINT16 waiting_update_conn_timeout;
|
||||
/* cache parameters that is being updated */
|
||||
UINT16 updating_conn_min_interval;
|
||||
UINT16 updating_conn_max_interval;
|
||||
bool updating_param_flag;
|
||||
/* current connection parameters that current connection is using */
|
||||
UINT16 current_used_conn_interval;
|
||||
UINT16 current_used_conn_latency;
|
||||
UINT16 current_used_conn_timeout;
|
||||
/* connection parameters update order:
|
||||
waiting_update_conn_xx -> updating_conn_xx -> current_used_conn_xx
|
||||
*/
|
||||
#endif
|
||||
|
||||
#if (L2CAP_ROUND_ROBIN_CHANNEL_SERVICE == TRUE)
|
||||
@ -706,7 +719,7 @@ extern void l2c_fcr_proc_pdu (tL2C_CCB *p_ccb, BT_HDR *p_buf);
|
||||
extern void l2c_fcr_proc_tout (tL2C_CCB *p_ccb);
|
||||
extern void l2c_fcr_proc_ack_tout (tL2C_CCB *p_ccb);
|
||||
extern void l2c_fcr_send_S_frame (tL2C_CCB *p_ccb, UINT16 function_code, UINT16 pf_bit);
|
||||
extern BT_HDR *l2c_fcr_clone_buf (BT_HDR *p_buf, UINT16 new_offset, UINT16 no_of_bytes, UINT8 pool);
|
||||
extern BT_HDR *l2c_fcr_clone_buf (BT_HDR *p_buf, UINT16 new_offset, UINT16 no_of_bytes);
|
||||
extern BOOLEAN l2c_fcr_is_flow_controlled (tL2C_CCB *p_ccb);
|
||||
extern BT_HDR *l2c_fcr_get_next_xmit_sdu_seg (tL2C_CCB *p_ccb, UINT16 max_packet_length);
|
||||
extern void l2c_fcr_start_timer (tL2C_CCB *p_ccb);
|
||||
@ -733,6 +746,7 @@ extern void l2cble_notify_le_connection (BD_ADDR bda);
|
||||
extern void l2c_ble_link_adjust_allocation (void);
|
||||
extern void l2cble_process_conn_update_evt (UINT16 handle, UINT8 status, UINT16 conn_interval,
|
||||
UINT16 conn_latency, UINT16 conn_timeout);
|
||||
extern void l2cble_get_conn_param_format_err_from_contoller(UINT8 status, UINT16 handle);
|
||||
|
||||
#if (defined BLE_LLT_INCLUDED) && (BLE_LLT_INCLUDED == TRUE)
|
||||
extern void l2cble_process_rc_param_request_evt(UINT16 handle, UINT16 int_min, UINT16 int_max,
|
||||
@ -745,6 +759,7 @@ extern void l2cble_set_fixed_channel_tx_data_length(BD_ADDR remote_bda, UINT16 f
|
||||
extern void l2c_send_update_conn_params_cb(tL2C_LCB *p_lcb, UINT8 status);
|
||||
extern void l2cble_process_data_length_change_event(UINT16 handle, UINT16 tx_data_len,
|
||||
UINT16 rx_data_len);
|
||||
extern UINT32 CalConnectParamTimeout(tL2C_LCB *p_lcb);
|
||||
|
||||
#endif
|
||||
extern void l2cu_process_fixed_disc_cback (tL2C_LCB *p_lcb);
|
||||
|
@ -258,8 +258,9 @@
|
||||
#define L2CAP_BLE_EXTFEA_MASK 0
|
||||
#endif
|
||||
|
||||
/* Define a value that tells L2CAP to use the default HCI ACL buffer pool */
|
||||
#define L2CAP_DEFAULT_ERM_POOL_ID 0xFF
|
||||
/* Define a value that tells L2CAP to use the default HCI ACL buffer size */
|
||||
#define L2CAP_INVALID_ERM_BUF_SIZE 0
|
||||
|
||||
/* Define a value that tells L2CAP to use the default MPS */
|
||||
#define L2CAP_DEFAULT_ERM_MPS 0x0000
|
||||
|
||||
@ -273,7 +274,8 @@
|
||||
/* To optimize this, it must be a multiplum of the L2CAP PDU length AND match the 3DH5 air
|
||||
* including the l2cap headers in each packet - to match the latter - the -5 is added
|
||||
*/
|
||||
#define L2CAP_MAX_SDU_LENGTH (GKI_BUF4_SIZE - (L2CAP_MIN_OFFSET + L2CAP_MAX_HEADER_FCS) -5)
|
||||
#define L2CAP_MAX_SDU_LENGTH (8080 + 26 - (L2CAP_MIN_OFFSET + 6))
|
||||
#define L2CAP_MAX_BUF_SIZE (10240 + 24)
|
||||
|
||||
/* Part of L2CAP_MIN_OFFSET that is not part of L2CAP
|
||||
*/
|
||||
|
@ -10,7 +10,7 @@ struct list_t;
|
||||
typedef struct list_t list_t;
|
||||
|
||||
typedef void (*list_free_cb)(void *data);
|
||||
typedef bool (*list_iter_cb)(void *data);
|
||||
typedef bool (*list_iter_cb)(void *data, void *context);
|
||||
|
||||
// Returns a new, empty list. Returns NULL if not enough memory could be allocated
|
||||
// for the list structure. The returned list must be freed with |list_free|. The
|
||||
@ -22,7 +22,6 @@ list_t *list_new(list_free_cb callback);
|
||||
|
||||
|
||||
list_node_t *list_free_node(list_t *list, list_node_t *node);
|
||||
//list_node_t *list_free_node(list_t *list, list_node_t *node);
|
||||
// Frees the list. This function accepts NULL as an argument, in which case it
|
||||
// behaves like a no-op.
|
||||
void list_free(list_t *list);
|
||||
@ -44,7 +43,8 @@ void *list_front(const list_t *list);
|
||||
|
||||
// Returns the last element in the list without removing it. |list| may not
|
||||
// be NULL or empty.
|
||||
//void *list_back(const list_t *list);
|
||||
void *list_back(const list_t *list);
|
||||
list_node_t *list_back_node(const list_t *list);
|
||||
|
||||
// Inserts |data| after |prev_node| in |list|. |data|, |list|, and |prev_node|
|
||||
// may not be NULL. This function does not make a copy of |data| so the pointer
|
||||
@ -84,7 +84,7 @@ void list_clear(list_t *list);
|
||||
// list inside the callback. If an element is added before the node being visited,
|
||||
// there will be no callback for the newly-inserted node. Neither |list| nor
|
||||
// |callback| may be NULL.
|
||||
void list_foreach(const list_t *list, list_iter_cb callback);
|
||||
list_node_t *list_foreach(const list_t *list, list_iter_cb callback, void *context);
|
||||
|
||||
// Returns an iterator to the first element in |list|. |list| may not be NULL.
|
||||
// The returned iterator is valid as long as it does not equal the value returned
|
||||
|
53
tools/sdk/include/bluedroid/mutex.h
Normal file
53
tools/sdk/include/bluedroid/mutex.h
Normal file
@ -0,0 +1,53 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2015 Google, Inc.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __MUTEX_H__
|
||||
#define __MUTEX_H__
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/semphr.h"
|
||||
|
||||
|
||||
#define OSI_MUTEX_MAX_TIMEOUT 0xffffffffUL
|
||||
|
||||
#define osi_mutex_valid( x ) ( ( ( *x ) == NULL) ? pdFALSE : pdTRUE )
|
||||
#define osi_mutex_set_invalid( x ) ( ( *x ) = NULL )
|
||||
|
||||
typedef xSemaphoreHandle osi_mutex_t;
|
||||
|
||||
int osi_mutex_new(osi_mutex_t *mutex);
|
||||
|
||||
int osi_mutex_lock(osi_mutex_t *mutex, uint32_t timeout);
|
||||
|
||||
void osi_mutex_unlock(osi_mutex_t *mutex);
|
||||
|
||||
void osi_mutex_free(osi_mutex_t *mutex);
|
||||
|
||||
/* Just for a global mutex */
|
||||
int osi_mutex_global_init(void);
|
||||
|
||||
void osi_mutex_global_deinit(void);
|
||||
|
||||
void osi_mutex_global_lock(void);
|
||||
|
||||
void osi_mutex_global_unlock(void);
|
||||
|
||||
#endif /* __MUTEX_H__ */
|
||||
|
@ -6,21 +6,11 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#define UNUSED_ATTR __attribute__((unused))
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#define INVALID_FD (-1)
|
||||
|
||||
#define CONCAT(a, b) a##b
|
||||
#define COMPILE_ASSERT(x)
|
||||
|
||||
// Use during compile time to check conditional values
|
||||
// NOTE: The the failures will present as a generic error
|
||||
// "error: initialization makes pointer from integer without a cast"
|
||||
// but the file and line number will present the condition that
|
||||
// failed.
|
||||
#define DUMMY_COUNTER(c) CONCAT(__osi_dummy_, c)
|
||||
#define DUMMY_PTR DUMMY_COUNTER(__COUNTER__)
|
||||
|
||||
#define COMPILE_ASSERT(x) char * DUMMY_PTR = !(x)
|
||||
|
||||
typedef uint32_t timeout_t;
|
||||
int osi_init(void);
|
||||
void osi_deinit(void);
|
||||
|
||||
#endif /*_OSI_H_*/
|
||||
|
@ -1,45 +0,0 @@
|
||||
#ifndef __os_ARCH_H__
|
||||
#define __os_ARCH_H__
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/semphr.h"
|
||||
|
||||
#define OSI_ARCH_TIMEOUT 0xffffffffUL
|
||||
|
||||
typedef xSemaphoreHandle osi_sem_t;
|
||||
typedef xSemaphoreHandle osi_mutex_t;
|
||||
|
||||
#define osi_mutex_valid( x ) ( ( ( *x ) == NULL) ? pdFALSE : pdTRUE )
|
||||
#define osi_mutex_set_invalid( x ) ( ( *x ) = NULL )
|
||||
#define osi_sem_valid( x ) ( ( ( *x ) == NULL) ? pdFALSE : pdTRUE )
|
||||
#define osi_sem_set_invalid( x ) ( ( *x ) = NULL )
|
||||
|
||||
int osi_mutex_new(osi_mutex_t *pxMutex);
|
||||
|
||||
void osi_mutex_lock(osi_mutex_t *pxMutex);
|
||||
|
||||
int osi_mutex_trylock(osi_mutex_t *pxMutex);
|
||||
|
||||
void osi_mutex_unlock(osi_mutex_t *pxMutex);
|
||||
|
||||
void osi_mutex_free(osi_mutex_t *pxMutex);
|
||||
|
||||
int osi_sem_new(osi_sem_t *sem, uint32_t max_count, uint32_t init_count);
|
||||
|
||||
void osi_sem_signal(osi_sem_t *sem);
|
||||
|
||||
uint32_t osi_sem_wait(osi_sem_t *sem, uint32_t timeout);
|
||||
|
||||
void osi_sem_free(osi_sem_t *sem);
|
||||
|
||||
void osi_arch_init(void);
|
||||
|
||||
uint32_t osi_now(void);
|
||||
|
||||
void osi_delay_ms(uint32_t ms);
|
||||
|
||||
|
||||
#endif /* __os_ARCH_H__ */
|
||||
|
@ -25,7 +25,6 @@
|
||||
#ifndef PORTEXT_H
|
||||
#define PORTEXT_H
|
||||
|
||||
#include "gki.h"
|
||||
|
||||
/* Port emulation entity Entry Points */
|
||||
extern void rfcomm_process_timeout (TIMER_LIST_ENT *p_tle);
|
||||
|
@ -26,7 +26,6 @@
|
||||
#define PORT_INT_H
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "gki.h"
|
||||
#include "rfcdefs.h"
|
||||
#include "port_api.h"
|
||||
|
||||
@ -52,7 +51,7 @@
|
||||
** Define Port Data Transfere control block
|
||||
*/
|
||||
typedef struct {
|
||||
BUFFER_Q queue; /* Queue of buffers waiting to be sent */
|
||||
fixed_queue_t *queue; /* Queue of buffers waiting to be sent */
|
||||
BOOLEAN peer_fc; /* TRUE if flow control is set based on peer's request */
|
||||
BOOLEAN user_fc; /* TRUE if flow control is set based on user's request */
|
||||
UINT32 queue_size; /* Number of data bytes in the queue */
|
||||
@ -88,7 +87,7 @@ typedef struct {
|
||||
*/
|
||||
typedef struct {
|
||||
TIMER_LIST_ENT tle; /* Timer list entry */
|
||||
BUFFER_Q cmd_q; /* Queue for command messages on this mux */
|
||||
fixed_queue_t *cmd_q; /* Queue for command messages on this mux */
|
||||
UINT8 port_inx[RFCOMM_MAX_DLCI + 1]; /* Array for quick access to */
|
||||
/* tPORT based on dlci */
|
||||
BD_ADDR bd_addr; /* BD ADDR of the peer if initiator */
|
||||
|
@ -26,6 +26,7 @@
|
||||
#define SDP_INT_H
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "bt_defs.h"
|
||||
#include "sdp_api.h"
|
||||
#include "l2c_api.h"
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2012 Broadcom Corporation
|
||||
* Copyright (C) 2015 Google, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -16,19 +16,28 @@
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _GKI_INT_H_
|
||||
#define _GKI_INT_H_
|
||||
#ifndef __SEMAPHORE_H__
|
||||
#define __SEMAPHORE_H__
|
||||
|
||||
//#include <pthread.h>
|
||||
#include "bt_defs.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/semphr.h"
|
||||
|
||||
#include "gki_common.h"
|
||||
#define OSI_SEM_MAX_TIMEOUT 0xffffffffUL
|
||||
|
||||
typedef struct {
|
||||
pthread_mutex_t lock;
|
||||
tGKI_COM_CB com;
|
||||
} tGKI_CB;
|
||||
typedef xSemaphoreHandle osi_sem_t;
|
||||
|
||||
extern tGKI_CB gki_cb;
|
||||
#define osi_sem_valid( x ) ( ( ( *x ) == NULL) ? pdFALSE : pdTRUE )
|
||||
#define osi_sem_set_invalid( x ) ( ( *x ) = NULL )
|
||||
|
||||
#endif /*_GKI_INT_H_*/
|
||||
int osi_sem_new(osi_sem_t *sem, uint32_t max_count, uint32_t init_count);
|
||||
|
||||
void osi_sem_free(osi_sem_t *sem);
|
||||
|
||||
int osi_sem_take(osi_sem_t *sem, uint32_t timeout);
|
||||
|
||||
void osi_sem_give(osi_sem_t *sem);
|
||||
|
||||
|
||||
#endif /* __SEMAPHORE_H__ */
|
@ -35,12 +35,27 @@ typedef struct bt_task_evt BtTaskEvt_t;
|
||||
|
||||
typedef bt_status_t (* BtTaskCb_t)(void *arg);
|
||||
|
||||
enum {
|
||||
SIG_PRF_START_UP = 0xfc,
|
||||
SIG_PRF_WORK = 0xfd,
|
||||
SIG_BTU_START_UP = 0xfe,
|
||||
SIG_BTU_WORK = 0xff,
|
||||
};
|
||||
typedef enum {
|
||||
SIG_HCI_HAL_RECV_PACKET = 0,
|
||||
SIG_HCI_HAL_NUM,
|
||||
} SIG_HCI_HAL_t;
|
||||
|
||||
|
||||
typedef enum {
|
||||
SIG_HCI_HOST_SEND_AVAILABLE = 0,
|
||||
SIG_HCI_HOST_NUM,
|
||||
} SIG_HCI_HOST_t;
|
||||
|
||||
typedef enum {
|
||||
SIG_BTU_START_UP = 0,
|
||||
SIG_BTU_HCI_MSG,
|
||||
SIG_BTU_BTA_MSG,
|
||||
SIG_BTU_BTA_ALARM,
|
||||
SIG_BTU_GENERAL_ALARM,
|
||||
SIG_BTU_ONESHOT_ALARM,
|
||||
SIG_BTU_L2CAP_ALARM,
|
||||
SIG_BTU_NUM,
|
||||
} SIG_BTU_t;
|
||||
|
||||
#define HCI_HOST_TASK_STACK_SIZE (2048 + BT_TASK_EXTRA_STACK_SIZE)
|
||||
#define HCI_HOST_TASK_PRIO (configMAX_PRIORITIES - 3)
|
||||
@ -67,9 +82,13 @@ enum {
|
||||
#define TASK_POST_BLOCKING (portMAX_DELAY)
|
||||
typedef uint32_t task_post_t; /* Timeout of task post return, unit TICK */
|
||||
|
||||
void btu_task_post(uint32_t sig, task_post_t timeout);
|
||||
void hci_host_task_post(task_post_t timeout);
|
||||
void hci_hal_h4_task_post(task_post_t timeout);
|
||||
typedef enum {
|
||||
TASK_POST_SUCCESS = 0,
|
||||
TASK_POST_FAIL,
|
||||
} task_post_status_t;
|
||||
|
||||
task_post_status_t btu_task_post(uint32_t sig, void *param, task_post_t timeout);
|
||||
task_post_status_t hci_host_task_post(task_post_t timeout);
|
||||
task_post_status_t hci_hal_h4_task_post(task_post_t timeout);
|
||||
|
||||
#endif /* __THREAD_H__ */
|
||||
|
@ -105,7 +105,7 @@ extern UINT8 utl_itoa(UINT16 i, char *p_s);
|
||||
**
|
||||
** Function utl_freebuf
|
||||
**
|
||||
** Description This function calls GKI_freebuf to free the buffer passed
|
||||
** Description This function calls osi_free to free the buffer passed
|
||||
** in, if buffer pointer is not NULL, and also initializes
|
||||
** buffer pointer to NULL.
|
||||
**
|
||||
|
Reference in New Issue
Block a user