mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-04 22:36:32 +02:00
Update IDF to aaf1239 (#1539)
* fix sdmmc config * Fix warnings in EEPROM from @Curclamas * remove leftover TAG in EEPROM * Initial add of @stickbreaker i2c * Add log_n * fix warnings when log is off * i2c code clean up and reorganization * add flags to interrupt allocator * fix sdmmc config * Fix warnings in EEPROM from @Curclamas * remove leftover TAG in EEPROM * fix errors with latest IDF * fix debug optimization (#1365) incorrect optimization for debugging tick markers. * Fix some missing BT header * Change BTSerial log calls * Update BLE lib * Arduino-ESP32 release management scripted (#1515) * Calculate an absolute path for a custom partitions table (#1452) * * Arduino-ESP32 release management scripted (ready-to-merge) * * secure env for espressif/arduino-esp32 * * build tests enabled * gitter webhook enabled * * gitter room link fixed * better comment * * filepaths fixed * BT Serial adjustments * * don't run sketch builds & tests for tagged builds * Return false from WiFi.hostByName() if hostname is not resolved * Free BT Memory when BT is not used * WIFI_MODE_NULL is not supported anymore * Select some key examples to build with PlatformIO to save some time * Update BLE lib * Fixed BLE lib * Major WiFi overhaul - auto reconnect on connection loss now works - moved to event groups - some code clean up and procedure optimizations - new methods to get a more elaborate system ststus * Add cmake tests to travis * Add initial AsyncUDP * Add NetBIOS lib and fix CMake includes * Add Initial WebServer * Fix WebServer and examples * travis not quiting on build fail * Try different travis build * Update IDF to aaf1239 * Fix WPS Example * fix script permission and add some fail tests to sketch builder * Add missing space in WiFiClient::write(Stream &stream)
This commit is contained in:
362
tools/sdk/include/bluedroid/hci/bt_vendor_lib.h
Normal file
362
tools/sdk/include/bluedroid/hci/bt_vendor_lib.h
Normal file
@ -0,0 +1,362 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2009-2012 Broadcom Corporation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BT_VENDOR_LIB_H
|
||||
#define BT_VENDOR_LIB_H
|
||||
|
||||
#include <stdint.h>
|
||||
//#include <sys/cdefs.h>
|
||||
//#include <sys/types.h>
|
||||
|
||||
/** Struct types */
|
||||
|
||||
|
||||
/** Typedefs and defines */
|
||||
|
||||
/** Vendor specific operations OPCODE */
|
||||
typedef enum {
|
||||
/* [operation]
|
||||
* Power on or off the BT Controller.
|
||||
* [input param]
|
||||
* A pointer to int type with content of bt_vendor_power_state_t.
|
||||
* Typecasting conversion: (int *) param.
|
||||
* [return]
|
||||
* 0 - default, don't care.
|
||||
* [callback]
|
||||
* None.
|
||||
*/
|
||||
BT_VND_OP_POWER_CTRL,
|
||||
|
||||
/* [operation]
|
||||
* Perform any vendor specific initialization or configuration
|
||||
* on the BT Controller. This is called before stack initialization.
|
||||
* [input param]
|
||||
* None.
|
||||
* [return]
|
||||
* 0 - default, don't care.
|
||||
* [callback]
|
||||
* Must call fwcfg_cb to notify the stack of the completion of vendor
|
||||
* specific initialization once it has been done.
|
||||
*/
|
||||
BT_VND_OP_FW_CFG,
|
||||
|
||||
/* [operation]
|
||||
* Perform any vendor specific SCO/PCM configuration on the BT Controller.
|
||||
* This is called after stack initialization.
|
||||
* [input param]
|
||||
* None.
|
||||
* [return]
|
||||
* 0 - default, don't care.
|
||||
* [callback]
|
||||
* Must call scocfg_cb to notify the stack of the completion of vendor
|
||||
* specific SCO configuration once it has been done.
|
||||
*/
|
||||
BT_VND_OP_SCO_CFG,
|
||||
|
||||
/* [operation]
|
||||
* Open UART port on where the BT Controller is attached.
|
||||
* This is called before stack initialization.
|
||||
* [input param]
|
||||
* A pointer to int array type for open file descriptors.
|
||||
* The mapping of HCI channel to fd slot in the int array is given in
|
||||
* bt_vendor_hci_channels_t.
|
||||
* And, it requires the vendor lib to fill up the content before returning
|
||||
* the call.
|
||||
* Typecasting conversion: (int (*)[]) param.
|
||||
* [return]
|
||||
* Numbers of opened file descriptors.
|
||||
* Valid number:
|
||||
* 1 - CMD/EVT/ACL-In/ACL-Out via the same fd (e.g. UART)
|
||||
* 2 - CMD/EVT on one fd, and ACL-In/ACL-Out on the other fd
|
||||
* 4 - CMD, EVT, ACL-In, ACL-Out are on their individual fd
|
||||
* [callback]
|
||||
* None.
|
||||
*/
|
||||
BT_VND_OP_USERIAL_OPEN,
|
||||
|
||||
/* [operation]
|
||||
* Close the previously opened UART port.
|
||||
* [input param]
|
||||
* None.
|
||||
* [return]
|
||||
* 0 - default, don't care.
|
||||
* [callback]
|
||||
* None.
|
||||
*/
|
||||
BT_VND_OP_USERIAL_CLOSE,
|
||||
|
||||
/* [operation]
|
||||
* Get the LPM idle timeout in milliseconds.
|
||||
* The stack uses this information to launch a timer delay before it
|
||||
* attempts to de-assert LPM WAKE signal once downstream HCI packet
|
||||
* has been delivered.
|
||||
* [input param]
|
||||
* A pointer to uint32_t type which is passed in by the stack. And, it
|
||||
* requires the vendor lib to fill up the content before returning
|
||||
* the call.
|
||||
* Typecasting conversion: (uint32_t *) param.
|
||||
* [return]
|
||||
* 0 - default, don't care.
|
||||
* [callback]
|
||||
* None.
|
||||
*/
|
||||
BT_VND_OP_GET_LPM_IDLE_TIMEOUT,
|
||||
|
||||
/* [operation]
|
||||
* Enable or disable LPM mode on BT Controller.
|
||||
* [input param]
|
||||
* A pointer to uint8_t type with content of bt_vendor_lpm_mode_t.
|
||||
* Typecasting conversion: (uint8_t *) param.
|
||||
* [return]
|
||||
* 0 - default, don't care.
|
||||
* [callback]
|
||||
* Must call lpm_cb to notify the stack of the completion of LPM
|
||||
* disable/enable process once it has been done.
|
||||
*/
|
||||
BT_VND_OP_LPM_SET_MODE,
|
||||
|
||||
/* [operation]
|
||||
* Assert or Deassert LPM WAKE on BT Controller.
|
||||
* [input param]
|
||||
* A pointer to uint8_t type with content of bt_vendor_lpm_wake_state_t.
|
||||
* Typecasting conversion: (uint8_t *) param.
|
||||
* [return]
|
||||
* 0 - default, don't care.
|
||||
* [callback]
|
||||
* None.
|
||||
*/
|
||||
BT_VND_OP_LPM_WAKE_SET_STATE,
|
||||
|
||||
/* [operation]
|
||||
* Perform any vendor specific commands related to audio state changes.
|
||||
* [input param]
|
||||
* a pointer to bt_vendor_op_audio_state_t indicating what audio state is
|
||||
* set.
|
||||
* [return]
|
||||
* 0 - default, don't care.
|
||||
* [callback]
|
||||
* None.
|
||||
*/
|
||||
BT_VND_OP_SET_AUDIO_STATE,
|
||||
|
||||
/* [operation]
|
||||
* The epilog call to the vendor module so that it can perform any
|
||||
* vendor-specific processes (e.g. send a HCI_RESET to BT Controller)
|
||||
* before the caller calls for cleanup().
|
||||
* [input param]
|
||||
* None.
|
||||
* [return]
|
||||
* 0 - default, don't care.
|
||||
* [callback]
|
||||
* Must call epilog_cb to notify the stack of the completion of vendor
|
||||
* specific epilog process once it has been done.
|
||||
*/
|
||||
BT_VND_OP_EPILOG,
|
||||
} bt_vendor_opcode_t;
|
||||
|
||||
/** Power on/off control states */
|
||||
typedef enum {
|
||||
BT_VND_PWR_OFF,
|
||||
BT_VND_PWR_ON,
|
||||
} bt_vendor_power_state_t;
|
||||
|
||||
/** Define HCI channel identifier in the file descriptors array
|
||||
used in BT_VND_OP_USERIAL_OPEN operation.
|
||||
*/
|
||||
typedef enum {
|
||||
CH_CMD, // HCI Command channel
|
||||
CH_EVT, // HCI Event channel
|
||||
CH_ACL_OUT, // HCI ACL downstream channel
|
||||
CH_ACL_IN, // HCI ACL upstream channel
|
||||
|
||||
CH_MAX // Total channels
|
||||
} bt_vendor_hci_channels_t;
|
||||
|
||||
/** LPM disable/enable request */
|
||||
typedef enum {
|
||||
BT_VND_LPM_DISABLE,
|
||||
BT_VND_LPM_ENABLE,
|
||||
} bt_vendor_lpm_mode_t;
|
||||
|
||||
/** LPM WAKE set state request */
|
||||
typedef enum {
|
||||
BT_VND_LPM_WAKE_ASSERT,
|
||||
BT_VND_LPM_WAKE_DEASSERT,
|
||||
} bt_vendor_lpm_wake_state_t;
|
||||
|
||||
/** Callback result values */
|
||||
typedef enum {
|
||||
BT_VND_OP_RESULT_SUCCESS,
|
||||
BT_VND_OP_RESULT_FAIL,
|
||||
} bt_vendor_op_result_t;
|
||||
|
||||
/** audio (SCO) state changes triggering VS commands for configuration */
|
||||
typedef struct {
|
||||
uint16_t handle;
|
||||
uint16_t peer_codec;
|
||||
uint16_t state;
|
||||
} bt_vendor_op_audio_state_t;
|
||||
|
||||
/*
|
||||
* Bluetooth Host/Controller Vendor callback structure.
|
||||
*/
|
||||
|
||||
/* vendor initialization/configuration callback */
|
||||
typedef void (*cfg_result_cb)(bt_vendor_op_result_t result);
|
||||
|
||||
/* datapath buffer allocation callback (callout)
|
||||
*
|
||||
* Vendor lib needs to request a buffer through the alloc callout function
|
||||
* from HCI lib if the buffer is for constructing a HCI Command packet which
|
||||
* will be sent through xmit_cb to BT Controller.
|
||||
*
|
||||
* For each buffer allocation, the requested size needs to be big enough to
|
||||
* accommodate the below header plus a complete HCI packet --
|
||||
* typedef struct
|
||||
* {
|
||||
* uint16_t event;
|
||||
* uint16_t len;
|
||||
* uint16_t offset;
|
||||
* uint16_t layer_specific;
|
||||
* } HC_BT_HDR;
|
||||
*
|
||||
* HCI lib returns a pointer to the buffer where Vendor lib should use to
|
||||
* construct a HCI command packet as below format:
|
||||
*
|
||||
* --------------------------------------------
|
||||
* | HC_BT_HDR | HCI command |
|
||||
* --------------------------------------------
|
||||
* where
|
||||
* HC_BT_HDR.event = 0x2000;
|
||||
* HC_BT_HDR.len = Length of HCI command;
|
||||
* HC_BT_HDR.offset = 0;
|
||||
* HC_BT_HDR.layer_specific = 0;
|
||||
*
|
||||
* For example, a HCI_RESET Command will be formed as
|
||||
* ------------------------
|
||||
* | HC_BT_HDR |03|0c|00|
|
||||
* ------------------------
|
||||
* with
|
||||
* HC_BT_HDR.event = 0x2000;
|
||||
* HC_BT_HDR.len = 3;
|
||||
* HC_BT_HDR.offset = 0;
|
||||
* HC_BT_HDR.layer_specific = 0;
|
||||
*/
|
||||
typedef void *(*malloc_cb)(int size);
|
||||
|
||||
/* datapath buffer deallocation callback (callout) */
|
||||
typedef void (*mdealloc_cb)(void *p_buf);
|
||||
|
||||
/* define callback of the cmd_xmit_cb
|
||||
*
|
||||
* The callback function which HCI lib will call with the return of command
|
||||
* complete packet. Vendor lib is responsible for releasing the buffer passed
|
||||
* in at the p_mem parameter by calling dealloc callout function.
|
||||
*/
|
||||
typedef void (*tINT_CMD_CBACK)(void *p_mem);
|
||||
|
||||
/* hci command packet transmit callback (callout)
|
||||
*
|
||||
* Vendor lib calls xmit_cb callout function in order to send a HCI Command
|
||||
* packet to BT Controller. The buffer carrying HCI Command packet content
|
||||
* needs to be first allocated through the alloc callout function.
|
||||
* HCI lib will release the buffer for Vendor lib once it has delivered the
|
||||
* packet content to BT Controller.
|
||||
*
|
||||
* Vendor lib needs also provide a callback function (p_cback) which HCI lib
|
||||
* will call with the return of command complete packet.
|
||||
*
|
||||
* The opcode parameter gives the HCI OpCode (combination of OGF and OCF) of
|
||||
* HCI Command packet. For example, opcode = 0x0c03 for the HCI_RESET command
|
||||
* packet.
|
||||
*/
|
||||
typedef uint8_t (*cmd_xmit_cb)(uint16_t opcode, void *p_buf, tINT_CMD_CBACK p_cback);
|
||||
|
||||
typedef struct {
|
||||
/** set to sizeof(bt_vendor_callbacks_t) */
|
||||
size_t size;
|
||||
|
||||
/*
|
||||
* Callback and callout functions have implemented in HCI libray
|
||||
* (libbt-hci.so).
|
||||
*/
|
||||
|
||||
/* notifies caller result of firmware configuration request */
|
||||
cfg_result_cb fwcfg_cb;
|
||||
|
||||
/* notifies caller result of sco configuration request */
|
||||
cfg_result_cb scocfg_cb;
|
||||
|
||||
/* notifies caller result of lpm enable/disable */
|
||||
cfg_result_cb lpm_cb;
|
||||
|
||||
/* notifies the result of codec setting */
|
||||
cfg_result_cb audio_state_cb;
|
||||
|
||||
/* buffer allocation request */
|
||||
malloc_cb alloc;
|
||||
|
||||
/* buffer deallocation request */
|
||||
mdealloc_cb dealloc;
|
||||
|
||||
/* hci command packet transmit request */
|
||||
cmd_xmit_cb xmit_cb;
|
||||
|
||||
/* notifies caller completion of epilog process */
|
||||
cfg_result_cb epilog_cb;
|
||||
} bt_vendor_callbacks_t;
|
||||
|
||||
/*
|
||||
* Bluetooth Host/Controller VENDOR Interface
|
||||
*/
|
||||
typedef struct {
|
||||
/** Set to sizeof(bt_vndor_interface_t) */
|
||||
size_t size;
|
||||
|
||||
/*
|
||||
* Functions need to be implemented in Vendor libray (libbt-vendor.so).
|
||||
*/
|
||||
|
||||
/**
|
||||
* Caller will open the interface and pass in the callback routines
|
||||
* to the implemenation of this interface.
|
||||
*/
|
||||
int (*init)(const bt_vendor_callbacks_t *p_cb, unsigned char *local_bdaddr);
|
||||
|
||||
/** Vendor specific operations */
|
||||
int (*op)(bt_vendor_opcode_t opcode, void *param);
|
||||
|
||||
/** Closes the interface */
|
||||
void (*cleanup)(void);
|
||||
} bt_vendor_interface_t;
|
||||
|
||||
|
||||
/*
|
||||
* External shared lib functions/data
|
||||
*/
|
||||
|
||||
/* Entry point of DLib --
|
||||
* Vendor library needs to implement the body of bt_vendor_interface_t
|
||||
* structure and uses the below name as the variable name. HCI library
|
||||
* will use this symbol name to get address of the object through the
|
||||
* dlsym call.
|
||||
*/
|
||||
//extern const bt_vendor_interface_t BLUETOOTH_VENDOR_LIB_INTERFACE;
|
||||
|
||||
#endif /* BT_VENDOR_LIB_H */
|
||||
|
25
tools/sdk/include/bluedroid/hci/buffer_allocator.h
Normal file
25
tools/sdk/include/bluedroid/hci/buffer_allocator.h
Normal file
@ -0,0 +1,25 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2014 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 _BUFFER_ALLOCATOR_H_
|
||||
|
||||
#include "osi/allocator.h"
|
||||
|
||||
const allocator_t *buffer_allocator_get_interface();
|
||||
|
||||
#endif /*_BUFFER_ALLOCATOR_H_*/
|
42
tools/sdk/include/bluedroid/hci/hci_audio.h
Normal file
42
tools/sdk/include/bluedroid/hci/hci_audio.h
Normal file
@ -0,0 +1,42 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* 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 _HCI_AUDIO_H_
|
||||
#define _HCI_AUDIO_H_
|
||||
#include <stdint.h>
|
||||
|
||||
// Audio state definitions.
|
||||
typedef enum {
|
||||
SCO_STATE_OFF = 0, // Audio is off.
|
||||
SCO_STATE_OFF_TRANSFER, // Closed pending final transfer of audio.
|
||||
SCO_STATE_ON, // Audio is on.
|
||||
SCO_STATE_SETUP, // Open pending completion of audio setup.
|
||||
} sco_state_t;
|
||||
|
||||
// Codec type definitions.
|
||||
typedef enum {
|
||||
SCO_CODEC_NONE = 0x0000,
|
||||
SCO_CODEC_CVSD = 0x0001,
|
||||
SCO_CODEC_MSBC = 0x0002,
|
||||
} sco_codec_t;
|
||||
|
||||
// Set the audio state on the controller for SCO (PCM, WBS, ...) using the
|
||||
// vendor library.
|
||||
void set_audio_state(uint16_t handle, sco_codec_t codec, sco_state_t state);
|
||||
|
||||
#endif /* _HCI_AUDIO_H_ */
|
85
tools/sdk/include/bluedroid/hci/hci_hal.h
Normal file
85
tools/sdk/include/bluedroid/hci/hci_hal.h
Normal file
@ -0,0 +1,85 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2014 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 _HCI_HAL_H_
|
||||
#define _HCI_HAL_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "stack/bt_types.h"
|
||||
|
||||
typedef enum {
|
||||
DATA_TYPE_COMMAND = 1,
|
||||
DATA_TYPE_ACL = 2,
|
||||
DATA_TYPE_SCO = 3,
|
||||
DATA_TYPE_EVENT = 4
|
||||
} serial_data_type_t;
|
||||
|
||||
typedef void (*packet_ready_cb)(BT_HDR *packet);
|
||||
|
||||
typedef struct {
|
||||
// Called when the HAL detects inbound data.
|
||||
// Data |type| may be ACL, SCO, or EVENT.
|
||||
// Executes in the context of the thread supplied to |init|.
|
||||
packet_ready_cb packet_ready;
|
||||
|
||||
/*
|
||||
// Called when the HAL detects inbound astronauts named Dave.
|
||||
// HAL will deny all requests to open the pod bay doors after this.
|
||||
dave_ready_cb dave_ready;
|
||||
*/
|
||||
} hci_hal_callbacks_t;
|
||||
|
||||
typedef struct hci_hal_t {
|
||||
// Initialize the HAL, with |upper_callbacks| and |upper_thread| to run in the context of.
|
||||
//bool (*init)(const hci_hal_callbacks_t *upper_callbacks);
|
||||
|
||||
// Connect to the underlying hardware, and let data start flowing.
|
||||
bool (*open)(const hci_hal_callbacks_t *upper_callbacks);
|
||||
// Disconnect from the underlying hardware, and close the HAL.
|
||||
// "Daisy, Daisy..."
|
||||
void (*close)(void);
|
||||
|
||||
// Retrieve up to |max_size| bytes for ACL, SCO, or EVENT data packets into
|
||||
// |buffer|, blocking until max_size bytes read if |block| is true.
|
||||
// Only guaranteed to be correct in the context of a data_ready callback
|
||||
// of the corresponding type.
|
||||
//size_t (*read_data)(serial_data_type_t type, uint8_t *buffer, size_t max_size);
|
||||
// The upper layer must call this to notify the HAL that it has finished
|
||||
// reading a packet of the specified |type|. Underlying implementations that
|
||||
// use shared channels for multiple data types depend on this to know when
|
||||
// to reinterpret the data stream.
|
||||
//void (*packet_finished)(serial_data_type_t type);
|
||||
// Transmit COMMAND, ACL, or SCO data packets.
|
||||
// |data| may not be NULL. |length| must be greater than zero.
|
||||
//
|
||||
// IMPORTANT NOTE:
|
||||
// Depending on the underlying implementation, the byte right
|
||||
// before the beginning of |data| may be borrowed during this call
|
||||
// and then restored to its original value.
|
||||
// This is safe in the bluetooth context, because there is always a buffer
|
||||
// header that prefixes data you're sending.
|
||||
uint16_t (*transmit_data)(serial_data_type_t type, uint8_t *data, uint16_t length);
|
||||
} hci_hal_t;
|
||||
|
||||
|
||||
// Gets the correct hal implementation, as compiled for.
|
||||
const hci_hal_t *hci_hal_h4_get_interface(void);
|
||||
|
||||
#endif /* _HCI_HAL_H */
|
31
tools/sdk/include/bluedroid/hci/hci_internals.h
Normal file
31
tools/sdk/include/bluedroid/hci/hci_internals.h
Normal file
@ -0,0 +1,31 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2014 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 _HCI_INTERNALS_H_
|
||||
#define _HCI_INTERNALS_H_
|
||||
|
||||
// 2 bytes for opcode, 1 byte for parameter length (Volume 2, Part E, 5.4.1)
|
||||
#define HCI_COMMAND_PREAMBLE_SIZE 3
|
||||
// 2 bytes for handle, 2 bytes for data length (Volume 2, Part E, 5.4.2)
|
||||
#define HCI_ACL_PREAMBLE_SIZE 4
|
||||
// 2 bytes for handle, 1 byte for data length (Volume 2, Part E, 5.4.3)
|
||||
#define HCI_SCO_PREAMBLE_SIZE 3
|
||||
// 1 byte for event code, 1 byte for parameter length (Volume 2, Part E, 5.4.4)
|
||||
#define HCI_EVENT_PREAMBLE_SIZE 2
|
||||
|
||||
#endif /* _HCI_INTERNALS_H_ */
|
99
tools/sdk/include/bluedroid/hci/hci_layer.h
Normal file
99
tools/sdk/include/bluedroid/hci/hci_layer.h
Normal file
@ -0,0 +1,99 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2014 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 _HCI_LAYER_H_
|
||||
#define _HCI_LAYER_H_
|
||||
|
||||
#include "stack/bt_types.h"
|
||||
#include "osi/allocator.h"
|
||||
#include "osi/osi.h"
|
||||
#include "osi/future.h"
|
||||
///// LEGACY DEFINITIONS /////
|
||||
|
||||
/* Message event mask across Host/Controller lib and stack */
|
||||
#define MSG_EVT_MASK 0xFF00 /* eq. BT_EVT_MASK */
|
||||
#define MSG_SUB_EVT_MASK 0x00FF /* eq. BT_SUB_EVT_MASK */
|
||||
|
||||
/* Message event ID passed from Host/Controller lib to stack */
|
||||
#define MSG_HC_TO_STACK_HCI_ERR 0x1300 /* eq. BT_EVT_TO_BTU_HCIT_ERR */
|
||||
#define MSG_HC_TO_STACK_HCI_ACL 0x1100 /* eq. BT_EVT_TO_BTU_HCI_ACL */
|
||||
#define MSG_HC_TO_STACK_HCI_SCO 0x1200 /* eq. BT_EVT_TO_BTU_HCI_SCO */
|
||||
#define MSG_HC_TO_STACK_HCI_EVT 0x1000 /* eq. BT_EVT_TO_BTU_HCI_EVT */
|
||||
#define MSG_HC_TO_STACK_L2C_SEG_XMIT 0x1900 /* eq. BT_EVT_TO_BTU_L2C_SEG_XMIT */
|
||||
|
||||
/* Message event ID passed from stack to vendor lib */
|
||||
#define MSG_STACK_TO_HC_HCI_ACL 0x2100 /* eq. BT_EVT_TO_LM_HCI_ACL */
|
||||
#define MSG_STACK_TO_HC_HCI_SCO 0x2200 /* eq. BT_EVT_TO_LM_HCI_SCO */
|
||||
#define MSG_STACK_TO_HC_HCI_CMD 0x2000 /* eq. BT_EVT_TO_LM_HCI_CMD */
|
||||
|
||||
/* Local Bluetooth Controller ID for BR/EDR */
|
||||
#define LOCAL_BR_EDR_CONTROLLER_ID 0
|
||||
|
||||
///// END LEGACY DEFINITIONS /////
|
||||
|
||||
typedef struct hci_hal_t hci_hal_t;
|
||||
//typedef struct btsnoop_t btsnoop_t;
|
||||
typedef struct controller_t controller_t;
|
||||
//typedef struct hci_inject_t hci_inject_t;
|
||||
typedef struct packet_fragmenter_t packet_fragmenter_t;
|
||||
//typedef struct vendor_t vendor_t;
|
||||
//typedef struct low_power_manager_t low_power_manager_t;
|
||||
|
||||
//typedef unsigned char * bdaddr_t;
|
||||
typedef uint16_t command_opcode_t;
|
||||
|
||||
/*
|
||||
typedef enum {
|
||||
LPM_DISABLE,
|
||||
LPM_ENABLE,
|
||||
LPM_WAKE_ASSERT,
|
||||
LPM_WAKE_DEASSERT
|
||||
} low_power_command_t;
|
||||
*/
|
||||
|
||||
typedef void (*command_complete_cb)(BT_HDR *response, void *context);
|
||||
typedef void (*command_status_cb)(uint8_t status, BT_HDR *command, void *context);
|
||||
|
||||
typedef struct hci_t {
|
||||
// Send a low power command, if supported and the low power manager is enabled.
|
||||
//void (*send_low_power_command)(low_power_command_t command);
|
||||
|
||||
// Do the postload sequence (call after the rest of the BT stack initializes).
|
||||
void (*do_postload)(void);
|
||||
|
||||
// Send a command through the HCI layer
|
||||
void (*transmit_command)(
|
||||
BT_HDR *command,
|
||||
command_complete_cb complete_callback,
|
||||
command_status_cb status_cb,
|
||||
void *context
|
||||
);
|
||||
|
||||
future_t *(*transmit_command_futured)(BT_HDR *command);
|
||||
|
||||
// Send some data downward through the HCI layer
|
||||
void (*transmit_downward)(uint16_t type, void *data);
|
||||
} hci_t;
|
||||
|
||||
const hci_t *hci_layer_get_interface();
|
||||
|
||||
int hci_start_up(void);
|
||||
void hci_shut_down(void);
|
||||
|
||||
|
||||
#endif /* _HCI_LAYER_H_ */
|
51
tools/sdk/include/bluedroid/hci/hci_packet_factory.h
Normal file
51
tools/sdk/include/bluedroid/hci/hci_packet_factory.h
Normal file
@ -0,0 +1,51 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2014 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 _HCI_PACKET_FACTORY_H_
|
||||
#define _HCI_PACKET_FACTORY_H_
|
||||
|
||||
#include "stack/bt_types.h"
|
||||
#include "device/event_mask.h"
|
||||
|
||||
typedef struct {
|
||||
BT_HDR *(*make_reset)(void);
|
||||
BT_HDR *(*make_read_buffer_size)(void);
|
||||
BT_HDR *(*make_set_c2h_flow_control)(uint8_t enable);
|
||||
BT_HDR *(*make_host_buffer_size)(uint16_t acl_size, uint8_t sco_size, uint16_t acl_count, uint16_t sco_count);
|
||||
BT_HDR *(*make_read_local_version_info)(void);
|
||||
BT_HDR *(*make_read_bd_addr)(void);
|
||||
BT_HDR *(*make_read_local_supported_commands)(void);
|
||||
BT_HDR *(*make_read_local_extended_features)(uint8_t page_number);
|
||||
BT_HDR *(*make_write_simple_pairing_mode)(uint8_t mode);
|
||||
BT_HDR *(*make_write_secure_connections_host_support)(uint8_t mode);
|
||||
BT_HDR *(*make_set_event_mask)(const bt_event_mask_t *event_mask);
|
||||
BT_HDR *(*make_ble_write_host_support)(uint8_t supported_host, uint8_t simultaneous_host);
|
||||
BT_HDR *(*make_ble_read_white_list_size)(void);
|
||||
BT_HDR *(*make_ble_read_buffer_size)(void);
|
||||
BT_HDR *(*make_ble_read_supported_states)(void);
|
||||
BT_HDR *(*make_ble_read_local_supported_features)(void);
|
||||
BT_HDR *(*make_ble_read_resolving_list_size)(void);
|
||||
BT_HDR *(*make_ble_read_suggested_default_data_length)(void);
|
||||
BT_HDR *(*make_ble_write_suggested_default_data_length)(uint16_t SuggestedMaxTxOctets, uint16_t SuggestedMaxTxTime);
|
||||
BT_HDR *(*make_ble_set_event_mask)(const bt_event_mask_t *event_mask);
|
||||
BT_HDR *(*make_write_sync_flow_control_enable)(uint8_t enable);
|
||||
} hci_packet_factory_t;
|
||||
|
||||
const hci_packet_factory_t *hci_packet_factory_get_interface();
|
||||
|
||||
#endif /*_HCI_PACKET_FACTORY_H_*/
|
102
tools/sdk/include/bluedroid/hci/hci_packet_parser.h
Normal file
102
tools/sdk/include/bluedroid/hci/hci_packet_parser.h
Normal file
@ -0,0 +1,102 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2014 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 _HCI_PACKET_PARSER_H_
|
||||
#define _HCI_PACKET_PARSER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "osi/allocator.h"
|
||||
#include "device/bdaddr.h"
|
||||
#include "stack/bt_types.h"
|
||||
#include "device/device_features.h"
|
||||
//#include "features.h"
|
||||
#include "device/version.h"
|
||||
|
||||
typedef struct {
|
||||
void (*parse_generic_command_complete)(BT_HDR *response);
|
||||
|
||||
void (*parse_read_buffer_size_response)(
|
||||
BT_HDR *response,
|
||||
uint16_t *acl_data_size_ptr,
|
||||
uint16_t *acl_buffer_count_ptr,
|
||||
uint8_t *sco_data_size_ptr,
|
||||
uint16_t *sco_buffer_count_ptr
|
||||
);
|
||||
|
||||
void (*parse_read_local_version_info_response)(
|
||||
BT_HDR *response,
|
||||
bt_version_t *bt_version_ptr
|
||||
);
|
||||
|
||||
void (*parse_read_bd_addr_response)(
|
||||
BT_HDR *response,
|
||||
bt_bdaddr_t *address_ptr
|
||||
);
|
||||
|
||||
void (*parse_read_local_supported_commands_response)(
|
||||
BT_HDR *response,
|
||||
uint8_t *supported_commands_ptr,
|
||||
size_t supported_commands_length
|
||||
);
|
||||
|
||||
void (*parse_read_local_extended_features_response)(
|
||||
BT_HDR *response,
|
||||
uint8_t *page_number_ptr,
|
||||
uint8_t *max_page_number_ptr,
|
||||
bt_device_features_t *feature_pages,
|
||||
size_t feature_pages_count
|
||||
);
|
||||
|
||||
void (*parse_ble_read_white_list_size_response)(
|
||||
BT_HDR *response,
|
||||
uint8_t *white_list_size_ptr
|
||||
);
|
||||
|
||||
void (*parse_ble_read_buffer_size_response)(
|
||||
BT_HDR *response,
|
||||
uint16_t *data_size_ptr,
|
||||
uint8_t *acl_buffer_count_ptr
|
||||
);
|
||||
|
||||
void (*parse_ble_read_supported_states_response)(
|
||||
BT_HDR *response,
|
||||
uint8_t *supported_states,
|
||||
size_t supported_states_size
|
||||
);
|
||||
|
||||
void (*parse_ble_read_local_supported_features_response)(
|
||||
BT_HDR *response,
|
||||
bt_device_features_t *supported_features
|
||||
);
|
||||
|
||||
void (*parse_ble_read_resolving_list_size_response) (
|
||||
BT_HDR *response,
|
||||
uint8_t *resolving_list_size_ptr
|
||||
);
|
||||
|
||||
void (*parse_ble_read_suggested_default_data_length_response)(
|
||||
BT_HDR *response,
|
||||
uint16_t *ble_default_packet_length_ptr,
|
||||
uint16_t *ble_default_packet_txtime_ptr
|
||||
);
|
||||
} hci_packet_parser_t;
|
||||
|
||||
const hci_packet_parser_t *hci_packet_parser_get_interface();
|
||||
|
||||
#endif /*_HCI_PACKET_PARSER_H_*/
|
62
tools/sdk/include/bluedroid/hci/packet_fragmenter.h
Normal file
62
tools/sdk/include/bluedroid/hci/packet_fragmenter.h
Normal file
@ -0,0 +1,62 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2014 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 _PACKET_FRAGMENTER_H_
|
||||
#define _PACKET_FRAGMENTER_H_
|
||||
|
||||
#include "osi/allocator.h"
|
||||
#include "stack/bt_types.h"
|
||||
#include "hci/hci_layer.h"
|
||||
|
||||
typedef void (*transmit_finished_cb)(BT_HDR *packet, bool all_fragments_sent);
|
||||
typedef void (*packet_reassembled_cb)(BT_HDR *packet);
|
||||
typedef void (*packet_fragmented_cb)(BT_HDR *packet, bool send_transmit_finished);
|
||||
|
||||
typedef struct {
|
||||
// Called for every packet fragment.
|
||||
packet_fragmented_cb fragmented;
|
||||
|
||||
// Called for every completely reassembled packet.
|
||||
packet_reassembled_cb reassembled;
|
||||
|
||||
// Called when the fragmenter finishes sending all requested fragments,
|
||||
// but the packet has not been entirely sent.
|
||||
transmit_finished_cb transmit_finished;
|
||||
} packet_fragmenter_callbacks_t;
|
||||
|
||||
typedef struct packet_fragmenter_t {
|
||||
// Initialize the fragmenter, specifying the |result_callbacks|.
|
||||
void (*init)(const packet_fragmenter_callbacks_t *result_callbacks);
|
||||
|
||||
// Release all resources associated with the fragmenter.
|
||||
void (*cleanup)(void);
|
||||
|
||||
// CHeck if Current fragmenter is ongoing
|
||||
BT_HDR *(*fragment_current_packet)(void);
|
||||
|
||||
// Fragments |packet| if necessary and hands off everything to the fragmented callback.
|
||||
void (*fragment_and_dispatch)(BT_HDR *packet);
|
||||
// If |packet| is a complete packet, forwards to the reassembled callback. Otherwise
|
||||
// holds onto it until all fragments arrive, at which point the reassembled callback is called
|
||||
// with the reassembled data.
|
||||
void (*reassemble_and_dispatch)(BT_HDR *packet);
|
||||
} packet_fragmenter_t;
|
||||
|
||||
const packet_fragmenter_t *packet_fragmenter_get_interface();
|
||||
|
||||
#endif /* _PACKET_FRAGMENTER_H_ */
|
Reference in New Issue
Block a user