Update IDF to 65acd99 (#358)

* Update IDF to 65acd99

* Update platformio and arduino build paths and libs

* Update esptool binaries
This commit is contained in:
Me No Dev 2017-05-06 20:29:12 +03:00 committed by GitHub
parent 450df7e3f8
commit 376961d168
221 changed files with 14441 additions and 523 deletions

View File

@ -38,7 +38,7 @@
{
"packager": "esp32",
"name": "esptool",
"version": "fe69994"
"version": "96698a3"
}
]
}
@ -80,20 +80,20 @@
},
{
"name": "esptool",
"version": "9072736",
"version": "96698a3",
"systems": [
{
"host": "i686-mingw32",
"url": "https://dl.espressif.com/dl/esptool-9072736-windows.zip",
"archiveFileName": "esptool-9072736-windows.zip",
"checksum": "SHA-256:eac14998df3fed9998943ace5c2f07114b678869f143c3316f4ff26cc851e268",
"url": "https://dl.espressif.com/dl/esptool-96698a3-windows.zip",
"archiveFileName": "esptool-96698a3-windows.zip",
"checksum": "SHA-256:12f026c84869f0bd2f6a863191ec84d27b91f21d17e2e2e9e11c79be50f2d0fc",
"size": "3390935"
},
{
"host": "x86_64-apple-darwin",
"url": "https://dl.espressif.com/dl/esptool-9072736-macos.tar.gz",
"archiveFileName": "esptool-9072736-macos.tar.gz",
"checksum": "SHA-256:2b88ce516719f8b54c22ae637109b1437f3ab5f81a1e6260ef14799e4dd3b355",
"url": "https://dl.espressif.com/dl/esptool-96698a3-macos.tar.gz",
"archiveFileName": "esptool-96698a3-macos.tar.gz",
"checksum": "SHA-256:e3154dbf32c3ba5e5ebd45e913178b167cf761e5ce0152b2bb069a2453f6839b",
"size": "3805789"
}
]

View File

@ -21,7 +21,7 @@ compiler.warning_flags.all=-Wall -Werror=all -Wextra
compiler.path={runtime.tools.xtensa-esp32-elf-gcc.path}/bin/
compiler.sdk.path={runtime.platform.path}/tools/sdk
compiler.cpreprocessor.flags=-DESP_PLATFORM -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DHAVE_CONFIG_H "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/bluedroid" "-I{compiler.sdk.path}/include/app_update" "-I{compiler.sdk.path}/include/bootloader_support" "-I{compiler.sdk.path}/include/bt" "-I{compiler.sdk.path}/include/driver" "-I{compiler.sdk.path}/include/esp32" "-I{compiler.sdk.path}/include/ethernet" "-I{compiler.sdk.path}/include/fatfs" "-I{compiler.sdk.path}/include/freertos" "-I{compiler.sdk.path}/include/jsmn" "-I{compiler.sdk.path}/include/log" "-I{compiler.sdk.path}/include/mdns" "-I{compiler.sdk.path}/include/mbedtls" "-I{compiler.sdk.path}/include/mbedtls_port" "-I{compiler.sdk.path}/include/newlib" "-I{compiler.sdk.path}/include/nvs_flash" "-I{compiler.sdk.path}/include/openssl" "-I{compiler.sdk.path}/include/soc" "-I{compiler.sdk.path}/include/spi_flash" "-I{compiler.sdk.path}/include/sdmmc" "-I{compiler.sdk.path}/include/tcpip_adapter" "-I{compiler.sdk.path}/include/ulp" "-I{compiler.sdk.path}/include/vfs" "-I{compiler.sdk.path}/include/xtensa-debug-module" "-I{compiler.sdk.path}/include/newlib" "-I{compiler.sdk.path}/include/coap" "-I{compiler.sdk.path}/include/wpa_supplicant" "-I{compiler.sdk.path}/include/expat" "-I{compiler.sdk.path}/include/json" "-I{compiler.sdk.path}/include/nghttp" "-I{compiler.sdk.path}/include/lwip"
compiler.cpreprocessor.flags=-DESP_PLATFORM -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DHAVE_CONFIG_H "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/bluedroid" "-I{compiler.sdk.path}/include/app_update" "-I{compiler.sdk.path}/include/bootloader_support" "-I{compiler.sdk.path}/include/bt" "-I{compiler.sdk.path}/include/driver" "-I{compiler.sdk.path}/include/esp32" "-I{compiler.sdk.path}/include/ethernet" "-I{compiler.sdk.path}/include/fatfs" "-I{compiler.sdk.path}/include/freertos" "-I{compiler.sdk.path}/include/jsmn" "-I{compiler.sdk.path}/include/log" "-I{compiler.sdk.path}/include/mdns" "-I{compiler.sdk.path}/include/mbedtls" "-I{compiler.sdk.path}/include/mbedtls_port" "-I{compiler.sdk.path}/include/newlib" "-I{compiler.sdk.path}/include/nvs_flash" "-I{compiler.sdk.path}/include/openssl" "-I{compiler.sdk.path}/include/soc" "-I{compiler.sdk.path}/include/spi_flash" "-I{compiler.sdk.path}/include/sdmmc" "-I{compiler.sdk.path}/include/tcpip_adapter" "-I{compiler.sdk.path}/include/ulp" "-I{compiler.sdk.path}/include/vfs" "-I{compiler.sdk.path}/include/wear_levelling" "-I{compiler.sdk.path}/include/xtensa-debug-module" "-I{compiler.sdk.path}/include/newlib" "-I{compiler.sdk.path}/include/coap" "-I{compiler.sdk.path}/include/wpa_supplicant" "-I{compiler.sdk.path}/include/expat" "-I{compiler.sdk.path}/include/json" "-I{compiler.sdk.path}/include/nghttp" "-I{compiler.sdk.path}/include/lwip"
compiler.c.cmd=xtensa-esp32-elf-gcc
compiler.c.flags=-std=gnu99 -Os -g3 -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib -Wpointer-arith {compiler.warning_flags} -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -Wno-old-style-declaration -MMD -c
@ -34,7 +34,7 @@ compiler.S.flags=-c -g3 -x assembler-with-cpp -MMD -mlongcalls
compiler.c.elf.cmd=xtensa-esp32-elf-gcc
compiler.c.elf.flags=-nostdlib "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" -T esp32_out.ld -T esp32.common.ld -T esp32.rom.ld -T esp32.peripherals.ld -u call_user_start_cpu0 -Wl,--gc-sections -Wl,-static -Wl,--undefined=uxTopUsedPriority
compiler.c.elf.libs=-lgcc -lstdc++ -lapp_update -lbootloader_support -lbt -lbtdm_app -lc -lc_nano -lcoap -lcoexist -lcore -lcxx -ldriver -lesp32 -lethernet -lexpat -lfatfs -lfreertos -lhal -ljsmn -ljson -llog -llwip -lm -lmbedtls -lmdns -lmicro-ecc -lnet80211 -lnewlib -lnghttp -lnvs_flash -lopenssl -lphy -lpp -lrtc -lsdmmc -lsmartconfig -lsoc -lspi_flash -ltcpip_adapter -lulp -lvfs -lwpa -lwpa2 -lwpa_supplicant -lwps -lxtensa-debug-module
compiler.c.elf.libs=-lgcc -lstdc++ -lapp_update -lbootloader_support -lbt -lbtdm_app -lc -lc_nano -lcoap -lcoexist -lcore -lcxx -ldriver -lesp32 -lethernet -lexpat -lfatfs -lfreertos -lhal -ljsmn -ljson -llog -llwip -lm -lmbedtls -lmdns -lmicro-ecc -lnet80211 -lnewlib -lnghttp -lnvs_flash -lopenssl -lphy -lpp -lrtc -lsdmmc -lsmartconfig -lsoc -lspi_flash -ltcpip_adapter -lulp -lvfs -lwear_levelling -lwpa -lwpa2 -lwpa_supplicant -lwps -lxtensa-debug-module
compiler.as.cmd=xtensa-esp32-elf-as

View File

@ -30,7 +30,7 @@ import base64
import zlib
import shlex
__version__ = "2.0-beta2"
__version__ = "2.0-beta3"
MAX_UINT32 = 0xffffffff
MAX_UINT24 = 0xffffff
@ -574,14 +574,19 @@ class ESPLoader(object):
raise FatalError('Digest mismatch: expected %s, got %s' % (expected_digest, digest))
return data
def flash_spi_attach(self,is_hspi,is_legacy):
def flash_spi_attach(self, hspi_arg):
"""Send SPI attach command to enable the SPI flash pins
ESP8266 ROM does this when you send flash_begin, ESP32 ROM
has it as a SPI command.
"""
# last 3 bytes in ESP_SPI_ATTACH argument are reserved values
arg = struct.pack('<IBBBB', 1 if is_hspi else 0, 1 if is_legacy else 0, 0, 0, 0)
arg = struct.pack('<I', hspi_arg)
if not self.IS_STUB:
# ESP32 ROM loader takes additional 'is legacy' arg, which is not
# currently supported in the stub loader or esptool.py (as it's not usually needed.)
is_legacy = 0
arg += struct.pack('BBBB', is_legacy, 0, 0, 0)
self.check_command("configure SPI flash pins", ESP32ROM.ESP_SPI_ATTACH, arg)
def flash_set_parameters(self, size):
@ -809,9 +814,9 @@ class ESP8266ROM(ESPLoader):
FLASH_HEADER_OFFSET = 0
def flash_spi_attach(self, is_spi, is_legacy):
def flash_spi_attach(self, hspi_arg):
if self.IS_STUB:
super(ESP8266ROM, self).flash_spi_attach(is_spi, is_legacy)
super(ESP8266ROM, self).flash_spi_attach(hspi_arg)
else:
# ESP8266 ROM has no flash_spi_attach command in serial protocol,
# but flash_begin will do it
@ -1892,6 +1897,11 @@ def main():
dest='operation',
help='Run esptool {command} -h for additional help')
def add_spi_connection_arg(parent):
parent.add_argument('--spi-connection', '-sc', help='ESP32-only argument. Override default SPI Flash connection. ' +
'Value can be SPI, HSPI or a comma-separated list of 5 I/O numbers to use for SPI flash (CLK,Q,D,HD,CS).',
action=SpiConnectionAction)
parser_load_ram = subparsers.add_parser(
'load_ram',
help='Download an image to RAM and execute')
@ -1928,8 +1938,7 @@ def main():
' plus ESP8266-only (256KB, 512KB, 2MB-c1, 4MB-c1, 4MB-2)',
action=FlashSizeAction, auto_detect=auto_detect,
default=os.environ.get('ESPTOOL_FS', 'detect' if auto_detect else '1MB'))
parent.add_argument('--ucIsHspi', '-ih', help='Config SPI PORT/PINS (Espressif internal feature)',action='store_true')
parent.add_argument('--ucIsLegacy', '-il', help='Config SPI LEGACY (Espressif internal feature)',action='store_true')
add_spi_connection_arg(parent)
parser_write_flash = subparsers.add_parser(
'write_flash',
@ -1978,20 +1987,23 @@ def main():
'chip_id',
help='Read Chip ID from OTP ROM')
subparsers.add_parser(
parser_flash_id = subparsers.add_parser(
'flash_id',
help='Read SPI flash manufacturer and device ID')
add_spi_connection_arg(parser_flash_id)
parser_read_status = subparsers.add_parser(
'read_flash_status',
help='Read SPI flash status register')
add_spi_connection_arg(parser_read_status)
parser_read_status.add_argument('--bytes', help='Number of bytes to read (1-3)', type=int, choices=[1,2,3], default=2)
parser_write_status = subparsers.add_parser(
'write_flash_status',
help='Write SPI flash status register')
add_spi_connection_arg(parser_write_status)
parser_write_status.add_argument('--non-volatile', help='Write non-volatile bits (use with caution)', action='store_true')
parser_write_status.add_argument('--bytes', help='Number of status bytes to write (1-3)', type=int, choices=[1,2,3], default=2)
parser_write_status.add_argument('value', help='New value', type=arg_auto_int)
@ -1999,6 +2011,7 @@ def main():
parser_read_flash = subparsers.add_parser(
'read_flash',
help='Read SPI flash content')
add_spi_connection_arg(parser_read_flash)
parser_read_flash.add_argument('address', help='Start address', type=arg_auto_int)
parser_read_flash.add_argument('size', help='Size of region to dump', type=arg_auto_int)
parser_read_flash.add_argument('filename', help='Name of binary dump')
@ -2013,13 +2026,15 @@ def main():
choices=['no', 'yes'], default='no')
add_spi_flash_subparsers(parser_verify_flash, auto_detect=True)
subparsers.add_parser(
parser_erase_flash = subparsers.add_parser(
'erase_flash',
help='Perform Chip Erase on SPI flash')
add_spi_connection_arg(parser_erase_flash)
parser_erase_region = subparsers.add_parser(
'erase_region',
help='Erase a region of the flash')
add_spi_connection_arg(parser_erase_region)
parser_erase_region.add_argument('address', help='Start address (must be multiple of 4096)', type=arg_auto_int)
parser_erase_region.add_argument('size', help='Size of region to erase (must be multiple of 4096)', type=arg_auto_int)
@ -2066,12 +2081,17 @@ def main():
except NotImplementedInROMError:
print("WARNING: ROM doesn't support changing baud rate. Keeping initial baud rate %d" % initial_baud)
# override common SPI flash parameter stuff as required
if hasattr(args, "ucIsHspi"):
print("Attaching SPI flash...")
esp.flash_spi_attach(args.ucIsHspi,args.ucIsLegacy)
else:
esp.flash_spi_attach(0, 0)
# override common SPI flash parameter stuff if configured to do so
if hasattr(args, "spi_connection") and args.spi_connection is not None:
if esp.CHIP_NAME != "ESP32":
raise FatalError("Chip %s does not support --spi-connection option." % esp.CHIP_NAME)
print("Configuring SPI flash mode...")
esp.flash_spi_attach(args.spi_connection)
elif args.no_stub:
print("Enabling default SPI flash mode...")
# ROM loader doesn't enable flash unless we explicitly do it
esp.flash_spi_attach(0)
if hasattr(args, "flash_size"):
print("Configuring flash size...")
detect_flash_size(esp, args)
@ -2152,6 +2172,34 @@ class FlashSizeAction(argparse.Action):
setattr(namespace, self.dest, value)
class SpiConnectionAction(argparse.Action):
""" Custom action to parse 'spi connection' override. Values are SPI, HSPI, or a sequence of 5 pin numbers separated by commas.
"""
def __call__(self, parser, namespace, value, option_string=None):
if value.upper() == "SPI":
value = 0
elif value.upper() == "HSPI":
value = 1
elif "," in value:
values = value.split(",")
if len(values) != 5:
raise argparse.ArgumentError(self, '%s is not a valid list of comma-separate pin numbers. Must be 5 numbers - CLK,Q,D,HD,CS.' % value)
try:
values = tuple(int(v,0) for v in values)
except ValueError:
raise argparse.ArgumentError(self, '%s is not a valid argument. All pins must be numeric values' % values)
if any([v for v in values if v > 33 or v < 0]):
raise argparse.ArgumentError(self, 'Pin numbers must be in the range 0-33.')
# encode the pin numbers as a 32-bit integer with packed 6-bit values, the same way ESP32 ROM takes them
# TODO: make this less ESP32 ROM specific somehow...
clk,q,d,hd,cs = values
value = (hd << 24) | (cs << 18) | (d << 12) | (q << 6) | clk
else:
raise argparse.ArgumentError(self, '%s is not a valid spi-connection value. ' +
'Values are SPI, HSPI, or a sequence of 5 pin numbers CLK,Q,D,HD,CS).' % values)
setattr(namespace, self.dest, value)
class AddrFilenamePairAction(argparse.Action):
""" Custom parser class for the address/filename pairs passed as arguments """
def __init__(self, option_strings, dest, nargs='+', **kwargs):
@ -2190,108 +2238,112 @@ class AddrFilenamePairAction(argparse.Action):
# Binary stub code (see flasher_stub dir for source & details)
ESP8266ROM.STUB_CODE = eval(zlib.decompress(base64.b64decode(b"""
eNrNPWtj00a2f8VSQkhMaDWSrEcIxXaCSSlsA5QUet020kiCsoVNjHdDWfrfr85rZiQ7BNrt3vsh1CONZs6cc+a8Z/rv68v63fLnt8tisby+N1BBGqd5EAfB7uB6VSwL902UhkEYZu0b+KZ9Vl6fvyuy+TsVzN8F\
wbj9R83fNQ38zQ7hUfcva/+a+s63R5Ov2+/i9q+Ernfat5ob9R3qljmflW1PlcMsY+pJL057E6j1v5XTh0BzANLdmWiGHtT2o/Ha5czf5foGr6MI5Fc77XW3+z9pDUHUW3mvIZ+XHex0EDLYcWBrk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hda//gfTQr5T\
""")))
if __name__ == '__main__':
def _main():
try:
main()
except FatalError as e:
print('\nA fatal error occurred: %s' % e)
sys.exit(2)
if __name__ == '__main__':
_main()

View File

@ -73,6 +73,7 @@ env.Prepend(
join(FRAMEWORK_DIR, "tools", "sdk", "include", "tcpip_adapter"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "ulp"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "vfs"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "wear_levelling"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "xtensa-debug-module"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "newlib"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "coap"),
@ -83,14 +84,12 @@ env.Prepend(
join(FRAMEWORK_DIR, "tools", "sdk", "include", "lwip"),
join(FRAMEWORK_DIR, "cores", env.BoardConfig().get("build.core"))
],
LIBPATH=[
join(FRAMEWORK_DIR, "tools", "sdk", "lib"),
join(FRAMEWORK_DIR, "tools", "sdk", "ld")
],
LIBS=[
"gcc", "stdc++", "app_update", "bootloader_support", "bt", "btdm_app", "c", "c_nano", "coap", "coexist", "core", "cxx", "driver", "esp32", "ethernet", "expat", "fatfs", "freertos", "hal", "jsmn", "json", "log", "lwip", "m", "mbedtls", "mdns", "micro-ecc", "net80211", "newlib", "nghttp", "nvs_flash", "openssl", "phy", "pp", "rtc", "sdmmc", "smartconfig", "soc", "spi_flash", "tcpip_adapter", "ulp", "vfs", "wpa", "wpa2", "wpa_supplicant", "wps", "xtensa-debug-module"
"gcc", "stdc++", "app_update", "bootloader_support", "bt", "btdm_app", "c", "c_nano", "coap", "coexist", "core", "cxx", "driver", "esp32", "ethernet", "expat", "fatfs", "freertos", "hal", "jsmn", "json", "log", "lwip", "m", "mbedtls", "mdns", "micro-ecc", "net80211", "newlib", "nghttp", "nvs_flash", "openssl", "phy", "pp", "rtc", "sdmmc", "smartconfig", "soc", "spi_flash", "tcpip_adapter", "ulp", "vfs", "wear_levelling", "wpa", "wpa2", "wpa_supplicant", "wps", "xtensa-debug-module"
],
UPLOADERFLAGS=[

Binary file not shown.

View File

@ -0,0 +1,255 @@
/******************************************************************************
*
* Copyright (C) 2000-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.
*
******************************************************************************/
/******************************************************************************
*
* nterface to A2DP Application Programming Interface
*
******************************************************************************/
#ifndef A2D_API_H
#define A2D_API_H
#include "sdp_api.h"
#if (A2D_INCLUDED == TRUE)
/*****************************************************************************
** constants
*****************************************************************************/
/* Profile supported features */
#define A2D_SUPF_PLAYER 0x0001
#define A2D_SUPF_MIC 0x0002
#define A2D_SUPF_TUNER 0x0004
#define A2D_SUPF_MIXER 0x0008
#define A2D_SUPF_HEADPHONE 0x0001
#define A2D_SUPF_SPEAKER 0x0002
#define A2D_SUPF_RECORDER 0x0004
#define A2D_SUPF_AMP 0x0008
/* AV Media Types */
#define A2D_MEDIA_TYPE_AUDIO 0x00 /* audio media type + RFA */
#define A2D_MEDIA_TYPE_VIDEO 0x10 /* video media type + RFA */
#define A2D_MEDIA_TYPE_MULTI 0x20 /* multimedia media type + RFA */
/* AV Media Codec Type (Audio Codec ID) */
#define A2D_MEDIA_CT_SBC 0x00 /* SBC media codec type */
#define A2D_MEDIA_CT_M12 0x01 /* MPEG-1, 2 Audio media codec type */
#define A2D_MEDIA_CT_M24 0x02 /* MPEG-2, 4 AAC media codec type */
#define A2D_MEDIA_CT_ATRAC 0x04 /* ATRAC family media codec type */
#define A2D_SUCCESS 0 /* Success */
#define A2D_FAIL 0x0A /* Failed */
#define A2D_BUSY 0x0B /* A2D_FindService is already in progress */
#define A2D_INVALID_PARAMS 0x0C /* bad parameters */
#define A2D_WRONG_CODEC 0x0D /* wrong codec info */
#define A2D_BAD_CODEC_TYPE 0xC1 /* Media Codec Type is not valid */
#define A2D_NS_CODEC_TYPE 0xC2 /* Media Codec Type is not supported */
#define A2D_BAD_SAMP_FREQ 0xC3 /* Sampling Frequency is not valid or multiple values have been selected */
#define A2D_NS_SAMP_FREQ 0xC4 /* Sampling Frequency is not supported */
#define A2D_BAD_CH_MODE 0xC5 /* Channel Mode is not valid or multiple values have been selected */
#define A2D_NS_CH_MODE 0xC6 /* Channel Mode is not supported */
#define A2D_BAD_SUBBANDS 0xC7 /* None or multiple values have been selected for Number of Subbands */
#define A2D_NS_SUBBANDS 0xC8 /* Number of Subbands is not supported */
#define A2D_BAD_ALLOC_MTHD 0xC9 /* None or multiple values have been selected for Allocation Method */
#define A2D_NS_ALLOC_MTHD 0xCA /* Allocation Method is not supported */
#define A2D_BAD_MIN_BITPOOL 0xCB /* Minimum Bitpool Value is not valid */
#define A2D_NS_MIN_BITPOOL 0xCC /* Minimum Bitpool Value is not supported */
#define A2D_BAD_MAX_BITPOOL 0xCD /* Maximum Bitpool Value is not valid */
#define A2D_NS_MAX_BITPOOL 0xCE /* Maximum Bitpool Value is not supported */
#define A2D_BAD_LAYER 0xCF /* None or multiple values have been selected for Layer */
#define A2D_NS_LAYER 0xD0 /* Layer is not supported */
#define A2D_NS_CRC 0xD1 /* CRC is not supported */
#define A2D_NS_MPF 0xD2 /* MPF-2 is not supported */
#define A2D_NS_VBR 0xD3 /* VBR is not supported */
#define A2D_BAD_BIT_RATE 0xD4 /* None or multiple values have been selected for Bit Rate */
#define A2D_NS_BIT_RATE 0xD5 /* Bit Rate is not supported */
#define A2D_BAD_OBJ_TYPE 0xD6 /* Either 1) Object type is not valid (b3-b0) or 2) None or multiple values have been selected for Object Type */
#define A2D_NS_OBJ_TYPE 0xD7 /* Object type is not supported */
#define A2D_BAD_CHANNEL 0xD8 /* None or multiple values have been selected for Channels */
#define A2D_NS_CHANNEL 0xD9 /* Channels is not supported */
#define A2D_BAD_BLOCK_LEN 0xDD /* None or multiple values have been selected for Block Length */
#define A2D_BAD_CP_TYPE 0xE0 /* The requested CP Type is not supported. */
#define A2D_BAD_CP_FORMAT 0xE1 /* The format of Content Protection Service Capability/Content Protection Scheme Dependent Data is not correct. */
typedef UINT8 tA2D_STATUS;
/* the return values from A2D_BitsSet() */
#define A2D_SET_ONE_BIT 1 /* one and only one bit is set */
#define A2D_SET_ZERO_BIT 0 /* all bits clear */
#define A2D_SET_MULTL_BIT 2 /* multiple bits are set */
/*****************************************************************************
** type definitions
*****************************************************************************/
/* This data type is used in A2D_FindService() to initialize the SDP database
* to hold the result service search. */
typedef struct {
UINT32 db_len; /* Length, in bytes, of the discovery database */
UINT16 num_attr;/* The number of attributes in p_attrs */
tSDP_DISCOVERY_DB *p_db; /* Pointer to the discovery database */
UINT16 *p_attrs; /* The attributes filter. If NULL, A2DP API sets the attribute filter
* to be ATTR_ID_SERVICE_CLASS_ID_LIST, ATTR_ID_BT_PROFILE_DESC_LIST,
* ATTR_ID_SUPPORTED_FEATURES, ATTR_ID_SERVICE_NAME and ATTR_ID_PROVIDER_NAME.
* If not NULL, the input is taken as the filter. */
} tA2D_SDP_DB_PARAMS;
/* This data type is used in tA2D_FIND_CBACK to report the result of the SDP discovery process. */
typedef struct {
UINT16 service_len; /* Length, in bytes, of the service name */
UINT16 provider_len; /* Length, in bytes, of the provider name */
char *p_service_name; /* Pointer the service name. This character string may not be null terminated.
* Use the service_len parameter to safely copy this string */
char *p_provider_name;/* Pointer the provider name. This character string may not be null terminated.
* Use the provider_len parameter to safely copy this string */
UINT16 features; /* Profile supported features */
UINT16 avdt_version; /* AVDTP protocol version */
} tA2D_Service;
/* This is the callback to notify the result of the SDP discovery process. */
typedef void (tA2D_FIND_CBACK)(BOOLEAN found, tA2D_Service *p_service);
/*****************************************************************************
** external function declarations
*****************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
/******************************************************************************
**
** Function A2D_AddRecord
**
** Description This function is called by a server application to add
** SRC or SNK information to an SDP record. Prior to
** calling this function the application must call
** SDP_CreateRecord() to create an SDP record.
**
** Input Parameters:
** service_uuid: Indicates SRC or SNK.
**
** p_service_name: Pointer to a null-terminated character
** string containing the service name.
**
** p_provider_name: Pointer to a null-terminated character
** string containing the provider name.
**
** features: Profile supported features.
**
** sdp_handle: SDP handle returned by SDP_CreateRecord().
**
** Output Parameters:
** None.
**
** Returns A2D_SUCCESS if function execution succeeded,
** A2D_INVALID_PARAMS if bad parameters are given.
** A2D_FAIL if function execution failed.
**
******************************************************************************/
extern tA2D_STATUS A2D_AddRecord(UINT16 service_uuid, char *p_service_name, char *p_provider_name,
UINT16 features, UINT32 sdp_handle);
/******************************************************************************
**
** Function A2D_FindService
**
** Description This function is called by a client application to
** perform service discovery and retrieve SRC or SNK SDP
** record information from a server. Information is
** returned for the first service record found on the
** server that matches the service UUID. The callback
** function will be executed when service discovery is
** complete. There can only be one outstanding call to
** A2D_FindService() at a time; the application must wait
** for the callback before it makes another call to
** the function.
**
** Input Parameters:
** service_uuid: Indicates SRC or SNK.
**
** bd_addr: BD address of the peer device.
**
** p_db: Pointer to the information to initialize
** the discovery database.
**
** p_cback: Pointer to the A2D_FindService()
** callback function.
**
** Output Parameters:
** None.
**
** Returns A2D_SUCCESS if function execution succeeded,
** A2D_INVALID_PARAMS if bad parameters are given.
** A2D_BUSY if discovery is already in progress.
** A2D_FAIL if function execution failed.
**
******************************************************************************/
extern tA2D_STATUS A2D_FindService(UINT16 service_uuid, BD_ADDR bd_addr,
tA2D_SDP_DB_PARAMS *p_db, tA2D_FIND_CBACK *p_cback);
/******************************************************************************
**
** Function A2D_SetTraceLevel
**
** Description Sets the trace level for A2D. If 0xff is passed, the
** current trace level is returned.
**
** Input Parameters:
** new_level: The level to set the A2D tracing to:
** 0xff-returns the current setting.
** 0-turns off tracing.
** >= 1-Errors.
** >= 2-Warnings.
** >= 3-APIs.
** >= 4-Events.
** >= 5-Debug.
**
** Returns The new trace level or current trace level if
** the input parameter is 0xff.
**
******************************************************************************/
extern UINT8 A2D_SetTraceLevel (UINT8 new_level);
/******************************************************************************
** Function A2D_BitsSet
**
** Description Check the given num for the number of bits set
** Returns A2D_SET_ONE_BIT, if one and only one bit is set
** A2D_SET_ZERO_BIT, if all bits clear
** A2D_SET_MULTL_BIT, if multiple bits are set
******************************************************************************/
extern UINT8 A2D_BitsSet(UINT8 num);
#ifdef __cplusplus
}
#endif
/*******************************************************************************
**
** Function A2D_Init
**
** Description This function is called at stack startup to allocate the
** control block (if using dynamic memory), and initializes the
** control block and tracing level.
**
** Returns void
**
*******************************************************************************/
extern void A2D_Init(void);
#endif ///A2D_INCLUDED
#endif /* A2D_API_H */

View File

@ -0,0 +1,81 @@
/******************************************************************************
*
* Copyright (C) 2002-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.
*
******************************************************************************/
/******************************************************************************
*
* 2DP internal header file
*
******************************************************************************/
#ifndef A2D_INT_H
#define A2D_INT_H
#include "a2d_api.h"
#if (A2D_INCLUDED == TRUE)
/*****************************************************************************
** Constants
*****************************************************************************/
#define A2D_VERSION 0x0102
/* Number of attributes in A2D SDP record. */
#define A2D_NUM_ATTR 6
/* Number of protocol elements in protocol element list. */
#define A2D_NUM_PROTO_ELEMS 2
/*****************************************************************************
** Type definitions
*****************************************************************************/
/* Control block used by A2D_FindService(). */
typedef struct {
tA2D_FIND_CBACK *p_cback; /* pointer to application callback */
tSDP_DISCOVERY_DB *p_db; /* pointer to discovery database */
UINT16 service_uuid; /* service UUID of search */
} tA2D_FIND_CB;
typedef struct {
tA2D_FIND_CB find; /* find service control block */
UINT8 trace_level;
BOOLEAN use_desc;
UINT16 avdt_sdp_ver; /* AVDTP version */
} tA2D_CB;
#ifdef __cplusplus
extern "C"
{
#endif
/******************************************************************************
** Main Control Block
*******************************************************************************/
#if A2D_DYNAMIC_MEMORY == FALSE
extern tA2D_CB a2d_cb;
#else
extern tA2D_CB *a2d_cb_ptr;
#define a2d_cb (*a2d_cb_ptr)
#endif
/* Used only for conformance testing */
extern void a2d_set_avdt_sdp_ver (UINT16 avdt_sdp_ver);
#ifdef __cplusplus
}
#endif
#endif ///A2D_INCLUDED == TRUE
#endif /* A2D_INT_H */

View File

@ -0,0 +1,213 @@
/******************************************************************************
*
* Copyright (C) 2000-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.
*
******************************************************************************/
/******************************************************************************
*
* nterface to low complexity subband codec (SBC)
*
******************************************************************************/
#ifndef A2D_SBC_H
#define A2D_SBC_H
#if (A2D_INCLUDED == TRUE)
/*****************************************************************************
** Constants
*****************************************************************************/
/* the length of the SBC Media Payload header. */
#define A2D_SBC_MPL_HDR_LEN 1
/* the LOSC of SBC media codec capabilitiy */
#define A2D_SBC_INFO_LEN 6
/* for Codec Specific Information Element */
#define A2D_SBC_IE_SAMP_FREQ_MSK 0xF0 /* b7-b4 sampling frequency */
#define A2D_SBC_IE_SAMP_FREQ_16 0x80 /* b7:16 kHz */
#define A2D_SBC_IE_SAMP_FREQ_32 0x40 /* b6:32 kHz */
#define A2D_SBC_IE_SAMP_FREQ_44 0x20 /* b5:44.1kHz */
#define A2D_SBC_IE_SAMP_FREQ_48 0x10 /* b4:48 kHz */
#define A2D_SBC_IE_CH_MD_MSK 0x0F /* b3-b0 channel mode */
#define A2D_SBC_IE_CH_MD_MONO 0x08 /* b3: mono */
#define A2D_SBC_IE_CH_MD_DUAL 0x04 /* b2: dual */
#define A2D_SBC_IE_CH_MD_STEREO 0x02 /* b1: stereo */
#define A2D_SBC_IE_CH_MD_JOINT 0x01 /* b0: joint stereo */
#define A2D_SBC_IE_BLOCKS_MSK 0xF0 /* b7-b4 number of blocks */
#define A2D_SBC_IE_BLOCKS_4 0x80 /* 4 blocks */
#define A2D_SBC_IE_BLOCKS_8 0x40 /* 8 blocks */
#define A2D_SBC_IE_BLOCKS_12 0x20 /* 12blocks */
#define A2D_SBC_IE_BLOCKS_16 0x10 /* 16blocks */
#define A2D_SBC_IE_SUBBAND_MSK 0x0C /* b3-b2 number of subbands */
#define A2D_SBC_IE_SUBBAND_4 0x08 /* b3: 4 */
#define A2D_SBC_IE_SUBBAND_8 0x04 /* b2: 8 */
#define A2D_SBC_IE_ALLOC_MD_MSK 0x03 /* b1-b0 allocation mode */
#define A2D_SBC_IE_ALLOC_MD_S 0x02 /* b1: SNR */
#define A2D_SBC_IE_ALLOC_MD_L 0x01 /* b0: loundess */
#define A2D_SBC_IE_MIN_BITPOOL 2
#define A2D_SBC_IE_MAX_BITPOOL 250
/* for media payload header */
#define A2D_SBC_HDR_F_MSK 0x80
#define A2D_SBC_HDR_S_MSK 0x40
#define A2D_SBC_HDR_L_MSK 0x20
#define A2D_SBC_HDR_NUM_MSK 0x0F
/*****************************************************************************
** Type Definitions
*****************************************************************************/
/* data type for the SBC Codec Information Element*/
typedef struct {
UINT8 samp_freq; /* Sampling frequency */
UINT8 ch_mode; /* Channel mode */
UINT8 block_len; /* Block length */
UINT8 num_subbands; /* Number of subbands */
UINT8 alloc_mthd; /* Allocation method */
UINT8 max_bitpool; /* Maximum bitpool */
UINT8 min_bitpool; /* Minimum bitpool */
} tA2D_SBC_CIE;
/*****************************************************************************
** External Function Declarations
*****************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
/******************************************************************************
**
** Function A2D_SbcChkFrInit
**
** Description check if need to init the descramble control block.
**
** Returns nothing.
******************************************************************************/
extern void A2D_SbcChkFrInit(UINT8 *p_pkt);
/******************************************************************************
**
** Function A2D_SbcDescramble
**
** Description descramble the packet.
**
** Returns nothing.
******************************************************************************/
extern void A2D_SbcDescramble(UINT8 *p_pkt, UINT16 len);
/******************************************************************************
**
** Function A2D_BldSbcInfo
**
** Description This function is called by an application to build
** the SBC Media Codec Capabilities byte sequence
** beginning from the LOSC octet.
** Input Parameters:
** media_type: Indicates Audio, or Multimedia.
**
** p_ie: The SBC Codec Information Element information.
**
** Output Parameters:
** p_result: the resulting codec info byte sequence.
**
** Returns A2D_SUCCESS if function execution succeeded.
** Error status code, otherwise.
******************************************************************************/
extern tA2D_STATUS A2D_BldSbcInfo(UINT8 media_type, tA2D_SBC_CIE *p_ie,
UINT8 *p_result);
/******************************************************************************
**
** Function A2D_ParsSbcInfo
**
** Description This function is called by an application to parse
** the SBC Media Codec Capabilities byte sequence
** beginning from the LOSC octet.
** Input Parameters:
** p_info: the byte sequence to parse.
**
** for_caps: TRUE, if the byte sequence is for get capabilities response.
**
** Output Parameters:
** p_ie: The SBC Codec Information Element information.
**
** Returns A2D_SUCCESS if function execution succeeded.
** Error status code, otherwise.
******************************************************************************/
extern tA2D_STATUS A2D_ParsSbcInfo(tA2D_SBC_CIE *p_ie, UINT8 *p_info,
BOOLEAN for_caps);
/******************************************************************************
**
** Function A2D_BldSbcMplHdr
**
** Description This function is called by an application to parse
** the SBC Media Payload header.
** Input Parameters:
** frag: 1, if fragmented. 0, otherwise.
**
** start: 1, if the starting packet of a fragmented frame.
**
** last: 1, if the last packet of a fragmented frame.
**
** num: If frag is 1, this is the number of remaining fragments
** (including this fragment) of this frame.
** If frag is 0, this is the number of frames in this packet.
**
** Output Parameters:
** p_dst: the resulting media payload header byte sequence.
**
** Returns void.
******************************************************************************/
extern void A2D_BldSbcMplHdr(UINT8 *p_dst, BOOLEAN frag, BOOLEAN start,
BOOLEAN last, UINT8 num);
/******************************************************************************
**
** Function A2D_ParsSbcMplHdr
**
** Description This function is called by an application to parse
** the SBC Media Payload header.
** Input Parameters:
** p_src: the byte sequence to parse..
**
** Output Parameters:
** frag: 1, if fragmented. 0, otherwise.
**
** start: 1, if the starting packet of a fragmented frame.
**
** last: 1, if the last packet of a fragmented frame.
**
** num: If frag is 1, this is the number of remaining fragments
** (including this fragment) of this frame.
** If frag is 0, this is the number of frames in this packet.
**
** Returns void.
******************************************************************************/
extern void A2D_ParsSbcMplHdr(UINT8 *p_src, BOOLEAN *p_frag,
BOOLEAN *p_start, BOOLEAN *p_last,
UINT8 *p_num);
#ifdef __cplusplus
}
#endif
#endif ///A2D_INCLUDED == TRUE
#endif /* A2D_SBC_H */

View File

@ -26,7 +26,7 @@
typedef uint32_t period_ms_t;
typedef void (*osi_alarm_callback_t)(void *data);
#define ALARM_CBS_NUM 20
#define ALARM_CBS_NUM 30
#define ALARM_ID_BASE 1000
typedef struct alarm_t {
/* timer id point to here */

0
tools/sdk/include/bluedroid/avct_api.h Executable file → Normal file
View File

View File

@ -0,0 +1,62 @@
/******************************************************************************
*
* Copyright (C) 2003-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.
*
******************************************************************************/
/******************************************************************************
*
* This contains constants definitions and other information from the AVCTP
* specification. This file is intended for use internal to AVCT only.
*
******************************************************************************/
#ifndef AVCT_DEFS_H
#define AVCT_DEFS_H
/*****************************************************************************
** constants
*****************************************************************************/
/* packet type */
#define AVCT_PKT_TYPE_SINGLE 0 /* single packet */
#define AVCT_PKT_TYPE_START 1 /* start packet */
#define AVCT_PKT_TYPE_CONT 2 /* continue packet */
#define AVCT_PKT_TYPE_END 3 /* end packet */
/* header lengths for different packet types */
#define AVCT_HDR_LEN_SINGLE 3
#define AVCT_HDR_LEN_START 4
#define AVCT_HDR_LEN_CONT 1
#define AVCT_HDR_LEN_END 1
/* invalid cr+ipid value */
#define AVCT_CR_IPID_INVALID 1
/*****************************************************************************
** message parsing and building macros
*****************************************************************************/
#define AVCT_BLD_HDR(p, label, type, cr_ipid) \
*(p)++ = ((label) << 4) | ((type) << 2) | (cr_ipid);
#define AVCT_PRS_HDR(p, label, type, cr_ipid) \
label = *(p) >> 4; \
type = (*(p) >> 2) & 3; \
cr_ipid = *(p)++ & 3;
#define AVCT_PRS_PKT_TYPE(p, type) \
type = (*(p) >> 2) & 3;
#endif /* AVCT_DEFS_H */

View File

@ -0,0 +1,237 @@
/******************************************************************************
*
* Copyright (C) 2003-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.
*
******************************************************************************/
/******************************************************************************
*
* This file contains interfaces which are internal to AVCTP.
*
******************************************************************************/
#ifndef AVCT_INT_H
#define AVCT_INT_H
#include "gki.h"
#include "avct_api.h"
#include "avct_defs.h"
#include "l2c_api.h"
/*****************************************************************************
** constants
*****************************************************************************/
/* lcb state machine events */
enum {
AVCT_LCB_UL_BIND_EVT,
AVCT_LCB_UL_UNBIND_EVT,
AVCT_LCB_UL_MSG_EVT,
AVCT_LCB_INT_CLOSE_EVT,
AVCT_LCB_LL_OPEN_EVT,
AVCT_LCB_LL_CLOSE_EVT,
AVCT_LCB_LL_MSG_EVT,
AVCT_LCB_LL_CONG_EVT
};
/* "states" used for L2CAP channel */
#define AVCT_CH_IDLE 0 /* No connection */
#define AVCT_CH_CONN 1 /* Waiting for connection confirm */
#define AVCT_CH_CFG 2 /* Waiting for configuration complete */
#define AVCT_CH_OPEN 3 /* Channel opened */
/* "no event" indicator used by ccb dealloc */
#define AVCT_NO_EVT 0xFF
/*****************************************************************************
** data types
*****************************************************************************/
/* sub control block type - common data members for tAVCT_LCB and tAVCT_BCB */
typedef struct {
UINT16 peer_mtu; /* peer l2c mtu */
UINT16 ch_result; /* L2CAP connection result value */
UINT16 ch_lcid; /* L2CAP channel LCID */
UINT8 allocated; /* 0, not allocated. index+1, otherwise. */
UINT8 state; /* The state machine state */
UINT8 ch_state; /* L2CAP channel state */
UINT8 ch_flags; /* L2CAP configuration flags */
} tAVCT_SCB;
/* link control block type */
typedef struct {
UINT16 peer_mtu; /* peer l2c mtu */
UINT16 ch_result; /* L2CAP connection result value */
UINT16 ch_lcid; /* L2CAP channel LCID */
UINT8 allocated; /* 0, not allocated. index+1, otherwise. */
UINT8 state; /* The state machine state */
UINT8 ch_state; /* L2CAP channel state */
UINT8 ch_flags; /* L2CAP configuration flags */
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 */
BOOLEAN cong; /* TRUE, if congested */
} tAVCT_LCB;
/* browse control block type */
typedef struct {
UINT16 peer_mtu; /* peer l2c mtu */
UINT16 ch_result; /* L2CAP connection result value */
UINT16 ch_lcid; /* L2CAP channel LCID */
UINT8 allocated; /* 0, not allocated. index+1, otherwise. */
UINT8 state; /* The state machine state */
UINT8 ch_state; /* L2CAP channel state */
UINT8 ch_flags; /* L2CAP configuration flags */
BT_HDR *p_tx_msg; /* Message to be sent - in case the browsing channel is not open when MsgReg is called */
UINT8 ch_close; /* CCB index+1, if CCB initiated channel close */
} tAVCT_BCB;
#define AVCT_ALOC_LCB 0x01
#define AVCT_ALOC_BCB 0x02
/* connection control block */
typedef struct {
tAVCT_CC cc; /* parameters from connection creation */
tAVCT_LCB *p_lcb; /* Associated LCB */
tAVCT_BCB *p_bcb; /* associated BCB */
BOOLEAN ch_close; /* Whether CCB initiated channel close */
UINT8 allocated; /* Whether LCB/BCB is allocated */
} tAVCT_CCB;
/* data type associated with UL_MSG_EVT */
typedef struct {
BT_HDR *p_buf;
tAVCT_CCB *p_ccb;
UINT8 label;
UINT8 cr;
} tAVCT_UL_MSG;
/* union associated with lcb state machine events */
typedef union {
tAVCT_UL_MSG ul_msg;
BT_HDR *p_buf;
tAVCT_CCB *p_ccb;
UINT16 result;
BOOLEAN cong;
UINT8 err_code;
} tAVCT_LCB_EVT;
/* Control block for AVCT */
typedef struct {
tAVCT_LCB lcb[AVCT_NUM_LINKS]; /* link control blocks */
tAVCT_BCB bcb[AVCT_NUM_LINKS]; /* browse control blocks */
tAVCT_CCB ccb[AVCT_NUM_CONN]; /* connection control blocks */
UINT16 mtu; /* our L2CAP MTU */
UINT16 mtu_br; /* our L2CAP MTU for the Browsing channel */
UINT8 trace_level; /* trace level */
} tAVCT_CB;
/*****************************************************************************
** function declarations
*****************************************************************************/
/* LCB function declarations */
extern void avct_lcb_event(tAVCT_LCB *p_lcb, UINT8 event, tAVCT_LCB_EVT *p_data);
#if (AVCT_BROWSE_INCLUDED == TRUE)
extern void avct_bcb_event(tAVCT_BCB *p_bcb, UINT8 event, tAVCT_LCB_EVT *p_data);
extern void avct_close_bcb(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data);
extern tAVCT_LCB *avct_lcb_by_bcb(tAVCT_BCB *p_bcb);
extern tAVCT_BCB *avct_bcb_by_lcb(tAVCT_LCB *p_lcb);
extern BOOLEAN avct_bcb_last_ccb(tAVCT_BCB *p_bcb, tAVCT_CCB *p_ccb_last);
extern tAVCT_BCB *avct_bcb_by_lcid(UINT16 lcid);
#endif
extern tAVCT_LCB *avct_lcb_by_bd(BD_ADDR bd_addr);
extern tAVCT_LCB *avct_lcb_alloc(BD_ADDR bd_addr);
extern void avct_lcb_dealloc(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data);
extern tAVCT_LCB *avct_lcb_by_lcid(UINT16 lcid);
extern tAVCT_CCB *avct_lcb_has_pid(tAVCT_LCB *p_lcb, UINT16 pid);
extern BOOLEAN avct_lcb_last_ccb(tAVCT_LCB *p_lcb, tAVCT_CCB *p_ccb_last);
/* LCB action functions */
extern void avct_lcb_chnl_open(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data);
extern void avct_lcb_unbind_disc(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data);
extern void avct_lcb_open_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data);
extern void avct_lcb_open_fail(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data);
extern void avct_lcb_close_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data);
extern void avct_lcb_close_cfm(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data);
extern void avct_lcb_bind_conn(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data);
extern void avct_lcb_chk_disc(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data);
extern void avct_lcb_chnl_disc(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data);
extern void avct_lcb_bind_fail(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data);
extern void avct_lcb_cong_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data);
extern void avct_lcb_discard_msg(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data);
extern void avct_lcb_send_msg(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data);
extern void avct_lcb_msg_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data);
extern void avct_lcb_free_msg_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data);
/* BCB action functions */
#if (AVCT_BROWSE_INCLUDED == TRUE)
typedef void (*tAVCT_BCB_ACTION)(tAVCT_BCB *p_bcb, tAVCT_LCB_EVT *p_data);
extern void avct_bcb_chnl_open(tAVCT_BCB *p_bcb, tAVCT_LCB_EVT *p_data);
extern void avct_bcb_unbind_disc(tAVCT_BCB *p_bcb, tAVCT_LCB_EVT *p_data);
extern void avct_bcb_open_ind(tAVCT_BCB *p_bcb, tAVCT_LCB_EVT *p_data);
extern void avct_bcb_open_fail(tAVCT_BCB *p_bcb, tAVCT_LCB_EVT *p_data);
extern void avct_bcb_close_ind(tAVCT_BCB *p_bcb, tAVCT_LCB_EVT *p_data);
extern void avct_bcb_close_cfm(tAVCT_BCB *p_bcb, tAVCT_LCB_EVT *p_data);
extern void avct_bcb_bind_conn(tAVCT_BCB *p_bcb, tAVCT_LCB_EVT *p_data);
extern void avct_bcb_chk_disc(tAVCT_BCB *p_bcb, tAVCT_LCB_EVT *p_data);
extern void avct_bcb_chnl_disc(tAVCT_BCB *p_bcb, tAVCT_LCB_EVT *p_data);
extern void avct_bcb_bind_fail(tAVCT_BCB *p_bcb, tAVCT_LCB_EVT *p_data);
extern void avct_bcb_cong_ind(tAVCT_BCB *p_bcb, tAVCT_LCB_EVT *p_data);
extern void avct_bcb_discard_msg(tAVCT_BCB *p_bcb, tAVCT_LCB_EVT *p_data);
extern void avct_bcb_send_msg(tAVCT_BCB *p_bcb, tAVCT_LCB_EVT *p_data);
extern void avct_bcb_msg_ind(tAVCT_BCB *p_bcb, tAVCT_LCB_EVT *p_data);
extern void avct_bcb_free_msg_ind(tAVCT_BCB *p_bcb, tAVCT_LCB_EVT *p_data);
extern void avct_bcb_dealloc(tAVCT_BCB *p_bcb, tAVCT_LCB_EVT *p_data);
extern const tAVCT_BCB_ACTION avct_bcb_action[];
extern const UINT8 avct_lcb_pkt_type_len[];
extern const tL2CAP_FCR_OPTS avct_l2c_br_fcr_opts_def;
#endif
/* CCB function declarations */
extern tAVCT_CCB *avct_ccb_alloc(tAVCT_CC *p_cc);
extern void avct_ccb_dealloc(tAVCT_CCB *p_ccb, UINT8 event, UINT16 result, BD_ADDR bd_addr);
extern UINT8 avct_ccb_to_idx(tAVCT_CCB *p_ccb);
extern tAVCT_CCB *avct_ccb_by_idx(UINT8 idx);
/*****************************************************************************
** global data
*****************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
/* Main control block */
#if AVCT_DYNAMIC_MEMORY == FALSE
extern tAVCT_CB avct_cb;
#else
extern tAVCT_CB *avct_cb_ptr;
#define avct_cb (*avct_cb_ptr)
#endif
/* L2CAP callback registration structure */
extern const tL2CAP_APPL_INFO avct_l2c_appl;
#if (AVCT_BROWSE_INCLUDED == TRUE)
extern const tL2CAP_APPL_INFO avct_l2c_br_appl;
#endif
#ifdef __cplusplus
}
#endif
#endif /* AVCT_INT_H */

View File

@ -203,6 +203,9 @@ typedef UINT8 AVDT_REPORT_TYPE;
#define AVDT_NSC_RECONFIG 0x02 /* Reconfigure command not supported */
#define AVDT_NSC_SECURITY 0x04 /* Security command not supported */
/* AVDT disconnection reason */
#define AVDT_DISC_RSN_NORMAL 0
#define AVDT_DISC_RSN_ABNORMAL (0xce) /* unintentional disconnection */
/*****************************************************************************
** Type Definitions
*****************************************************************************/

5
tools/sdk/include/bluedroid/avdt_defs.h Executable file → Normal file
View File

@ -24,6 +24,9 @@
******************************************************************************/
#ifndef AVDT_DEFS_H
#define AVDT_DEFS_H
#include "bt_target.h"
#if (AVDT_INCLUDED == TRUE)
/*****************************************************************************
** constants
@ -199,5 +202,7 @@
#define AVDT_MSG_BLD_NOSP(p, nosp) \
*(p)++ = (UINT8) (nosp);
#endif ///AVRC_INCLUDED == TRUE
#endif /* AVDT_DEFS_H */

View File

@ -0,0 +1,748 @@
/******************************************************************************
*
* Copyright (C) 2002-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.
*
******************************************************************************/
/******************************************************************************
*
* This file contains interfaces which are internal to AVDTP.
*
******************************************************************************/
#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"
#if (AVRC_INCLUDED == TRUE)
#ifndef AVDT_DEBUG
#define AVDT_DEBUG FALSE
#endif
/*****************************************************************************
** constants
*****************************************************************************/
/* channel types */
enum {
AVDT_CHAN_SIG, /* signaling channel */
AVDT_CHAN_MEDIA, /* media channel */
#if AVDT_REPORTING == TRUE
AVDT_CHAN_REPORT, /* reporting channel */
#endif
AVDT_CHAN_NUM_TYPES
};
/* protocol service capabilities of this AVDTP implementation */
/* for now multiplexing will be used only for fragmentation */
#if ((AVDT_MULTIPLEXING == TRUE) && (AVDT_REPORTING == TRUE))
#define AVDT_PSC (AVDT_PSC_TRANS | AVDT_PSC_MUX | AVDT_PSC_REPORT | AVDT_PSC_DELAY_RPT)
#define AVDT_LEG_PSC (AVDT_PSC_TRANS | AVDT_PSC_MUX | AVDT_PSC_REPORT)
#else /* AVDT_MULTIPLEXING && AVDT_REPORTING */
#if (AVDT_MULTIPLEXING == TRUE)
#define AVDT_PSC (AVDT_PSC_TRANS | AVDT_PSC_MUX | AVDT_PSC_DELAY_RPT)
#define AVDT_LEG_PSC (AVDT_PSC_TRANS | AVDT_PSC_MUX)
#else /* AVDT_MULTIPLEXING */
#if (AVDT_REPORTING == TRUE)
#define AVDT_PSC (AVDT_PSC_TRANS | AVDT_PSC_REPORT | AVDT_PSC_DELAY_RPT)
#define AVDT_LEG_PSC (AVDT_PSC_TRANS | AVDT_PSC_REPORT)
#else /* AVDT_REPORTING */
#define AVDT_PSC (AVDT_PSC_TRANS | AVDT_PSC_DELAY_RPT)
#define AVDT_LEG_PSC (AVDT_PSC_TRANS)
#endif /* AVDT_REPORTING */
#endif /* AVDT_MULTIPLEXING */
#endif /* AVDT_MULTIPLEXING && AVDT_REPORTING */
/* initiator/acceptor signaling roles */
#define AVDT_CLOSE_ACP 0
#define AVDT_CLOSE_INT 1
#define AVDT_OPEN_ACP 2
#define AVDT_OPEN_INT 3
/* states for avdt_scb_verify */
#define AVDT_VERIFY_OPEN 0
#define AVDT_VERIFY_STREAMING 1
#define AVDT_VERIFY_SUSPEND 2
#define AVDT_VERIFY_START 3
/* to distinguish CCB events from SCB events */
#define AVDT_CCB_MKR 0x80
/* offset where AVDTP signaling message header starts in message */
#define AVDT_HDR_OFFSET (L2CAP_MIN_OFFSET + AVDT_NUM_SEPS)
/* offset where AVDTP signaling message content starts;
** use the size of a start header since it's the largest possible
** layout of signaling message in a buffer is:
**
** | BT_HDR | SCB handles | L2CAP + HCI header | AVDTP header | data ... |
**
** Note that we "hide" the scb handles at the top of the message buffer.
*/
#define AVDT_MSG_OFFSET (L2CAP_MIN_OFFSET + AVDT_NUM_SEPS + AVDT_LEN_TYPE_START)
/* scb transport channel connect timeout value */
#define AVDT_SCB_TC_CONN_TOUT 10
/* scb transport channel disconnect timeout value */
#define AVDT_SCB_TC_DISC_TOUT 10
/* maximum number of command retransmissions */
#ifndef AVDT_RET_MAX
#define AVDT_RET_MAX 1
#endif
/* ccb state machine states */
enum {
AVDT_CCB_IDLE_ST,
AVDT_CCB_OPENING_ST,
AVDT_CCB_OPEN_ST,
AVDT_CCB_CLOSING_ST
};
/* state machine action enumeration list */
enum {
AVDT_CCB_CHAN_OPEN,
AVDT_CCB_CHAN_CLOSE,
AVDT_CCB_CHK_CLOSE,
AVDT_CCB_HDL_DISCOVER_CMD,
AVDT_CCB_HDL_DISCOVER_RSP,
AVDT_CCB_HDL_GETCAP_CMD,
AVDT_CCB_HDL_GETCAP_RSP,
AVDT_CCB_HDL_START_CMD,
AVDT_CCB_HDL_START_RSP,
AVDT_CCB_HDL_SUSPEND_CMD,
AVDT_CCB_HDL_SUSPEND_RSP,
AVDT_CCB_SND_DISCOVER_CMD,
AVDT_CCB_SND_DISCOVER_RSP,
AVDT_CCB_SND_GETCAP_CMD,
AVDT_CCB_SND_GETCAP_RSP,
AVDT_CCB_SND_START_CMD,
AVDT_CCB_SND_START_RSP,
AVDT_CCB_SND_SUSPEND_CMD,
AVDT_CCB_SND_SUSPEND_RSP,
AVDT_CCB_CLEAR_CMDS,
AVDT_CCB_CMD_FAIL,
AVDT_CCB_FREE_CMD,
AVDT_CCB_CONG_STATE,
AVDT_CCB_RET_CMD,
AVDT_CCB_SND_CMD,
AVDT_CCB_SND_MSG,
AVDT_CCB_SET_RECONN,
AVDT_CCB_CLR_RECONN,
AVDT_CCB_CHK_RECONN,
AVDT_CCB_CHK_TIMER,
AVDT_CCB_SET_CONN,
AVDT_CCB_SET_DISCONN,
AVDT_CCB_DO_DISCONN,
AVDT_CCB_LL_CLOSED,
AVDT_CCB_LL_OPENED,
AVDT_CCB_DEALLOC,
AVDT_CCB_NUM_ACTIONS
};
#define AVDT_CCB_IGNORE AVDT_CCB_NUM_ACTIONS
/* ccb state machine events */
enum {
AVDT_CCB_API_DISCOVER_REQ_EVT,
AVDT_CCB_API_GETCAP_REQ_EVT,
AVDT_CCB_API_START_REQ_EVT,
AVDT_CCB_API_SUSPEND_REQ_EVT,
AVDT_CCB_API_DISCOVER_RSP_EVT,
AVDT_CCB_API_GETCAP_RSP_EVT,
AVDT_CCB_API_START_RSP_EVT,
AVDT_CCB_API_SUSPEND_RSP_EVT,
AVDT_CCB_API_CONNECT_REQ_EVT,
AVDT_CCB_API_DISCONNECT_REQ_EVT,
AVDT_CCB_MSG_DISCOVER_CMD_EVT,
AVDT_CCB_MSG_GETCAP_CMD_EVT,
AVDT_CCB_MSG_START_CMD_EVT,
AVDT_CCB_MSG_SUSPEND_CMD_EVT,
AVDT_CCB_MSG_DISCOVER_RSP_EVT,
AVDT_CCB_MSG_GETCAP_RSP_EVT,
AVDT_CCB_MSG_START_RSP_EVT,
AVDT_CCB_MSG_SUSPEND_RSP_EVT,
AVDT_CCB_RCVRSP_EVT,
AVDT_CCB_SENDMSG_EVT,
AVDT_CCB_RET_TOUT_EVT,
AVDT_CCB_RSP_TOUT_EVT,
AVDT_CCB_IDLE_TOUT_EVT,
AVDT_CCB_UL_OPEN_EVT,
AVDT_CCB_UL_CLOSE_EVT,
AVDT_CCB_LL_OPEN_EVT,
AVDT_CCB_LL_CLOSE_EVT,
AVDT_CCB_LL_CONG_EVT
};
/* scb state machine states; these state values are private to this module so
** the scb state cannot be read or set by actions functions
*/
enum {
AVDT_SCB_IDLE_ST,
AVDT_SCB_CONF_ST,
AVDT_SCB_OPENING_ST,
AVDT_SCB_OPEN_ST,
AVDT_SCB_STREAM_ST,
AVDT_SCB_CLOSING_ST
};
/* state machine action enumeration list */
enum {
AVDT_SCB_HDL_ABORT_CMD,
AVDT_SCB_HDL_ABORT_RSP,
AVDT_SCB_HDL_CLOSE_CMD,
AVDT_SCB_HDL_CLOSE_RSP,
AVDT_SCB_HDL_GETCONFIG_CMD,
AVDT_SCB_HDL_GETCONFIG_RSP,
AVDT_SCB_HDL_OPEN_CMD,
AVDT_SCB_HDL_OPEN_REJ,
AVDT_SCB_HDL_OPEN_RSP,
AVDT_SCB_HDL_PKT,
AVDT_SCB_DROP_PKT,
AVDT_SCB_HDL_RECONFIG_CMD,
AVDT_SCB_HDL_RECONFIG_RSP,
AVDT_SCB_HDL_SECURITY_CMD,
AVDT_SCB_HDL_SECURITY_RSP,
AVDT_SCB_HDL_SETCONFIG_CMD,
AVDT_SCB_HDL_SETCONFIG_REJ,
AVDT_SCB_HDL_SETCONFIG_RSP,
AVDT_SCB_HDL_START_CMD,
AVDT_SCB_HDL_START_RSP,
AVDT_SCB_HDL_SUSPEND_CMD,
AVDT_SCB_HDL_SUSPEND_RSP,
AVDT_SCB_HDL_TC_CLOSE,
#if AVDT_REPORTING == TRUE
AVDT_SCB_HDL_TC_CLOSE_STO,
#endif
AVDT_SCB_HDL_TC_OPEN,
#if AVDT_REPORTING == TRUE
AVDT_SCB_HDL_TC_OPEN_STO,
#endif
AVDT_SCB_SND_DELAY_RPT_REQ,
AVDT_SCB_HDL_DELAY_RPT_CMD,
AVDT_SCB_HDL_DELAY_RPT_RSP,
AVDT_SCB_HDL_WRITE_REQ,
AVDT_SCB_SND_ABORT_REQ,
AVDT_SCB_SND_ABORT_RSP,
AVDT_SCB_SND_CLOSE_REQ,
AVDT_SCB_SND_STREAM_CLOSE,
AVDT_SCB_SND_CLOSE_RSP,
AVDT_SCB_SND_GETCONFIG_REQ,
AVDT_SCB_SND_GETCONFIG_RSP,
AVDT_SCB_SND_OPEN_REQ,
AVDT_SCB_SND_OPEN_RSP,
AVDT_SCB_SND_RECONFIG_REQ,
AVDT_SCB_SND_RECONFIG_RSP,
AVDT_SCB_SND_SECURITY_REQ,
AVDT_SCB_SND_SECURITY_RSP,
AVDT_SCB_SND_SETCONFIG_REQ,
AVDT_SCB_SND_SETCONFIG_REJ,
AVDT_SCB_SND_SETCONFIG_RSP,
AVDT_SCB_SND_TC_CLOSE,
AVDT_SCB_CB_ERR,
AVDT_SCB_CONG_STATE,
AVDT_SCB_REJ_STATE,
AVDT_SCB_REJ_IN_USE,
AVDT_SCB_REJ_NOT_IN_USE,
AVDT_SCB_SET_REMOVE,
AVDT_SCB_FREE_PKT,
AVDT_SCB_CLR_PKT,
AVDT_SCB_CHK_SND_PKT,
AVDT_SCB_TC_TIMER,
AVDT_SCB_CLR_VARS,
AVDT_SCB_DEALLOC,
AVDT_SCB_NUM_ACTIONS
};
#define AVDT_SCB_IGNORE AVDT_SCB_NUM_ACTIONS
/* scb state machine events */
enum {
AVDT_SCB_API_REMOVE_EVT,
AVDT_SCB_API_WRITE_REQ_EVT,
AVDT_SCB_API_GETCONFIG_REQ_EVT,
AVDT_SCB_API_DELAY_RPT_REQ_EVT,
AVDT_SCB_API_SETCONFIG_REQ_EVT,
AVDT_SCB_API_OPEN_REQ_EVT,
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TC_OPEN_EVT,
AVDT_SCB_TC_CLOSE_EVT,
AVDT_SCB_TC_CONG_EVT,
AVDT_SCB_TC_DATA_EVT,
AVDT_SCB_CC_CLOSE_EVT
};
/* adaption layer number of stream routing table entries */
#if AVDT_REPORTING == TRUE
/* 2 channels(1 media, 1 report) for each SEP and one for signalling */
#define AVDT_NUM_RT_TBL ((AVDT_NUM_SEPS<<1) + 1)
#else
#define AVDT_NUM_RT_TBL (AVDT_NUM_SEPS + 1)
#endif
/* adaption layer number of transport channel table entries - moved to target.h
#define AVDT_NUM_TC_TBL (AVDT_NUM_SEPS + AVDT_NUM_LINKS) */
/* "states" used in transport channel table */
#define AVDT_AD_ST_UNUSED 0 /* Unused - unallocated */
#define AVDT_AD_ST_IDLE 1 /* No connection */
#define AVDT_AD_ST_ACP 2 /* Waiting to accept a connection */
#define AVDT_AD_ST_INT 3 /* Initiating a connection */
#define AVDT_AD_ST_CONN 4 /* Waiting for connection confirm */
#define AVDT_AD_ST_CFG 5 /* Waiting for configuration complete */
#define AVDT_AD_ST_OPEN 6 /* Channel opened */
#define AVDT_AD_ST_SEC_INT 7 /* Security process as INT */
#define AVDT_AD_ST_SEC_ACP 8 /* Security process as ACP */
/* Configuration flags. tAVDT_TC_TBL.cfg_flags */
#define AVDT_L2C_CFG_IND_DONE (1<<0)
#define AVDT_L2C_CFG_CFM_DONE (1<<1)
#define AVDT_L2C_CFG_CONN_INT (1<<2)
#define AVDT_L2C_CFG_CONN_ACP (1<<3)
/* result code for avdt_ad_write_req() (L2CA_DataWrite()) */
#define AVDT_AD_FAILED L2CAP_DW_FAILED /* FALSE */
#define AVDT_AD_SUCCESS L2CAP_DW_SUCCESS /* TRUE */
#define AVDT_AD_CONGESTED L2CAP_DW_CONGESTED /* 2 */
/*****************************************************************************
** data types
*****************************************************************************/
/* msg union of all message parameter types */
typedef union {
tAVDT_EVT_HDR hdr;
tAVDT_EVT_HDR single;
tAVDT_SETCONFIG config_cmd;
tAVDT_CONFIG reconfig_cmd;
tAVDT_MULTI multi;
tAVDT_SECURITY security_cmd;
tAVDT_DISCOVER discover_rsp;
tAVDT_CONFIG svccap;
tAVDT_SECURITY security_rsp;
tAVDT_DELAY_RPT delay_rpt_cmd;
} tAVDT_MSG;
/* data type for AVDT_CCB_API_DISCOVER_REQ_EVT */
typedef struct {
tAVDT_CTRL_CBACK *p_cback;
tAVDT_SEP_INFO *p_sep_info;
UINT8 num_seps;
} tAVDT_CCB_API_DISCOVER;
/* data type for AVDT_CCB_API_GETCAP_REQ_EVT */
typedef struct {
tAVDT_EVT_HDR single;
tAVDT_CTRL_CBACK *p_cback;
tAVDT_CFG *p_cfg;
} tAVDT_CCB_API_GETCAP;
/* data type for AVDT_CCB_API_CONNECT_REQ_EVT */
typedef struct {
tAVDT_CTRL_CBACK *p_cback;
UINT8 sec_mask;
} tAVDT_CCB_API_CONNECT;
/* data type for AVDT_CCB_API_DISCONNECT_REQ_EVT */
typedef struct {
tAVDT_CTRL_CBACK *p_cback;
} tAVDT_CCB_API_DISCONNECT;
/* union associated with ccb state machine events */
typedef union {
tAVDT_CCB_API_DISCOVER discover;
tAVDT_CCB_API_GETCAP getcap;
tAVDT_CCB_API_CONNECT connect;
tAVDT_CCB_API_DISCONNECT disconnect;
tAVDT_MSG msg;
BOOLEAN llcong;
UINT8 err_code;
} tAVDT_CCB_EVT;
/* channel control block type */
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 */
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 */
BT_HDR *p_curr_cmd; /* Current command being sent awaiting response */
BT_HDR *p_curr_msg; /* Current message being sent */
BT_HDR *p_rx_msg; /* Current message being received */
BOOLEAN allocated; /* Whether ccb is allocated */
UINT8 state; /* The CCB state machine state */
BOOLEAN ll_opened; /* TRUE if LL is opened */
BOOLEAN proc_busy; /* TRUE when a discover or get capabilities procedure in progress */
UINT8 proc_param; /* Procedure parameter; either SEID for get capabilities or number of SEPS for discover */
BOOLEAN cong; /* Whether signaling channel is congested */
UINT8 label; /* Message header "label" (sequence number) */
BOOLEAN reconn; /* If TRUE, reinitiate connection after transitioning from CLOSING to IDLE state */
UINT8 ret_count; /* Command retransmission count */
UINT8 disc_rsn; /* disconnection reason */
} tAVDT_CCB;
/* type for action functions */
typedef void (*tAVDT_CCB_ACTION)(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
/* type for AVDT_SCB_API_WRITE_REQ_EVT */
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 */
UINT8 *p_data;
UINT32 data_len;
#endif
UINT8 m_pt;
tAVDT_DATA_OPT_MASK opt;
} tAVDT_SCB_APIWRITE;
/* type for AVDT_SCB_TC_CLOSE_EVT */
typedef struct {
UINT8 old_tc_state; /* channel state before closed */
UINT8 tcid; /* TCID */
UINT8 type; /* channel type */
UINT8 disc_rsn; /* disconnection reason */
} tAVDT_SCB_TC_CLOSE;
/* type for scb event data */
typedef union {
tAVDT_MSG msg;
tAVDT_SCB_APIWRITE apiwrite;
tAVDT_DELAY_RPT apidelay;
tAVDT_OPEN open;
tAVDT_SCB_TC_CLOSE close;
BOOLEAN llcong;
BT_HDR *p_pkt;
} tAVDT_SCB_EVT;
/* stream control block type */
typedef struct {
tAVDT_CS cs; /* stream creation struct */
tAVDT_CFG curr_cfg; /* current configuration */
tAVDT_CFG req_cfg; /* requested configuration */
TIMER_LIST_ENT timer_entry; /* timer entry */
BT_HDR *p_pkt; /* packet waiting to be sent */
tAVDT_CCB *p_ccb; /* ccb associated with this scb */
UINT16 media_seq; /* media packet sequence number */
BOOLEAN allocated; /* whether scb is allocated or unused */
BOOLEAN in_use; /* whether stream being used by peer */
BOOLEAN sink_activated; /* A2DP Sink activated/de-activated from Application */
UINT8 role; /* initiator/acceptor role in current procedure */
BOOLEAN remove; /* whether CB is marked for removal */
UINT8 state; /* state machine state */
UINT8 peer_seid; /* SEID of peer stream */
UINT8 curr_evt; /* current event; set only by state machine */
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 */
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 */
UINT8 *p_media_buf; /* buffer for media packet assigned by AVDT_SetMediaBuf */
UINT32 media_buf_len; /* length of buffer for media packet assigned by AVDT_SetMediaBuf */
#endif
} tAVDT_SCB;
/* type for action functions */
typedef void (*tAVDT_SCB_ACTION)(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
/* adaption layer type for transport channel table */
typedef struct {
UINT16 peer_mtu; /* L2CAP mtu of the peer device */
UINT16 my_mtu; /* Our MTU for this channel */
UINT16 my_flush_to; /* Our flush timeout for this channel */
UINT16 lcid;
UINT8 tcid; /* transport channel id */
UINT8 ccb_idx; /* channel control block associated with this tc */
UINT8 state; /* transport channel state */
UINT8 cfg_flags; /* L2CAP configuration flags */
UINT8 id;
} tAVDT_TC_TBL;
/* adaption layer type for stream routing table */
typedef struct {
UINT16 lcid; /* L2CAP LCID of the associated transport channel */
UINT8 scb_hdl; /* stream control block associated with this tc */
} tAVDT_RT_TBL;
/* adaption layer control block */
typedef struct {
tAVDT_RT_TBL rt_tbl[AVDT_NUM_LINKS][AVDT_NUM_RT_TBL];
tAVDT_TC_TBL tc_tbl[AVDT_NUM_TC_TBL];
UINT8 lcid_tbl[MAX_L2CAP_CHANNELS]; /* map LCID to tc_tbl index */
} tAVDT_AD;
/* Control block for AVDT */
typedef struct {
tAVDT_REG rcb; /* registration control block */
tAVDT_CCB ccb[AVDT_NUM_LINKS]; /* channel control blocks */
tAVDT_SCB scb[AVDT_NUM_SEPS]; /* stream control blocks */
tAVDT_AD ad; /* adaption layer control block */
tAVDTC_CTRL_CBACK *p_conf_cback; /* conformance callback function */
tAVDT_CCB_ACTION *p_ccb_act; /* pointer to CCB action functions */
tAVDT_SCB_ACTION *p_scb_act; /* pointer to SCB action functions */
tAVDT_CTRL_CBACK *p_conn_cback; /* connection callback function */
UINT8 trace_level; /* trace level */
} tAVDT_CB;
/*****************************************************************************
** function declarations
*****************************************************************************/
/* CCB function declarations */
extern void avdt_ccb_init(void);
extern void avdt_ccb_event(tAVDT_CCB *p_ccb, UINT8 event, tAVDT_CCB_EVT *p_data);
extern tAVDT_CCB *avdt_ccb_by_bd(BD_ADDR bd_addr);
extern tAVDT_CCB *avdt_ccb_alloc(BD_ADDR bd_addr);
extern void avdt_ccb_dealloc(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern UINT8 avdt_ccb_to_idx(tAVDT_CCB *p_ccb);
extern tAVDT_CCB *avdt_ccb_by_idx(UINT8 idx);
/* CCB action functions */
extern void avdt_ccb_chan_open(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_chan_close(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_chk_close(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_hdl_discover_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_hdl_discover_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_hdl_getcap_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_hdl_getcap_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_hdl_start_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_hdl_start_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_hdl_suspend_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_hdl_suspend_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_snd_discover_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_snd_discover_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_snd_getcap_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_snd_getcap_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_snd_start_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_snd_start_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_snd_suspend_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_snd_suspend_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_clear_cmds(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_cmd_fail(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_free_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_cong_state(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_ret_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_snd_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_snd_msg(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_set_reconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_clr_reconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_chk_reconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_chk_timer(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_set_conn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_set_disconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_do_disconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_ll_closed(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
extern void avdt_ccb_ll_opened(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
/* SCB function prototypes */
extern void avdt_scb_event(tAVDT_SCB *p_scb, UINT8 event, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_init(void);
extern tAVDT_SCB *avdt_scb_alloc(tAVDT_CS *p_cs);
extern void avdt_scb_dealloc(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern UINT8 avdt_scb_to_hdl(tAVDT_SCB *p_scb);
extern tAVDT_SCB *avdt_scb_by_hdl(UINT8 hdl);
extern UINT8 avdt_scb_verify(tAVDT_CCB *p_ccb, UINT8 state, UINT8 *p_seid, UINT16 num_seid, UINT8 *p_err_code);
extern void avdt_scb_peer_seid_list(tAVDT_MULTI *p_multi);
extern UINT32 avdt_scb_gen_ssrc(tAVDT_SCB *p_scb);
/* SCB action functions */
extern void avdt_scb_hdl_abort_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_abort_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_close_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_close_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_getconfig_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_getconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_open_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_open_rej(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_open_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_drop_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_reconfig_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_reconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_security_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_security_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_setconfig_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_setconfig_rej(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_setconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_start_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_start_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_suspend_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_suspend_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_snd_delay_rpt_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_delay_rpt_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_delay_rpt_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_tc_close(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_tc_open(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_tc_close_sto(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_tc_open_sto(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_hdl_write_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_snd_abort_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_snd_abort_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_snd_close_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_snd_stream_close(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_snd_close_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_snd_getconfig_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_snd_getconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_snd_open_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_snd_open_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_snd_reconfig_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_snd_reconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_snd_security_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_snd_security_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_snd_setconfig_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_snd_setconfig_rej(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_snd_setconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_snd_tc_close(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_cb_err(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_cong_state(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_rej_state(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_rej_in_use(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_rej_not_in_use(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_set_remove(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_free_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
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);
/* msg function declarations */
extern BOOLEAN avdt_msg_send(tAVDT_CCB *p_ccb, BT_HDR *p_msg);
extern void avdt_msg_send_cmd(tAVDT_CCB *p_ccb, void *p_scb, UINT8 sig_id, tAVDT_MSG *p_params);
extern void avdt_msg_send_rsp(tAVDT_CCB *p_ccb, UINT8 sig_id, tAVDT_MSG *p_params);
extern void avdt_msg_send_rej(tAVDT_CCB *p_ccb, UINT8 sig_id, tAVDT_MSG *p_params);
extern void avdt_msg_send_grej(tAVDT_CCB *p_ccb, UINT8 sig_id, tAVDT_MSG *p_params);
extern void avdt_msg_ind(tAVDT_CCB *p_ccb, BT_HDR *p_buf);
/* adaption layer function declarations */
extern void avdt_ad_init(void);
extern UINT8 avdt_ad_type_to_tcid(UINT8 type, tAVDT_SCB *p_scb);
extern tAVDT_TC_TBL *avdt_ad_tc_tbl_by_st(UINT8 type, tAVDT_CCB *p_ccb, UINT8 state);
extern tAVDT_TC_TBL *avdt_ad_tc_tbl_by_lcid(UINT16 lcid);
extern tAVDT_TC_TBL *avdt_ad_tc_tbl_alloc(tAVDT_CCB *p_ccb);
extern UINT8 avdt_ad_tc_tbl_to_idx(tAVDT_TC_TBL *p_tbl);
extern void avdt_ad_tc_close_ind(tAVDT_TC_TBL *p_tbl, UINT16 reason);
extern void avdt_ad_tc_open_ind(tAVDT_TC_TBL *p_tbl);
extern void avdt_ad_tc_cong_ind(tAVDT_TC_TBL *p_tbl, BOOLEAN is_congested);
extern void avdt_ad_tc_data_ind(tAVDT_TC_TBL *p_tbl, BT_HDR *p_buf);
extern tAVDT_TC_TBL *avdt_ad_tc_tbl_by_type(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb);
extern UINT8 avdt_ad_write_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, BT_HDR *p_buf);
extern void avdt_ad_open_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, UINT8 role);
extern void avdt_ad_close_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb);
extern void avdt_process_timeout(TIMER_LIST_ENT *p_tle);
/*****************************************************************************
** macros
*****************************************************************************/
/* we store the scb and the label in the layer_specific field of the
** current cmd
*/
#define AVDT_BLD_LAYERSPEC(ls, msg, label) \
ls = (((label) << 4) | (msg))
#define AVDT_LAYERSPEC_LABEL(ls) ((UINT8)((ls) >> 4))
#define AVDT_LAYERSPEC_MSG(ls) ((UINT8)((ls) & 0x000F))
/*****************************************************************************
** global data
*****************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
/******************************************************************************
** Main Control Block
*******************************************************************************/
#if AVDT_DYNAMIC_MEMORY == FALSE
extern tAVDT_CB avdt_cb;
#else
extern tAVDT_CB *avdt_cb_ptr;
#define avdt_cb (*avdt_cb_ptr)
#endif
/* L2CAP callback registration structure */
extern const tL2CAP_APPL_INFO avdt_l2c_appl;
/* reject message event lookup table */
extern const UINT8 avdt_msg_rej_2_evt[];
#ifdef __cplusplus
}
#endif
#endif ///AVRC_INCLUDED == TRUE
#endif /* AVDT_INT_H */

0
tools/sdk/include/bluedroid/avdtc_api.h Executable file → Normal file
View File

View File

@ -27,7 +27,7 @@
#include "avct_api.h"
#include "sdp_api.h"
#include "avrc_defs.h"
#if (AVRC_INCLUDED == TRUE)
/*****************************************************************************
** constants
*****************************************************************************/
@ -634,4 +634,7 @@ extern BOOLEAN AVRC_IsValidPlayerAttr(UINT8 attr);
}
#endif
#endif ///AVRC_INCLUDED == TRUE
#endif /* AVRC_API_H */

View File

@ -23,7 +23,9 @@
******************************************************************************/
#ifndef _AVRC_DEFS_H
#define _AVRC_DEFS_H
#include "bt_target.h"
#if (AVRC_INCLUDED == TRUE)
/*****************************************************************************
** constants
*****************************************************************************/
@ -1356,5 +1358,5 @@ typedef union {
tAVRC_RSP add_to_play; /* AddToNowPlaying */
} tAVRC_RESPONSE;
#endif ///AVRC_INCLUDED == TRUE
#endif

View File

@ -0,0 +1,158 @@
/******************************************************************************
*
* Copyright (C) 2003-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.
*
******************************************************************************/
/******************************************************************************
*
* VRCP internal header file.
*
******************************************************************************/
#ifndef AVRC_INT_H
#define AVRC_INT_H
#include "avct_defs.h"
#include "avrc_api.h"
#if (AVRC_INCLUDED == TRUE)
/* DEBUG FLAGS
*
* #define META_DEBUG_ENABLED
*/
/*****************************************************************************
** Constants
*****************************************************************************/
/* Number of attributes in AVRC SDP record. */
#define AVRC_NUM_ATTR 6
/* Number of protocol elements in protocol element list. */
#define AVRC_NUM_PROTO_ELEMS 2
#ifndef AVRC_MIN_CMD_LEN
#define AVRC_MIN_CMD_LEN 20
#endif
#define AVRC_UNIT_OPRND_BYTES 5
#define AVRC_SUB_OPRND_BYTES 4
#define AVRC_SUBRSP_OPRND_BYTES 3
#define AVRC_SUB_PAGE_MASK 7
#define AVRC_SUB_PAGE_SHIFT 4
#define AVRC_SUB_EXT_CODE 7
#define AVRC_PASS_OP_ID_MASK 0x7F
#define AVRC_PASS_STATE_MASK 0x80
#define AVRC_CMD_OPRND_PAD 0xFF
#define AVRC_CTYPE_MASK 0x0F
#define AVRC_SUBTYPE_MASK 0xF8
#define AVRC_SUBTYPE_SHIFT 3
#define AVRC_SUBID_MASK 0x07
#define AVRC_SUBID_IGNORE 0x07
#define AVRC_SINGLE_PARAM_SIZE 1
#define AVRC_METADATA_PKT_TYPE_MASK 0x03
#define AVRC_PASS_THOUGH_MSG_MASK 0x80 /* MSB of msg_type indicates the PAS THROUGH msg */
#define AVRC_VENDOR_UNIQUE_MASK 0x70 /* vendor unique id */
/* Company ID is 24-bit integer We can not use the macros in bt_types.h */
#define AVRC_CO_ID_TO_BE_STREAM(p, u32) {*(p)++ = (UINT8)((u32) >> 16); *(p)++ = (UINT8)((u32) >> 8); *(p)++ = (UINT8)(u32); }
#define AVRC_BE_STREAM_TO_CO_ID(u32, p) {u32 = (((UINT32)(*((p) + 2))) + (((UINT32)(*((p) + 1))) << 8) + (((UINT32)(*(p))) << 16)); (p) += 3;}
#define AVRC_AVC_HDR_SIZE 3 /* ctype, subunit*, opcode */
#define AVRC_MIN_META_HDR_SIZE 4 /* pdu id(1), packet type(1), param len(2) */
#define AVRC_MIN_BROWSE_HDR_SIZE 3 /* pdu id(1), param len(2) */
#define AVRC_VENDOR_HDR_SIZE 6 /* ctype, subunit*, opcode, CO_ID */
#define AVRC_MSG_VENDOR_OFFSET 23
#define AVRC_MIN_VENDOR_SIZE (AVRC_MSG_VENDOR_OFFSET + BT_HDR_SIZE + AVRC_MIN_META_HDR_SIZE)
#define AVRC_PASS_THRU_SIZE 8
#define AVRC_MSG_PASS_THRU_OFFSET 25
#define AVRC_MIN_PASS_THRU_SIZE (AVRC_MSG_PASS_THRU_OFFSET + BT_HDR_SIZE + 4)
#define AVRC_MIN_BROWSE_SIZE (AVCT_BROWSE_OFFSET + BT_HDR_SIZE + AVRC_MIN_BROWSE_HDR_SIZE)
#define AVRC_CTRL_PKT_LEN(pf, pk) {pf = (UINT8 *)((pk) + 1) + (pk)->offset + 2;}
#define AVRC_MAX_CTRL_DATA_LEN (AVRC_PACKET_LEN)
/*****************************************************************************
** Type definitions
*****************************************************************************/
#if (AVRC_METADATA_INCLUDED == TRUE)
/* type for Metadata fragmentation control block */
typedef struct {
BT_HDR *p_fmsg; /* the fragmented message */
UINT8 frag_pdu; /* the PDU ID for fragmentation */
BOOLEAN frag_enabled; /* fragmentation flag */
} tAVRC_FRAG_CB;
/* type for Metadata re-assembly control block */
typedef struct {
BT_HDR *p_rmsg; /* the received message */
UINT16 rasm_offset; /* re-assembly flag, the offset of the start fragment */
UINT8 rasm_pdu; /* the PDU ID for re-assembly */
} tAVRC_RASM_CB;
#endif
typedef struct {
tAVRC_CONN_CB ccb[AVCT_NUM_CONN];
#if (AVRC_METADATA_INCLUDED == TRUE)
tAVRC_FRAG_CB fcb[AVCT_NUM_CONN];
tAVRC_RASM_CB rcb[AVCT_NUM_CONN];
#endif
tAVRC_FIND_CBACK *p_cback; /* pointer to application callback */
tSDP_DISCOVERY_DB *p_db; /* pointer to discovery database */
UINT16 service_uuid; /* service UUID to search */
UINT8 trace_level;
} tAVRC_CB;
#ifdef __cplusplus
extern "C"
{
#endif
/******************************************************************************
** Main Control Block
*******************************************************************************/
#if AVRC_DYNAMIC_MEMORY == FALSE
extern tAVRC_CB avrc_cb;
#else
extern tAVRC_CB *avrc_cb_ptr;
#define avrc_cb (*avrc_cb_ptr)
#endif
extern BOOLEAN avrc_is_valid_pdu_id(UINT8 pdu_id);
extern BOOLEAN avrc_is_valid_player_attrib_value(UINT8 attrib, UINT8 value);
extern BT_HDR *avrc_alloc_ctrl_pkt (UINT8 pdu);
extern tAVRC_STS avrc_pars_pass_thru(tAVRC_MSG_PASS *p_msg, UINT16 *p_vendor_unique_id);
extern UINT8 avrc_opcode_from_pdu(UINT8 pdu);
extern BOOLEAN avrc_is_valid_opcode(UINT8 opcode);
#ifdef __cplusplus
}
#endif
#endif ///AVRC_INCLUDED == TRUE
#endif /* AVRC_INT_H */

0
tools/sdk/include/bluedroid/bdaddr.h Executable file → Normal file
View File

View File

@ -92,6 +92,7 @@ typedef struct blufi_frag_hdr blufi_frag_hdr_t;
#define BLUFI_TYPE_CTRL_SUBTYPE_GET_WIFI_STATUS 0x05
#define BLUFI_TYPE_CTRL_SUBTYPE_DEAUTHENTICATE_STA 0x06
#define BLUFI_TYPE_CTRL_SUBTYPE_GET_VERSION 0x07
#define BLUFI_TYPE_CTRL_SUBTYPE_DISCONNECT_BLE 0x08
#define BLUFI_TYPE_DATA 0x1
#define BLUFI_TYPE_DATA_SUBTYPE_NEG 0x00

0
tools/sdk/include/bluedroid/bt_common_types.h Executable file → Normal file
View File

0
tools/sdk/include/bluedroid/bt_sdp.h Executable file → Normal file
View File

View File

@ -34,16 +34,87 @@
#include "bdroid_buildcfg.h"
#endif
#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
#define CLASSIC_BT_INCLUDED TRUE
#define BTA_SDP_INCLUDED TRUE
#define BTA_PAN_INCLUDED FALSE
#define BTA_HH_INCLUDED FALSE
#define BTA_AR_INCLUDED TRUE
#define BTA_AV_INCLUDED TRUE
#define BTA_AV_SINK_INCLUDED TRUE
#define SDP_INCLUDED TRUE
#define RFCOMM_INCLUDED FALSE
#define PAN_INCLUDED FALSE
#define HID_HOST_INCLUDED FALSE
#define AVDT_INCLUDED TRUE
#define A2D_INCLUDED TRUE
#define AVCT_INCLUDED TRUE
#define AVRC_INCLUDED TRUE
#define SBC_DEC_INCLUDED TRUE
#define SBC_ENC_INCLUDED FALSE
#define MCA_INCLUDED FALSE
#define BTC_SM_INCLUDED TRUE
#define BTC_PRF_QUEUE_INCLUDED TRUE
#define BTC_GAP_BT_INCLUDED TRUE
#define BTC_AV_INCLUDED TRUE
#ifndef CLASSIC_BT_INCLUDED
#define CLASSIC_BT_INCLUDED TRUE
#endif ///CLASSIC_BT_INCLUDED
#else /* #if CONFIG_CLASSIC_BT_ENABLED */
#define CLASSIC_BT_INCLUDED FALSE
#define BTA_SDP_INCLUDED FALSE
#define BTA_PAN_INCLUDED FALSE
#define BTA_HH_INCLUDED FALSE
#define BTA_AR_INCLUDED FALSE
#define BTA_AV_INCLUDED FALSE
#define BTA_AV_SINK_INCLUDED FALSE
#define SDP_INCLUDED FALSE
#define RFCOMM_INCLUDED FALSE
#define PAN_INCLUDED FALSE
#define HID_HOST_INCLUDED FALSE
#define AVDT_INCLUDED FALSE
#define A2D_INCLUDED FALSE
#define AVCT_INCLUDED FALSE
#define AVRC_INCLUDED FALSE
#define SBC_DEC_INCLUDED FALSE
#define SBC_ENC_INCLUDED FALSE
#define MCA_INCLUDED FALSE
#define BTC_SM_INCLUDED FALSE
#define BTC_PRF_QUEUE_INCLUDED FALSE
#define BTC_GAP_BT_INCLUDED FALSE
#define BTC_AV_INCLUDED FALSE
#endif /* #if CONFIG_CLASSIC_BT_ENABLED */
#if (CONFIG_GATTS_ENABLE)
#define GATTS_INCLUDED TRUE
#else
#define GATTS_INCLUDED FALSE
#endif /* CONFIG_GATTS_ENABLE */
#if (CONFIG_GATTC_ENABLE)
#define GATTC_INCLUDED TRUE
#else
#define GATTC_INCLUDED FALSE
#endif /* CONFIG_GATTC_ENABLE */
#if (CONFIG_SMP_ENABLE)
#define SMP_INCLUDED TRUE
#define BLE_PRIVACY_SPT TRUE
#else
#define SMP_INCLUDED FALSE
#define BLE_PRIVACY_SPT FALSE
#endif /* CONFIG_GATTC_ENABLE */
#if (CONFIG_BT_ACL_CONNECTIONS)
#define MAX_ACL_CONNECTIONS CONFIG_BT_ACL_CONNECTIONS
#define GATT_MAX_PHY_CHANNEL CONFIG_BT_ACL_CONNECTIONS
#endif /* CONFIG_BT_ACL_CONNECTIONS */
//------------------Added from bdroid_buildcfg.h---------------------
#ifndef L2CAP_EXTFEA_SUPPORTED_MASK
@ -91,15 +162,15 @@
#endif
#ifndef BTA_AR_INCLUDED
#define BTA_AR_INCLUDED FALSE//TRUE
#define BTA_AR_INCLUDED TRUE//TRUE
#endif
#ifndef BTA_AV_INCLUDED
#define BTA_AV_INCLUDED FALSE//TRUE
#define BTA_AV_INCLUDED TRUE//TRUE
#endif
#ifndef BTA_AV_SINK_INCLUDED
#define BTA_AV_SINK_INCLUDED FALSE//FALSE
#define BTA_AV_SINK_INCLUDED TRUE//FALSE
#endif
#ifndef BTA_DISABLE_DELAY
@ -157,7 +228,7 @@
#endif
#ifndef BT_USE_TRACES
#define BT_USE_TRACES TRUE
#define BT_USE_TRACES FALSE
#endif
#ifndef BT_TRACE_BTIF
@ -431,9 +502,9 @@
#define BTM_SCO_DATA_SIZE_MAX 240
#endif
/* The size in bytes of the BTM inquiry database. 40 As Default */
/* The size in bytes of the BTM inquiry database. 5 As Default */
#ifndef BTM_INQ_DB_SIZE
#define BTM_INQ_DB_SIZE 32
#define BTM_INQ_DB_SIZE 5
#endif
/* The default scan mode */
@ -466,7 +537,7 @@
#define BTM_DEFAULT_DISC_INTERVAL 0x0800
#endif
/* Default class of device
/*
* {SERVICE_CLASS, MAJOR_CLASS, MINOR_CLASS}
*
* SERVICE_CLASS:0x5A (Bit17 -Networking,Bit19 - Capturing,Bit20 -Object Transfer,Bit22 -Telephony)
@ -474,13 +545,29 @@
* MINOR_CLASS:0x0C - SMART_PHONE
*
*/
#define BTA_DM_COD_SMARTPHONE {0x5A, 0x02, 0x0C}
/*
* {SERVICE_CLASS, MAJOR_CLASS, MINOR_CLASS}
*
* SERVICE_CLASS:0x2C (Bit21 - Audio, Bit19 - Capturing)
* MAJOR_CLASS:0x04 - Audio/Video
* MINOR_CLASS:0x05 - LoudSpeaker
*/
#define BTA_DM_COD_LOUDSPEAKER {0x2C, 0x04, 0x14}
/* Default class of device */
#ifndef BTA_DM_COD
#define BTA_DM_COD {0x5A, 0x02, 0x0C}
#define BTA_DM_COD BTA_DM_COD_LOUDSPEAKER
#endif
/* The number of SCO links. */
#ifndef BTM_MAX_SCO_LINKS
#if (CLASSIC_BT_INCLUDED == TRUE)
#define BTM_MAX_SCO_LINKS 1 //3
#else ///CLASSIC_BT_INCLUDED == TRUE
#define BTM_MAX_SCO_LINKS 0
#endif ///CLASSIC_BT_INCLUDED == TRUE
#endif
/* The preferred type of SCO links (2-eSCO, 0-SCO). */
@ -573,11 +660,15 @@
/* The IO capability of the local device (for Simple Pairing) */
#ifndef BTM_LOCAL_IO_CAPS
#define BTM_LOCAL_IO_CAPS BTM_IO_CAP_IO
#define BTM_LOCAL_IO_CAPS BTM_IO_CAP_NONE
#endif
#ifndef BTM_LOCAL_IO_CAPS_BLE
#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
#define BTM_LOCAL_IO_CAPS_BLE BTM_IO_CAP_KBDISP
#else
#define BTM_LOCAL_IO_CAPS_BLE 4
#endif ///BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
#endif
/* The default MITM Protection Requirement (for Simple Pairing)
@ -599,7 +690,7 @@
/* TRUE to include Sniff Subrating */
#ifndef BTM_SSR_INCLUDED
#define BTM_SSR_INCLUDED TRUE
#define BTM_SSR_INCLUDED FALSE
#endif
/*************************
@ -626,22 +717,29 @@
#define L2CAP_CLIENT_INCLUDED FALSE
#endif
/* The maximum number of simultaneous links that L2CAP can support. Up to 7*/
#ifndef MAX_ACL_CONNECTIONS
#define MAX_L2CAP_LINKS 3
#define MAX_L2CAP_LINKS 5
#else
#define MAX_L2CAP_LINKS MAX_ACL_CONNECTIONS
#endif
/* The maximum number of simultaneous channels that L2CAP can support. Up to 16*/
#ifndef MAX_L2CAP_CHANNELS
#if (CLASSIC_BT_INCLUDED == TRUE)
#define MAX_L2CAP_CHANNELS 8
#else
#define MAX_L2CAP_CHANNELS 2 //Not support to create l2cap channels in the BLE only mode in this bluedroid version(6.0)
#endif ///CLASSIC_BT_INCLUDED == TRUE
#endif
/* The maximum number of simultaneous applications that can register with L2CAP. */
#ifndef MAX_L2CAP_CLIENTS
#if (CLASSIC_BT_INCLUDED == TRUE)
#define MAX_L2CAP_CLIENTS 8
#else
#define MAX_L2CAP_CLIENTS 1 //Not support to allocate a channel control block in BLE only mode
#endif ///CLASSIC_BT_INCLUDED == TRUE
#endif
/* The number of seconds of link inactivity before a link is disconnected. */
@ -727,7 +825,11 @@
/* Used for features using fixed channels; set to zero if no fixed channels supported (BLE, etc.) */
/* Excluding L2CAP signaling channel and UCD */
#ifndef L2CAP_NUM_FIXED_CHNLS
#if (CLASSIC_BT_INCLUDED == TRUE)
#define L2CAP_NUM_FIXED_CHNLS 32
#else
#define L2CAP_NUM_FIXED_CHNLS 3 //There are just three fix channel in the BLE only mode(gatt,signal,smp)
#endif ///CLASSIC_BT_INCLUDED == TRUE
#endif
/* First fixed channel supported */
@ -795,7 +897,7 @@
* resolution, local address rotation etc.
*/
#ifndef BLE_PRIVACY_SPT
#define BLE_PRIVACY_SPT TRUE
#define BLE_PRIVACY_SPT FALSE
#endif
/*
@ -907,7 +1009,7 @@
******************************************************************************/
#ifndef GATTC_INCLUDED
#if BLE_INCLUDED == TRUE
#define GATTC_INCLUDED TRUE
#define GATTC_INCLUDED FALSE
#else
#define GATTC_INCLUDED FALSE
#endif
@ -934,7 +1036,7 @@
******************************************************************************/
#ifndef SMP_INCLUDED
#if BLE_INCLUDED == TRUE
#define SMP_INCLUDED TRUE
#define SMP_INCLUDED FALSE
#else
#define SMP_INCLUDED FALSE
#endif
@ -1001,16 +1103,16 @@
/* The maximum number of SDP records the server can support. */
#ifndef SDP_MAX_RECORDS
#define SDP_MAX_RECORDS 15 /*max is 30*/
#define SDP_MAX_RECORDS 6 /*max is 30*/
#endif
/* The maximum number of attributes in each record. */
#ifndef SDP_MAX_REC_ATTR
#define SDP_MAX_REC_ATTR 25
#define SDP_MAX_REC_ATTR 8
#endif
#ifndef SDP_MAX_PAD_LEN
#define SDP_MAX_PAD_LEN 600
#define SDP_MAX_PAD_LEN 300
#endif
/* The maximum length, in bytes, of an attribute. */
@ -1326,17 +1428,17 @@ Range: 2 octets
******************************************************************************/
#ifndef AVDT_INCLUDED
#define AVDT_INCLUDED FALSE//TRUE
#define AVDT_INCLUDED TRUE
#endif
/* Include reporting capability in AVDTP */
#ifndef AVDT_REPORTING
#define AVDT_REPORTING FALSE//TRUE
#define AVDT_REPORTING TRUE
#endif
/* Include multiplexing capability in AVDTP */
#ifndef AVDT_MULTIPLEXING
#define AVDT_MULTIPLEXING FALSE//TRUE
#define AVDT_MULTIPLEXING TRUE
#endif
/* Number of simultaneous links to different peer devices. */
@ -1477,7 +1579,7 @@ Range: 2 octets
/* This is set to enable use of GAP L2CAP connections. */
#ifndef GAP_CONN_INCLUDED
#if GAP_INCLUDED == TRUE
#if (GAP_INCLUDED == TRUE && CLASSIC_BT_INCLUDED == TRUE)
#define GAP_CONN_INCLUDED TRUE
#else
#define GAP_CONN_INCLUDED FALSE
@ -1593,7 +1695,7 @@ Range: 2 octets
**
******************************************************************************/
#ifndef AVRC_INCLUDED
#define AVRC_INCLUDED FALSE
#define AVRC_INCLUDED TRUE
#endif
#ifndef AVRC_METADATA_INCLUDED

View File

@ -18,6 +18,7 @@
#ifndef _BT_TRACE_H_
#define _BT_TRACE_H_
#include "sdkconfig.h"
#include <stdio.h>
#include "bt_types.h"
@ -170,7 +171,7 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
/* Enables or disables all trace messages. */
#ifndef BT_USE_TRACES
#define BT_USE_TRACES TRUE
#define BT_USE_TRACES FALSE
#endif
/******************************************************************************
@ -270,11 +271,13 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
#ifndef LOG_LEVEL
#define LOG_LEVEL LOG_LEVEL_INFO
#endif
#define LOG_ERROR(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_ERROR) BT_PRINTF(fmt,## args);} while(0)
#define LOG_WARN(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_WARN) BT_PRINTF(fmt,## args);} while(0)
#define LOG_INFO(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_INFO) BT_PRINTF(fmt,## args);} while(0)
#define LOG_DEBUG(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_DEBUG) BT_PRINTF(fmt,## args);} while(0)
#define LOG_VERBOSE(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_VERBOSE) BT_PRINTF(fmt,## args);} while(0)
#if !CONFIG_BT_STACK_NO_LOG
#define LOG_ERROR(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_ERROR) BT_PRINTF(fmt,## args);} while(0)
#define LOG_WARN(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_WARN) BT_PRINTF(fmt,## args);} while(0)
#define LOG_INFO(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_INFO) BT_PRINTF(fmt,## args);} while(0)
#define LOG_DEBUG(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_DEBUG) BT_PRINTF(fmt,## args);} while(0)
#define LOG_VERBOSE(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_VERBOSE) BT_PRINTF(fmt,## args);} while(0)
/* Define tracing for the HCI unit
*/
@ -287,7 +290,7 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
*/
#define BTM_TRACE_ERROR(fmt, args...) {if (btm_cb.trace_level >= BT_TRACE_LEVEL_ERROR) BT_PRINTF(fmt, ## args);}
#define BTM_TRACE_WARNING(fmt, args...) {if (btm_cb.trace_level >= BT_TRACE_LEVEL_WARNING) BT_PRINTF(fmt, ## args);}
#define BTM_TRACE_API(fmt, args...) {if (btm_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define BTM_TRACE_API(fmt, args...) {if (btm_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define BTM_TRACE_EVENT(fmt, args...) {if (btm_cb.trace_level >= BT_TRACE_LEVEL_EVENT) BT_PRINTF(fmt, ## args);}
#define BTM_TRACE_DEBUG(fmt, args...) {if (btm_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) BT_PRINTF(fmt, ## args);}
@ -303,7 +306,7 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
*/
#define SDP_TRACE_ERROR(fmt, args...) {if (sdp_cb.trace_level >= BT_TRACE_LEVEL_ERROR) BT_PRINTF(fmt, ## args);}
#define SDP_TRACE_WARNING(fmt, args...) {if (sdp_cb.trace_level >= BT_TRACE_LEVEL_WARNING) BT_PRINTF(fmt, ## args);}
#define SDP_TRACE_API(fmt, args...) {if (sdp_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define SDP_TRACE_API(fmt, args...) {if (sdp_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define SDP_TRACE_EVENT(fmt, args...) {if (sdp_cb.trace_level >= BT_TRACE_LEVEL_EVENT) BT_PRINTF(fmt, ## args);}
#define SDP_TRACE_DEBUG(fmt, args...) {if (sdp_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) BT_PRINTF(fmt, ## args);}
@ -318,7 +321,7 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
/* Generic Access Profile traces */
#define GAP_TRACE_ERROR(fmt, args...) {if (gap_cb.trace_level >= BT_TRACE_LEVEL_ERROR) BT_PRINTF(fmt, ## args);}
#define GAP_TRACE_EVENT(fmt, args...) {if (gap_cb.trace_level >= BT_TRACE_LEVEL_EVENT) BT_PRINTF(fmt, ## args);}
#define GAP_TRACE_API(fmt, args...) {if (gap_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define GAP_TRACE_API(fmt, args...) {if (gap_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define GAP_TRACE_WARNING(fmt, args...) {if (gap_cb.trace_level >= BT_TRACE_LEVEL_WARNING) BT_PRINTF(fmt, ## args);}
/* define traces for HID Host */
@ -340,7 +343,7 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
#define PAN_TRACE_ERROR(fmt, args...) {if (pan_cb.trace_level >= BT_TRACE_LEVEL_ERROR) BT_PRINTF(fmt, ## args);}
#define PAN_TRACE_WARNING(fmt, args...) {if (pan_cb.trace_level >= BT_TRACE_LEVEL_WARNING) BT_PRINTF(fmt, ## args);}
#define PAN_TRACE_API(fmt, args...) {if (pan_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define PAN_TRACE_API(fmt, args...) {if (pan_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define PAN_TRACE_EVENT(fmt, args...) {if (pan_cb.trace_level >= BT_TRACE_LEVEL_EVENT) BT_PRINTF(fmt, ## args);}
#define PAN_TRACE_DEBUG(fmt, args...) {if (pan_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) BT_PRINTF(fmt, ## args);}
@ -350,7 +353,7 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
#define A2D_TRACE_WARNING(fmt, args...) {if (a2d_cb.trace_level >= BT_TRACE_LEVEL_WARNING) BT_PRINTF(fmt, ## args);}
#define A2D_TRACE_EVENT(fmt, args...) {if (a2d_cb.trace_level >= BT_TRACE_LEVEL_EVENT) BT_PRINTF(fmt, ## args);}
#define A2D_TRACE_DEBUG(fmt, args...) {if (a2d_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) BT_PRINTF(fmt, ## args);}
#define A2D_TRACE_API(fmt, args...) {if (a2d_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define A2D_TRACE_API(fmt, args...) {if (a2d_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
/* AVDTP
*/
@ -382,7 +385,7 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
#define MCA_TRACE_WARNING(fmt, args...) {if (mca_cb.trace_level >= BT_TRACE_LEVEL_WARNING) BT_PRINTF(fmt, ## args);}
#define MCA_TRACE_EVENT(fmt, args...) {if (mca_cb.trace_level >= BT_TRACE_LEVEL_EVENT) BT_PRINTF(fmt, ## args);}
#define MCA_TRACE_DEBUG(fmt, args...) {if (mca_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) BT_PRINTF(fmt, ## args);}
#define MCA_TRACE_API(fmt, args...) {if (mca_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define MCA_TRACE_API(fmt, args...) {if (mca_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
/* Define tracing for the ATT/GATT unit
*/
@ -396,7 +399,7 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
*/
#define SMP_TRACE_ERROR(fmt, args...) {if (smp_cb.trace_level >= BT_TRACE_LEVEL_ERROR) BT_PRINTF(fmt, ## args);}
#define SMP_TRACE_WARNING(fmt, args...) {if (smp_cb.trace_level >= BT_TRACE_LEVEL_WARNING) BT_PRINTF(fmt, ## args);}
#define SMP_TRACE_API(fmt, args...) {if (smp_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define SMP_TRACE_API(fmt, args...) {if (smp_cb.trace_level >= BT_TRACE_LEVEL_API) BT_PRINTF(fmt, ## args);}
#define SMP_TRACE_EVENT(fmt, args...) {if (smp_cb.trace_level >= BT_TRACE_LEVEL_EVENT) BT_PRINTF(fmt, ## args);}
#define SMP_TRACE_DEBUG(fmt, args...) {if (smp_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) BT_PRINTF(fmt, ## args);}
@ -419,6 +422,158 @@ extern UINT8 btif_trace_level;
#define APPL_TRACE_DEBUG(fmt, args...) {if (appl_trace_level >= BT_TRACE_LEVEL_DEBUG) BT_PRINTF(fmt, ## args);}
#define APPL_TRACE_VERBOSE(fmt, args...) {if (appl_trace_level >= BT_TRACE_LEVEL_VERBOSE) BT_PRINTF(fmt, ## args);}
#else
#define LOG_ERROR(fmt, args...)
#define LOG_WARN(fmt, args...)
#define LOG_INFO(fmt, args...)
#define LOG_DEBUG(fmt, args...)
#define LOG_VERBOSE(fmt, args...)
/* Define tracing for the HCI unit
*/
#define HCI_TRACE_ERROR(fmt, args...)
#define HCI_TRACE_WARNING(fmt, args...)
#define HCI_TRACE_EVENT(fmt, args...)
#define HCI_TRACE_DEBUG(fmt, args...)
/* Define tracing for BTM
*/
#define BTM_TRACE_ERROR(fmt, args...)
#define BTM_TRACE_WARNING(fmt, args...)
#define BTM_TRACE_API(fmt, args...)
#define BTM_TRACE_EVENT(fmt, args...)
#define BTM_TRACE_DEBUG(fmt, args...)
/* Define tracing for the L2CAP unit
*/
#define L2CAP_TRACE_ERROR(fmt, args...)
#define L2CAP_TRACE_WARNING(fmt, args...)
#define L2CAP_TRACE_API(fmt, args...)
#define L2CAP_TRACE_EVENT(fmt, args...)
#define L2CAP_TRACE_DEBUG(fmt, args...)
/* Define tracing for the SDP unit
*/
#define SDP_TRACE_ERROR(fmt, args...)
#define SDP_TRACE_WARNING(fmt, args...)
#define SDP_TRACE_API(fmt, args...)
#define SDP_TRACE_EVENT(fmt, args...)
#define SDP_TRACE_DEBUG(fmt, args...)
/* Define tracing for the RFCOMM unit
*/
#define RFCOMM_TRACE_ERROR(fmt, args...)
#define RFCOMM_TRACE_WARNING(fmt, args...)
#define RFCOMM_TRACE_API(fmt, args...)
#define RFCOMM_TRACE_EVENT(fmt, args...)
#define RFCOMM_TRACE_DEBUG(fmt, args...)
/* Generic Access Profile traces */
#define GAP_TRACE_ERROR(fmt, args...)
#define GAP_TRACE_EVENT(fmt, args...)
#define GAP_TRACE_API(fmt, args...)
#define GAP_TRACE_WARNING(fmt, args...)
/* define traces for HID Host */
#define HIDH_TRACE_ERROR(fmt, args...)
#define HIDH_TRACE_WARNING(fmt, args...)
#define HIDH_TRACE_API(fmt, args...)
#define HIDH_TRACE_EVENT(fmt, args...)
#define HIDH_TRACE_DEBUG(fmt, args...)
/* define traces for BNEP */
#define BNEP_TRACE_ERROR(fmt, args...)
#define BNEP_TRACE_WARNING(fmt, args...)
#define BNEP_TRACE_API(fmt, args...)
#define BNEP_TRACE_EVENT(fmt, args...)
#define BNEP_TRACE_DEBUG(fmt, args...)
/* define traces for PAN */
#define PAN_TRACE_ERROR(fmt, args...)
#define PAN_TRACE_WARNING(fmt, args...)
#define PAN_TRACE_API(fmt, args...)
#define PAN_TRACE_EVENT(fmt, args...)
#define PAN_TRACE_DEBUG(fmt, args...)
/* Define tracing for the A2DP profile
*/
#define A2D_TRACE_ERROR(fmt, args...)
#define A2D_TRACE_WARNING(fmt, args...)
#define A2D_TRACE_EVENT(fmt, args...)
#define A2D_TRACE_DEBUG(fmt, args...)
#define A2D_TRACE_API(fmt, args...)
/* AVDTP
*/
#define AVDT_TRACE_ERROR(fmt, args...)
#define AVDT_TRACE_WARNING(fmt, args...)
#define AVDT_TRACE_EVENT(fmt, args...)
#define AVDT_TRACE_DEBUG(fmt, args...)
#define AVDT_TRACE_API(fmt, args...)
/* Define tracing for the AVCTP protocol
*/
#define AVCT_TRACE_ERROR(fmt, args...)
#define AVCT_TRACE_WARNING(fmt, args...)
#define AVCT_TRACE_EVENT(fmt, args...)
#define AVCT_TRACE_DEBUG(fmt, args...)
#define AVCT_TRACE_API(fmt, args...)
/* Define tracing for the AVRCP profile
*/
#define AVRC_TRACE_ERROR(fmt, args...)
#define AVRC_TRACE_WARNING(fmt, args...)
#define AVRC_TRACE_EVENT(fmt, args...)
#define AVRC_TRACE_DEBUG(fmt, args...)
#define AVRC_TRACE_API(fmt, args...)
/* MCAP
*/
#define MCA_TRACE_ERROR(fmt, args...)
#define MCA_TRACE_WARNING(fmt, args...)
#define MCA_TRACE_EVENT(fmt, args...)
#define MCA_TRACE_DEBUG(fmt, args...)
#define MCA_TRACE_API(fmt, args...)
/* Define tracing for the ATT/GATT unit
*/
#define GATT_TRACE_ERROR(fmt, args...)
#define GATT_TRACE_WARNING(fmt, args...)
#define GATT_TRACE_API(fmt, args...)
#define GATT_TRACE_EVENT(fmt, args...)
#define GATT_TRACE_DEBUG(fmt, args...)
/* Define tracing for the SMP unit
*/
#define SMP_TRACE_ERROR(fmt, args...)
#define SMP_TRACE_WARNING(fmt, args...)
#define SMP_TRACE_API(fmt, args...)
#define SMP_TRACE_EVENT(fmt, args...)
#define SMP_TRACE_DEBUG(fmt, args...)
extern UINT8 btif_trace_level;
// define traces for application
#define BTIF_TRACE_ERROR(fmt, args...)
#define BTIF_TRACE_WARNING(fmt, args...)
#define BTIF_TRACE_API(fmt, args...)
#define BTIF_TRACE_EVENT(fmt, args...)
#define BTIF_TRACE_DEBUG(fmt, args...)
#define BTIF_TRACE_VERBOSE(fmt, args...)
/* define traces for application */
#define APPL_TRACE_ERROR(fmt, args...)
#define APPL_TRACE_WARNING(fmt, args...)
#define APPL_TRACE_API(fmt, args...)
#define APPL_TRACE_EVENT(fmt, args...)
#define APPL_TRACE_DEBUG(fmt, args...)
#define APPL_TRACE_VERBOSE(fmt, args...)
#endif ///CONFIG_BT_STACK_NO_LOG
/* Simplified Trace Helper Macro
*/
#define bdld(fmt, args...) \

View File

@ -41,7 +41,7 @@ typedef int32_t INT32;
typedef bool BOOLEAN;
#define PACKED __packed
#define INLINE __inline
// #define INLINE __inline
#define BCM_STRCPY_S(x1,x2,x3) strcpy((x1),(x3))
#define BCM_STRNCPY_S(x1,x2,x3,x4) strncpy((x1),(x3),(x4))

View File

@ -0,0 +1,46 @@
/******************************************************************************
*
* 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_UTILS_H
#define BT_UTILS_H
// static const char BT_UTILS_MODULE[] = "bt_utils_module";
/*******************************************************************************
** Type definitions
********************************************************************************/
typedef enum {
TASK_HIGH_MEDIA = 0,
TASK_HIGH_GKI_TIMER,
TASK_HIGH_BTU,
TASK_HIGH_HCI_WORKER,
TASK_HIGH_USERIAL_READ,
TASK_UIPC_READ,
TASK_JAVA_ALARM,
TASK_HIGH_MAX
} tHIGH_PRIORITY_TASK;
/*******************************************************************************
** Functions
********************************************************************************/
void raise_priority_a2dp(tHIGH_PRIORITY_TASK high_task);
void adjust_priority_a2dp(int start);
#define UNUSED(x) (void)(x)
#endif /* BT_UTILS_H */

View File

@ -635,7 +635,7 @@ typedef struct {
} tBTA_DM_PIN_REQ;
/* BLE related definition */
#if (SMP_INCLUDED == TRUE)
#define BTA_DM_AUTH_FAIL_BASE (HCI_ERR_MAX_ERR + 10)
#define BTA_DM_AUTH_CONVERT_SMP_CODE(x) (BTA_DM_AUTH_FAIL_BASE + (x))
#define BTA_DM_AUTH_SMP_PASSKEY_FAIL BTA_DM_AUTH_CONVERT_SMP_CODE (SMP_PASSKEY_ENTRY_FAIL)
@ -655,7 +655,7 @@ typedef struct {
#define BTA_DM_AUTH_SMP_BUSY (BTA_DM_AUTH_FAIL_BASE + SMP_BUSY)
#define BTA_DM_AUTH_SMP_ENC_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_ENC_FAIL)
#define BTA_DM_AUTH_SMP_RSP_TIMEOUT (BTA_DM_AUTH_FAIL_BASE + SMP_RSP_TIMEOUT)
#endif ///SMP_INCLUDED == TRUE
/* connection parameter boundary value and dummy value */
#define BTA_DM_BLE_SCAN_INT_MIN BTM_BLE_SCAN_INT_MIN
#define BTA_DM_BLE_SCAN_INT_MAX BTM_BLE_SCAN_INT_MAX
@ -668,13 +668,14 @@ typedef struct {
#define BTA_DM_BLE_CONN_SUP_TOUT_MAX BTM_BLE_CONN_SUP_TOUT_MAX
#define BTA_DM_BLE_CONN_PARAM_UNDEF BTM_BLE_CONN_PARAM_UNDEF /* use this value when a specific value not to be overwritten */
#if (SMP_INCLUDED == TRUE)
#define BTA_LE_KEY_PENC BTM_LE_KEY_PENC /* encryption information of peer device */
#define BTA_LE_KEY_PID BTM_LE_KEY_PID /* identity key of the peer device */
#define BTA_LE_KEY_PCSRK BTM_LE_KEY_PCSRK /* peer SRK */
#define BTA_LE_KEY_LENC BTM_LE_KEY_LENC /* master role security information:div */
#define BTA_LE_KEY_LID BTM_LE_KEY_LID /* master device ID key */
#define BTA_LE_KEY_LCSRK BTM_LE_KEY_LCSRK /* local CSRK has been deliver to peer */
#endif ///SMP_INCLUDED == TRUE
typedef UINT8 tBTA_LE_KEY_TYPE; /* can be used as a bit mask */
@ -702,10 +703,11 @@ typedef struct {
BT_OCTET16 irk;
BT_OCTET16 dhk;
} tBTA_BLE_LOCAL_ID_KEYS;
#if (SMP_INCLUDED == TRUE)
#define BTA_DM_SEC_GRANTED BTA_SUCCESS
#define BTA_DM_SEC_PAIR_NOT_SPT BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT
#define BTA_DM_SEC_REP_ATTEMPTS BTA_DM_AUTH_SMP_REPEATED_ATTEMPT
#endif ///SMP_INCLUDED == TRUE
typedef UINT8 tBTA_DM_BLE_SEC_GRANT;
@ -810,6 +812,7 @@ typedef tBTM_AUTH_REQ tBTA_AUTH_REQ;
#define BTA_AUTH_GEN_BOND BTM_AUTH_SPGB_NO /* 4 this bit is set for general bonding */
#define BTA_AUTH_BONDS BTM_AUTH_BONDS /* 6 the general/dedicated bonding bits */
#if (SMP_INCLUDED == TRUE)
#define BTA_LE_AUTH_NO_BOND BTM_LE_AUTH_REQ_NO_BOND /* 0*/
#define BTA_LE_AUTH_BOND BTM_LE_AUTH_REQ_BOND /* 1 << 0 */
#define BTA_LE_AUTH_REQ_MITM BTM_LE_AUTH_REQ_MITM /* 1 << 2 */
@ -818,6 +821,7 @@ typedef tBTM_AUTH_REQ tBTA_AUTH_REQ;
#define BTA_LE_AUTH_REQ_SC_BOND BTM_LE_AUTH_REQ_SC_BOND /* 1001 */
#define BTA_LE_AUTH_REQ_SC_MITM BTM_LE_AUTH_REQ_SC_MITM /* 1100 */
#define BTA_LE_AUTH_REQ_SC_MITM_BOND BTM_LE_AUTH_REQ_SC_MITM_BOND /* 1101 */
#endif ///SMP_INCLUDED == TRUE
typedef tBTM_LE_AUTH_REQ tBTA_LE_AUTH_REQ; /* combination of the above bit pattern */
#define BTA_OOB_NONE BTM_OOB_NONE
@ -1099,7 +1103,9 @@ typedef void (tBTA_BLE_SCAN_SETUP_CBACK) (tBTA_BLE_BATCH_SCAN_EVT evt,
tBTA_DM_BLE_REF_VALUE ref_value,
tBTA_STATUS status);
typedef void (tBTA_START_SCAN_CMPL_CBACK) (tBTA_STATUS status);
typedef void (tBTA_START_STOP_SCAN_CMPL_CBACK) (tBTA_STATUS status);
typedef void (tBTA_START_STOP_ADV_CMPL_CBACK) (tBTA_STATUS status);
typedef void (tBTA_BLE_TRACK_ADV_CMPL_CBACK)(int action, tBTA_STATUS status,
tBTA_DM_BLE_PF_AVBL_SPACE avbl_space,
@ -1283,7 +1289,7 @@ typedef void (tBTA_DM_SWITCH_CBACK)(tBTA_DM_SWITCH_EVT event, tBTA_STATUS status
typedef UINT8 tBTA_DM_ROUTE_PATH;
#if (SDP_INCLUDED == TRUE)
/* Device Identification (DI) data structure
*/
/* Used to set the DI record */
@ -1292,6 +1298,7 @@ typedef tSDP_DI_RECORD tBTA_DI_RECORD;
typedef tSDP_DI_GET_RECORD tBTA_DI_GET_RECORD;
/* SDP discovery database */
typedef tSDP_DISCOVERY_DB tBTA_DISCOVERY_DB;
#endif ///SDP_INCLUDED == TRUE
#ifndef BTA_DI_NUM_MAX
#define BTA_DI_NUM_MAX 3
@ -1444,9 +1451,9 @@ extern void BTA_DmSearchCancel(void);
** Returns void
**
*******************************************************************************/
#if (SDP_INCLUDED == TRUE)
extern void BTA_DmDiscover(BD_ADDR bd_addr, tBTA_SERVICE_MASK services,
tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search);
// btla-specific ++
/*******************************************************************************
**
@ -1461,7 +1468,7 @@ extern void BTA_DmDiscover(BD_ADDR bd_addr, tBTA_SERVICE_MASK services,
*******************************************************************************/
extern void BTA_DmDiscoverUUID(BD_ADDR bd_addr, tSDP_UUID *uuid,
tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search);
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
** Function BTA_DmGetCachedRemoteName
@ -1617,7 +1624,7 @@ extern void BTA_GetEirService( UINT8 *p_eir, tBTA_SERVICE_MASK *p_services );
*******************************************************************************/
extern UINT16 BTA_DmGetConnectionState( BD_ADDR bd_addr );
#if (SDP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function BTA_DmSetLocalDiRecord
@ -1629,7 +1636,7 @@ extern UINT16 BTA_DmGetConnectionState( BD_ADDR bd_addr );
*******************************************************************************/
extern tBTA_STATUS BTA_DmSetLocalDiRecord( tBTA_DI_RECORD *p_device_info,
UINT32 *p_handle );
#endif ///SDP_INCLUDED == TRUE
/*******************************************************************************
**
**
@ -2004,7 +2011,7 @@ extern void BTA_DmSetEncryption(BD_ADDR bd_addr, tBTA_TRANSPORT transport,
*******************************************************************************/
extern void BTA_DmBleObserve(BOOLEAN start, UINT8 duration,
tBTA_DM_SEARCH_CBACK *p_results_cb,
tBTA_START_SCAN_CMPL_CBACK *p_start_scan_cb);
tBTA_START_STOP_SCAN_CMPL_CBACK *p_start_stop_scan_cb);
extern void BTA_DmBleStopAdvertising(void);
@ -2111,11 +2118,12 @@ extern void BTA_DmBleSetScanRspRaw (UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_l
** Description This function starts or stops LE broadcasting.
**
** Parameters start: start or stop broadcast.
** p_start_stop_adv_cb: stop broadcast completed event
**
** Returns None
**
*******************************************************************************/
extern void BTA_DmBleBroadcast (BOOLEAN start);
extern void BTA_DmBleBroadcast (BOOLEAN start, tBTA_START_STOP_ADV_CMPL_CBACK *p_start_stop_adv_cb);
/*******************************************************************************

View File

@ -0,0 +1,144 @@
/******************************************************************************
*
* Copyright (C) 2004-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.
*
******************************************************************************/
/******************************************************************************
*
* This is the public interface file for the simulatenous advanced
* audio/video streaming (AV) source and sink of BTA, Broadcom's Bluetooth
* application layer for mobile phones.
*
******************************************************************************/
#ifndef BTA_AR_API_H
#define BTA_AR_API_H
#include "avdt_api.h"
#include "avct_api.h"
#include "avrc_api.h"
#include "sdp_api.h"
#include "bta_av_api.h"
#include "bta_sys.h"
#if (BTA_AR_INCLUDED == TRUE)
/*****************************************************************************
** Constants and data types
*****************************************************************************/
/* This event signal to AR user that other profile is connected */
#define BTA_AR_AVDT_CONN_EVT (AVDT_MAX_EVT + 1)
/*******************************************************************************
**
** Function bta_ar_init
**
** Description This function is called from bta_sys_init().
** to initialize the control block
**
** Returns void
**
*******************************************************************************/
extern void bta_ar_init(void);
/*******************************************************************************
**
** Function bta_ar_reg_avdt
**
** Description This function is called to register to AVDTP.
**
** Returns void
**
*******************************************************************************/
extern void bta_ar_reg_avdt(tAVDT_REG *p_reg, tAVDT_CTRL_CBACK *p_cback, tBTA_SYS_ID sys_id);
/*******************************************************************************
**
** Function bta_ar_dereg_avdt
**
** Description This function is called to de-register from AVDTP.
**
** Returns void
**
*******************************************************************************/
extern void bta_ar_dereg_avdt(tBTA_SYS_ID sys_id);
/*******************************************************************************
**
** Function bta_ar_avdt_conn
**
** Description This function is called to let ar know that some AVDTP profile
** is connected for this sys_id.
** If the other sys modules started a timer for PENDING_EVT,
** the timer can be stopped now.
**
** Returns void
**
*******************************************************************************/
extern void bta_ar_avdt_conn(tBTA_SYS_ID sys_id, BD_ADDR bd_addr);
/*******************************************************************************
**
** Function bta_ar_reg_avct
**
** Description This function is called to register to AVCTP.
**
** Returns void
**
*******************************************************************************/
extern void bta_ar_reg_avct(UINT16 mtu, UINT16 mtu_br, UINT8 sec_mask, tBTA_SYS_ID sys_id);
/*******************************************************************************
**
** Function bta_ar_dereg_avct
**
** Description This function is called to deregister from AVCTP.
**
** Returns void
**
*******************************************************************************/
extern void bta_ar_dereg_avct(tBTA_SYS_ID sys_id);
/******************************************************************************
**
** Function bta_ar_reg_avrc
**
** Description This function is called to register an SDP record for AVRCP.
**
** Returns void
**
******************************************************************************/
extern void bta_ar_reg_avrc(UINT16 service_uuid, char *p_service_name,
char *p_provider_name, UINT16 categories, tBTA_SYS_ID sys_id);
/******************************************************************************
**
** Function bta_ar_dereg_avrc
**
** Description This function is called to de-register/delete an SDP record for AVRCP.
**
** Returns void
**
******************************************************************************/
extern void bta_ar_dereg_avrc(UINT16 service_uuid, tBTA_SYS_ID sys_id);
#ifdef __cplusplus
}
#endif
#endif ///BTA_AR_INCLUDED == TRUE
#endif /* BTA_AR_API_H */

View File

@ -0,0 +1,812 @@
/******************************************************************************
*
* Copyright (C) 2004-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.
*
******************************************************************************/
/******************************************************************************
*
* This is the public interface file for the advanced audio/video streaming
* (AV) subsystem of BTA, Broadcom's Bluetooth application layer for mobile
* phones.
*
******************************************************************************/
#ifndef BTA_AV_API_H
#define BTA_AV_API_H
#include "avrc_api.h"
#include "avdt_api.h"
#include "a2d_api.h"
#include "bta_api.h"
#if (BTA_AV_INCLUDED == TRUE)
/*****************************************************************************
** Constants and data types
*****************************************************************************/
/* Set to TRUE if seperate authorization prompt desired for AVCTP besides A2DP authorization */
/* Typically FALSE when AVRCP is used in conjunction with A2DP */
#ifndef BTA_AV_WITH_AVCTP_AUTHORIZATION
#define BTA_AV_WITH_AVCTP_AUTHORIZATION FALSE
#endif
/* AV status values */
#define BTA_AV_SUCCESS 0 /* successful operation */
#define BTA_AV_FAIL 1 /* generic failure */
#define BTA_AV_FAIL_SDP 2 /* service not found */
#define BTA_AV_FAIL_STREAM 3 /* stream connection failed */
#define BTA_AV_FAIL_RESOURCES 4 /* no resources */
#define BTA_AV_FAIL_ROLE 5 /* failed due to role management related issues */
#define BTA_AV_FAIL_GET_CAP 6 /* get capability failed due to no SEP availale on the peer */
typedef UINT8 tBTA_AV_STATUS;
/* AV features masks */
#define BTA_AV_FEAT_RCTG 0x0001 /* remote control target */
#define BTA_AV_FEAT_RCCT 0x0002 /* remote control controller */
#define BTA_AV_FEAT_PROTECT 0x0004 /* streaming media contect protection */
#define BTA_AV_FEAT_VENDOR 0x0008 /* remote control vendor dependent commands */
#define BTA_AV_FEAT_REPORT 0x0020 /* use reporting service for VDP */
#define BTA_AV_FEAT_METADATA 0x0040 /* remote control Metadata Transfer command/response */
#define BTA_AV_FEAT_MULTI_AV 0x0080 /* use multi-av, if controller supports it */
#define BTA_AV_FEAT_BROWSE 0x0010 /* use browsing channel */
#define BTA_AV_FEAT_MASTER 0x0100 /* stream only as master role */
#define BTA_AV_FEAT_ADV_CTRL 0x0200 /* remote control Advanced Control command/response */
#define BTA_AV_FEAT_DELAY_RPT 0x0400 /* allow delay reporting */
#define BTA_AV_FEAT_ACP_START 0x0800 /* start stream when 2nd SNK was accepted */
/* Internal features */
#define BTA_AV_FEAT_NO_SCO_SSPD 0x8000 /* Do not suspend av streaming as to AG events(SCO or Call) */
typedef UINT16 tBTA_AV_FEAT;
/* AV channel values */
#define BTA_AV_CHNL_MSK 0xC0
#define BTA_AV_CHNL_AUDIO 0x40 /* audio channel */
#define BTA_AV_CHNL_VIDEO 0x80 /* video channel */
typedef UINT8 tBTA_AV_CHNL;
#define BTA_AV_HNDL_MSK 0x3F
typedef UINT8 tBTA_AV_HNDL;
/* handle index to mask */
#define BTA_AV_HNDL_TO_MSK(h) ((UINT8)(1 << (h)))
/* tBTA_AV_HNDL to mask */
#define BTA_AV_HNDL_TYPE_TO_MSK(h) ((UINT8)(1 << (h&BTA_AV_HNDL_MSK)))
/* offset of codec type in codec info byte array */
#define BTA_AV_CODEC_TYPE_IDX AVDT_CODEC_TYPE_INDEX /* 2 */
/* maximum number of streams created: 1 for audio, 1 for video */
#ifndef BTA_AV_NUM_STRS
#define BTA_AV_NUM_STRS 2
#endif
#ifndef BTA_AV_MAX_SEPS
#define BTA_AV_MAX_SEPS 2
#endif
#ifndef BTA_AV_MAX_A2DP_MTU
/*#define BTA_AV_MAX_A2DP_MTU 668 //224 (DM5) * 3 - 4(L2CAP header) */
#define BTA_AV_MAX_A2DP_MTU 1008
#endif
#ifndef BTA_AV_MAX_VDP_MTU
#define BTA_AV_MAX_VDP_MTU 1008
#endif
/* codec type */
#define BTA_AV_CODEC_SBC A2D_MEDIA_CT_SBC /* SBC media codec type */
#define BTA_AV_CODEC_M12 A2D_MEDIA_CT_M12 /* MPEG-1, 2 Audio media codec type */
#define BTA_AV_CODEC_M24 A2D_MEDIA_CT_M24 /* MPEG-2, 4 AAC media codec type */
#define BTA_AV_CODEC_ATRAC A2D_MEDIA_CT_ATRAC /* ATRAC family media codec type */
#define BTA_AV_CODEC_H263_P0 VDP_MEDIA_CT_H263_P0 /* H.263 baseline (profile 0) */
#define BTA_AV_CODEC_MPEG4 VDP_MEDIA_CT_MPEG4 /* MPEG-4 Visual Simple Profile */
#define BTA_AV_CODEC_H263_P3 VDP_MEDIA_CT_H263_P3 /* H.263 profile 3 */
#define BTA_AV_CODEC_H263_P8 VDP_MEDIA_CT_H263_P8 /* H.263 profile 8 */
#define BTA_AV_CODEC_VEND VDP_MEDIA_CT_VEND /* Non-VDP */
typedef UINT8 tBTA_AV_CODEC;
/* Company ID in BT assigned numbers */
#define BTA_AV_BT_VENDOR_ID VDP_BT_VENDOR_ID /* Broadcom Corporation */
/* vendor specific codec ID */
#define BTA_AV_CODEC_ID_H264 VDP_CODEC_ID_H264 /* Non-VDP codec ID - H.264 */
#define BTA_AV_CODEC_ID_IMG VDP_CODEC_ID_IMG /* Non-VDP codec ID - images/slideshow */
/* operation id list for BTA_AvRemoteCmd */
#define BTA_AV_RC_SELECT AVRC_ID_SELECT /* select */
#define BTA_AV_RC_UP AVRC_ID_UP /* up */
#define BTA_AV_RC_DOWN AVRC_ID_DOWN /* down */
#define BTA_AV_RC_LEFT AVRC_ID_LEFT /* left */
#define BTA_AV_RC_RIGHT AVRC_ID_RIGHT /* right */
#define BTA_AV_RC_RIGHT_UP AVRC_ID_RIGHT_UP /* right-up */
#define BTA_AV_RC_RIGHT_DOWN AVRC_ID_RIGHT_DOWN /* right-down */
#define BTA_AV_RC_LEFT_UP AVRC_ID_LEFT_UP /* left-up */
#define BTA_AV_RC_LEFT_DOWN AVRC_ID_LEFT_DOWN /* left-down */
#define BTA_AV_RC_ROOT_MENU AVRC_ID_ROOT_MENU /* root menu */
#define BTA_AV_RC_SETUP_MENU AVRC_ID_SETUP_MENU /* setup menu */
#define BTA_AV_RC_CONT_MENU AVRC_ID_CONT_MENU /* contents menu */
#define BTA_AV_RC_FAV_MENU AVRC_ID_FAV_MENU /* favorite menu */
#define BTA_AV_RC_EXIT AVRC_ID_EXIT /* exit */
#define BTA_AV_RC_0 AVRC_ID_0 /* 0 */
#define BTA_AV_RC_1 AVRC_ID_1 /* 1 */
#define BTA_AV_RC_2 AVRC_ID_2 /* 2 */
#define BTA_AV_RC_3 AVRC_ID_3 /* 3 */
#define BTA_AV_RC_4 AVRC_ID_4 /* 4 */
#define BTA_AV_RC_5 AVRC_ID_5 /* 5 */
#define BTA_AV_RC_6 AVRC_ID_6 /* 6 */
#define BTA_AV_RC_7 AVRC_ID_7 /* 7 */
#define BTA_AV_RC_8 AVRC_ID_8 /* 8 */
#define BTA_AV_RC_9 AVRC_ID_9 /* 9 */
#define BTA_AV_RC_DOT AVRC_ID_DOT /* dot */
#define BTA_AV_RC_ENTER AVRC_ID_ENTER /* enter */
#define BTA_AV_RC_CLEAR AVRC_ID_CLEAR /* clear */
#define BTA_AV_RC_CHAN_UP AVRC_ID_CHAN_UP /* channel up */
#define BTA_AV_RC_CHAN_DOWN AVRC_ID_CHAN_DOWN /* channel down */
#define BTA_AV_RC_PREV_CHAN AVRC_ID_PREV_CHAN /* previous channel */
#define BTA_AV_RC_SOUND_SEL AVRC_ID_SOUND_SEL /* sound select */
#define BTA_AV_RC_INPUT_SEL AVRC_ID_INPUT_SEL /* input select */
#define BTA_AV_RC_DISP_INFO AVRC_ID_DISP_INFO /* display information */
#define BTA_AV_RC_HELP AVRC_ID_HELP /* help */
#define BTA_AV_RC_PAGE_UP AVRC_ID_PAGE_UP /* page up */
#define BTA_AV_RC_PAGE_DOWN AVRC_ID_PAGE_DOWN /* page down */
#define BTA_AV_RC_POWER AVRC_ID_POWER /* power */
#define BTA_AV_RC_VOL_UP AVRC_ID_VOL_UP /* volume up */
#define BTA_AV_RC_VOL_DOWN AVRC_ID_VOL_DOWN /* volume down */
#define BTA_AV_RC_MUTE AVRC_ID_MUTE /* mute */
#define BTA_AV_RC_PLAY AVRC_ID_PLAY /* play */
#define BTA_AV_RC_STOP AVRC_ID_STOP /* stop */
#define BTA_AV_RC_PAUSE AVRC_ID_PAUSE /* pause */
#define BTA_AV_RC_RECORD AVRC_ID_RECORD /* record */
#define BTA_AV_RC_REWIND AVRC_ID_REWIND /* rewind */
#define BTA_AV_RC_FAST_FOR AVRC_ID_FAST_FOR /* fast forward */
#define BTA_AV_RC_EJECT AVRC_ID_EJECT /* eject */
#define BTA_AV_RC_FORWARD AVRC_ID_FORWARD /* forward */
#define BTA_AV_RC_BACKWARD AVRC_ID_BACKWARD /* backward */
#define BTA_AV_RC_ANGLE AVRC_ID_ANGLE /* angle */
#define BTA_AV_RC_SUBPICT AVRC_ID_SUBPICT /* subpicture */
#define BTA_AV_RC_F1 AVRC_ID_F1 /* F1 */
#define BTA_AV_RC_F2 AVRC_ID_F2 /* F2 */
#define BTA_AV_RC_F3 AVRC_ID_F3 /* F3 */
#define BTA_AV_RC_F4 AVRC_ID_F4 /* F4 */
#define BTA_AV_RC_F5 AVRC_ID_F5 /* F5 */
#define BTA_AV_VENDOR AVRC_ID_VENDOR /* vendor unique */
typedef UINT8 tBTA_AV_RC;
/* state flag for pass through command */
#define BTA_AV_STATE_PRESS AVRC_STATE_PRESS /* key pressed */
#define BTA_AV_STATE_RELEASE AVRC_STATE_RELEASE /* key released */
typedef UINT8 tBTA_AV_STATE;
/* command codes for BTA_AvVendorCmd */
#define BTA_AV_CMD_CTRL AVRC_CMD_CTRL
#define BTA_AV_CMD_STATUS AVRC_CMD_STATUS
#define BTA_AV_CMD_SPEC_INQ AVRC_CMD_SPEC_INQ
#define BTA_AV_CMD_NOTIF AVRC_CMD_NOTIF
#define BTA_AV_CMD_GEN_INQ AVRC_CMD_GEN_INQ
typedef UINT8 tBTA_AV_CMD;
/* response codes for BTA_AvVendorRsp */
#define BTA_AV_RSP_NOT_IMPL AVRC_RSP_NOT_IMPL
#define BTA_AV_RSP_ACCEPT AVRC_RSP_ACCEPT
#define BTA_AV_RSP_REJ AVRC_RSP_REJ
#define BTA_AV_RSP_IN_TRANS AVRC_RSP_IN_TRANS
#define BTA_AV_RSP_IMPL_STBL AVRC_RSP_IMPL_STBL
#define BTA_AV_RSP_CHANGED AVRC_RSP_CHANGED
#define BTA_AV_RSP_INTERIM AVRC_RSP_INTERIM
typedef UINT8 tBTA_AV_CODE;
/* error codes for BTA_AvProtectRsp */
#define BTA_AV_ERR_NONE A2D_SUCCESS /* Success, no error */
#define BTA_AV_ERR_BAD_STATE AVDT_ERR_BAD_STATE /* Message cannot be processed in this state */
#define BTA_AV_ERR_RESOURCE AVDT_ERR_RESOURCE /* Insufficient resources */
#define BTA_AV_ERR_BAD_CP_TYPE A2D_BAD_CP_TYPE /* The requested Content Protection Type is not supported */
#define BTA_AV_ERR_BAD_CP_FORMAT A2D_BAD_CP_FORMAT /* The format of Content Protection Data is not correct */
typedef UINT8 tBTA_AV_ERR;
/* AV callback events */
#define BTA_AV_ENABLE_EVT 0 /* AV enabled */
#define BTA_AV_REGISTER_EVT 1 /* registered to AVDT */
#define BTA_AV_OPEN_EVT 2 /* connection opened */
#define BTA_AV_CLOSE_EVT 3 /* connection closed */
#define BTA_AV_START_EVT 4 /* stream data transfer started */
#define BTA_AV_STOP_EVT 5 /* stream data transfer stopped */
#define BTA_AV_PROTECT_REQ_EVT 6 /* content protection request */
#define BTA_AV_PROTECT_RSP_EVT 7 /* content protection response */
#define BTA_AV_RC_OPEN_EVT 8 /* remote control channel open */
#define BTA_AV_RC_CLOSE_EVT 9 /* remote control channel closed */
#define BTA_AV_REMOTE_CMD_EVT 10 /* remote control command */
#define BTA_AV_REMOTE_RSP_EVT 11 /* remote control response */
#define BTA_AV_VENDOR_CMD_EVT 12 /* vendor dependent remote control command */
#define BTA_AV_VENDOR_RSP_EVT 13 /* vendor dependent remote control response */
#define BTA_AV_RECONFIG_EVT 14 /* reconfigure response */
#define BTA_AV_SUSPEND_EVT 15 /* suspend response */
#define BTA_AV_PENDING_EVT 16 /* incoming connection pending:
* signal channel is open and stream is not open
* after BTA_AV_SIG_TIME_VAL ms */
#define BTA_AV_META_MSG_EVT 17 /* metadata messages */
#define BTA_AV_REJECT_EVT 18 /* incoming connection rejected */
#define BTA_AV_RC_FEAT_EVT 19 /* remote control channel peer supported features update */
#define BTA_AV_MEDIA_SINK_CFG_EVT 20 /* command to configure codec */
#define BTA_AV_MEDIA_DATA_EVT 21 /* sending data to Media Task */
/* Max BTA event */
#define BTA_AV_MAX_EVT 22
/* function types for call-out functions */
typedef BOOLEAN (*tBTA_AV_CO_INIT) (UINT8 *p_codec_type, UINT8 *p_codec_info,
UINT8 *p_num_protect, UINT8 *p_protect_info, UINT8 index);
typedef void (*tBTA_AV_CO_DISC_RES) (tBTA_AV_HNDL hndl, UINT8 num_seps,
UINT8 num_snk, UINT8 num_src, BD_ADDR addr, UINT16 uuid_local);
typedef UINT8 (*tBTA_AV_CO_GETCFG) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT8 *p_codec_info, UINT8 *p_sep_info_idx, UINT8 seid,
UINT8 *p_num_protect, UINT8 *p_protect_info);
typedef void (*tBTA_AV_CO_SETCFG) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT8 *p_codec_info, UINT8 seid, BD_ADDR addr,
UINT8 num_protect, UINT8 *p_protect_info,
UINT8 t_local_sep, UINT8 avdt_handle);
typedef void (*tBTA_AV_CO_OPEN) (tBTA_AV_HNDL hndl,
tBTA_AV_CODEC codec_type, UINT8 *p_codec_info,
UINT16 mtu);
typedef void (*tBTA_AV_CO_CLOSE) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type, UINT16 mtu);
typedef void (*tBTA_AV_CO_START) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type, UINT8 *p_codec_info, BOOLEAN *p_no_rtp_hdr);
typedef void (*tBTA_AV_CO_STOP) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type);
typedef void *(*tBTA_AV_CO_DATAPATH) (tBTA_AV_CODEC codec_type,
UINT32 *p_len, UINT32 *p_timestamp);
typedef void (*tBTA_AV_CO_DELAY) (tBTA_AV_HNDL hndl, UINT16 delay);
/* the call-out functions for one stream */
typedef struct {
tBTA_AV_CO_INIT init;
tBTA_AV_CO_DISC_RES disc_res;
tBTA_AV_CO_GETCFG getcfg;
tBTA_AV_CO_SETCFG setcfg;
tBTA_AV_CO_OPEN open;
tBTA_AV_CO_CLOSE close;
tBTA_AV_CO_START start;
tBTA_AV_CO_STOP stop;
tBTA_AV_CO_DATAPATH data;
tBTA_AV_CO_DELAY delay;
} tBTA_AV_CO_FUNCTS;
typedef UINT8 tBTA_AV_EVT;
/* Event associated with BTA_AV_ENABLE_EVT */
typedef struct {
tBTA_AV_FEAT features;
} tBTA_AV_ENABLE;
/* Event associated with BTA_AV_REGISTER_EVT */
typedef struct {
tBTA_AV_CHNL chnl; /* audio/video */
tBTA_AV_HNDL hndl; /* Handle associated with the stream. */
UINT8 app_id; /* ID associated with call to BTA_AvRegister() */
tBTA_AV_STATUS status;
tBTA_AV_CO_FUNCTS *p_bta_av_cos;
} tBTA_AV_REGISTER;
/* data associated with BTA_AV_OPEN_EVT */
#define BTA_AV_EDR_2MBPS 0x01
#define BTA_AV_EDR_3MBPS 0x02
typedef UINT8 tBTA_AV_EDR;
typedef struct {
tBTA_AV_CHNL chnl;
tBTA_AV_HNDL hndl;
BD_ADDR bd_addr;
tBTA_AV_STATUS status;
BOOLEAN starting;
tBTA_AV_EDR edr; /* 0, if peer device does not support EDR */
UINT8 sep; /* sep type of peer device */
} tBTA_AV_OPEN;
/* data associated with BTA_AV_CLOSE_EVT */
typedef struct {
tBTA_AV_CHNL chnl;
tBTA_AV_HNDL hndl;
UINT8 disc_rsn; /* disconnection reason */
} tBTA_AV_CLOSE;
/* data associated with BTA_AV_START_EVT */
typedef struct {
tBTA_AV_CHNL chnl;
tBTA_AV_HNDL hndl;
tBTA_AV_STATUS status;
BOOLEAN initiator; /* TRUE, if local device initiates the START */
BOOLEAN suspending;
} tBTA_AV_START;
/* data associated with BTA_AV_SUSPEND_EVT */
typedef struct {
tBTA_AV_CHNL chnl;
tBTA_AV_HNDL hndl;
BOOLEAN initiator; /* TRUE, if local device initiates the SUSPEND */
tBTA_AV_STATUS status;
} tBTA_AV_SUSPEND;
/* data associated with BTA_AV_RECONFIG_EVT */
typedef struct {
tBTA_AV_CHNL chnl;
tBTA_AV_HNDL hndl;
tBTA_AV_STATUS status;
} tBTA_AV_RECONFIG;
/* data associated with BTA_AV_PROTECT_REQ_EVT */
typedef struct {
tBTA_AV_CHNL chnl;
tBTA_AV_HNDL hndl;
UINT8 *p_data;
UINT16 len;
} tBTA_AV_PROTECT_REQ;
/* data associated with BTA_AV_PROTECT_RSP_EVT */
typedef struct {
tBTA_AV_CHNL chnl;
tBTA_AV_HNDL hndl;
UINT8 *p_data;
UINT16 len;
tBTA_AV_ERR err_code;
} tBTA_AV_PROTECT_RSP;
/* data associated with BTA_AV_RC_OPEN_EVT */
typedef struct {
UINT8 rc_handle;
tBTA_AV_FEAT peer_features;
BD_ADDR peer_addr;
tBTA_AV_STATUS status;
} tBTA_AV_RC_OPEN;
/* data associated with BTA_AV_RC_CLOSE_EVT */
typedef struct {
UINT8 rc_handle;
BD_ADDR peer_addr;
} tBTA_AV_RC_CLOSE;
/* data associated with BTA_AV_RC_FEAT_EVT */
typedef struct {
UINT8 rc_handle;
tBTA_AV_FEAT peer_features;
} tBTA_AV_RC_FEAT;
/* data associated with BTA_AV_REMOTE_CMD_EVT */
typedef struct {
UINT8 rc_handle;
tBTA_AV_RC rc_id;
tBTA_AV_STATE key_state;
UINT8 len;
UINT8 *p_data;
tAVRC_HDR hdr; /* Message header. */
UINT8 label;
} tBTA_AV_REMOTE_CMD;
/* data associated with BTA_AV_REMOTE_RSP_EVT */
typedef struct {
UINT8 rc_handle;
tBTA_AV_RC rc_id;
tBTA_AV_STATE key_state;
UINT8 len;
UINT8 *p_data;
tBTA_AV_CODE rsp_code;
UINT8 label;
} tBTA_AV_REMOTE_RSP;
/* data associated with BTA_AV_VENDOR_CMD_EVT, BTA_AV_VENDOR_RSP_EVT */
typedef struct {
UINT8 rc_handle;
UINT16 len; /* Max vendor dependent message is 512 */
UINT8 label;
tBTA_AV_CODE code;
UINT32 company_id;
UINT8 *p_data;
} tBTA_AV_VENDOR;
/* data associated with BTA_AV_META_MSG_EVT */
typedef struct {
UINT8 rc_handle;
UINT16 len;
UINT8 label;
tBTA_AV_CODE code;
UINT32 company_id;
UINT8 *p_data;
tAVRC_MSG *p_msg;
} tBTA_AV_META_MSG;
/* data associated with BTA_AV_PENDING_EVT */
typedef struct {
BD_ADDR bd_addr;
} tBTA_AV_PEND;
/* data associated with BTA_AV_REJECT_EVT */
typedef struct {
BD_ADDR bd_addr;
tBTA_AV_HNDL hndl; /* Handle associated with the stream that rejected the connection. */
} tBTA_AV_REJECT;
/* union of data associated with AV callback */
typedef union {
tBTA_AV_CHNL chnl;
tBTA_AV_ENABLE enable;
tBTA_AV_REGISTER registr;
tBTA_AV_OPEN open;
tBTA_AV_CLOSE close;
tBTA_AV_START start;
tBTA_AV_PROTECT_REQ protect_req;
tBTA_AV_PROTECT_RSP protect_rsp;
tBTA_AV_RC_OPEN rc_open;
tBTA_AV_RC_CLOSE rc_close;
tBTA_AV_REMOTE_CMD remote_cmd;
tBTA_AV_REMOTE_RSP remote_rsp;
tBTA_AV_VENDOR vendor_cmd;
tBTA_AV_VENDOR vendor_rsp;
tBTA_AV_RECONFIG reconfig;
tBTA_AV_SUSPEND suspend;
tBTA_AV_PEND pend;
tBTA_AV_META_MSG meta_msg;
tBTA_AV_REJECT reject;
tBTA_AV_RC_FEAT rc_feat;
} tBTA_AV;
/* union of data associated with AV Media callback */
typedef union {
BT_HDR *p_data;
UINT8 *codec_info;
} tBTA_AV_MEDIA;
#define BTA_AVC_PACKET_LEN AVRC_PACKET_LEN
#define BTA_VENDOR_DATA_OFFSET 6
#define BTA_VENDOR_HEADER_LEN 4
#define BTA_MAX_VENDOR_DEPENDENT_DATA_LEN (BTA_AVC_PACKET_LEN-BTA_VENDOR_DATA_OFFSET-BTA_VENDOR_HEADER_LEN)
#define BTA_GROUP_NAVI_MSG_OP_DATA_LEN 5
#define BTA_ERROR_INVALID_CMD AVRC_STS_BAD_CMD
#define BTA_ERROR_INVALID_PARAM AVRC_STS_BAD_PARAM
#define BTA_ERROR_BAD_CONTENTS AVRC_STS_NOT_FOUND
#define BTA_ERROR_INTERNAL AVRC_STS_INTERNAL_ERR
#define BTA_AV_META_SINGLE_PACKET AVRC_PKT_SINGLE
#define BTA_AV_CO_METADATA AVRC_CO_METADATA
/* AV callback */
typedef void (tBTA_AV_CBACK)(tBTA_AV_EVT event, tBTA_AV *p_data);
typedef void (tBTA_AV_DATA_CBACK)(tBTA_AV_EVT event, tBTA_AV_MEDIA *p_data);
/* type for stream state machine action functions */
typedef void (*tBTA_AV_ACT)(void *p_cb, void *p_data);
/* type for registering VDP */
typedef void (tBTA_AV_REG) (tAVDT_CS *p_cs, char *p_service_name, void *p_data);
/* AV configuration structure */
typedef struct {
UINT32 company_id; /* AVRCP Company ID */
UINT16 avrc_mtu; /* AVRCP MTU at L2CAP for control channel */
UINT16 avrc_br_mtu; /* AVRCP MTU at L2CAP for browsing channel */
UINT16 avrc_ct_cat; /* AVRCP controller categories */
UINT16 avrc_tg_cat; /* AVRCP target categories */
UINT16 sig_mtu; /* AVDTP signaling channel MTU at L2CAP */
UINT16 audio_mtu; /* AVDTP audio transport channel MTU at L2CAP */
const UINT16 *p_audio_flush_to;/* AVDTP audio transport channel flush timeout */
UINT16 audio_mqs; /* AVDTP audio channel max data queue size */
UINT16 video_mtu; /* AVDTP video transport channel MTU at L2CAP */
UINT16 video_flush_to; /* AVDTP video transport channel flush timeout */
BOOLEAN avrc_group; /* TRUE, to accept AVRC 1.3 group nevigation command */
UINT8 num_co_ids; /* company id count in p_meta_co_ids */
UINT8 num_evt_ids; /* event id count in p_meta_evt_ids */
tBTA_AV_CODE rc_pass_rsp; /* the default response code for pass through commands */
const UINT32 *p_meta_co_ids;/* the metadata Get Capabilities response for company id */
const UINT8 *p_meta_evt_ids;/* the the metadata Get Capabilities response for event id */
const tBTA_AV_ACT *p_act_tbl;/* the action function table for VDP stream */
tBTA_AV_REG *p_reg; /* action function to register VDP */
char avrc_controller_name[BTA_SERVICE_NAME_LEN]; /* Default AVRCP controller name */
char avrc_target_name[BTA_SERVICE_NAME_LEN]; /* Default AVRCP target name*/
} tBTA_AV_CFG;
#ifdef __cplusplus
extern "C"
{
#endif
/*****************************************************************************
** External Function Declarations
*****************************************************************************/
/*******************************************************************************
**
** Function BTA_AvEnable
**
** Description Enable the advanced audio/video service. When the enable
** operation is complete the callback function will be
** called with a BTA_AV_ENABLE_EVT. This function must
** be called before other function in the AV API are
** called.
**
** Returns void
**
*******************************************************************************/
void BTA_AvEnable(tBTA_SEC sec_mask, tBTA_AV_FEAT features,
tBTA_AV_CBACK *p_cback);
/*******************************************************************************
**
** Function BTA_AvDisable
**
** Description Disable the advanced audio/video service.
**
**
** Returns void
**
*******************************************************************************/
void BTA_AvDisable(void);
/*******************************************************************************
**
** Function BTA_AvRegister
**
** Description Register the audio or video service to stack. When the
** operation is complete the callback function will be
** called with a BTA_AV_REGISTER_EVT. This function must
** be called before AVDT stream is open.
**
**
** Returns void
**
*******************************************************************************/
void BTA_AvRegister(tBTA_AV_CHNL chnl, const char *p_service_name,
UINT8 app_id, tBTA_AV_DATA_CBACK *p_data_cback, tBTA_AV_CO_FUNCTS *bta_av_cos);
/*******************************************************************************
**
** Function BTA_AvDeregister
**
** Description Deregister the audio or video service
**
** Returns void
**
*******************************************************************************/
void BTA_AvDeregister(tBTA_AV_HNDL hndl);
/*******************************************************************************
**
** Function BTA_AvOpen
**
** Description Opens an advanced audio/video connection to a peer device.
** When connection is open callback function is called
** with a BTA_AV_OPEN_EVT.
**
** Returns void
**
*******************************************************************************/
void BTA_AvOpen(BD_ADDR bd_addr, tBTA_AV_HNDL handle,
BOOLEAN use_rc, tBTA_SEC sec_mask, UINT16 uuid);
/*******************************************************************************
**
** Function BTA_AvClose
**
** Description Close the current streams.
**
** Returns void
**
*******************************************************************************/
void BTA_AvClose(tBTA_AV_HNDL handle);
/*******************************************************************************
**
** Function BTA_AvDisconnect
**
** Description Close the connection to the address.
**
** Returns void
**
*******************************************************************************/
void BTA_AvDisconnect(BD_ADDR bd_addr);
/*******************************************************************************
**
** Function BTA_AvEnable_Sink
**
** Description Enable/Disable A2DP Sink.
**
** Returns void
**
*******************************************************************************/
void BTA_AvEnable_Sink(int enable);
/*******************************************************************************
**
** Function BTA_AvStart
**
** Description Start audio/video stream data transfer.
**
** Returns void
**
*******************************************************************************/
void BTA_AvStart(void);
/*******************************************************************************
**
** Function BTA_AvStop
**
** Description Stop audio/video stream data transfer.
** If suspend is TRUE, this function sends AVDT suspend signal
** to the connected peer(s).
**
** Returns void
**
*******************************************************************************/
void BTA_AvStop(BOOLEAN suspend);
/*******************************************************************************
**
** Function BTA_AvReconfig
**
** Description Reconfigure the audio/video stream.
** If suspend is TRUE, this function tries the suspend/reconfigure
** procedure first.
** If suspend is FALSE or when suspend/reconfigure fails,
** this function closes and re-opens the AVDT connection.
**
** Returns void
**
*******************************************************************************/
void BTA_AvReconfig(tBTA_AV_HNDL hndl, BOOLEAN suspend, UINT8 sep_info_idx,
UINT8 *p_codec_info, UINT8 num_protect, UINT8 *p_protect_info);
/*******************************************************************************
**
** Function BTA_AvProtectReq
**
** Description Send a content protection request. This function can only
** be used if AV is enabled with feature BTA_AV_FEAT_PROTECT.
**
** Returns void
**
*******************************************************************************/
void BTA_AvProtectReq(tBTA_AV_HNDL hndl, UINT8 *p_data, UINT16 len);
/*******************************************************************************
**
** Function BTA_AvProtectRsp
**
** Description Send a content protection response. This function must
** be called if a BTA_AV_PROTECT_REQ_EVT is received.
** This function can only be used if AV is enabled with
** feature BTA_AV_FEAT_PROTECT.
**
** Returns void
**
*******************************************************************************/
void BTA_AvProtectRsp(tBTA_AV_HNDL hndl, UINT8 error_code, UINT8 *p_data,
UINT16 len);
/*******************************************************************************
**
** Function BTA_AvRemoteCmd
**
** Description Send a remote control command. This function can only
** be used if AV is enabled with feature BTA_AV_FEAT_RCCT.
**
** Returns void
**
*******************************************************************************/
void BTA_AvRemoteCmd(UINT8 rc_handle, UINT8 label, tBTA_AV_RC rc_id,
tBTA_AV_STATE key_state);
/*******************************************************************************
**
** Function BTA_AvVendorCmd
**
** Description Send a vendor dependent remote control command. This
** function can only be used if AV is enabled with feature
** BTA_AV_FEAT_VENDOR.
**
** Returns void
**
*******************************************************************************/
void BTA_AvVendorCmd(UINT8 rc_handle, UINT8 label, tBTA_AV_CODE cmd_code,
UINT8 *p_data, UINT16 len);
/*******************************************************************************
**
** Function BTA_AvVendorRsp
**
** Description Send a vendor dependent remote control response.
** This function must be called if a BTA_AV_VENDOR_CMD_EVT
** is received. This function can only be used if AV is
** enabled with feature BTA_AV_FEAT_VENDOR.
**
** Returns void
**
*******************************************************************************/
void BTA_AvVendorRsp(UINT8 rc_handle, UINT8 label, tBTA_AV_CODE rsp_code,
UINT8 *p_data, UINT16 len, UINT32 company_id);
/*******************************************************************************
**
** Function BTA_AvOpenRc
**
** Description Open an AVRCP connection toward the device with the
** specified handle
**
** Returns void
**
*******************************************************************************/
void BTA_AvOpenRc(tBTA_AV_HNDL handle);
/*******************************************************************************
**
** Function BTA_AvCloseRc
**
** Description Close an AVRCP connection
**
** Returns void
**
*******************************************************************************/
void BTA_AvCloseRc(UINT8 rc_handle);
/*******************************************************************************
**
** Function BTA_AvMetaRsp
**
** Description Send a Metadata command/response. The message contained
** in p_pkt can be composed with AVRC utility functions.
** This function can only be used if AV is enabled with feature
** BTA_AV_FEAT_METADATA.
**
** Returns void
**
*******************************************************************************/
void BTA_AvMetaRsp(UINT8 rc_handle, UINT8 label, tBTA_AV_CODE rsp_code,
BT_HDR *p_pkt);
/*******************************************************************************
**
** Function BTA_AvMetaCmd
**
** Description Send a Metadata/Advanced Control command. The message contained
** in p_pkt can be composed with AVRC utility functions.
** This function can only be used if AV is enabled with feature
** BTA_AV_FEAT_METADATA.
** This message is sent only when the peer supports the TG role.
*8 The only command makes sense right now is the absolute volume command.
**
** Returns void
**
*******************************************************************************/
void BTA_AvMetaCmd(UINT8 rc_handle, UINT8 label, tBTA_AV_CMD cmd_code, BT_HDR *p_pkt);
#ifdef __cplusplus
}
#endif
#endif ///BTA_AV_INCLUDED == TRUE
#endif /* BTA_AV_API_H */

View File

@ -0,0 +1,77 @@
/******************************************************************************
*
* Copyright (C) 2005-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.
*
******************************************************************************/
/******************************************************************************
*
* This is the interface file for advanced audio/video call-in functions.
*
******************************************************************************/
#ifndef BTA_AV_CI_H
#define BTA_AV_CI_H
#include "bta_av_api.h"
#if (BTA_AV_INCLUDED == TRUE)
/*****************************************************************************
** Function Declarations
*****************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
/*******************************************************************************
**
** Function bta_av_ci_src_data_ready
**
** Description This function sends an event to the AV indicating that
** the phone has audio stream data ready to send and AV
** should call bta_av_co_audio_src_data_path() or
** bta_av_co_video_src_data_path().
**
** Returns void
**
*******************************************************************************/
extern void bta_av_ci_src_data_ready(tBTA_AV_CHNL chnl);
/*******************************************************************************
**
** Function bta_av_ci_setconfig
**
** Description This function must be called in response to function
** bta_av_co_audio_setconfig() or bta_av_co_video_setconfig.
** Parameter err_code is set to an AVDTP status value;
** AVDT_SUCCESS if the codec configuration is ok,
** otherwise error.
**
** Returns void
**
*******************************************************************************/
extern void bta_av_ci_setconfig(tBTA_AV_HNDL hndl, UINT8 err_code,
UINT8 category, UINT8 num_seid, UINT8 *p_seid,
BOOLEAN recfg_needed, UINT8 avdt_handle);
#ifdef __cplusplus
}
#endif
#endif ///BTA_AV_INCLUDED == TRUE
#endif /* BTA_AV_CI_H */

View File

@ -0,0 +1,393 @@
/******************************************************************************
*
* Copyright (C) 2003-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.
*
******************************************************************************/
/******************************************************************************
*
* This is the interface file for advanced audio/video call-out functions.
*
******************************************************************************/
#ifndef BTA_AV_CO_H
#define BTA_AV_CO_H
#include "l2c_api.h"
#include "bta_av_api.h"
#if (BTA_AV_INCLUDED == TRUE)
/*****************************************************************************
** Constants and data types
*****************************************************************************/
/* TRUE to use SCMS-T content protection */
#ifndef BTA_AV_CO_CP_SCMS_T
#define BTA_AV_CO_CP_SCMS_T FALSE
#endif
/* the content protection IDs assigned by BT SIG */
#define BTA_AV_CP_SCMS_T_ID 0x0002
#define BTA_AV_CP_DTCP_ID 0x0001
#define BTA_AV_CP_LOSC 2
#define BTA_AV_CP_INFO_LEN 3
#define BTA_AV_CP_SCMS_COPY_MASK 3
#define BTA_AV_CP_SCMS_COPY_FREE 2
#define BTA_AV_CP_SCMS_COPY_ONCE 1
#define BTA_AV_CP_SCMS_COPY_NEVER 0
#define BTA_AV_CO_DEFAULT_AUDIO_OFFSET AVDT_MEDIA_OFFSET
enum {
BTA_AV_CO_ST_INIT,
BTA_AV_CO_ST_IN,
BTA_AV_CO_ST_OUT,
BTA_AV_CO_ST_OPEN,
BTA_AV_CO_ST_STREAM
};
/* data type for the Audio Codec Information*/
typedef struct {
UINT16 bit_rate; /* SBC encoder bit rate in kbps */
UINT16 bit_rate_busy; /* SBC encoder bit rate in kbps */
UINT16 bit_rate_swampd;/* SBC encoder bit rate in kbps */
UINT8 busy_level; /* Busy level indicating the bit-rate to be used */
UINT8 codec_info[AVDT_CODEC_SIZE];
UINT8 codec_type; /* Codec type */
} tBTA_AV_AUDIO_CODEC_INFO;
/*******************************************************************************
**
** Function bta_av_co_audio_init
**
** Description This callout function is executed by AV when it is
** started by calling BTA_AvEnable(). This function can be
** used by the phone to initialize audio paths or for other
** initialization purposes.
**
**
** Returns Stream codec and content protection capabilities info.
**
*******************************************************************************/
extern BOOLEAN bta_av_co_audio_init(UINT8 *p_codec_type, UINT8 *p_codec_info,
UINT8 *p_num_protect, UINT8 *p_protect_info, UINT8 index);
/*******************************************************************************
**
** Function bta_av_co_audio_disc_res
**
** Description This callout function is executed by AV to report the
** number of stream end points (SEP) were found during the
** AVDT stream discovery process.
**
**
** Returns void.
**
*******************************************************************************/
extern void bta_av_co_audio_disc_res(tBTA_AV_HNDL hndl, UINT8 num_seps,
UINT8 num_snk, UINT8 num_src, BD_ADDR addr, UINT16 uuid_local);
/*******************************************************************************
**
** Function bta_av_co_video_disc_res
**
** Description This callout function is executed by AV to report the
** number of stream end points (SEP) were found during the
** AVDT stream discovery process.
**
**
** Returns void.
**
*******************************************************************************/
extern void bta_av_co_video_disc_res(tBTA_AV_HNDL hndl, UINT8 num_seps,
UINT8 num_snk, BD_ADDR addr);
/*******************************************************************************
**
** Function bta_av_co_audio_getconfig
**
** Description This callout function is executed by AV to retrieve the
** desired codec and content protection configuration for the
** audio stream.
**
**
** Returns Stream codec and content protection configuration info.
**
*******************************************************************************/
extern UINT8 bta_av_co_audio_getconfig(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT8 *p_codec_info, UINT8 *p_sep_info_idx, UINT8 seid,
UINT8 *p_num_protect, UINT8 *p_protect_info);
/*******************************************************************************
**
** Function bta_av_co_video_getconfig
**
** Description This callout function is executed by AV to retrieve the
** desired codec and content protection configuration for the
** video stream.
**
**
** Returns Stream codec and content protection configuration info.
**
*******************************************************************************/
extern UINT8 bta_av_co_video_getconfig(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT8 *p_codec_info, UINT8 *p_sep_info_idx, UINT8 seid,
UINT8 *p_num_protect, UINT8 *p_protect_info);
/*******************************************************************************
**
** Function bta_av_co_audio_setconfig
**
** Description This callout function is executed by AV to set the
** codec and content protection configuration of the audio stream.
**
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_audio_setconfig(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT8 *p_codec_info, UINT8 seid, BD_ADDR addr,
UINT8 num_protect, UINT8 *p_protect_info, UINT8 t_local_sep, UINT8 avdt_handle);
/*******************************************************************************
**
** Function bta_av_co_video_setconfig
**
** Description This callout function is executed by AV to set the
** codec and content protection configuration of the video stream.
**
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_video_setconfig(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT8 *p_codec_info, UINT8 seid, BD_ADDR addr,
UINT8 num_protect, UINT8 *p_protect_info);
/*******************************************************************************
**
** Function bta_av_co_audio_open
**
** Description This function is called by AV when the audio stream connection
** is opened.
** BTA-AV maintains the MTU of A2DP streams.
** If this is the 2nd audio stream, mtu is the smaller of the 2
** streams.
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_audio_open(tBTA_AV_HNDL hndl,
tBTA_AV_CODEC codec_type, UINT8 *p_codec_info,
UINT16 mtu);
/*******************************************************************************
**
** Function bta_av_co_video_open
**
** Description This function is called by AV when the video stream connection
** is opened.
**
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_video_open(tBTA_AV_HNDL hndl,
tBTA_AV_CODEC codec_type, UINT8 *p_codec_info,
UINT16 mtu);
/*******************************************************************************
**
** Function bta_av_co_audio_close
**
** Description This function is called by AV when the audio stream connection
** is closed.
** BTA-AV maintains the MTU of A2DP streams.
** When one stream is closed and no other audio stream is open,
** mtu is reported as 0.
** Otherwise, the MTU remains open is reported.
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_audio_close(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT16 mtu);
/*******************************************************************************
**
** Function bta_av_co_video_close
**
** Description This function is called by AV when the video stream connection
** is closed.
**
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_video_close(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT16 mtu);
/*******************************************************************************
**
** Function bta_av_co_audio_start
**
** Description This function is called by AV when the audio streaming data
** transfer is started.
**
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_audio_start(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT8 *p_codec_info, BOOLEAN *p_no_rtp_hdr);
/*******************************************************************************
**
** Function bta_av_co_video_start
**
** Description This function is called by AV when the video streaming data
** transfer is started.
**
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_video_start(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
UINT8 *p_codec_info, BOOLEAN *p_no_rtp_hdr);
/*******************************************************************************
**
** Function bta_av_co_audio_stop
**
** Description This function is called by AV when the audio streaming data
** transfer is stopped.
**
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_audio_stop(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type);
/*******************************************************************************
**
** Function bta_av_co_video_stop
**
** Description This function is called by AV when the video streaming data
** transfer is stopped.
**
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_video_stop(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type);
/*******************************************************************************
**
** Function bta_av_co_audio_src_data_path
**
** Description This function is called to get the next data buffer from
** the audio codec
**
** Returns NULL if data is not ready.
** Otherwise, a GKI buffer (BT_HDR*) containing the audio data.
**
*******************************************************************************/
extern void *bta_av_co_audio_src_data_path(tBTA_AV_CODEC codec_type,
UINT32 *p_len, UINT32 *p_timestamp);
/*******************************************************************************
**
** Function bta_av_co_video_src_data_path
**
** Description This function is called to get the next data buffer from
** the video codec.
**
** Returns NULL if data is not ready.
** Otherwise, a video data buffer (UINT8*).
**
*******************************************************************************/
extern void *bta_av_co_video_src_data_path(tBTA_AV_CODEC codec_type,
UINT32 *p_len, UINT32 *p_timestamp);
/*******************************************************************************
**
** Function bta_av_co_audio_drop
**
** Description An Audio packet is dropped. .
** It's very likely that the connected headset with this handle
** is moved far away. The implementation may want to reduce
** the encoder bit rate setting to reduce the packet size.
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_audio_drop(tBTA_AV_HNDL hndl);
/*******************************************************************************
**
** Function bta_av_co_video_report_conn
**
** Description This function is called by AV when the reporting channel is
** opened (open=TRUE) or closed (open=FALSE).
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_video_report_conn (BOOLEAN open, UINT8 avdt_handle);
/*******************************************************************************
**
** Function bta_av_co_video_report_rr
**
** Description This function is called by AV when a Receiver Report is
** received
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_video_report_rr (UINT32 packet_lost);
/*******************************************************************************
**
** Function bta_av_co_audio_delay
**
** Description This function is called by AV when the audio stream connection
** needs to send the initial delay report to the connected SRC.
**
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_audio_delay(tBTA_AV_HNDL hndl, UINT16 delay);
/*******************************************************************************
**
** Function bta_av_co_video_delay
**
** Description This function is called by AV when the video stream connection
** needs to send the initial delay report to the connected SRC.
**
**
** Returns void
**
*******************************************************************************/
extern void bta_av_co_video_delay(tBTA_AV_HNDL hndl, UINT16 delay);
#endif ///BTA_AV_INCLUDED == TRUE
#endif /* BTA_AV_CO_H */

View File

@ -0,0 +1,223 @@
/******************************************************************************
*
* Copyright (C) 2004-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.
*
******************************************************************************/
/******************************************************************************
*
* This is the interface to utility functions for dealing with SBC data
* frames and codec capabilities.
*
******************************************************************************/
#ifndef BTA_AV_SBC_H
#define BTA_AV_SBC_H
#if (BTA_AV_INCLUDED == TRUE)
/*****************************************************************************
** constants
*****************************************************************************/
/* SBC packet header size */
#define BTA_AV_SBC_HDR_SIZE A2D_SBC_MPL_HDR_LEN
/*******************************************************************************
**
** Function bta_av_sbc_init_up_sample
**
** Description initialize the up sample
**
** src_sps: samples per second (source audio data)
** dst_sps: samples per second (converted audio data)
** bits: number of bits per pcm sample
** n_channels: number of channels (i.e. mono(1), stereo(2)...)
**
** Returns none
**
*******************************************************************************/
extern void bta_av_sbc_init_up_sample (UINT32 src_sps, UINT32 dst_sps,
UINT16 bits, UINT16 n_channels);
/*******************************************************************************
**
** Function bta_av_sbc_up_sample
**
** Description Given the source (p_src) audio data and
** source speed (src_sps, samples per second),
** This function converts it to audio data in the desired format
**
** p_src: the data buffer that holds the source audio data
** p_dst: the data buffer to hold the converted audio data
** src_samples: The number of source samples (number of bytes)
** dst_samples: The size of p_dst (number of bytes)
**
** Note: An AE reported an issue with this function.
** When called with bta_av_sbc_up_sample(src, uint8_array_dst..)
** the byte before uint8_array_dst may get overwritten.
** Using uint16_array_dst avoids the problem.
** This issue is related to endian-ness and is hard to resolve
** in a generic manner.
** **************** Please use uint16 array as dst.
**
** Returns The number of bytes used in p_dst
** The number of bytes used in p_src (in *p_ret)
**
*******************************************************************************/
extern int bta_av_sbc_up_sample (void *p_src, void *p_dst,
UINT32 src_samples, UINT32 dst_samples,
UINT32 *p_ret);
/*******************************************************************************
**
** Function bta_av_sbc_up_sample_16s (16bits-stereo)
**
** Description Given the source (p_src) audio data and
** source speed (src_sps, samples per second),
** This function converts it to audio data in the desired format
**
** p_src: the data buffer that holds the source audio data
** p_dst: the data buffer to hold the converted audio data
** src_samples: The number of source samples (in uint of 4 bytes)
** dst_samples: The size of p_dst (in uint of 4 bytes)
**
** Returns The number of bytes used in p_dst
** The number of bytes used in p_src (in *p_ret)
**
*******************************************************************************/
extern int bta_av_sbc_up_sample_16s (void *p_src, void *p_dst,
UINT32 src_samples, UINT32 dst_samples,
UINT32 *p_ret);
/*******************************************************************************
**
** Function bta_av_sbc_up_sample_16m (16bits-mono)
**
** Description Given the source (p_src) audio data and
** source speed (src_sps, samples per second),
** This function converts it to audio data in the desired format
**
** p_src: the data buffer that holds the source audio data
** p_dst: the data buffer to hold the converted audio data
** src_samples: The number of source samples (in uint of 2 bytes)
** dst_samples: The size of p_dst (in uint of 2 bytes)
**
** Returns The number of bytes used in p_dst
** The number of bytes used in p_src (in *p_ret)
**
*******************************************************************************/
extern int bta_av_sbc_up_sample_16m (void *p_src, void *p_dst,
UINT32 src_samples, UINT32 dst_samples,
UINT32 *p_ret);
/*******************************************************************************
**
** Function bta_av_sbc_up_sample_8s (8bits-stereo)
**
** Description Given the source (p_src) audio data and
** source speed (src_sps, samples per second),
** This function converts it to audio data in the desired format
**
** p_src: the data buffer that holds the source audio data
** p_dst: the data buffer to hold the converted audio data
** src_samples: The number of source samples (in uint of 2 bytes)
** dst_samples: The size of p_dst (in uint of 2 bytes)
**
** Returns The number of bytes used in p_dst
** The number of bytes used in p_src (in *p_ret)
**
*******************************************************************************/
extern int bta_av_sbc_up_sample_8s (void *p_src, void *p_dst,
UINT32 src_samples, UINT32 dst_samples,
UINT32 *p_ret);
/*******************************************************************************
**
** Function bta_av_sbc_up_sample_8m (8bits-mono)
**
** Description Given the source (p_src) audio data and
** source speed (src_sps, samples per second),
** This function converts it to audio data in the desired format
**
** p_src: the data buffer that holds the source audio data
** p_dst: the data buffer to hold the converted audio data
** src_samples: The number of source samples (number of bytes)
** dst_samples: The size of p_dst (number of bytes)
**
** Returns The number of bytes used in p_dst
** The number of bytes used in p_src (in *p_ret)
**
*******************************************************************************/
extern int bta_av_sbc_up_sample_8m (void *p_src, void *p_dst,
UINT32 src_samples, UINT32 dst_samples,
UINT32 *p_ret);
/*******************************************************************************
**
** Function bta_av_sbc_cfg_for_cap
**
** Description Determine the preferred SBC codec configuration for the
** given codec capabilities. The function is passed the
** preferred codec configuration and the peer codec
** capabilities for the stream. The function attempts to
** match the preferred capabilities with the configuration
** as best it can. The resulting codec configuration is
** returned in the same memory used for the capabilities.
**
** Returns 0 if ok, nonzero if error.
** Codec configuration in p_cap.
**
*******************************************************************************/
extern UINT8 bta_av_sbc_cfg_for_cap(UINT8 *p_peer, tA2D_SBC_CIE *p_cap, tA2D_SBC_CIE *p_pref);
/*******************************************************************************
**
** Function bta_av_sbc_cfg_in_cap
**
** Description This function checks whether an SBC codec configuration
** is allowable for the given codec capabilities.
**
** Returns 0 if ok, nonzero if error.
**
*******************************************************************************/
extern UINT8 bta_av_sbc_cfg_in_cap(UINT8 *p_cfg, tA2D_SBC_CIE *p_cap);
/*******************************************************************************
**
** Function bta_av_sbc_cfg_matches_cap
**
** Description This function checks whether an SBC codec configuration
** matched with capabilities. Here we check subset.
**
** Returns 0 if ok, nonzero if error.
**
*******************************************************************************/
extern UINT8 bta_av_sbc_cfg_matches_cap(UINT8 *p_cfg, tA2D_SBC_CIE *p_cap);
/*******************************************************************************
**
** Function bta_av_sbc_bld_hdr
**
** Description This function builds the packet header for MPF1.
**
** Returns void
**
*******************************************************************************/
extern void bta_av_sbc_bld_hdr(BT_HDR *p_buf, UINT16 fr_per_pkt);
#endif ///BTA_AV_INCLUDED == TRUE
#endif /* BTA_AV_SBC_H */

View File

@ -270,4 +270,13 @@ extern void bta_dm_co_ble_io_req(BD_ADDR bd_addr, tBTA_IO_CAP *p_io_cap,
tBTA_LE_KEY_TYPE *p_resp_key );
// btla-specific --
extern void bta_dm_co_ble_set_io_cap(UINT8 ble_io_cap);
extern void bta_dm_co_ble_set_auth_req(UINT8 ble_auth_req);
extern void bta_dm_co_ble_set_init_key_req(UINT8 init_key);
extern void bta_dm_co_ble_set_rsp_key_req(UINT8 rsp_key);
extern void bta_dm_co_ble_set_max_key_size(UINT8 ble_key_size);
#endif

View File

@ -984,7 +984,7 @@ extern tBTA_GATT_STATUS BTA_GATTC_DeregisterForNotifications (tBTA_GATTC_IF
** Description This function is called to prepare write a characteristic value.
**
** Parameters conn_id - connection ID.
** p_char_id - GATT characteritic ID of the service.
** p_char_id - GATT characteritic ID of the service.
** offset - offset of the write value.
** len: length of the data to be written.
** p_value - the value to be written.
@ -1001,6 +1001,26 @@ extern void BTA_GATTC_PrepareWrite (UINT16 conn_id,
/*******************************************************************************
**
** Function BTA_GATTC_PrepareWriteCharDescr
**
** Description This function is called to prepare write a characteristic descriptor value.
**
** Parameters conn_id - connection ID.
** p_char_descr_id - GATT characteritic descriptor ID of the service.
** offset - offset of the write value.
** len: length of the data to be written.
** p_value - the value to be written.
**
** Returns None
**
*******************************************************************************/
extern void BTA_GATTC_PrepareWriteCharDescr (UINT16 conn_id,
tBTA_GATTC_CHAR_DESCR_ID *p_char_descr_id,
UINT16 offset,
tBTA_GATT_UNFMT *p_data,
tBTA_GATT_AUTH_REQ auth_req);
/*******************************************************************************
**
** Function BTA_GATTC_ExecuteWrite
**
** Description This function is called to execute write a prepare write sequence.

View File

@ -320,7 +320,7 @@ typedef struct {
} tBTA_GATTC_SERV;
#ifndef BTA_GATTC_NOTIF_REG_MAX
#define BTA_GATTC_NOTIF_REG_MAX 15
#define BTA_GATTC_NOTIF_REG_MAX 7//15
#endif
typedef struct {
@ -398,8 +398,9 @@ typedef struct {
tBTA_GATTC_CLCB clcb[BTA_GATTC_CLCB_MAX];
tBTA_GATTC_SERV known_server[BTA_GATTC_KNOWN_SR_MAX];
#if (SDP_INCLUDED == TRUE)
tSDP_DISCOVERY_DB *p_sdp_db;
#endif ///SDP_INCLUDED == TRUE
UINT16 sdp_conn_id;
} tBTA_GATTC_CB;

View File

@ -20,6 +20,7 @@
#include "bta_api.h"
#include "hidh_api.h"
#if defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE)
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
#include "gatt_api.h"
@ -538,4 +539,7 @@ extern void bta_hh_le_hid_read_rpt_clt_cfg(BD_ADDR bd_addr, UINT8 rpt_id);
}
#endif
#endif ///defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE)
#endif /* BTA_HH_API_H */

View File

@ -30,6 +30,7 @@
#include "bta_api.h"
#include "btm_api.h"
#if (SDP_INCLUDED == TRUE)
/* status values */
#define BTA_SDP_SUCCESS 0 /* Successful operation. */
#define BTA_SDP_FAILURE 1 /* Generic failure. */
@ -70,7 +71,9 @@ typedef void (tBTA_SDP_DM_CBACK)(tBTA_SDP_EVT event, tBTA_SDP *p_data, void *use
/* MCE configuration structure */
typedef struct {
UINT16 sdp_db_size; /* The size of p_sdp_db */
#if (SDP_INCLUDED == TRUE)
tSDP_DISCOVERY_DB *p_sdp_db; /* The data buffer to keep SDP database */
#endif ///SDP_INCLUDED == TRUE
} tBTA_SDP_CFG;
#ifdef __cplusplus
@ -139,4 +142,6 @@ extern tBTA_SDP_STATUS BTA_SdpRemoveRecordByUser(void *user_data);
}
#endif
#endif ///SDP_INCLUDED == TRUE
#endif /* BTA_SDP_API_H */

View File

@ -0,0 +1,30 @@
// Copyright 2015-2016 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.
#ifndef __BTC_ALARM_H__
#define __BTC_ALARM_H__
#include <stdint.h>
#include "alarm.h"
/* btc_alarm_args_t */
typedef struct {
osi_alarm_callback_t cb;
void *cb_data;
} btc_alarm_args_t;
void btc_alarm_handler(btc_msg_t *msg);
#endif /* __BTC_ALARM_H__ */

View File

@ -0,0 +1,176 @@
// Copyright 2015-2016 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.
/*******************************************************************************
*
* Filename: btc_av.h
*
* Description: Main API header file for all BTC AV functions accessed
* from internal stack.
*
*******************************************************************************/
#ifndef __BTC_AV_H__
#define __BTC_AV_H__
#include "esp_a2dp_api.h"
#include "btc_task.h"
#include "btc_common.h"
#include "btc_sm.h"
#include "bta_av_api.h"
#if (BTA_AV_INCLUDED == TRUE)
/*******************************************************************************
** Type definitions for callback functions
********************************************************************************/
typedef enum {
BTC_AV_CONNECT_REQ_EVT = BTA_AV_MAX_EVT,
BTC_AV_DISCONNECT_REQ_EVT,
BTC_AV_START_STREAM_REQ_EVT,
BTC_AV_STOP_STREAM_REQ_EVT,
BTC_AV_SUSPEND_STREAM_REQ_EVT,
BTC_AV_SINK_CONFIG_REQ_EVT,
} btc_av_sm_event_t;
typedef enum {
BTC_AV_SINK_API_INIT_EVT = 0,
BTC_AV_SINK_API_DEINIT_EVT,
BTC_AV_SINK_API_CONNECT_EVT,
BTC_AV_SINK_API_DISCONNECT_EVT,
BTC_AV_SINK_API_REG_DATA_CB_EVT,
} btc_av_act_t;
/* btc_av_args_t */
typedef union {
// BTC_AV_SINK_CONFIG_REQ_EVT -- internal event
esp_a2d_mcc_t mcc;
// BTC_AV_SINK_API_CONNECT_EVT
bt_bdaddr_t connect;
// BTC_AV_SINK_API_REG_DATA_CB_EVT
esp_a2d_data_cb_t data_cb;
} btc_av_args_t;
/*******************************************************************************
** BTC AV API
********************************************************************************/
void btc_a2dp_call_handler(btc_msg_t *msg);
void btc_a2dp_cb_handler(btc_msg_t *msg);
void btc_a2dp_sink_reg_data_cb(esp_a2d_data_cb_t callback);
/*******************************************************************************
**
** Function btc_av_get_sm_handle
**
** Description Fetches current av SM handle
**
** Returns None
**
*******************************************************************************/
btc_sm_handle_t btc_av_get_sm_handle(void);
/*******************************************************************************
**
** Function btc_av_stream_ready
**
** Description Checks whether AV is ready for starting a stream
**
** Returns None
**
*******************************************************************************/
BOOLEAN btc_av_stream_ready(void);
/*******************************************************************************
**
** Function btc_av_stream_started_ready
**
** Description Checks whether AV ready for media start in streaming state
**
** Returns None
**
*******************************************************************************/
BOOLEAN btc_av_stream_started_ready(void);
/*******************************************************************************
**
** Function btc_dispatch_sm_event
**
** Description Send event to AV statemachine
**
** Returns None
**
*******************************************************************************/
/* used to pass events to AV statemachine from other tasks */
void btc_dispatch_sm_event(btc_av_sm_event_t event, void *p_data, int len);
/*******************************************************************************
**
** Function btc_av_init
**
** Description Initializes btc AV if not already done
**
** Returns bt_status_t
**
*******************************************************************************/
bt_status_t btc_av_init(void);
/*******************************************************************************
**
** Function btc_av_is_connected
**
** Description Checks if av has a connected sink
**
** Returns BOOLEAN
**
*******************************************************************************/
BOOLEAN btc_av_is_connected(void);
/*******************************************************************************
**
** Function btc_av_is_peer_edr
**
** Description Check if the connected a2dp device supports
** EDR or not. Only when connected this function
** will accurately provide a true capability of
** remote peer. If not connected it will always be false.
**
** Returns TRUE if remote device is capable of EDR
**
*******************************************************************************/
BOOLEAN btc_av_is_peer_edr(void);
/******************************************************************************
**
** Function btc_av_clear_remote_suspend_flag
**
** Description Clears remote suspended flag
**
** Returns Void
********************************************************************************/
void btc_av_clear_remote_suspend_flag(void);
#endif ///BTA_AV_INCLUDED == TRUE
#endif /* __BTC_AV_H__ */

View File

@ -0,0 +1,203 @@
// Copyright 2015-2016 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.
/*****************************************************************************
**
** Name: btc_av_api.h
**
** Description: This is the public interface file for the advanced
** audio/video streaming (AV) subsystem of BTC.
**
*****************************************************************************/
#ifndef __BTC_AV_API_H__
#define __BTC_AV_API_H__
#include "bt_target.h"
#include "bta_av_api.h"
#include "btc_media.h"
#include "a2d_api.h"
#include "a2d_sbc.h"
#if (BTC_AV_INCLUDED == TRUE)
/*****************************************************************************
** Constants and data types
*****************************************************************************/
/* Codec type */
#define BTC_AV_CODEC_NONE 0xFF
#define BTC_AV_CODEC_SBC A2D_MEDIA_CT_SBC /* SBC media codec type */
#define BTC_AV_CODEC_PCM 0x5 /* Raw PCM */
typedef UINT8 tBTC_AV_CODEC_ID;
/* AV features masks */
#define BTC_AV_FEAT_RCTG BTA_AV_FEAT_RCTG /* remote control target */
#define BTC_AV_FEAT_RCCT BTA_AV_FEAT_RCCT /* remote control controller */
#define BTC_AV_FEAT_METADATA BTA_AV_FEAT_METADATA /* remote control Metadata Transfer command/response */
typedef UINT16 tBTC_AV_FEAT;
/* AV channel values */
#define BTC_AV_CHNL_MSK BTA_AV_CHNL_MSK
#define BTC_AV_CHNL_AUDIO BTA_AV_CHNL_AUDIO /* audio channel */
#define BTC_AV_CHNL_VIDEO BTA_AV_CHNL_VIDEO /* video channel */
typedef UINT8 tBTC_AV_CHNL;
typedef UINT8 tBTC_AV_HNDL;
/* Operation id list for BTC_AvRemoteCmd */
#define BTC_AV_ID_SELECT 0x00 /* select */
#define BTC_AV_ID_UP 0x01 /* up */
#define BTC_AV_ID_DOWN 0x02 /* down */
#define BTC_AV_ID_LEFT 0x03 /* left */
#define BTC_AV_ID_RIGHT 0x04 /* right */
#define BTC_AV_ID_RIGHT_UP 0x05 /* right-up */
#define BTC_AV_ID_RIGHT_DOWN 0x06 /* right-down */
#define BTC_AV_ID_LEFT_UP 0x07 /* left-up */
#define BTC_AV_ID_LEFT_DOWN 0x08 /* left-down */
#define BTC_AV_ID_ROOT_MENU 0x09 /* root menu */
#define BTC_AV_ID_SETUP_MENU 0x0A /* setup menu */
#define BTC_AV_ID_CONT_MENU 0x0B /* contents menu */
#define BTC_AV_ID_FAV_MENU 0x0C /* favorite menu */
#define BTC_AV_ID_EXIT 0x0D /* exit */
#define BTC_AV_ID_0 0x20 /* 0 */
#define BTC_AV_ID_1 0x21 /* 1 */
#define BTC_AV_ID_2 0x22 /* 2 */
#define BTC_AV_ID_3 0x23 /* 3 */
#define BTC_AV_ID_4 0x24 /* 4 */
#define BTC_AV_ID_5 0x25 /* 5 */
#define BTC_AV_ID_6 0x26 /* 6 */
#define BTC_AV_ID_7 0x27 /* 7 */
#define BTC_AV_ID_8 0x28 /* 8 */
#define BTC_AV_ID_9 0x29 /* 9 */
#define BTC_AV_ID_DOT 0x2A /* dot */
#define BTC_AV_ID_ENTER 0x2B /* enter */
#define BTC_AV_ID_CLEAR 0x2C /* clear */
#define BTC_AV_ID_CHAN_UP 0x30 /* channel up */
#define BTC_AV_ID_CHAN_DOWN 0x31 /* channel down */
#define BTC_AV_ID_PREV_CHAN 0x32 /* previous channel */
#define BTC_AV_ID_SOUND_SEL 0x33 /* sound select */
#define BTC_AV_ID_INPUT_SEL 0x34 /* input select */
#define BTC_AV_ID_DISP_INFO 0x35 /* display information */
#define BTC_AV_ID_HELP 0x36 /* help */
#define BTC_AV_ID_PAGE_UP 0x37 /* page up */
#define BTC_AV_ID_PAGE_DOWN 0x38 /* page down */
#define BTC_AV_ID_POWER 0x40 /* power */
#define BTC_AV_ID_VOL_UP 0x41 /* volume up */
#define BTC_AV_ID_VOL_DOWN 0x42 /* volume down */
#define BTC_AV_ID_MUTE 0x43 /* mute */
#define BTC_AV_ID_PLAY 0x44 /* play */
#define BTC_AV_ID_STOP 0x45 /* stop */
#define BTC_AV_ID_PAUSE 0x46 /* pause */
#define BTC_AV_ID_RECORD 0x47 /* record */
#define BTC_AV_ID_REWIND 0x48 /* rewind */
#define BTC_AV_ID_FAST_FOR 0x49 /* fast forward */
#define BTC_AV_ID_EJECT 0x4A /* eject */
#define BTC_AV_ID_FORWARD 0x4B /* forward */
#define BTC_AV_ID_BACKWARD 0x4C /* backward */
#define BTC_AV_ID_ANGLE 0x50 /* angle */
#define BTC_AV_ID_SUBPICT 0x51 /* subpicture */
#define BTC_AV_ID_F1 0x71 /* F1 */
#define BTC_AV_ID_F2 0x72 /* F2 */
#define BTC_AV_ID_F3 0x73 /* F3 */
#define BTC_AV_ID_F4 0x74 /* F4 */
#define BTC_AV_ID_F5 0x75 /* F5 */
#define BTC_AV_ID_VENDOR 0x7E /* vendor unique */
#define BTC_AV_KEYPRESSED_RELEASE 0x80
typedef UINT8 tBTC_AV_RC;
/* State flag for pass through command */
#define BTC_AV_STATE_PRESS 0 /* key pressed */
#define BTC_AV_STATE_RELEASE 1 /* key released */
typedef UINT8 tBTC_AV_STATE;
typedef UINT8 tBTC_AV_RC_HNDL;
/* Command codes for BTC_AvVendorCmd */
#define BTC_AV_CMD_CTRL 0
#define BTC_AV_CMD_STATUS 1
#define BTC_AV_CMD_SPEC_INQ 2
#define BTC_AV_CMD_NOTIF 3
#define BTC_AV_CMD_GEN_INQ 4
typedef UINT8 tBTC_AV_CMD;
/* AV callback events */
#define BTC_AV_OPEN_EVT 0 /* connection opened */
#define BTC_AV_CLOSE_EVT 1 /* connection closed */
#define BTC_AV_START_EVT 2 /* stream data transfer started */
#define BTC_AV_STOP_EVT 3 /* stream data transfer stopped */
#define BTC_AV_RC_OPEN_EVT 4 /* remote control channel open */
#define BTC_AV_RC_CLOSE_EVT 5 /* remote control channel closed */
#define BTC_AV_REMOTE_CMD_EVT 6 /* remote control command */
#define BTC_AV_REMOTE_RSP_EVT 7 /* remote control response */
#define BTC_AV_META_MSG_EVT 8 /* metadata messages */
typedef UINT8 tBTC_AV_EVT;
#define BTC_AV_FEEDING_ASYNCHRONOUS 0 /* asynchronous feeding, use tx av timer */
#define BTC_AV_FEEDING_SYNCHRONOUS 1 /* synchronous feeding, no av tx timer */
#define BTC_AV_MAX_SYNCHRONOUS_LATENCY 80 /* max latency in ms for BTC_AV_FEEDING_SYNCHRONOUS */
#define BTC_AV_MIN_SYNCHRONOUS_LATENCY 4 /* min latency in ms for BTC_AV_FEEDING_SYNCHRONOUS */
typedef UINT8 tBTC_AV_FEEDING_MODE;
#define BTC_AV_CHANNEL_MODE_MONO A2D_SBC_IE_CH_MD_MONO
#define BTC_AV_CHANNEL_MODE_STEREO A2D_SBC_IE_CH_MD_STEREO
#define BTC_AV_CHANNEL_MODE_JOINT A2D_SBC_IE_CH_MD_JOINT
#define BTC_AV_CHANNEL_MODE_DUAL A2D_SBC_IE_CH_MD_DUAL
typedef UINT8 tBTC_AV_CHANNEL_MODE;
/**
* Structure used to configure the AV codec capabilities/config
*/
typedef struct {
tBTC_AV_CODEC_ID id; /* Codec ID (in terms of BTC) */
UINT8 info[AVDT_CODEC_SIZE]; /* Codec info (can be config or capabilities) */
} tBTC_AV_CODEC_INFO;
/**
* Structure used to configure the AV media feeding
*/
typedef struct {
UINT16 sampling_freq; /* 44100, 48000 etc */
UINT16 num_channel; /* 1 for mono or 2 stereo */
UINT8 bit_per_sample; /* Number of bits per sample (8, 16) */
} tBTC_AV_MEDIA_FEED_CFG_PCM;
typedef union {
tBTC_AV_MEDIA_FEED_CFG_PCM pcm; /* Raw PCM feeding format */
} tBTC_AV_MEDIA_FEED_CFG;
typedef struct {
tBTC_AV_CODEC_ID format; /* Media codec identifier */
tBTC_AV_MEDIA_FEED_CFG cfg; /* Media codec configuration */
} tBTC_AV_MEDIA_FEEDINGS;
#ifdef __cplusplus
}
#endif
#endif ///BTC_AV_INCLUDED == TRUE
#endif /* __BTC_AV_API_H__ */

View File

@ -0,0 +1,172 @@
// Copyright 2015-2016 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.
#ifndef __BTC_AV_CO_H__
#define __BTC_AV_CO_H__
#include "btc_media.h"
#if (BTA_AV_INCLUDED == TRUE)
/*******************************************************************************
** Constants & Macros
********************************************************************************/
enum {
BTC_SV_AV_AA_SBC_INDEX = 0,
BTC_SV_AV_AA_SBC_SINK_INDEX,
BTC_SV_AV_AA_SEP_INDEX /* Last index */
};
/*******************************************************************************
** Functions
********************************************************************************/
/*******************************************************************************
**
** Function bta_av_co_cp_is_active
**
** Description Get the current configuration of content protection
**
** Returns TRUE if the current streaming has CP, FALSE otherwise
**
*******************************************************************************/
BOOLEAN bta_av_co_cp_is_active(void);
/*******************************************************************************
**
** Function bta_av_co_cp_get_flag
**
** Description Get content protection flag
** BTA_AV_CP_SCMS_COPY_NEVER
** BTA_AV_CP_SCMS_COPY_ONCE
** BTA_AV_CP_SCMS_COPY_FREE
**
** Returns The current flag value
**
*******************************************************************************/
UINT8 bta_av_co_cp_get_flag(void);
/*******************************************************************************
**
** Function bta_av_co_cp_set_flag
**
** Description Set content protection flag
** BTA_AV_CP_SCMS_COPY_NEVER
** BTA_AV_CP_SCMS_COPY_ONCE
** BTA_AV_CP_SCMS_COPY_FREE
**
** Returns TRUE if setting the SCMS flag is supported else FALSE
**
*******************************************************************************/
BOOLEAN bta_av_co_cp_set_flag(UINT8 cp_flag);
/*******************************************************************************
**
** Function bta_av_co_audio_codec_reset
**
** Description Reset the current codec configuration
**
** Returns void
**
*******************************************************************************/
void bta_av_co_audio_codec_reset(void);
/*******************************************************************************
**
** Function bta_av_co_audio_codec_supported
**
** Description Check if all opened connections are compatible with a codec
** configuration
**
** Returns TRUE if all opened devices support this codec, FALSE otherwise
**
*******************************************************************************/
BOOLEAN bta_av_co_audio_codec_supported(tBTC_STATUS *p_status);
/*******************************************************************************
**
** Function bta_av_co_audio_set_codec
**
** Description Set the current codec configuration from the feeding type.
** This function is starting to modify the configuration, it
** should be protected.
**
** Returns TRUE if successful, FALSE otherwise
**
*******************************************************************************/
BOOLEAN bta_av_co_audio_set_codec(const tBTC_AV_MEDIA_FEEDINGS *p_feeding, tBTC_STATUS *p_status);
/*******************************************************************************
**
** Function bta_av_co_audio_get_sbc_config
**
** Description Retrieves the SBC codec configuration. If the codec in use
** is not SBC, return the default SBC codec configuration.
**
** Returns TRUE if codec is SBC, FALSE otherwise
**
*******************************************************************************/
BOOLEAN bta_av_co_audio_get_sbc_config(tA2D_SBC_CIE *p_sbc_config, UINT16 *p_minmtu);
/*******************************************************************************
**
** Function bta_av_co_audio_discard_config
**
** Description Discard the codec configuration of a connection
**
** Returns Nothing
**
*******************************************************************************/
void bta_av_co_audio_discard_config(tBTA_AV_HNDL hndl);
/*******************************************************************************
**
** Function bta_av_co_init
**
** Description Initialization
**
** Returns Nothing
**
*******************************************************************************/
void bta_av_co_init(void);
/*******************************************************************************
**
** Function bta_av_co_peer_cp_supported
**
** Description Checks if the peer supports CP
**
** Returns TRUE if the peer supports CP
**
*******************************************************************************/
BOOLEAN bta_av_co_peer_cp_supported(tBTA_AV_HNDL hndl);
/*******************************************************************************
**
** Function bta_av_co_get_remote_bitpool_pref
**
** Description Check if remote side did a setconfig within the limits
** of our exported bitpool range. If set we will set the
** remote preference.
**
** Returns TRUE if config set, FALSE otherwize
**
*******************************************************************************/
BOOLEAN bta_av_co_get_remote_bitpool_pref(UINT8 *min, UINT8 *max);
#endif ///BTA_AV_INCLUDED == TRUE
#endif

View File

@ -0,0 +1,77 @@
/*
* Copyright (C) 2012 The Android Open Source Project
*
* 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 __BTC_AVRC_H__
#define __BTC_AVRC_H__
#include <stdint.h>
#include <stdbool.h>
#include "bt_defs.h"
#include "bt_types.h"
#include "bta_av_api.h"
#if (BTC_AV_INCLUDED == TRUE)
#ifndef BTC_AVRC_TGT_INCLUDED
#define BTC_AVRC_TGT_INCLUDED FALSE
#endif
/* Macros */
typedef enum {
BTRC_FEAT_NONE = 0x00, /* AVRCP 1.0 */
BTRC_FEAT_METADATA = 0x01, /* AVRCP 1.3 */
BTRC_FEAT_ABSOLUTE_VOLUME = 0x02, /* Supports TG role and volume sync */
BTRC_FEAT_BROWSE = 0x04, /* AVRCP 1.4 and up, with Browsing support */
} btrc_remote_features_t;
typedef enum {
BTC_AVRC_CTRL_API_INIT_EVT = 0,
BTC_AVRC_CTRL_API_DEINIT_EVT,
BTC_AVRC_CTRL_API_SND_PTCMD_EVT
} btc_avrc_act_t;
typedef struct {
uint8_t tl; /* transaction label */
uint8_t key_code;
uint8_t key_state;
} pt_cmd_t;
/* btc_avrc_args_t */
typedef union {
// BTC_AVRC_CTRL_API_SND_PT_CMD_EVT
struct {
uint8_t tl;
uint8_t key_code;
uint8_t key_state;
} pt_cmd;
} btc_avrc_args_t;
/** BT-RC Controller callback structure. */
typedef void (* btrc_passthrough_rsp_callback) (int id, int key_state);
typedef void (* btrc_connection_state_callback) (bool state, bt_bdaddr_t *bd_addr);
void btc_rc_handler(tBTA_AV_EVT event, tBTA_AV *p_data);
BOOLEAN btc_rc_get_connected_peer(BD_ADDR peer_addr);
/*******************************************************************************
** BTC AVRC API
********************************************************************************/
void btc_avrc_call_handler(btc_msg_t *msg);
#endif ///BTC_AV_INCLUDED == TRUE
#endif /* __BTC_AVRC_H__ */

View File

@ -0,0 +1,124 @@
// Copyright (C) 2014 The Android Open Source Project
//
// 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 "bt_types.h"
#include "bt_target.h"
#if (SMP_INCLUDED == TRUE)
#define BTC_LE_LOCAL_KEY_IR (1<<0)
#define BTC_LE_LOCAL_KEY_IRK (1<<1)
#define BTC_LE_LOCAL_KEY_DHK (1<<2)
#define BTC_LE_LOCAL_KEY_ER (1<<3)
/************************************************************************************
** Local type definitions
************************************************************************************/
typedef struct
{
uint32_t num_devices;
bt_bdaddr_t devices[BTM_SEC_MAX_DEVICE_RECORDS];
} btc_bonded_devices_t;
typedef struct
{
bool is_penc_key_rcvd;
tBTM_LE_PENC_KEYS penc_key; /* received peer encryption key */
bool is_pcsrk_key_rcvd;
tBTM_LE_PCSRK_KEYS pcsrk_key; /* received peer device SRK */
bool is_pid_key_rcvd;
tBTM_LE_PID_KEYS pid_key; /* peer device ID key */
bool is_lenc_key_rcvd;
tBTM_LE_LENC_KEYS lenc_key; /* local encryption reproduction keys LTK = = d1(ER,DIV,0)*/
bool is_lcsrk_key_rcvd;
tBTM_LE_LCSRK_KEYS lcsrk_key; /* local device CSRK = d1(ER,DIV,1)*/
bool is_lidk_key_rcvd; /* local identity key received */
} btc_dm_ble_cb_t;
typedef struct
{
bt_bdaddr_t static_bdaddr;
BD_ADDR bd_addr;
btc_dm_ble_cb_t ble;
} btc_dm_pairing_cb_t;
typedef struct
{
uint8_t ir[BT_OCTET16_LEN];
uint8_t irk[BT_OCTET16_LEN];
uint8_t dhk[BT_OCTET16_LEN];
}btc_dm_local_key_id_t;
typedef struct
{
bool is_er_rcvd;
uint8_t er[BT_OCTET16_LEN];
bool is_id_keys_rcvd;
btc_dm_local_key_id_t id_keys; /* ID kyes */
}btc_dm_local_key_cb_t;
typedef struct
{
BT_OCTET16 sp_c;
BT_OCTET16 sp_r;
BD_ADDR oob_bdaddr; /* peer bdaddr*/
} btc_dm_oob_cb_t;
extern btc_dm_pairing_cb_t pairing_cb;
extern btc_dm_local_key_cb_t ble_local_key_cb;
bt_status_t btc_storage_load_bonded_ble_devices(void);
bt_status_t btc_in_fetch_bonded_ble_devices(int add);
void btc_dm_remove_ble_bonding_keys(void);
bt_status_t btc_storage_add_ble_bonding_key( bt_bdaddr_t *remote_bd_addr,
char *key,
uint8_t key_type,
uint8_t key_length);
void btc_save_ble_bonding_keys(void);
bt_status_t btc_in_fetch_bonded_ble_device(const char *remote_bd_addr, int add,
btc_bonded_devices_t *p_bonded_devices);
bt_status_t btc_storage_get_ble_bonding_key(bt_bdaddr_t *remote_bd_addr,
uint8_t key_type,
char *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_remove_ble_local_keys(void);
bt_status_t btc_storage_get_ble_local_key(uint8_t key_type,
char *key_value,
int key_len);
bt_status_t btc_storage_get_remote_addr_type(bt_bdaddr_t *remote_bd_addr,
int *addr_type);
bt_status_t btc_storage_set_remote_addr_type(bt_bdaddr_t *remote_bd_addr,
uint8_t addr_type);
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

View File

@ -0,0 +1,35 @@
// Copyright 2015-2016 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.
#ifndef __BTC_COMMON_H__
#define __BTC_COMMON_H__
#include "bt_trace.h"
#include "bt_types.h"
#include "osi.h"
#define BTC_ASSERTC(cond, msg, val) if (!(cond)) { LOG_ERROR( \
"### ASSERT : %s line %d %s (%d) ###", __FILE__, __LINE__, msg, val);}
#define BTC_HAL_CBACK(P_CB, P_CBACK, ...)\
if (P_CB && P_CB->P_CBACK) { \
LOG_INFO("HAL %s->%s", #P_CB, #P_CBACK); \
P_CB->P_CBACK(__VA_ARGS__); \
} \
else { \
BTC_ASSERTC(0, "Callback is NULL", 0); \
}
#endif /* __BTC_COMMON_H__ */

View File

@ -0,0 +1,54 @@
// Copyright 2015-2016 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.
#ifndef __BTC_CONFIG_H__
#define __BTC_CONFIG_H__
#include <stdbool.h>
#include <stddef.h>
#include "bt_types.h"
typedef struct btc_config_section_iter_t btc_config_section_iter_t;
bool btc_config_init(void);
bool btc_config_shut_down(void);
bool btc_config_clean_up(void);
bool btc_config_has_section(const char *section);
bool btc_config_exist(const char *section, const char *key);
bool btc_config_get_int(const char *section, const char *key, int *value);
bool btc_config_set_int(const char *section, const char *key, int value);
bool btc_config_get_str(const char *section, const char *key, char *value, int *size_bytes);
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);
size_t btc_config_get_bin_length(const char *section, const char *key);
const btc_config_section_iter_t *btc_config_section_begin(void);
const btc_config_section_iter_t *btc_config_section_end(void);
const btc_config_section_iter_t *btc_config_section_next(const btc_config_section_iter_t *section);
const char *btc_config_section_name(const btc_config_section_iter_t *section);
void btc_config_save(void);
void btc_config_flush(void);
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_get_device_type(const BD_ADDR bd_addr, int *p_device_type);
#endif

View File

@ -0,0 +1,38 @@
// Copyright 2015-2016 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.
#ifndef __BTC_DEV_H__
#define __BTC_DEV_H__
#include "esp_bt_defs.h"
#include "esp_bt_device.h"
#include "btc_task.h"
typedef enum {
BTC_DEV_ACT_SET_DEVICE_NAME
} btc_dev_act_t;
/* btc_dev_args_t */
typedef union {
// BTC_BT_GAP_ACT_SET_DEV_NAME
struct set_bt_dev_name_args {
#define ESP_DEV_DEVICE_NAME_MAX (32)
char device_name[ESP_DEV_DEVICE_NAME_MAX + 1];
} set_dev_name;
} btc_dev_args_t;
void btc_dev_call_handler(btc_msg_t *msg);
#endif /* __BTC_DEV_H__ */

View File

@ -0,0 +1,40 @@
// Copyright 2015-2016 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.
#ifndef __BTC_DM_H__
#define __BTC_DM_H__
#include "btc_task.h"
#include "esp_bt_defs.h"
#include "bta_api.h"
typedef enum {
BTC_DM_SEC_ACT
} btc_dm_sec_act_t;
/* btc_dm_args_t */
typedef union {
//BTC_DM_SEC_ACT
tBTA_DM_SEC sec;
} btc_dm_sec_args_t;
// void btc_dm_call_handler(btc_msg_t *msg);
void btc_dm_sec_evt(tBTA_DM_SEC_EVT event, tBTA_DM_SEC *data);
void btc_dm_sec_cb_handler(btc_msg_t *msg);
void btc_dm_sec_arg_deep_copy(btc_msg_t *msg, void *dst, void *src);
bt_status_t btc_dm_enable_service(tBTA_SERVICE_ID service_id);
bt_status_t btc_dm_disable_service(tBTA_SERVICE_ID service_id);
#endif /* __BTC_DM_H__ */

View File

@ -34,6 +34,11 @@ typedef enum {
BTC_GAP_BLE_ACT_SET_DEV_NAME,
BTC_GAP_BLE_ACT_CFG_ADV_DATA_RAW,
BTC_GAP_BLE_ACT_CFG_SCAN_RSP_DATA_RAW,
BTC_GAP_BLE_SET_ENCRYPTION_EVT,
BTC_GAP_BLE_SET_SECURITY_PARAM_EVT,
BTC_GAP_BLE_SECURITY_RSP_EVT,
BTC_GAP_BLE_PASSKEY_REPLY_EVT,
BTC_GAP_BLE_CONFIRM_REPLY_EVT,
} btc_gap_ble_act_t;
/* btc_ble_gap_args_t */
@ -73,11 +78,6 @@ typedef union {
struct cfg_local_privacy_args {
bool privacy_enable;
} cfg_local_privacy;
//BTC_GAP_BLE_ACT_SET_DEV_NAME,
struct set_dev_name_args {
#define ESP_GAP_DEVICE_NAME_MAX (32)
char device_name[ESP_GAP_DEVICE_NAME_MAX + 1];
} set_dev_name;
//BTC_GAP_BLE_ACT_CFG_ADV_DATA_RAW,
struct config_adv_data_raw_args {
uint8_t *raw_adv;
@ -88,6 +88,33 @@ typedef union {
uint8_t *raw_scan_rsp;
uint32_t raw_scan_rsp_len;
} cfg_scan_rsp_data_raw;
struct set_encryption_args {
esp_bd_addr_t bd_addr;
esp_ble_sec_act_t sec_act;
} set_encryption;
struct set_security_param_args {
esp_ble_sm_param_t param_type;
uint8_t len;
uint8_t *value;
} set_security_param;
struct enc_rsp_args {
esp_bd_addr_t bd_addr;
bool accept;
} sec_rsp;
struct enc_passkey_reply_args {
esp_bd_addr_t bd_addr;
bool accept;
uint32_t passkey;
} enc_passkey_replay;
struct enc_comfirm_reply_args {
esp_bd_addr_t bd_addr;
bool accept;
} enc_comfirm_replay;
} btc_ble_gap_args_t;
void btc_gap_ble_call_handler(btc_msg_t *msg);

View File

@ -15,8 +15,24 @@
#ifndef __BTC_GAP_BT_H__
#define __BTC_GAP_BT_H__
#include "esp_bt_defs.h"
#include "esp_gap_bt_api.h"
#include "btc_task.h"
typedef enum {
BTC_GAP_BT_ACT_SET_SCAN_MODE = 0,
} btc_gap_bt_act_t;
/* btc_bt_gap_args_t */
typedef union {
// BTC_BT_GAP_ACT_SET_SCAN_MODE,
struct set_bt_scan_mode_args {
esp_bt_scan_mode_t mode;
} set_scan_mode;
} btc_gap_bt_args_t;
void btc_gap_bt_call_handler(btc_msg_t *msg);
#define /* __BTC_GAP_BT_H__ */
void btc_gap_bt_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
#endif /* __BTC_GAP_BT_H__ */

View File

@ -38,6 +38,7 @@ typedef enum {
BTC_GATTC_ACT_WRITE_CHAR,
BTC_GATTC_ACT_WRITE_CHAR_DESCR,
BTC_GATTC_ACT_PREPARE_WRITE,
BTC_GATTC_ACT_PREPARE_WRITE_CHAR_DESCR,
BTC_GATTC_ACT_EXECUTE_WRITE,
BTC_GATTC_ACT_REG_FOR_NOTIFY,
BTC_GATTC_ACT_UNREG_FOR_NOTIFY
@ -155,6 +156,17 @@ typedef union {
uint8_t *value;
esp_gatt_auth_req_t auth_req;
} prep_write;
//BTC_GATTC_ACT_PREPARE_WRITE_CHAR_DESCR,
struct prep_write_descr_arg {
uint16_t conn_id;
esp_gatt_srvc_id_t service_id;
esp_gatt_id_t char_id;
esp_gatt_id_t descr_id;
uint16_t offset;
uint16_t value_len;
uint8_t *value;
esp_gatt_auth_req_t auth_req;
} prep_write_descr;
//BTC_GATTC_ACT_EXECUTE_WRITE,
struct exec_write_arg {
uint16_t conn_id;

View File

@ -123,7 +123,8 @@ typedef union {
} send_rsp;
//BTC_GATTS_SET_ATTR_VALUE
struct set_attr_val_args{
struct set_attr_val_args {
uint16_t handle;
uint16_t length;
uint8_t *value;
} set_attr_val;

View File

@ -0,0 +1,268 @@
// Copyright 2015-2016 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.
/*******************************************************************************
*
* Filename: btc_media.h
*
* Description: This is the audio module for the BTC system.
*
*******************************************************************************/
#ifndef __BTC_MEDIA_H__
#define __BTC_MEDIA_H__
#include <stdbool.h>
#include "bta_api.h"
#include "gki.h"
#include "btc_av_api.h"
#if (BTA_AV_INCLUDED == TRUE)
/*******************************************************************************
** Constants
*******************************************************************************/
#define BTC_SUCCESS (0)
/**
* AV (Audio Video source) Errors
*/
#define BTC_ERROR_SRV_AV_NOT_ENABLED 700 /* AV is not enabled */
#define BTC_ERROR_SRV_AV_FEEDING_NOT_SUPPORTED 701 /* Requested Feeding not supported */
#define BTC_ERROR_SRV_AV_BUSY 702 /* Another operation ongoing */
#define BTC_ERROR_SRV_AV_NOT_OPENED 703 /* No AV link opened */
#define BTC_ERROR_SRV_AV_NOT_STARTED 704 /* AV is not started */
#define BTC_ERROR_SRV_AV_CP_NOT_SUPPORTED 705 /* Content protection is not supported by all headsets */
/* Transcoding definition for TxTranscoding and RxTranscoding */
#define BTC_MEDIA_TRSCD_OFF 0
#define BTC_MEDIA_TRSCD_PCM_2_SBC 1 /* Tx */
/*******************************************************************************
** Data types
*******************************************************************************/
typedef int tBTC_STATUS;
/* tBTC_MEDIA_INIT_AUDIO msg structure */
typedef struct {
BT_HDR hdr;
UINT16 SamplingFreq; /* 16k, 32k, 44.1k or 48k*/
UINT8 ChannelMode; /* mono, dual, stereo or joint stereo*/
UINT8 NumOfSubBands; /* 4 or 8 */
UINT8 NumOfBlocks; /* 4, 8, 12 or 16*/
UINT8 AllocationMethod; /* loudness or SNR*/
UINT16 MtuSize; /* peer mtu size */
} tBTC_MEDIA_INIT_AUDIO;
#if (BTA_AV_INCLUDED == TRUE)
/* tBTC_MEDIA_UPDATE_AUDIO msg structure */
typedef struct {
BT_HDR hdr;
UINT16 MinMtuSize; /* Minimum peer mtu size */
UINT8 MaxBitPool; /* Maximum peer bitpool */
UINT8 MinBitPool; /* Minimum peer bitpool */
} tBTC_MEDIA_UPDATE_AUDIO;
/* tBTC_MEDIA_INIT_AUDIO_FEEDING msg structure */
typedef struct {
BT_HDR hdr;
tBTC_AV_FEEDING_MODE feeding_mode;
tBTC_AV_MEDIA_FEEDINGS feeding;
} tBTC_MEDIA_INIT_AUDIO_FEEDING;
typedef struct {
BT_HDR hdr;
UINT8 codec_info[AVDT_CODEC_SIZE];
} tBTC_MEDIA_SINK_CFG_UPDATE;
#endif
/*******************************************************************************
** Public functions
*******************************************************************************/
/*******************************************************************************
**
** Function btc_av_task
**
** Description
**
** Returns void
**
*******************************************************************************/
extern void btc_media_task(void);
/*******************************************************************************
**
** Function btc_media_task_enc_init_req
**
** Description Request to initialize the media task encoder
**
** Returns TRUE is success
**
*******************************************************************************/
extern BOOLEAN btc_media_task_enc_init_req(tBTC_MEDIA_INIT_AUDIO *p_msg);
/*******************************************************************************
**
** Function btc_media_task_enc_update_req
**
** Description Request to update the media task encoder
**
** Returns TRUE is success
**
*******************************************************************************/
#if (BTA_AV_INCLUDED == TRUE)
extern BOOLEAN btc_media_task_enc_update_req(tBTC_MEDIA_UPDATE_AUDIO *p_msg);
#endif
/*******************************************************************************
**
** Function btc_media_task_start_aa_req
**
** Description Request to start audio encoding task
**
** Returns TRUE is success
**
*******************************************************************************/
extern BOOLEAN btc_media_task_start_aa_req(void);
/*******************************************************************************
**
** Function btc_media_task_stop_aa_req
**
** Description Request to stop audio encoding task
**
** Returns TRUE is success
**
*******************************************************************************/
extern BOOLEAN btc_media_task_stop_aa_req(void);
/*******************************************************************************
**
** Function btc_media_task_aa_rx_flush_req
**
** Description Request to flush audio decoding pipe
**
** Returns TRUE is success
**
*******************************************************************************/
extern BOOLEAN btc_media_task_aa_rx_flush_req(void);
/*******************************************************************************
**
** Function btc_media_task_aa_tx_flush_req
**
** Description Request to flush audio encoding pipe
**
** Returns TRUE is success
**
*******************************************************************************/
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
**
** Returns pointer on a GKI aa buffer ready to send
**
*******************************************************************************/
extern BT_HDR *btc_media_aa_readbuf(void);
/*******************************************************************************
**
** Function btc_media_sink_enque_buf
**
** Description This function is called by the av_co to fill A2DP Sink Queue
**
**
** Returns size of the queue
*******************************************************************************/
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.
**
** Returns TRUE is success
**
*******************************************************************************/
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.
**
** Returns TRUE is success
**
*******************************************************************************/
extern BOOLEAN btc_media_av_writebuf(UINT8 *p_media, UINT32 media_len,
UINT32 timestamp, UINT16 seq_num);
#if (BTA_AV_INCLUDED == TRUE)
/*******************************************************************************
**
** Function btc_media_task_audio_feeding_init_req
**
** Description Request to initialize audio feeding
**
** Returns TRUE is success
**
*******************************************************************************/
extern BOOLEAN btc_media_task_audio_feeding_init_req(tBTC_MEDIA_INIT_AUDIO_FEEDING *p_msg);
#endif
/*******************************************************************************
**
** Function dump_codec_info
**
** Description Decode and display codec_info (for debug)
**
** Returns void
**
*******************************************************************************/
extern void dump_codec_info(unsigned char *p_codec);
/**
* Local adaptation helper functions between btc and media task
*/
bool btc_a2dp_start_media_task(void);
void btc_a2dp_stop_media_task(void);
void btc_a2dp_on_init(void);
void btc_a2dp_setup_codec(void);
void btc_a2dp_on_idle(void);
BOOLEAN btc_a2dp_on_started(tBTA_AV_START *p_av, BOOLEAN pending_start);
void btc_a2dp_on_stop_req(void);
void btc_a2dp_on_stopped(tBTA_AV_SUSPEND *p_av);
void btc_a2dp_on_suspend(void);
void btc_a2dp_on_suspended(tBTA_AV_SUSPEND *p_av);
void btc_a2dp_set_rx_flush(BOOLEAN enable);
void btc_media_check_iop_exceptions(UINT8 *peer_bda);
void btc_reset_decoder(UINT8 *p_av);
int btc_a2dp_get_track_frequency(UINT8 frequency);
int btc_a2dp_get_track_channel_count(UINT8 channeltype);
void btc_a2dp_set_peer_sep(UINT8 sep);
#endif ///BTA_AV_INCLUDED == TRUE
#endif

View File

@ -0,0 +1,55 @@
// Copyright 2015-2016 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.
/*******************************************************************************
*
* Filename: btc_profile_queue.h
*
* Description: Bluetooth remote device connection queuing
*
*******************************************************************************/
#ifndef __BTC_PROFILE_QUEUE_H__
#define __BTC_PROFILE_QUEUE_H__
#include "bt_defs.h"
#include "btc_task.h"
typedef enum {
BTC_PRF_QUE_CONNECT = 0,
BTC_PRF_QUE_ADVANCE
} btc_prf_que_act_t;
typedef bt_status_t (*btc_connect_cb_t) (bt_bdaddr_t *bda, uint16_t uuid);
typedef struct connect_node_t {
bt_bdaddr_t bda;
uint16_t uuid;
bool busy;
btc_connect_cb_t connect_cb;
} connect_node_t;
/* btc_prf_que_args_t */
typedef union {
// BTC_PRF_QUE_CONNECT
connect_node_t connect_node;
} btc_prf_que_args_t;
bt_status_t btc_queue_connect(uint16_t uuid, const bt_bdaddr_t *bda, btc_connect_cb_t connect_cb);
void btc_queue_advance(void);
bt_status_t btc_queue_connect_next(void);
void btc_queue_release(void);
void btc_profile_queue_handler(btc_msg_t *msg);
#endif /* __BTC_PROFILE_QUEUE_H__ */

View File

@ -1,129 +0,0 @@
// Copyright 2015-2016 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.
#ifndef __ESP_SDP_API_H__
#define __ESP_SDP_API_H__
#include <stdint.h>
#include "esp_err.h"
#include "esp_bt_common.h"
#include "bta_sdp_api.h"
#include "bt_sdp.h"
#define BT_SDP_STAT_SUCCESS BTA_SDP_SUCCESS
#define BT_SDP_STAT_FAILURE BTA_SDP_FAILURE
#define BT_SDP_STAT_BUSY BTA_SDP_BUSY
#define BT_SDP_ENABLE_EVT BTA_SDP_ENABLE_EVT
#define BT_SDP_SEARCH_EVT BTA_SDP_SEARCH_EVT
#define BT_SDP_SEARCH_COMP_EVT BTA_SDP_SEARCH_COMP_EVT
#define BT_SDP_CREATE_RECORD_USER_EVT BTA_SDP_CREATE_RECORD_USER_EVT
#define BT_SDP_REMOVE_RECORD_USER_EVT BTA_SDP_REMOVE_RECORD_USER_EVT
#define BT_SDP_MAX_EVT BTA_SDP_MAX_EVT
#define BT_SDP_MAX_RECORDS BTA_SDP_MAX_RECORDS
typedef tBTA_SDP_STATUS bt_sdp_status_t;
typedef tBTA_SDP_EVT bt_sdp_evt_t;
typedef bluetooth_sdp_record bt_sdp_record_t;
/* tBTA_SEARCH_COMP, bta_sdp_api.h */
typedef struct {
bt_sdp_status_t status;
esp_bd_addr_t remote_addr;
esp_bt_uuid_t uuid;
int record_count;
bt_sdp_record_t records[BT_SDP_MAX_RECORDS];
} bt_sdp_search_comp_t;
/* tBTA_SDP, bta_sdp_api.h */
typedef union {
bt_sdp_status_t status;
bt_sdp_search_comp_t sdp_search_comp;
} bt_sdp_t;
typedef void (bt_sdp_cb_t)(bt_sdp_evt_t event, bt_sdp_t *p_data, void *user_data);
esp_err_t esp_bt_sdp_enable(bt_sdp_cb_t *cback);
esp_err_t esp_bt_sdp_search(esp_bd_addr_t bd_addr, esp_bt_uuid_t *uuid);
esp_err_t esp_bt_sdp_create_record_by_user(void *user_data);
esp_err_t esp_bt_sdp_remove_record_by_user(void *user_data);
/**********************************************************************************************/
/**********************************************************************************************/
/* API into SDP for local service database updates
* these APIs are indended to be called in callback function in the context of stack task,
* to handle BT_SDP_CREATE_RECORD_USER_EVT and BT_SDP_REMOVE_RECORD_USER_EVT
*/
/* This structure is used to add protocol lists and find protocol elements */
#define ESP_BT_SDP_MAX_PROTOCOL_PARAMS SDP_MAX_PROTOCOL_PARAMS // bt_target.h
typedef struct {
uint16_t protocol_uuid;
uint16_t num_params;
uint16_t params[ESP_BT_SDP_MAX_PROTOCOL_PARAMS];
} sdp_proto_elem_t; // tSDP_PROTOCOL_ELEM, sdp_api.h
#define ESP_BT_SDP_MAX_LIST_ELEMS SDP_MAX_LIST_ELEMS // sdp_api.h
typedef struct {
uint16_t num_elems;
sdp_proto_elem_t list_elem[ESP_BT_SDP_MAX_LIST_ELEMS];
} sdp_proto_list_elem_t; // tSDP_PROTO_LIST_ELEM, sdp_api.h
uint32_t esp_bt_sdp_create_record(void);
bool esp_bt_sdp_delete_record(uint32_t handle);
int32_t esp_bt_sdp_read_record(uint32_t handle, uint8_t *data, int32_t *data_len);
bool esp_bt_sdp_add_attribute (uint32_t handle, uint16_t attr_id,
uint8_t attr_type, uint32_t attr_len,
uint8_t *p_val);
bool esp_bt_sdp_add_sequence (uint32_t handle, uint16_t attr_id,
uint16_t num_elem, uint8_t type[],
uint8_t len[], uint8_t *p_val[]);
bool esp_bt_sdp_add_uuid_sequence (uint32_t handle, uint16_t attr_id,
uint16_t num_uuids, uint16_t *p_uuids);
bool esp_bt_sdp_add_protocol_list (uint32_t handle, uint16_t num_elem,
sdp_proto_elem_t *p_elem_list);
bool esp_bt_sdp_add_addition_protocol_lists(uint32_t handle, uint16_t num_elem,
sdp_proto_list_elem_t *p_proto_list);
bool esp_bt_sdp_add_profile_dscp_list (uint32_t handle,
uint16_t profile_uuid,
uint16_t version);
bool esp_bt_sdp_add_lang_base_attr_id_list(uint32_t handle,
uint16_t lang, uint16_t char_enc,
uint16_t base_id);
bool esp_bt_sdp_add_service_class_id_list(uint32_t handle,
uint16_t num_services,
uint16_t *p_service_uuids);
bool esp_bt_sdp_delete_attribute(uint32_t handle, uint16_t attr_id);
#endif /* __ESP_SDP_API_H__ */

View File

@ -0,0 +1,115 @@
// Copyright 2015-2016 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.
/*****************************************************************************
*
* Filename: btc_sm.h
*
* Description: Generic BTC state machine API
*
*****************************************************************************/
#ifndef __BTC_SM_H__
#define __BTC_SM_H__
/*****************************************************************************
** Constants & Macros
******************************************************************************/
/* Generic Enter/Exit state machine events */
#define BTC_SM_ENTER_EVT 0xFFFF
#define BTC_SM_EXIT_EVT 0xFFFE
/*****************************************************************************
** Type definitions and return values
******************************************************************************/
typedef UINT32 btc_sm_state_t;
typedef UINT32 btc_sm_event_t;
typedef void *btc_sm_handle_t;
typedef BOOLEAN (* btc_sm_handler_t)(btc_sm_event_t event, void *data);
/*****************************************************************************
** Functions
**
** NOTE: THESE APIs SHOULD BE INVOKED ONLY IN THE BTC CONTEXT
**
******************************************************************************/
/*****************************************************************************
**
** Function btc_sm_init
**
** Description Initializes the state machine with the state handlers
** The caller should ensure that the table and the corresponding
** states match. The location that 'p_handlers' points to shall
** be available until the btc_sm_shutdown API is invoked.
**
** Returns Returns a pointer to the initialized state machine handle.
**
******************************************************************************/
btc_sm_handle_t btc_sm_init(const btc_sm_handler_t *p_handlers,
btc_sm_state_t initial_state);
/*****************************************************************************
**
** Function btc_sm_shutdown
**
** Description Tears down the state machine
**
** Returns None
**
******************************************************************************/
void btc_sm_shutdown(btc_sm_handle_t handle);
/*****************************************************************************
**
** Function btc_sm_get_state
**
** Description Fetches the current state of the state machine
**
** Returns Current state
**
******************************************************************************/
btc_sm_state_t btc_sm_get_state(btc_sm_handle_t handle);
/*****************************************************************************
**
** Function btc_sm_dispatch
**
** Description Dispatches the 'event' along with 'data' to the current state handler
**
** Returns Returns BT_STATUS_OK on success, BT_STATUS_FAIL otherwise
**
******************************************************************************/
bt_status_t btc_sm_dispatch(btc_sm_handle_t handle, btc_sm_event_t event,
void *data);
/*****************************************************************************
**
** Function btc_sm_change_state
**
** Description Make a transition to the new 'state'. The 'BTC_SM_EXIT_EVT'
** shall be invoked before exiting the current state. The
** 'BTC_SM_ENTER_EVT' shall be invoked before entering the new state
**
**
** Returns Returns BT_STATUS_OK on success, BT_STATUS_FAIL otherwise
**
******************************************************************************/
bt_status_t btc_sm_change_state(btc_sm_handle_t handle, btc_sm_state_t state);
#endif /* __BTC_SM_H__ */

View File

@ -0,0 +1,62 @@
// Copyright 2015-2016 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.
#ifndef __BTC_STORAGE_H__
#define __BTC_STORAGE_H__
#include <stdint.h>
#include "bt_defs.h"
#include "bt_types.h"
/*******************************************************************************
**
** Function btc_storage_add_bonded_device
**
** Description BTC storage API - Adds the newly bonded device to NVRAM
** along with the link-key, Key type and Pin key length
**
** Returns BT_STATUS_SUCCESS if the store was successful,
** BT_STATUS_FAIL otherwise
**
*******************************************************************************/
bt_status_t btc_storage_add_bonded_device(bt_bdaddr_t *remote_bd_addr,
LINK_KEY link_key,
uint8_t key_type,
uint8_t pin_length);
/*******************************************************************************
**
** Function btc_storage_remove_bonded_device
**
** Description BTC storage API - Deletes the bonded device from NVRAM
**
** Returns BT_STATUS_SUCCESS if the deletion was successful,
** BT_STATUS_FAIL otherwise
**
*******************************************************************************/
bt_status_t btc_storage_remove_bonded_device(bt_bdaddr_t *remote_bd_addr);
/*******************************************************************************
**
** Function btc_storage_remove_bonded_device
**
** Description BTC storage API - Deletes the bonded device from NVRAM
**
** Returns BT_STATUS_SUCCESS if the deletion was successful,
** BT_STATUS_FAIL otherwise
**
*******************************************************************************/
bt_status_t btc_storage_load_bonded_devices(void);
#endif /* BTC_STORAGE_H */

View File

@ -16,6 +16,7 @@
#define __BTC_TASK_H__
#include <stdint.h>
#include "bt_target.h"
#include "bt_defs.h"
#include "thread.h"
@ -35,16 +36,23 @@ typedef enum {
typedef enum {
BTC_PID_MAIN_INIT = 0,
BTC_PID_DEV,
BTC_PID_GATTS,
#if (GATTC_INCLUDED == TRUE)
BTC_PID_GATTC,
#endif ///GATTC_INCLUDED == TRUE
BTC_PID_GAP_BLE,
BTC_PID_GAP_BT,
BTC_PID_SDP,
BTC_PID_BLE_HID,
BTC_PID_BT_HID,
BTC_PID_SPP,
BTC_PID_SPPLIKE,
BTC_PID_BLUFI,
BTC_PID_DM_SEC,
BTC_PID_ALARM,
#if CONFIG_CLASSIC_BT_ENABLED
BTC_PID_GAP_BT,
BTC_PID_PRF_QUE,
BTC_PID_A2DP,
BTC_PID_AVRC,
#endif /* CONFIG_CLASSIC_BT_ENABLED */
BTC_PID_NUM,
} btc_pid_t; //btc profile id

View File

@ -0,0 +1,47 @@
// Copyright 2015-2016 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.
#ifndef __BTC_UTIL_H__
#define __BTC_UTIL_H__
#include <stdbool.h>
#include "bt_types.h"
#include "bt_defs.h"
/*******************************************************************************
** Constants & Macros
********************************************************************************/
#define CASE_RETURN_STR(const) case const: return #const;
/*******************************************************************************
** Type definitions for callback functions
********************************************************************************/
typedef char bdstr_t[18];
/*******************************************************************************
** Functions
********************************************************************************/
const char *dump_rc_event(UINT8 event);
const char *dump_rc_notification_event_id(UINT8 event_id);
const char *dump_rc_pdu(UINT8 pdu);
UINT32 devclass2uint(DEV_CLASS dev_class);
void uint2devclass(UINT32 dev, DEV_CLASS dev_class);
void uuid16_to_uuid128(uint16_t uuid16, bt_uuid_t *uuid128);
void uuid_to_string_legacy(bt_uuid_t *p_uuid, char *str);
void string_to_uuid(char *str, bt_uuid_t *p_uuid);
#endif /* __BTC_UTIL_H__ */

0
tools/sdk/include/bluedroid/bte_appl.h Executable file → Normal file
View File

View File

@ -1383,6 +1383,11 @@ typedef UINT8 tBTM_IO_CAP;
#define BTM_AUTH_BONDS 6 /* the general/dedicated bonding bits */
#define BTM_AUTH_YN_BIT 1 /* this is the Yes or No bit */
#define BTM_BLE_ENC_KEY_MASK (1 << 0)
#define BTM_BLE_ID_KEY_MASK (1 << 1)
#define BTM_BLE_CSR_KEY_MASK (1 << 2)
#define BTM_BLE_LINK_KEY_MASK (1 << 3)
#define BTM_BLE_INITIATOR_KEY_SIZE 15
#define BTM_BLE_RESPONDER_KEY_SIZE 15
#define BTM_BLE_MAX_KEY_SIZE 16
@ -1526,6 +1531,7 @@ typedef void (tBTM_BOND_CANCEL_CMPL_CALLBACK) (tBTM_STATUS result);
/* LE related event and data structure
*/
#if (SMP_INCLUDED == TRUE)
#define BTM_LE_IO_REQ_EVT SMP_IO_CAP_REQ_EVT /* received IO_CAPABILITY_REQUEST event */
#define BTM_LE_SEC_REQUEST_EVT SMP_SEC_REQUEST_EVT /* security request event */
#define BTM_LE_KEY_NOTIF_EVT SMP_PASSKEY_NOTIF_EVT /* received USER_PASSKEY_NOTIFY event */
@ -1541,8 +1547,10 @@ typedef void (tBTM_BOND_CANCEL_CMPL_CALLBACK) (tBTM_STATUS result);
#define BTM_LE_COMPLT_EVT SMP_COMPLT_EVT /* SMP complete event */
#define BTM_LE_LAST_FROM_SMP BTM_LE_BR_KEYS_REQ_EVT
#define BTM_LE_KEY_EVT BTM_LE_LAST_FROM_SMP + 1 /* KEY update event */
#endif ///SMP_INCLUDED == TRUE
typedef UINT8 tBTM_LE_EVT;
#if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
#define BTM_LE_KEY_NONE 0
#define BTM_LE_KEY_PENC SMP_SEC_KEY_TYPE_ENC /* encryption information of peer device */
#define BTM_LE_KEY_PID SMP_SEC_KEY_TYPE_ID /* identity key of the peer device */
@ -1552,12 +1560,15 @@ typedef UINT8 tBTM_LE_EVT;
#define BTM_LE_KEY_LENC (SMP_SEC_KEY_TYPE_ENC << 4) /* master role security information:div */
#define BTM_LE_KEY_LID (SMP_SEC_KEY_TYPE_ID << 4) /* master device ID key */
#define BTM_LE_KEY_LCSRK (SMP_SEC_KEY_TYPE_CSRK << 4) /* local CSRK has been deliver to peer */
#endif ///BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
typedef UINT8 tBTM_LE_KEY_TYPE;
#if (SMP_INCLUDED == TRUE)
#define BTM_LE_AUTH_REQ_NO_BOND SMP_AUTH_NO_BOND /* 0 */
#define BTM_LE_AUTH_REQ_BOND SMP_AUTH_GEN_BOND /* 1 << 0 */
#define BTM_LE_AUTH_REQ_MITM SMP_AUTH_YN_BIT /* 1 << 2 */
#endif ///SMP_INCLUDED == TRUE
typedef UINT8 tBTM_LE_AUTH_REQ;
#if (SMP_INCLUDED == TRUE)
#define BTM_LE_SC_SUPPORT_BIT SMP_SC_SUPPORT_BIT /* (1 << 3) */
#define BTM_LE_KP_SUPPORT_BIT SMP_KP_SUPPORT_BIT /* (1 << 4) */
@ -1571,6 +1582,7 @@ typedef UINT8 tBTM_LE_AUTH_REQ;
#define BTM_LE_SEC_NONE SMP_SEC_NONE
#define BTM_LE_SEC_UNAUTHENTICATE SMP_SEC_UNAUTHENTICATE /* 1 */
#define BTM_LE_SEC_AUTHENTICATED SMP_SEC_AUTHENTICATED /* 4 */
#endif ///SMP_INCLUDED == TRUE
typedef UINT8 tBTM_LE_SEC;
@ -2020,6 +2032,7 @@ tBTM_STATUS BTM_VendorSpecificCommand(UINT16 opcode,
**
*******************************************************************************/
//extern
#if (CLASSIC_BT_INCLUDED == TRUE)
UINT8 BTM_AllocateSCN(void);
// btla-specific ++
@ -2048,6 +2061,7 @@ BOOLEAN BTM_TryAllocateSCN(UINT8 scn);
*******************************************************************************/
//extern
BOOLEAN BTM_FreeSCN(UINT8 scn);
#endif ///CLASSIC_BT_INCLUDED == TRUE
/*******************************************************************************
@ -3677,6 +3691,17 @@ UINT8 *BTM_ReadOobData(UINT8 *p_data, UINT8 eir_tag, UINT8 *p_len);
//extern
char *BTM_SecReadDevName (BD_ADDR bd_addr);
/*******************************************************************************
**
** Function BTM_SecClearSecurityFlags
**
** Description Reset the security flags (mark as not-paired) for a given
** remove device.
**
*******************************************************************************/
extern void BTM_SecClearSecurityFlags (BD_ADDR bd_addr);
/*****************************************************************************
** POWER MANAGEMENT FUNCTIONS

View File

@ -759,7 +759,9 @@ typedef struct {
** ACL Management
****************************************************/
tACL_CONN acl_db[MAX_L2CAP_LINKS];
#if (CLASSIC_BT_INCLUDED == TRUE)
UINT8 btm_scn[BTM_MAX_SCN]; /* current SCNs: TRUE if SCN is in use */
#endif ///CLASSIC_BT_INCLUDED == TRUE
UINT16 btm_def_link_policy;
UINT16 btm_def_link_super_tout;
@ -815,9 +817,11 @@ typedef struct {
tBTM_APPL_INFO api;
#define BTM_SEC_MAX_RMT_NAME_CALLBACKS 2
tBTM_RMT_NAME_CALLBACK *p_rmt_name_callback[BTM_SEC_MAX_RMT_NAME_CALLBACKS];
tBTM_RMT_NAME_CALLBACK *p_rmt_name_callback[BTM_SEC_MAX_RMT_NAME_CALLBACKS];
#if (SMP_INCLUDED == TRUE)
tBTM_SEC_DEV_REC *p_collided_dev_rec;
#endif ///SMP_INCLUDED == TRUE
TIMER_LIST_ENT sec_collision_tle;
UINT32 collision_start_time;
UINT32 max_collision_delay;
@ -828,6 +832,7 @@ typedef struct {
BOOLEAN security_mode_changed; /* mode changed during bonding */
BOOLEAN pin_type_changed; /* pin type changed during bonding */
BOOLEAN sec_req_pending; /* TRUE if a request is pending */
#if (SMP_INCLUDED == TRUE)
// btla-specific ++
#ifdef PORCHE_PAIRING_CONFLICT
UINT8 pin_code_len_saved; /* for legacy devices */
@ -843,6 +848,7 @@ typedef struct {
UINT16 disc_handle; /* for legacy devices */
UINT8 disc_reason; /* for legacy devices */
tBTM_SEC_SERV_REC sec_serv_rec[BTM_SEC_MAX_SERVICE_RECORDS];
#endif ///SMP_INCLUDED == TRUE
tBTM_SEC_DEV_REC sec_dev_rec[BTM_SEC_MAX_DEVICE_RECORDS];
tBTM_SEC_SERV_REC *p_out_serv;
tBTM_MKEY_CALLBACK *mkey_cback;
@ -859,7 +865,6 @@ typedef struct {
BOOLEAN paging;
BOOLEAN discing;
BUFFER_Q 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

0
tools/sdk/include/bluedroid/buffer.h Executable file → Normal file
View File

0
tools/sdk/include/bluedroid/buffer_allocator.h Executable file → Normal file
View File

View File

@ -0,0 +1,144 @@
// Copyright 2015-2016 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.
#ifndef __CONFIG_H__
#define __CONFIG_H__
// This module implements a configuration parser. Clients can query the
// contents of a configuration file through the interface provided here.
// The current implementation is read-only; mutations are only kept in
// memory. This parser supports the INI file format.
// Implementation notes:
// - Key/value pairs that are not within a section are assumed to be under
// the |CONFIG_DEFAULT_SECTION| section.
// - Multiple sections with the same name will be merged as if they were in
// a single section.
// - Empty sections with no key/value pairs will be treated as if they do
// not exist. In other words, |config_has_section| will return false for
// empty sections.
// - Duplicate keys in a section will overwrite previous values.
// - All strings are case sensitive.
#include <stdbool.h>
// The default section name to use if a key/value pair is not defined within
// a section.
#define CONFIG_DEFAULT_SECTION "Global"
typedef struct config_t config_t;
typedef struct config_section_node_t config_section_node_t;
// Creates a new config object with no entries (i.e. not backed by a file).
// This function returns a config object or NULL on error. Clients must call
// |config_free| on the returned handle when it is no longer required.
config_t *config_new_empty(void);
// Loads the specified file and returns a handle to the config file. If there
// was a problem loading the file or allocating memory, this function returns
// NULL. Clients must call |config_free| on the returned handle when it is no
// longer required. |filename| must not be NULL and must point to a readable
// file on the filesystem.
config_t *config_new(const char *filename);
// Frees resources associated with the config file. No further operations may
// be performed on the |config| object after calling this function. |config|
// may be NULL.
void config_free(config_t *config);
// Returns true if the config file contains a section named |section|. If
// the section has no key/value pairs in it, this function will return false.
// |config| and |section| must not be NULL.
bool config_has_section(const config_t *config, const char *section);
// Returns true if the config file has a key named |key| under |section|.
// Returns false otherwise. |config|, |section|, and |key| must not be NULL.
bool config_has_key(const config_t *config, const char *section, const char *key);
// Returns the integral value for a given |key| in |section|. If |section|
// or |key| do not exist, or the value cannot be fully converted to an integer,
// this function returns |def_value|. |config|, |section|, and |key| must not
// be NULL.
int config_get_int(const config_t *config, const char *section, const char *key, int def_value);
// Returns the boolean value for a given |key| in |section|. If |section|
// or |key| do not exist, or the value cannot be converted to a boolean, this
// function returns |def_value|. |config|, |section|, and |key| must not be NULL.
bool config_get_bool(const config_t *config, const char *section, const char *key, bool def_value);
// Returns the string value for a given |key| in |section|. If |section| or
// |key| do not exist, this function returns |def_value|. The returned string
// is owned by the config module and must not be freed. |config|, |section|,
// and |key| must not be NULL. |def_value| may be NULL.
const char *config_get_string(const config_t *config, const char *section, const char *key, const char *def_value);
// Sets an integral value for the |key| in |section|. If |key| or |section| do
// not already exist, this function creates them. |config|, |section|, and |key|
// must not be NULL.
void config_set_int(config_t *config, const char *section, const char *key, int value);
// Sets a boolean value for the |key| in |section|. If |key| or |section| do
// not already exist, this function creates them. |config|, |section|, and |key|
// must not be NULL.
void config_set_bool(config_t *config, const char *section, const char *key, bool value);
// Sets a string value for the |key| in |section|. If |key| or |section| do
// not already exist, this function creates them. |config|, |section|, |key|, and
// |value| must not be NULL.
void config_set_string(config_t *config, const char *section, const char *key, const char *value, bool insert_back);
// Removes |section| from the |config| (and, as a result, all keys in the section).
// Returns true if |section| was found and removed from |config|, false otherwise.
// Neither |config| nor |section| may be NULL.
bool config_remove_section(config_t *config, const char *section);
// Removes one specific |key| residing in |section| of the |config|. Returns true
// if the section and key were found and the key was removed, false otherwise.
// None of |config|, |section|, or |key| may be NULL.
bool config_remove_key(config_t *config, const char *section, const char *key);
// Returns an iterator to the first section in the config file. If there are no
// sections, the iterator will equal the return value of |config_section_end|.
// The returned pointer must be treated as an opaque handle and must not be freed.
// The iterator is invalidated on any config mutating operation. |config| may not
// be NULL.
const config_section_node_t *config_section_begin(const config_t *config);
// Returns an iterator to one past the last section in the config file. It does not
// represent a valid section, but can be used to determine if all sections have been
// iterated over. The returned pointer must be treated as an opaque handle and must
// not be freed and must not be iterated on (must not call |config_section_next| on
// it). |config| may not be NULL.
const config_section_node_t *config_section_end(const config_t *config);
// Moves |iter| to the next section. If there are no more sections, |iter| will
// equal the value of |config_section_end|. |iter| may not be NULL and must be
// a pointer returned by either |config_section_begin| or |config_section_next|.
const config_section_node_t *config_section_next(const config_section_node_t *iter);
// Returns the name of the section referred to by |iter|. The returned pointer is
// owned by the config module and must not be freed by the caller. The pointer will
// remain valid until |config_free| is called. |iter| may not be NULL and must not
// equal the value returned by |config_section_end|.
const char *config_section_name(const config_section_node_t *iter);
// Saves |config| to a file given by |filename|. Note that this could be a destructive
// operation: if |filename| already exists, it will be overwritten. The config
// module does not preserve comments or formatting so if a config file was opened
// with |config_new| and subsequently overwritten with |config_save|, all comments
// and special formatting in the original file will be lost. Neither |config| nor
// |filename| may be NULL.
bool config_save(const config_t *config, const char *filename);
#endif /* #ifndef __CONFIG_H__ */

59
tools/sdk/include/bluedroid/dyn_mem.h Executable file → Normal file
View File

@ -18,6 +18,62 @@
#ifndef DYN_MEM_H
#define DYN_MEM_H
#include "sdkconfig.h"
#if CONFIG_CLASSIC_BT_ENABLED
#define SDP_DYNAMIC_MEMORY FALSE
#define RFC_DYNAMIC_MEMORY FALSE
#define TCS_DYNAMIC_MEMORY FALSE
#define BNEP_DYNAMIC_MEMORY FALSE
#define AVDT_DYNAMIC_MEMORY FALSE
#define AVCT_DYNAMIC_MEMORY FALSE
#define MCA_DYNAMIC_MEMORY FALSE
#define A2D_DYNAMIC_MEMORY FALSE
#define VDP_DYNAMIC_MEMORY FALSE
#define AVRC_DYNAMIC_MEMORY FALSE
#define BIP_DYNAMIC_MEMORY FALSE
#define BPP_DYNAMIC_MEMORY FALSE
#define CTP_DYNAMIC_MEMORY FALSE
#define FTP_DYNAMIC_MEMORY FALSE
#define HCRP_DYNAMIC_MEMORY FALSE
#define HFP_DYNAMIC_MEMORY FALSE
#define HID_DYNAMIC_MEMORY FALSE
#define HSP2_DYNAMIC_MEMORY FALSE
#define ICP_DYNAMIC_MEMORY FALSE
#define OPP_DYNAMIC_MEMORY FALSE
#define PAN_DYNAMIC_MEMORY FALSE
#define SPP_DYNAMIC_MEMORY FALSE
#define SLIP_DYNAMIC_MEMORY FALSE
#define LLCP_DYNAMIC_MEMORY FALSE
#else /* #if CONFIG_CLASSIC_BT_ENABLED */
#define SDP_DYNAMIC_MEMORY TRUE
#define RFC_DYNAMIC_MEMORY TRUE
#define TCS_DYNAMIC_MEMORY TRUE
#define BNEP_DYNAMIC_MEMORY TRUE
#define AVDT_DYNAMIC_MEMORY TRUE
#define AVCT_DYNAMIC_MEMORY TRUE
#define MCA_DYNAMIC_MEMORY TRUE
#define A2D_DYNAMIC_MEMORY TRUE
#define VDP_DYNAMIC_MEMORY TRUE
#define AVRC_DYNAMIC_MEMORY TRUE
#define BIP_DYNAMIC_MEMORY TRUE
#define BPP_DYNAMIC_MEMORY TRUE
#define CTP_DYNAMIC_MEMORY TRUE
#define FTP_DYNAMIC_MEMORY TRUE
#define HCRP_DYNAMIC_MEMORY TRUE
#define HFP_DYNAMIC_MEMORY TRUE
#define HID_DYNAMIC_MEMORY TRUE
#define HSP2_DYNAMIC_MEMORY TRUE
#define ICP_DYNAMIC_MEMORY TRUE
#define OPP_DYNAMIC_MEMORY TRUE
#define PAN_DYNAMIC_MEMORY TRUE
#define SPP_DYNAMIC_MEMORY TRUE
#define SLIP_DYNAMIC_MEMORY TRUE
#define LLCP_DYNAMIC_MEMORY TRUE
#endif /* #if CONFIG_CLASSIC_BT_ENABLED */
/****************************************************************************
** Define memory usage for each CORE component (if not defined in bdroid_buildcfg.h)
** The default for each component is to use static memory allocations.
@ -31,8 +87,7 @@
#endif
#ifndef SDP_DYNAMIC_MEMORY
//#define SDP_DYNAMIC_MEMORY FALSE
#define SDP_DYNAMIC_MEMORY TRUE
#define SDP_DYNAMIC_MEMORY FALSE
#endif
#ifndef L2C_DYNAMIC_MEMORY

View File

@ -0,0 +1,216 @@
// Copyright 2015-2016 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.
#ifndef __ESP_A2DP_API_H__
#define __ESP_A2DP_API_H__
#include "esp_err.h"
#include "esp_bt_defs.h"
#ifdef __cplusplus
extern "C" {
#endif
/// Media codec types supported by A2DP
#define ESP_A2D_MCT_SBC (0) /*!< SBC */
#define ESP_A2D_MCT_M12 (0x01) /*!< MPEG-1, 2 Audio */
#define ESP_A2D_MCT_M24 (0x02) /*!< MPEG-2, 4 AAC */
#define ESP_A2D_MCT_ATRAC (0x04) /*!< ATRAC family */
#define ESP_A2D_MCT_NON_A2DP (0xff)
typedef uint8_t esp_a2d_mct_t;
/// A2DP media codec capabilities union
typedef struct {
esp_a2d_mct_t type; /*!< A2DP media codec type */
#define ESP_A2D_CIE_LEN_SBC (4)
#define ESP_A2D_CIE_LEN_M12 (4)
#define ESP_A2D_CIE_LEN_M24 (6)
#define ESP_A2D_CIE_LEN_ATRAC (7)
union {
uint8_t sbc[ESP_A2D_CIE_LEN_SBC];
uint8_t m12[ESP_A2D_CIE_LEN_M12];
uint8_t m24[ESP_A2D_CIE_LEN_M24];
uint8_t atrac[ESP_A2D_CIE_LEN_ATRAC];
} cie; /*!< A2DP codec information element */
} __attribute__((packed)) esp_a2d_mcc_t;
/// Bluetooth A2DP connection states
typedef enum {
ESP_A2D_CONNECTION_STATE_DISCONNECTED = 0, /*!< connection released */
ESP_A2D_CONNECTION_STATE_CONNECTING, /*!< connecting remote device */
ESP_A2D_CONNECTION_STATE_CONNECTED, /*!< connection established */
ESP_A2D_CONNECTION_STATE_DISCONNECTING /*!< disconnecting remote device */
} esp_a2d_connection_state_t;
/// Bluetooth A2DP disconnection reason
typedef enum {
ESP_A2D_DISC_RSN_NORMAL = 0, /*!< Finished disconnection that is initiated by local or remote device */
ESP_A2D_DISC_RSN_ABNORMAL /*!< Abnormal disconnection caused by signal loss */
} esp_a2d_disc_rsn_t;
/// Bluetooth A2DP datapath states
typedef enum {
ESP_A2D_AUDIO_STATE_REMOTE_SUSPEND = 0, /*!< audio stream datapath suspended by remote device */
ESP_A2D_AUDIO_STATE_STOPPED, /*!< audio stream datapath stopped */
ESP_A2D_AUDIO_STATE_STARTED, /*!< audio stream datapath started */
} esp_a2d_audio_state_t;
/// A2DP callback events
typedef enum {
ESP_A2D_CONNECTION_STATE_EVT = 0, /*!< connection state changed event */
ESP_A2D_AUDIO_STATE_EVT = 1, /*!< audio stream transmission state changed event */
ESP_A2D_AUDIO_CFG_EVT = 2 /*!< audio codec is configured */
} esp_a2d_cb_event_t;
/// A2DP state callback parameters
typedef union {
/**
* @brief ESP_A2D_CONNECTION_STATE_EVT
*/
struct a2d_conn_stat_param {
esp_a2d_connection_state_t state; /*!< one of values from esp_a2d_connection_state_t */
esp_bd_addr_t remote_bda; /*!< remote bluetooth device address */
esp_a2d_disc_rsn_t disc_rsn; /*!< reason of disconnection for "DISCONNECTED" */
} conn_stat; /*!< A2DP connection status */
/**
* @brief ESP_A2D_AUDIO_STATE_EVT
*/
struct a2d_audio_stat_param {
esp_a2d_audio_state_t state; /*!< one of the values from esp_a2d_audio_state_t */
esp_bd_addr_t remote_bda; /*!< remote bluetooth device address */
} audio_stat; /*!< audio stream playing state */
/**
* @brief ESP_A2D_AUDIO_CFG_EVT
*/
struct a2d_audio_cfg_param {
esp_bd_addr_t remote_bda; /*!< remote bluetooth device address */
esp_a2d_mcc_t mcc; /*!< A2DP media codec capability information */
} audio_cfg; /*!< media codec configuration infomation */
} esp_a2d_cb_param_t;
/**
* @brief A2DP profile callback function type
* @param event : Event type
* @param param : Pointer to callback parameter
*/
typedef void (* esp_a2d_cb_t)(esp_a2d_cb_event_t event, esp_a2d_cb_param_t *param);
/**
* @brief A2DP profile data callback function
*
* @param[in] buf : data received from A2DP source device and is PCM format decoder from SBC decoder;
* buf references to a static memory block and can be overwritten by upcoming data
*
* @param[in] len : size(in bytes) in buf
*
*/
typedef void (* esp_a2d_data_cb_t)(const uint8_t *buf, uint32_t len);
/**
* @brief Register application callback function to A2DP module. This function should be called
* only after esp_bluedroid_enable() completes successfully
*
* @param[in] callback: A2DP sink event callback function
*
* @return
* - ESP_OK: success
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: if callback is a NULL function pointer
*
*/
esp_err_t esp_a2d_register_callback(esp_a2d_cb_t callback);
/**
* @brief Register A2DP sink data output function; For now the output is PCM data stream decoded
* from SBC format. This function should be called only after esp_bluedroid_enable()
* completes successfully
*
* @param[in] callback: A2DP data callback function
*
* @return
* - ESP_OK: success
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: if callback is a NULL function pointer
*
*/
esp_err_t esp_a2d_register_data_callback(esp_a2d_data_cb_t callback);
/**
*
* @brief Initialize the bluetooth A2DP sink module. This function should be called
* after esp_bluedroid_enable() completes successfully
*
* @return
* - ESP_OK: if the initialization request is sent successfully
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*
*/
esp_err_t esp_a2d_sink_init(void);
/**
*
* @brief De-initialize for A2DP sink module. This function
* should be called only after esp_bluedroid_enable() completes successfully
*
* @return
* - ESP_OK: success
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*
*/
esp_err_t esp_a2d_sink_deinit(void);
/**
*
* @brief Connect the remote bluetooth device bluetooth, must after esp_a2d_sink_init()
*
* @param[in] remote_bda: remote bluetooth device address
*
* @return
* - ESP_OK: connect request is sent to lower layer
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*
*/
esp_err_t esp_a2d_sink_connect(esp_bd_addr_t remote_bda);
/**
*
* @brief Disconnect the remote bluetooth device
*
* @param[in] remote_bda: remote bluetooth device address
* @return
* - ESP_OK: disconnect request is sent to lower layer
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*
*/
esp_err_t esp_a2d_sink_disconnect(esp_bd_addr_t remote_bda);
#ifdef __cplusplus
}
#endif
#endif /* __ESP_A2DP_API_H__ */

View File

@ -0,0 +1,153 @@
// Copyright 2015-2016 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.
#ifndef __ESP_AVRC_API_H__
#define __ESP_AVRC_API_H__
#include <stdint.h>
#include <stdbool.h>
#include "esp_err.h"
#include "esp_bt_defs.h"
#ifdef __cplusplus
extern "C" {
#endif
/// AVRC feature bit mask
typedef enum {
ESP_AVRC_FEAT_RCTG = 0x0001, /*!< remote control target */
ESP_AVRC_FEAT_RCCT = 0x0002, /*!< remote control controller */
ESP_AVRC_FEAT_VENDOR = 0x0008, /*!< remote control vendor dependent commands */
ESP_AVRC_FEAT_BROWSE = 0x0010, /*!< use browsing channel */
ESP_AVRC_FEAT_META_DATA = 0x0040, /*!< remote control metadata transfer command/response */
ESP_AVRC_FEAT_ADV_CTRL = 0x0200, /*!< remote control advanced control commmand/response */
} esp_avrc_features_t;
/// AVRC passthrough command code
typedef enum {
ESP_AVRC_PT_CMD_PLAY = 0x44, /*!< play */
ESP_AVRC_PT_CMD_STOP = 0x45, /*!< stop */
ESP_AVRC_PT_CMD_PAUSE = 0x46, /*!< pause */
ESP_AVRC_PT_CMD_FORWARD = 0x4B, /*!< forward */
ESP_AVRC_PT_CMD_BACKWARD = 0x4C /*!< backward */
} esp_avrc_pt_cmd_t;
/// AVRC passthrough command state
typedef enum {
ESP_AVRC_PT_CMD_STATE_PRESSED = 0, /*!< key pressed */
ESP_AVRC_PT_CMD_STATE_RELEASED = 1 /*!< key released */
} esp_avrc_pt_cmd_state_t;
/// AVRC Controller callback events
typedef enum {
ESP_AVRC_CT_CONNECTION_STATE_EVT = 0, /*!< connection state changed event */
ESP_AVRC_CT_PASSTHROUGH_RSP_EVT = 1, /*!< passthrough response event */
ESP_AVRC_CT_MAX_EVT
} esp_avrc_ct_cb_event_t;
/// AVRC controller callback parameters
typedef union {
/**
* @brief ESP_AVRC_CT_CONNECTION_STATE_EVT
*/
struct avrc_ct_conn_stat_param {
bool connected; /*!< whether AVRC connection is set up */
uint32_t feat_mask; /*!< AVRC feature mask of remote device */
esp_bd_addr_t remote_bda; /*!< remote bluetooth device address */
} conn_stat; /*!< AVRC connection status */
/**
* @brief ESP_AVRC_CT_PASSTHROUGH_RSP_EVT
*/
struct avrc_ct_psth_rsp_param {
uint8_t tl; /*!< transaction label, 0 to 15 */
uint8_t key_code; /*!< passthrough command code */
uint8_t key_state; /*!< 0 for PRESSED, 1 for RELEASED */
} psth_rsp; /*!< passthrough command response */
} esp_avrc_ct_cb_param_t;
/**
* @brief AVRCP controller callback function type
* @param event : Event type
* @param param : Pointer to callback parameter union
*/
typedef void (* esp_avrc_ct_cb_t)(esp_avrc_ct_cb_event_t event, esp_avrc_ct_cb_param_t *param);
/**
* @brief Register application callbacks to AVRCP module; for now only AVRCP Controller
* role is supported. This function should be called after esp_bluedroid_enable()
* completes successfully
*
* @param[in] callback: AVRCP controller callback function
*
* @return
* - ESP_OK: success
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*
*/
esp_err_t esp_avrc_ct_register_callback(esp_avrc_ct_cb_t callback);
/**
*
* @brief Initialize the bluetooth AVRCP controller module, This function should be called
* after esp_bluedroid_enable() completes successfully
*
* @return
* - ESP_OK: success
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*
*/
esp_err_t esp_avrc_ct_init(void);
/**
*
* @brief De-initialize AVRCP controller module. This function should be called after
* after esp_bluedroid_enable() completes successfully
*
* @return
* - ESP_OK: success
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*/
esp_err_t esp_avrc_ct_deinit(void);
/**
* @brief Send passthrough command to AVRCP target, This function should be called after
* ESP_AVRC_CT_CONNECTION_STATE_EVT is received and AVRCP connection is established
*
* @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
*
* @return
* - ESP_OK: success
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*/
esp_err_t esp_avrc_ct_send_passthrough_cmd(uint8_t tl, uint8_t key_code, uint8_t key_state);
#ifdef __cplusplus
}
#endif
#endif /* __ESP_AVRC_API_H__ */

View File

@ -49,6 +49,7 @@ typedef enum {
ESP_BLUFI_EVENT_RECV_SERVER_CERT, /*<! When Phone send Server certificate to ESP32, this event happen */
ESP_BLUFI_EVENT_RECV_CLIENT_PRIV_KEY, /*<! When Phone send Client Private key to ESP32, this event happen */
ESP_BLUFI_EVENT_RECV_SERVER_PRIV_KEY, /*<! When Phone send Server Private key to ESP32, this event happen */
ESP_BLUFI_EVENT_RECV_SLAVE_DISCONNECT_BLE, /*<! When Phone send Disconnect key to ESP32, this event happen */
} esp_blufi_cb_event_t;
/// BLUFI config status
@ -122,6 +123,8 @@ typedef union {
*/
struct blufi_connect_evt_param {
esp_bd_addr_t remote_bda; /*!< Blufi Remote bluetooth device address */
uint8_t server_if; /*!< server interface */
uint16_t conn_id; /*!< Connection id */
} connect; /*!< Blufi callback param of ESP_BLUFI_EVENT_CONNECT */
/**
@ -353,6 +356,18 @@ esp_err_t esp_blufi_send_wifi_conn_report(wifi_mode_t opmode, esp_blufi_sta_conn
*/
uint16_t esp_blufi_get_version(void);
/**
* @brief Close a connection a remote device.
*
* @param[in] gatts_if: GATT server access interface
* @param[in] conn_id: connection ID to be closed.
*
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_blufi_close(esp_gatt_if_t gatts_if, uint16_t conn_id);
#ifdef __cplusplus
}
#endif

View File

@ -32,6 +32,16 @@ typedef enum {
ESP_BT_STATUS_WRONG_MODE = 5,
} esp_bt_status_t;
/*Define the bt octet 16 bit size*/
#define ESP_BT_OCTET16_LEN 16
typedef uint8_t esp_bt_octet16_t[ESP_BT_OCTET16_LEN]; /* octet array: size 16 */
#define ESP_BT_OCTET8_LEN 8
typedef uint8_t esp_bt_octet8_t[ESP_BT_OCTET8_LEN]; /* octet array: size 8 */
typedef uint8_t esp_link_key[ESP_BT_OCTET16_LEN]; /* Link Key */
/// Default GATT interface id
#define ESP_DEFAULT_GATT_IF 0xff
@ -67,22 +77,6 @@ typedef enum {
/// Bluetooth device address
typedef uint8_t esp_bd_addr_t[ESP_BD_ADDR_LEN];
/// Own BD address source of the device
typedef enum {
/// Public Address
BD_ADDR_PUBLIC,
/// Provided random address
BD_ADDR_PROVIDED_RND,
/// Provided static random address
BD_ADDR_GEN_STATIC_RND,
/// Generated resolvable private random address
BD_ADDR_GEN_RSLV,
/// Generated non-resolvable private random address
BD_ADDR_GEN_NON_RSLV,
/// Provided Reconnection address
BD_ADDR_PROVIDED_RECON,
} esp_bd_addr_type_t;
/// BLE device address type
typedef enum {
BLE_ADDR_TYPE_PUBLIC = 0x00,
@ -91,6 +85,15 @@ typedef enum {
BLE_ADDR_TYPE_RPA_RANDOM = 0x03,
} esp_ble_addr_type_t;
/// Used to exchange the encrytyption key in the init key & response key
#define ESP_BLE_ENC_KEY_MASK (1 << 0)
/// Used to exchange the IRK key in the init key & response key
#define ESP_BLE_ID_KEY_MASK (1 << 1)
/// Used to exchange the CSRK key in the init key & response key
#define ESP_BLE_CSR_KEY_MASK (1 << 2)
/// 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)
/// Minimum of the application id
#define ESP_APP_ID_MIN 0x0000
/// Maximum of the application id

View File

@ -17,6 +17,8 @@
#include <stdint.h>
#include <stdbool.h>
#include "esp_err.h"
#include "esp_bt_defs.h"
#ifdef __cplusplus
extern "C" {
@ -30,6 +32,21 @@ extern "C" {
*/
const uint8_t *esp_bt_dev_get_address(void);
/**
* @brief Set bluetooth device name. This function should be called after esp_bluedroid_enable()
* completes successfully
*
* @param[in] name : device name to be set
*
* @return
* - ESP_OK : Succeed
* - ESP_ERR_INVALID_ARG : if name is NULL pointer or empty, or string length out of limit
* - ESP_INVALID_STATE : if bluetooth stack is not yet enabled
* - ESP_FAIL : others
*/
esp_err_t esp_bt_dev_set_device_name(const char *name);
#ifdef __cplusplus
}
#endif

View File

@ -38,6 +38,34 @@ extern "C" {
* @}
*/
#define ESP_LE_KEY_NONE 0
#define ESP_LE_KEY_PENC (1 << 0) /*!< encryption key, encryption information of peer device */
#define ESP_LE_KEY_PID (1 << 1) /*!< identity key of the peer device */
#define ESP_LE_KEY_PCSRK (1 << 2) /*!< peer SRK */
#define ESP_LE_KEY_PLK (1 << 3) /*!< Link key*/
#define ESP_LE_KEY_LLK (ESP_LE_KEY_PLK << 4)
#define ESP_LE_KEY_LENC (ESP_LE_KEY_PENC << 4) /*!< master role security information:div */
#define ESP_LE_KEY_LID (ESP_LE_KEY_PID << 4) /*!< master device ID key */
#define ESP_LE_KEY_LCSRK (ESP_LE_KEY_PCSRK << 4) /*!< local CSRK has been deliver to peer */
typedef uint8_t esp_ble_key_type_t;
#define ESP_LE_AUTH_NO_BOND 0x00 /*!< 0*/
#define ESP_LE_AUTH_BOND 0x01 /*!< 1 << 0 */
#define ESP_LE_AUTH_REQ_MITM (1 << 2) /*!< 1 << 2 */
#define ESP_LE_AUTH_REQ_SC_ONLY (1 << 3) /*!< 1 << 3 */
#define ESP_LE_AUTH_REQ_SC_BOND (ESP_LE_AUTH_BOND | ESP_LE_AUTH_REQ_SC_ONLY) /*!< 1001 */
#define ESP_LE_AUTH_REQ_SC_MITM (ESP_LE_AUTH_REQ_MITM | ESP_LE_AUTH_REQ_SC_ONLY) /*!< 1100 */
#define ESP_LE_AUTH_REQ_SC_MITM_BOND (ESP_LE_AUTH_REQ_MITM | ESP_LE_AUTH_REQ_SC_ONLY | ESP_LE_AUTH_BOND) /*!< 1101 */
typedef uint8_t esp_ble_auth_req_t; /*!< combination of the above bit pattern */
#define ESP_IO_CAP_OUT 0 /*!< DisplayOnly */
#define ESP_IO_CAP_IO 1 /*!< DisplayYesNo */
#define ESP_IO_CAP_IN 2 /*!< KeyboardOnly */
#define ESP_IO_CAP_NONE 3 /*!< NoInputNoOutput */
#define ESP_IO_CAP_KBDISP 4 /*!< Keyboard display */
typedef uint8_t esp_ble_io_cap_t; /*!< combination of the io capability */
/// GAP BLE callback event type
typedef enum {
ESP_GAP_BLE_ADV_DATA_SET_COMPLETE_EVT = 0, /*!< When advertising data set complete, the event comes */
@ -48,6 +76,17 @@ typedef enum {
ESP_GAP_BLE_SCAN_RSP_DATA_RAW_SET_COMPLETE_EVT, /*!< When raw advertising data set complete, the event comes */
ESP_GAP_BLE_ADV_START_COMPLETE_EVT, /*!< When start advertising complete, the event comes */
ESP_GAP_BLE_SCAN_START_COMPLETE_EVT, /*!< When start scan complete, the event comes */
ESP_GAP_BLE_AUTH_CMPL_EVT, /* Authentication complete indication. */
ESP_GAP_BLE_KEY_EVT, /* BLE key event for peer device keys */
ESP_GAP_BLE_SEC_REQ_EVT, /* BLE security request */
ESP_GAP_BLE_PASSKEY_NOTIF_EVT, /* passkey notification event */
ESP_GAP_BLE_PASSKEY_REQ_EVT, /* passkey request event */
ESP_GAP_BLE_OOB_REQ_EVT, /* OOB request event */
ESP_GAP_BLE_LOCAL_IR_EVT, /* BLE local IR event */
ESP_GAP_BLE_LOCAL_ER_EVT, /* BLE local ER event */
ESP_GAP_BLE_NC_REQ_EVT, /* Numeric Comparison request event */
ESP_GAP_BLE_ADV_STOP_COMPLETE_EVT, /*!< When stop adv complete, the event comes */
ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT, /*!< When stop scan complete, the event comes */
} esp_gap_ble_cb_event_t;
/// Advertising data maximum length
@ -113,6 +152,23 @@ typedef enum {
///Enumeration end value for advertising filter policy value check
} esp_ble_adv_filter_t;
typedef enum {
ESP_BLE_SEC_NONE,
ESP_BLE_SEC_ENCRYPT,
ESP_BLE_SEC_ENCRYPT_NO_MITM,
ESP_BLE_SEC_ENCRYPT_MITM,
}esp_ble_sec_act_t;
typedef enum {
ESP_BLE_SM_PASSKEY,
ESP_BLE_SM_AUTHEN_REQ_MODE,
ESP_BLE_SM_IOCAP_MODE,
ESP_BLE_SM_SET_INIT_KEY,
ESP_BLE_SM_SET_RSP_KEK,
ESP_BLE_SM_MAX_KEY_SIZE,
} esp_ble_sm_param_t;
/// Advertising parameters
typedef struct {
uint16_t adv_int_min; /*!< Minimum advertising interval for
@ -148,22 +204,6 @@ typedef struct {
uint8_t flag; /*!< Advertising flag of discovery mode, see BLE_ADV_DATA_FLAG detail */
} esp_ble_adv_data_t;
/// Own BD address source of the device
typedef enum {
/// Public Address
ESP_PUBLIC_ADDR,
/// Provided random address
ESP_PROVIDED_RND_ADDR,
/// Provided static random address
ESP_GEN_STATIC_RND_ADDR,
/// Generated resolvable private random address
ESP_GEN_RSLV_ADDR,
/// Generated non-resolvable private random address
ESP_GEN_NON_RSLV_ADDR,
/// Provided Reconnection address
ESP_PROVIDED_RECON_ADDR,
} esp_ble_own_addr_src_t;
/// Ble scan type
typedef enum {
BLE_SCAN_TYPE_PASSIVE = 0x0, /*!< Passive scan */
@ -215,6 +255,137 @@ typedef struct {
Time Range: 100 msec to 32 seconds */
} esp_ble_conn_update_params_t;
/**
* @brief BLE encryption keys
*/
typedef struct
{
esp_bt_octet16_t ltk; /*!< The long term key*/
esp_bt_octet8_t rand; /*!< The random number*/
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*/
/**
* @brief BLE CSRK keys
*/
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 */
/**
* @brief BLE pid keys
*/
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 */
/**
* @brief BLE Encryption reproduction keys
*/
typedef struct
{
esp_bt_octet16_t ltk; /*!< The long term key */
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 */
/**
* @brief BLE SRK keys
*/
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 */
/**
* @brief Structure associated with ESP_KEY_NOTIF_EVT
*/
typedef struct
{
esp_bd_addr_t bd_addr; /*!< peer address */
uint32_t passkey; /*!< the numeric value for comparison. If just_works, do not show this number to UI */
} esp_ble_sec_key_notif_t; /*!< BLE key notify type*/
/**
* @brief Structure of the security request
*/
typedef struct
{
esp_bd_addr_t bd_addr; /*!< peer address */
}esp_ble_sec_req_t; /*!< BLE security request type*/
/**
* @brief union type of the security key value
*/
typedef union
{
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_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*/
/**
* @brief union type of the security key value
*/
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*/
/**
* @brief structure type of the ble local id keys value
*/
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*/
/**
* @brief Structure associated with ESP_AUTH_CMPL_EVT
*/
typedef struct
{
esp_bd_addr_t bd_addr; /*!< BD address peer device. */
bool key_present; /*!< Valid link key value in key element */
esp_link_key key; /*!< Link key associated with peer device. */
uint8_t key_type; /*!< The type of Link Key */
bool success; /*!< TRUE of authentication succeeded, FALSE if failed. */
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 */
/**
* @brief union associated with ble security
*/
typedef union
{
esp_ble_sec_key_notif_t key_notif; /*!< passkey notification */
esp_ble_sec_req_t ble_req; /*!< BLE SMP related request */
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 */
/// Sub Event of ESP_GAP_BLE_SCAN_RESULT_EVT
typedef enum {
ESP_GAP_SEARCH_INQ_RES_EVT = 0, /*!< Inquiry result for a peer device. */
@ -300,6 +471,20 @@ typedef union {
struct ble_scan_start_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate scan start operation success status */
} scan_start_cmpl; /*!< Event parameter of ESP_GAP_BLE_SCAN_START_COMPLETE_EVT */
esp_ble_sec_t ble_security; /*!< ble gap security union type */
/**
* @brief ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT
*/
struct ble_scan_stop_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate scan stop operation success status */
} scan_stop_cmpl; /*!< Event parameter of ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_ADV_STOP_COMPLETE_EVT
*/
struct ble_adv_stop_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate adv stop operation success status */
} adv_stop_cmpl; /*!< Event parameter of ESP_GAP_BLE_ADV_STOP_COMPLETE_EVT */
} esp_ble_gap_cb_param_t;
/**
@ -505,6 +690,76 @@ esp_err_t esp_ble_gap_config_adv_data_raw(uint8_t *raw_data, uint32_t raw_data_l
*/
esp_err_t esp_ble_gap_config_scan_rsp_data_raw(uint8_t *raw_data, uint32_t raw_data_len);
/**
* @brief Set a GAP security parameter value. Overrides the default value.
*
* @param[in] param_type :L the type of the param which to be set
* @param[in] value : the param value
* @param[out] len : the length of the param value
*
* @return - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_gap_set_security_param(esp_ble_sm_param_t param_type,
void *value, uint8_t len);
/**
* @brief Grant security request access.
*
* @param[in] bd_addr : BD address of the peer
* @param[in] accept : accept the security request or not
*
* @return - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_gap_security_rsp(esp_bd_addr_t bd_addr, bool accept);
/**
* @brief Set a gap parameter value. Use this function to change
* the default GAP parameter values.
*
* @param[in] bd_addr : the address of the peer device need to encryption
* @param[in] sec_act : This is the security action to indicate
* what kind of BLE security level is required for
* the BLE link if the BLE is supported
*
* @return - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_set_encryption(esp_bd_addr_t bd_addr, esp_ble_sec_act_t sec_act);
/**
* @brief Reply the key value to the peer device in the lagecy connection stage.
*
* @param[in] bd_addr : BD address of the peer
* @param[in] accept : passkey entry sucessful or declined.
* @param[in] passkey : passkey value, must be a 6 digit number,
* can be lead by 0.
*
* @return - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_passkey_reply(esp_bd_addr_t bd_addr, bool accept, uint32_t passkey);
/**
* @brief Reply the comfirm value to the peer device in the lagecy connection stage.
*
* @param[in] bd_addr : BD address of the peer device
* @param[in] accept : numbers to compare are the same or different.
*
* @return - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_confirm_reply(esp_bd_addr_t bd_addr, bool accept);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,52 @@
// Copyright 2015-2016 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.
#ifndef __ESP_GAP_BT_API_H__
#define __ESP_GAP_BT_API_H__
#include <stdint.h>
#include "esp_err.h"
#include "esp_bt_defs.h"
#ifdef __cplusplus
extern "C" {
#endif
/// Discoverability and Connectability mode
typedef enum {
ESP_BT_SCAN_MODE_NONE = 0, /*!< Neither discoverable nor connectable */
ESP_BT_SCAN_MODE_CONNECTABLE, /*!< Connectable but not discoverable */
ESP_BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE /*!< both discoverable and connectaable */
} esp_bt_scan_mode_t;
/**
* @brief Set discoverability and connectability mode for legacy bluetooth. This function should
* be called after esp_bluedroid_enable() completes successfully
*
* @param[in] mode : one of the enums of bt_scan_mode_t
*
* @return
* - ESP_OK : Succeed
* - ESP_ERR_INVALID_ARG: if argument invalid
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
* - ESP_FAIL: others
*/
esp_err_t esp_bt_gap_set_scan_mode(esp_bt_scan_mode_t mode);
#ifdef __cplusplus
}
#endif
#endif /* __ESP_GAP_BT_API_H__ */

View File

@ -297,13 +297,17 @@ typedef enum {
/**
* @brief attribute auto respose flag
* @brief attribute auto response flag
*/
typedef struct
{
#define ESP_GATT_RSP_BY_APP 0
#define ESP_GATT_AUTO_RSP 1
uint8_t auto_rsp; /*!< need the app response to the client if need_rsp set to 1*/
/**
* @brief if auto_rsp set to ESP_GATT_RSP_BY_APP, means the response of Write/Read operation will by replied by application.
if auto_rsp set to ESP_GATT_AUTO_RSP, means the response of Write/Read operation will be replied by GATT stack automatically.
*/
uint8_t auto_rsp;
} esp_attr_control_t;
@ -312,8 +316,8 @@ typedef struct
*/
typedef struct
{
esp_attr_control_t attr_control; /*!< The attribue control type*/
esp_attr_desc_t att_desc; /*!< The attribue type*/
esp_attr_control_t attr_control; /*!< The attribute control type*/
esp_attr_desc_t att_desc; /*!< The attribute type*/
} esp_gatts_attr_db_t;

View File

@ -511,14 +511,14 @@ esp_err_t esp_ble_gattc_write_char( esp_gatt_if_t gattc_if,
*
*/
esp_err_t esp_ble_gattc_write_char_descr (esp_gatt_if_t gattc_if,
uint16_t conn_id,
esp_gatt_srvc_id_t *srvc_id,
esp_gatt_id_t *char_id,
esp_gatt_id_t *descr_id,
uint16_t value_len,
uint8_t *value,
esp_gatt_write_type_t write_type,
esp_gatt_auth_req_t auth_req);
uint16_t conn_id,
esp_gatt_srvc_id_t *srvc_id,
esp_gatt_id_t *char_id,
esp_gatt_id_t *descr_id,
uint16_t value_len,
uint8_t *value,
esp_gatt_write_type_t write_type,
esp_gatt_auth_req_t auth_req);
/**
@ -548,6 +548,35 @@ esp_err_t esp_ble_gattc_prepare_write(esp_gatt_if_t gattc_if,
esp_gatt_auth_req_t auth_req);
/**
* @brief This function is called to prepare write a characteristic descriptor value.
*
* @param[in] gattc_if: Gatt client access interface.
* @param[in] conn_id : connection ID.
* @param[in] srvc_id : service ID.
* @param[in] char_id : GATT characteristic ID of the service.
* @param[in] descr_id : characteristic descriptor ID to write.
* @param[in] offset : offset of the write value.
* @param[in] value_len: length of the value to be written.
* @param[in] value : the value to be written.
* @param[in] auth_req : authentication request.
*
* @return
* - ESP_OK: success
* - other: failed
*
*/
esp_err_t esp_ble_gattc_prepare_write_char_descr(esp_gatt_if_t gattc_if,
uint16_t conn_id,
esp_gatt_srvc_id_t *srvc_id,
esp_gatt_id_t *char_id,
esp_gatt_id_t *descr_id,
uint16_t offset,
uint16_t value_len,
uint8_t *value,
esp_gatt_auth_req_t auth_req);
/**
* @brief This function is called to execute write a prepare write sequence.
*

View File

@ -0,0 +1,79 @@
// Copyright 2015-2016 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.
#ifndef __ESP_SEC_API_H__
#define __ESP_SEC_API_H__
#include "bt_types.h"
#define APP_SEC_IRK_FLAG (0)
#define RAND_NB_LEN 0x08
#define SEC_KEY_LEN 0x10
/*
* STRUCTURES DEFINITIONS
****************************************************************************************
*/
/// Generic Security key structure
typedef struct {
/// Key value MSB -> LSB
UINT8 key[SEC_KEY_LEN];
} smp_sec_key;
///Random number structure
typedef struct {
///8-byte array for random number
UINT8 nb[RAND_NB_LEN];
} rand_nb;
typedef struct {
// LTK
smp_sec_key ltk;
// Random Number
rand_nb rand_nb;
// EDIV
UINT16 ediv;
// LTK key size
UINT8 key_size;
// Last paired peer address type
UINT8 peer_addr_type;
// Last paired peer address
BD_ADDR peer_addr;
// authentication level
UINT8 auth;
} tAPP_SEC_ENV;
extern tAPP_SEC_ENV app_sec_env;
/*
* GLOBAL FUNCTIONS DECLARATIONS
****************************************************************************************
*/
void app_ble_sec_init(void);
void app_ble_sec_pairing_cmp_evt_send(UINT8);
UINT32 app_ble_sec_gen_tk(void);
void app_ble_sec_gen_ltk(UINT8 key_size);
void app_ble_security_start(void);
#endif /* __ESP_SEC_API_H__ */

0
tools/sdk/include/bluedroid/fixed_queue.h Executable file → Normal file
View File

View File

@ -49,4 +49,6 @@ void future_ready(future_t *future, void *value);
// Frees the future before return. |future| may not be NULL.
void *future_await(future_t *async_result);
//Free the future if this "future" is not used
void future_free(future_t *future);
#endif /* __FUTURE_H__ */

View File

@ -127,15 +127,15 @@ typedef struct {
tGAP_INFO blk[GAP_MAX_BLOCKS];
tBTM_CMPL_CB *btm_cback[GAP_MAX_BLOCKS];
UINT8 trace_level;
tGAP_FINDADDR_CB findaddr_cb; /* Contains the control block for finding a device addr */
tBTM_INQ_INFO *cur_inqptr;
//tGAP_FINDADDR_CB findaddr_cb; /* Contains the control block for finding a device addr */
//tBTM_INQ_INFO *cur_inqptr;
#if GAP_CONN_INCLUDED == TRUE
tGAP_CONN conn;
#endif
/* LE GAP attribute database */
#if BLE_INCLUDED == TRUE
#if BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE
tGAP_ATTR gatt_attr[GAP_MAX_CHAR_NUM];
tGAP_CLCB clcb[GAP_MAX_CL]; /* connection link*/
tGATT_IF gatt_if;
@ -147,7 +147,7 @@ extern tGAP_CB gap_cb;
#if (GAP_CONN_INCLUDED == TRUE)
extern void gap_conn_init(void);
#endif
#if (BLE_INCLUDED == TRUE)
#if (BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE)
extern void gap_attr_db_init(void);
#endif

View File

@ -326,6 +326,10 @@ typedef struct{
uint8_t auto_rsp;
}tGATTS_ATTR_CONTROL;
/* Mask for gatt server attribute */
#define GATT_ATTR_VALUE_ALLOCATED 0x01
typedef UINT8 tGATT_ATTR_MASK;
/* Union of the event data which is used in the server respond API to carry the server response information
*/
typedef union {

View File

@ -185,6 +185,7 @@ typedef struct {
tGATT_ATTR_UUID_TYPE uuid_type;
tGATT_PERM permission;
tGATTS_ATTR_CONTROL control;
tGATT_ATTR_MASK mask;
UINT16 handle;
UINT16 uuid;
} tGATT_ATTR16;
@ -197,6 +198,7 @@ typedef struct {
tGATT_ATTR_UUID_TYPE uuid_type;
tGATT_PERM permission;
tGATTS_ATTR_CONTROL control;
tGATT_ATTR_MASK mask;
UINT16 handle;
UINT32 uuid;
} tGATT_ATTR32;
@ -210,6 +212,7 @@ typedef struct {
tGATT_ATTR_UUID_TYPE uuid_type;
tGATT_PERM permission;
tGATTS_ATTR_CONTROL control;
tGATT_ATTR_MASK mask;
UINT16 handle;
UINT8 uuid[LEN_UUID_128];
} tGATT_ATTR128;
@ -382,7 +385,9 @@ typedef struct {
/* server needs */
/* server response data */
#if (GATTS_INCLUDED == TRUE)
tGATT_SR_CMD sr_cmd;
#endif ///GATTS_INCLUDED == TRUE
UINT16 indicate_handle;
BUFFER_Q pending_ind_q;
@ -499,11 +504,12 @@ typedef struct {
UINT16 next_handle; /* next available handle */
tGATT_SVC_CHG gattp_attr; /* GATT profile attribute service change */
tGATT_IF gatt_if;
#if (GATTS_INCLUDED == TRUE)
tGATT_HDL_LIST_INFO hdl_list_info;
tGATT_HDL_LIST_ELEM hdl_list[GATT_MAX_SR_PROFILES];
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 */
tGATT_REG cl_rcb[GATT_MAX_APPS];
@ -518,8 +524,9 @@ typedef struct {
UINT8 err_status;
UINT16 handle;
#endif
#if (GATTS_INCLUDED == TRUE)
tGATT_PROFILE_CLCB profile_clcb[GATT_MAX_APPS];
#endif ///GATTS_INCLUDED == TRUE
UINT16 handle_of_h_r; /* Handle of the handles reused characteristic value */
tGATT_APPL_INFO cb_info;
@ -586,7 +593,9 @@ extern tGATT_STATUS attp_send_msg_to_l2cap(tGATT_TCB *p_tcb, BT_HDR *p_toL2CAP);
/* utility functions */
extern UINT8 *gatt_dbg_op_name(UINT8 op_code);
#if (SDP_INCLUDED == TRUE)
extern UINT32 gatt_add_sdp_record (tBT_UUID *p_uuid, UINT16 start_hdl, UINT16 end_hdl);
#endif ///SDP_INCLUDED == TRUE
extern BOOLEAN gatt_parse_uuid_from_cmd(tBT_UUID *p_uuid, UINT16 len, UINT8 **p_data);
extern UINT8 gatt_build_uuid_to_stream(UINT8 **p_dst, tBT_UUID uuid);
extern BOOLEAN gatt_uuid_compare(tBT_UUID src, tBT_UUID tar);
@ -621,6 +630,7 @@ extern tGATT_HDL_LIST_ELEM *gatt_find_hdl_buffer_by_handle(UINT16 handle);
extern tGATT_HDL_LIST_ELEM *gatt_find_hdl_buffer_by_attr_handle(UINT16 attr_handle);
extern tGATT_HDL_LIST_ELEM *gatt_alloc_hdl_buffer(void);
extern void gatt_free_hdl_buffer(tGATT_HDL_LIST_ELEM *p);
extern void gatt_free_attr_value_buffer(tGATT_HDL_LIST_ELEM *p);
extern BOOLEAN gatt_is_last_attribute(tGATT_SRV_LIST_INFO *p_list, tGATT_SRV_LIST_ELEM *p_start, tBT_UUID value);
extern void gatt_update_last_pri_srv_info(tGATT_SRV_LIST_INFO *p_list);
extern BOOLEAN gatt_add_a_srv_to_list(tGATT_SRV_LIST_INFO *p_list, tGATT_SRV_LIST_ELEM *p_new);

0
tools/sdk/include/bluedroid/gki_target.h Executable file → Normal file
View File

0
tools/sdk/include/bluedroid/hash_functions.h Executable file → Normal file
View File

0
tools/sdk/include/bluedroid/hci_internals.h Executable file → Normal file
View File

View File

@ -0,0 +1,69 @@
/******************************************************************************
*
* Copyright (C) 2002-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.
*
******************************************************************************/
/******************************************************************************
*
* This file contains HID connection internal definitions
*
******************************************************************************/
#ifndef HID_CONN_H
#define HID_CONN_H
#if (HID_HOST_INCLUDED == TRUE)
/* Define the HID Connection Block
*/
typedef struct hid_conn {
#define HID_CONN_STATE_UNUSED (0)
#define HID_CONN_STATE_CONNECTING_CTRL (1)
#define HID_CONN_STATE_CONNECTING_INTR (2)
#define HID_CONN_STATE_CONFIG (3)
#define HID_CONN_STATE_CONNECTED (4)
#define HID_CONN_STATE_DISCONNECTING (5)
#define HID_CONN_STATE_SECURITY (6)
UINT8 conn_state;
#define HID_CONN_FLAGS_IS_ORIG (0x01)
#define HID_CONN_FLAGS_HIS_CTRL_CFG_DONE (0x02)
#define HID_CONN_FLAGS_MY_CTRL_CFG_DONE (0x04)
#define HID_CONN_FLAGS_HIS_INTR_CFG_DONE (0x08)
#define HID_CONN_FLAGS_MY_INTR_CFG_DONE (0x10)
#define HID_CONN_FLAGS_ALL_CONFIGURED (0x1E) /* All the config done */
#define HID_CONN_FLAGS_CONGESTED (0x20)
#define HID_CONN_FLAGS_INACTIVE (0x40)
UINT8 conn_flags;
UINT8 ctrl_id;
UINT16 ctrl_cid;
UINT16 intr_cid;
UINT16 rem_mtu_size;
UINT16 disc_reason; /* Reason for disconnecting (for HID_HDEV_EVT_CLOSE) */
TIMER_LIST_ENT timer_entry;
} tHID_CONN;
#define HID_SEC_CHN 1
#define HID_NOSEC_CHN 2
#define HIDD_SEC_CHN 3
#define HIDD_NOSEC_CHN 4
#endif ///HID_HOST_INCLUDED == TRUE
#endif

View File

@ -24,8 +24,12 @@
#ifndef HIDDEFS_H
#define HIDDEFS_H
#include "bt_target.h"
#if (HID_HOST_INCLUDED == TRUE)
#if (SDP_INCLUDED == TRUE)
#include "sdp_api.h"
#endif ///SDP_INCLUDED == TRUE
/*
** tHID_STATUS: HID result codes, returned by HID and device and host functions.
*/
@ -149,8 +153,11 @@ typedef struct sdp_info {
tHID_DEV_DSCP_INFO dscp_info; /* Descriptor list and Report list to be set in the SDP record.
This parameter is used if HID_DEV_USE_GLB_SDP_REC is set to FALSE.*/
#if(SDP_INCLUDED == TRUE)
tSDP_DISC_REC *p_sdp_layer_rec;
#endif ///SDP_INCLUDED == TRUE
} tHID_DEV_SDP_INFO;
#endif ///HID_HOST_INCLUDED == TRUE
#endif

View File

@ -21,6 +21,7 @@
#include "hiddefs.h"
#include "sdp_api.h"
#if (HID_HOST_INCLUDED == TRUE)
/*****************************************************************************
** Constants
*****************************************************************************/
@ -232,4 +233,6 @@ extern UINT8 HID_HostSetTraceLevel (UINT8 new_level);
}
#endif
#endif ///HID_HOST_INCLUDED == TRUE
#endif /* HIDH_API_H */

View File

@ -0,0 +1,95 @@
/******************************************************************************
*
* Copyright (C) 2002-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.
*
******************************************************************************/
/******************************************************************************
*
* This file contains HID HOST internal definitions
*
******************************************************************************/
#ifndef HIDH_INT_H
#define HIDH_INT_H
#include "hidh_api.h"
#include "hid_conn.h"
#include "l2c_api.h"
#if (HID_HOST_INCLUDED == TRUE)
enum {
HID_DEV_NO_CONN,
HID_DEV_CONNECTED
};
typedef struct per_device_ctb {
BOOLEAN in_use;
BD_ADDR addr; /* BD-Addr of the host device */
UINT16 attr_mask; /* 0x01- virtual_cable; 0x02- normally_connectable; 0x03- reconn_initiate;
0x04- sdp_disable; */
UINT8 state; /* Device state if in HOST-KNOWN mode */
UINT8 conn_substate;
UINT8 conn_tries; /* Remembers to the number of connection attempts while CONNECTING */
tHID_CONN conn; /* L2CAP channel info */
} tHID_HOST_DEV_CTB;
typedef struct host_ctb {
tHID_HOST_DEV_CTB devices[HID_HOST_MAX_DEVICES];
tHID_HOST_DEV_CALLBACK *callback; /* Application callbacks */
tL2CAP_CFG_INFO l2cap_cfg;
#define MAX_SERVICE_DB_SIZE 4000
BOOLEAN sdp_busy;
tHID_HOST_SDP_CALLBACK *sdp_cback;
tSDP_DISCOVERY_DB *p_sdp_db;
tHID_DEV_SDP_INFO sdp_rec;
BOOLEAN reg_flag;
UINT8 trace_level;
} tHID_HOST_CTB;
extern tHID_STATUS hidh_conn_snd_data(UINT8 dhandle, UINT8 trans_type, UINT8 param, \
UINT16 data, UINT8 rpt_id, BT_HDR *buf);
extern tHID_STATUS hidh_conn_reg (void);
extern void hidh_conn_dereg( void );
extern tHID_STATUS hidh_conn_disconnect (UINT8 dhandle);
extern tHID_STATUS hidh_conn_initiate (UINT8 dhandle);
extern void hidh_proc_repage_timeout (TIMER_LIST_ENT *p_tle);
#ifdef __cplusplus
extern "C"
{
#endif
/******************************************************************************
** Main Control Block
*******************************************************************************/
#if HID_DYNAMIC_MEMORY == FALSE
extern tHID_HOST_CTB hh_cb;
#else
extern tHID_HOST_CTB *hidh_cb_ptr;
#define hh_cb (*hidh_cb_ptr)
#endif
#ifdef __cplusplus
}
#endif
#endif ///HID_HOST_INCLUDED == TRUE
#endif

View File

@ -21,6 +21,7 @@
#include <stdbool.h>
#include "bt_defs.h"
#include "bt_target.h"
typedef enum {
// Disable secure connections

View File

@ -331,6 +331,7 @@ extern "C"
{
#endif
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function L2CA_Register
@ -483,6 +484,8 @@ extern BOOLEAN L2CA_DisconnectReq (UINT16 cid);
**
*******************************************************************************/
extern BOOLEAN L2CA_DisconnectRsp (UINT16 cid);
#endif ///CLASSIC_BT_INCLUDED == TRUE
/*******************************************************************************
**
@ -497,6 +500,8 @@ extern BOOLEAN L2CA_DisconnectRsp (UINT16 cid);
*******************************************************************************/
extern UINT8 L2CA_DataWrite (UINT16 cid, BT_HDR *p_data);
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function L2CA_Ping
@ -519,6 +524,8 @@ extern BOOLEAN L2CA_Ping (BD_ADDR p_bd_addr, tL2CA_ECHO_RSP_CB *p_cb);
**
*******************************************************************************/
extern BOOLEAN L2CA_Echo (BD_ADDR p_bd_addr, BT_HDR *p_data, tL2CA_ECHO_DATA_CB *p_callback);
#endif ///CLASSIC_BT_INCLUDED == TRUE
// Given a local channel identifier, |lcid|, this function returns the bound remote
// channel identifier, |rcid|, and the ACL link handle, |handle|. If |lcid| is not
@ -544,6 +551,7 @@ bool L2CA_GetIdentifiers(uint16_t lcid, uint16_t *rcid, uint16_t *handle);
extern BOOLEAN L2CA_SetIdleTimeout (UINT16 cid, UINT16 timeout,
BOOLEAN is_global);
/*******************************************************************************
**
** Function L2CA_SetIdleTimeoutByBdAddr
@ -566,6 +574,7 @@ extern BOOLEAN L2CA_SetIdleTimeout (UINT16 cid, UINT16 timeout,
extern BOOLEAN L2CA_SetIdleTimeoutByBdAddr(BD_ADDR bd_addr, UINT16 timeout,
tBT_TRANSPORT transport);
/*******************************************************************************
**
** Function L2CA_SetTraceLevel
@ -578,6 +587,7 @@ extern BOOLEAN L2CA_SetIdleTimeoutByBdAddr(BD_ADDR bd_addr, UINT16 timeout,
*******************************************************************************/
extern UINT8 L2CA_SetTraceLevel (UINT8 trace_level);
/*******************************************************************************
**
** Function L2CA_SetDesireRole
@ -595,7 +605,7 @@ extern UINT8 L2CA_SetTraceLevel (UINT8 trace_level);
**
*******************************************************************************/
extern UINT8 L2CA_SetDesireRole (UINT8 new_role);
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function L2CA_LocalLoopbackReq
@ -722,6 +732,7 @@ typedef void (tL2CA_RESERVE_CMPL_CBACK) (void);
** ACL link.
*******************************************************************************/
extern BOOLEAN L2CA_SetFlushTimeout (BD_ADDR bd_addr, UINT16 flush_tout);
#endif ///CLASSIC_BT_INCLUDED == TRUE
/*******************************************************************************
**
@ -780,6 +791,8 @@ extern BOOLEAN L2CA_GetPeerFeatures (BD_ADDR bd_addr, UINT32 *p_ext_feat, UINT8
*******************************************************************************/
extern BOOLEAN L2CA_GetBDAddrbyHandle (UINT16 handle, BD_ADDR bd_addr);
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function L2CA_GetChnlFcrMode
@ -792,6 +805,7 @@ extern BOOLEAN L2CA_GetBDAddrbyHandle (UINT16 handle, BD_ADDR bd_addr);
**
*******************************************************************************/
extern UINT8 L2CA_GetChnlFcrMode (UINT16 lcid);
#endif ///CLASSIC_BT_INCLUDED == TRUE
/*******************************************************************************
@ -1044,6 +1058,7 @@ extern BOOLEAN L2CA_SetFixedChannelTout (BD_ADDR rem_bda, UINT16 fixed_cid, UINT
#endif /* (L2CAP_NUM_FIXED_CHNLS > 0) */
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function L2CA_GetCurrentConfig
@ -1060,6 +1075,8 @@ extern BOOLEAN L2CA_SetFixedChannelTout (BD_ADDR rem_bda, UINT16 fixed_cid, UINT
extern BOOLEAN L2CA_GetCurrentConfig (UINT16 lcid,
tL2CAP_CFG_INFO **pp_our_cfg, tL2CAP_CH_CFG_BITS *p_our_cfg_bits,
tL2CAP_CFG_INFO **pp_peer_cfg, tL2CAP_CH_CFG_BITS *p_peer_cfg_bits);
#endif ///CLASSIC_BT_INCLUDED == TRUE
#if (BLE_INCLUDED == TRUE)
/*******************************************************************************

View File

@ -18,6 +18,7 @@
#ifndef _L2CAP_CLIENT_H_
#define _L2CAP_CLIENT_H_
#if (defined(L2CAP_CLIENT_INCLUDED) && L2CAP_CLIENT_INCLUDED == TRUE)
//#include <hardware/bluetooth.h>
#include <stdbool.h>
@ -74,4 +75,6 @@ bool l2cap_client_is_connected(const l2cap_client_t *client);
// |client| nor |packet| may be NULL.
bool l2cap_client_write(l2cap_client_t *client, buffer_t *packet);
#endif ///(defined(L2CAP_CLIENT_INCLUDED) && L2CAP_CLIENT_INCLUDED == TRUE)
#endif /*_L2CAP_CLIENT_H_*/

0
tools/sdk/include/bluedroid/list.h Executable file → Normal file
View File

View File

@ -0,0 +1,86 @@
/******************************************************************************
*
* Copyright (C) 2014 The Android Open Source Project
* Copyright 2002 - 2004 Open Interface North America, Inc. All rights reserved.
*
* 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 _OI_ASSERT_H
#define _OI_ASSERT_H
/** @file
This file provides macros and functions for compile-time and run-time assertions.
When the OI_DEBUG preprocessor value is defined, the macro OI_ASSERT is compiled into
the program, providing for a runtime assertion failure check.
C_ASSERT is a macro that can be used to perform compile time checks.
*/
/**********************************************************************************
$Revision: #1 $
***********************************************************************************/
/** \addtogroup Debugging Debugging APIs */
/**@{*/
#ifdef __cplusplus
extern "C" {
#endif
#ifdef OI_DEBUG
/** The macro OI_ASSERT takes a condition argument. If the asserted condition
does not evaluate to true, the OI_ASSERT macro calls the host-dependent function,
OI_AssertFail(), which reports the failure and generates a runtime error.
*/
void OI_AssertFail(char *file, int line, char *reason);
#define OI_ASSERT(condition) \
{ if (!(condition)) OI_AssertFail(__FILE__, __LINE__, #condition); }
#define OI_ASSERT_FAIL(msg) \
{ OI_AssertFail(__FILE__, __LINE__, msg); }
#else
#define OI_ASSERT(condition)
#define OI_ASSERT_FAIL(msg)
#endif
/**
C_ASSERT() can be used to perform many compile-time assertions: type sizes, field offsets, etc.
An assertion failure results in compile time error C2118: negative subscript.
Unfortunately, this elegant macro doesn't work with GCC, so it's all commented out
for now. Perhaps later.....
*/
#ifndef C_ASSERT
// #define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
// #define C_ASSERT(e)
#endif
/*****************************************************************************/
#ifdef __cplusplus
}
#endif
/**@}*/
#endif /* _OI_ASSERT_H */

View File

@ -0,0 +1,123 @@
/******************************************************************************
*
* Copyright (C) 2014 The Android Open Source Project
* Copyright 2003 - 2004 Open Interface North America, Inc. All rights reserved.
*
* 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 _OI_BITSTREAM_H
#define _OI_BITSTREAM_H
/**********************************************************************************
$Revision: #1 $
***********************************************************************************/
/**
@file
Function prototypes and macro definitions for manipulating input and output
bitstreams.
@ingroup codec_internal
*/
/**
@addtogroup codec_internal
@{
*/
#include "oi_codec_sbc_private.h"
#include "oi_stddefs.h"
INLINE void OI_BITSTREAM_ReadInit(OI_BITSTREAM *bs, const OI_BYTE *buffer);
INLINE void OI_BITSTREAM_WriteInit(OI_BITSTREAM *bs, OI_BYTE *buffer);
INLINE OI_UINT32 OI_BITSTREAM_ReadUINT(OI_BITSTREAM *bs, OI_UINT bits);
INLINE OI_UINT8 OI_BITSTREAM_ReadUINT4Aligned(OI_BITSTREAM *bs);
INLINE OI_UINT8 OI_BITSTREAM_ReadUINT8Aligned(OI_BITSTREAM *bs);
INLINE void OI_BITSTREAM_WriteUINT(OI_BITSTREAM *bs,
OI_UINT16 value,
OI_UINT bits);
/*
* Use knowledge that the bitstream is aligned to optimize the write of a byte
*/
PRIVATE void OI_BITSTREAM_WriteUINT8Aligned(OI_BITSTREAM *bs,
OI_UINT8 datum);
/*
* Use knowledge that the bitstream is aligned to optimize the write pair of nibbles
*/
PRIVATE void OI_BITSTREAM_Write2xUINT4Aligned(OI_BITSTREAM *bs,
OI_UINT8 datum1,
OI_UINT8 datum2);
/** Internally the bitstream looks ahead in the stream. When
* OI_SBC_ReadScalefactors() goes to temporarily break the abstraction, it will
* need to know where the "logical" pointer is in the stream.
*/
#define OI_BITSTREAM_GetWritePtr(bs) ((bs)->ptr.w - 3)
#define OI_BITSTREAM_GetReadPtr(bs) ((bs)->ptr.r - 3)
/** This is declared here as a macro because decoder.c breaks the bitsream
* encapsulation for efficiency reasons.
*/
#define OI_BITSTREAM_READUINT(result, bits, ptr, value, bitPtr) \
do { \
OI_ASSERT((bits) <= 16); \
OI_ASSERT((bitPtr) < 16); \
OI_ASSERT((bitPtr) >= 8); \
\
result = (value) << (bitPtr); \
result >>= 32 - (bits); \
\
bitPtr += (bits); \
while (bitPtr >= 16) { \
value = ((value) << 8) | *ptr++; \
bitPtr -= 8; \
} \
OI_ASSERT((bits == 0) || (result < (1u << (bits)))); \
} while (0)
#define OI_BITSTREAM_WRITEUINT(ptr, value, bitPtr, datum, bits) \
do {\
bitPtr -= bits;\
value |= datum << bitPtr;\
\
while (bitPtr <= 16) {\
bitPtr += 8;\
*ptr++ = (OI_UINT8)(value >> 24);\
value <<= 8;\
}\
} while (0)
#define OI_BITSTREAM_WRITEFLUSH(ptr, value, bitPtr) \
do {\
while (bitPtr < 32) {\
bitPtr += 8;\
*ptr++ = (OI_UINT8)(value >> 24);\
value <<= 8;\
}\
} while (0)
/**
@}
*/
#endif /* _OI_BITSTREAM_H */

View File

@ -0,0 +1,229 @@
/******************************************************************************
*
* Copyright (C) 2014 The Android Open Source Project
* Copyright 2002 - 2004 Open Interface North America, Inc. All rights reserved.
*
* 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 _OI_BT_SPEC_H
#define _OI_BT_SPEC_H
/**
* @file
*
* This file contains common definitions from the Bluetooth specification.
*
*/
/**********************************************************************************
$Revision: #1 $
***********************************************************************************/
#include "oi_stddefs.h"
/** \addtogroup Misc Miscellaneous APIs */
/**@{*/
#ifdef __cplusplus
extern "C" {
#endif
/** The maximum number of active slaves in a piconet. */
#define OI_BT_MAX_ACTIVE_SLAVES 7
/** the number of bytes in a Bluetooth device address (BD_ADDR) */
#define OI_BD_ADDR_BYTE_SIZE 6
/**
* 48-bit Bluetooth device address
*
* Because 48-bit integers may not be supported on all platforms, the
* address is defined as an array of bytes. This array is big-endian,
* meaning that
* - array[0] contains bits 47-40,
* - array[1] contains bits 39-32,
* - array[2] contains bits 31-24,
* - array[3] contains bits 23-16,
* - array[4] contains bits 15-8, and
* - array[5] contains bits 7-0.
*/
typedef struct {
OI_UINT8 addr[OI_BD_ADDR_BYTE_SIZE] ; /**< Bluetooth device address represented as an array of 8-bit values */
} OI_BD_ADDR ;
/**
* @name Data types for working with UUIDs
* UUIDs are 16 bytes (128 bits).
*
* To avoid having to pass around 128-bit values all the time, 32-bit and 16-bit
* UUIDs are defined, along with a mapping from the shorter versions to the full
* version.
*
* @{
*/
/**
* 16-bit representation of a 128-bit UUID
*/
typedef OI_UINT16 OI_UUID16;
/**
* 32-bit representation of a 128-bit UUID
*/
typedef OI_UINT32 OI_UUID32;
/**
* number of bytes in a 128 bit UUID
*/
#define OI_BT_UUID128_SIZE 16
/**
* number of bytes in IPv6 style addresses
*/
#define OI_BT_IPV6ADDR_SIZE 16
/**
* type definition for a 128-bit UUID
*
* To simplify conversion between 128-bit UUIDs and 16-bit and 32-bit UUIDs,
* the most significant 32 bits are stored with the same endian-ness as is
* native on the target (local) device. The remainder of the 128-bit UUID is
* stored as bytes in big-endian order.
*/
typedef struct {
OI_UINT32 ms32bits; /**< most significant 32 bits of 128-bit UUID */
OI_UINT8 base[OI_BT_UUID128_SIZE - sizeof(OI_UINT32)]; /**< remainder of 128-bit UUID, array of 8-bit values */
} OI_UUID128;
/** @} */
/** number of bytes in a link key */
#define OI_BT_LINK_KEY_SIZE 16
/**
* type definition for a baseband link key
*
* Because 128-bit integers may not be supported on all platforms, we define
* link keys as an array of bytes. Unlike the Bluetooth device address,
* the link key is stored in little-endian order, meaning that
* - array[0] contains bits 0 - 7,
* - array[1] contains bits 8 - 15,
* - array[2] contains bits 16 - 23,
* - array[3] contains bits 24 - 31,
* - array[4] contains bits 32 - 39,
* - array[5] contains bits 40 - 47,
* - array[6] contains bits 48 - 55,
* - array[7] contains bits 56 - 63,
* - array[8] contains bits 64 - 71,
* - array[9] contains bits 72 - 79,
* - array[10] contains bits 80 - 87,
* - array[11] contains bits 88 - 95,
* - array[12] contains bits 96 - 103,
* - array[13] contains bits 104- 111,
* - array[14] contains bits 112- 119, and
* - array[15] contains bits 120- 127.
*/
typedef struct {
OI_UINT8 key[OI_BT_LINK_KEY_SIZE] ; /**< link key represented as an array of 8-bit values */
} OI_LINK_KEY ;
/** Out-of-band data size - C and R values are 16-bytes each */
#define OI_BT_OOB_NUM_BYTES 16
typedef struct {
OI_UINT8 value[OI_BT_OOB_NUM_BYTES] ; /**< same struct used for C and R values */
} OI_OOB_DATA ;
/**
* link key types
*/
typedef enum {
OI_LINK_KEY_TYPE_COMBO = 0, /**< combination key */
OI_LINK_KEY_TYPE_LOCAL_UNIT = 1, /**< local unit key */
OI_LINK_KEY_TYPE_REMOTE_UNIT = 2, /**< remote unit key */
OI_LINK_KEY_TYPE_DEBUG_COMBO = 3, /**< debug combination key */
OI_LINK_KEY_TYPE_UNAUTHENTICATED = 4, /**< Unauthenticated */
OI_LINK_KEY_TYPE_AUTHENTICATED = 5, /**< Authenticated */
OI_LINK_KEY_TYPE_CHANGED_COMBO = 6 /**< Changed */
} OI_BT_LINK_KEY_TYPE ;
/** amount of space allocated for a PIN (personal indentification number) in bytes */
#define OI_BT_PIN_CODE_SIZE 16
/** data type for a PIN (PINs are treated as strings, so endianness does not apply.) */
typedef struct {
OI_UINT8 pin[OI_BT_PIN_CODE_SIZE] ; /**< PIN represented as an array of 8-bit values */
} OI_PIN_CODE ;
/** maximum number of SCO connections per device, which is 3 as of version 2.0+EDR
of the Bluetooth specification (see sec 4.3 of vol 2 part B) */
#define OI_BT_MAX_SCO_CONNECTIONS 3
/** data type for clock offset */
typedef OI_UINT16 OI_BT_CLOCK_OFFSET ;
/** data type for a LM handle */
typedef OI_UINT16 OI_HCI_LM_HANDLE;
/** opaque data type for a SCO or ACL connection handle */
typedef struct _OI_HCI_CONNECTION *OI_HCI_CONNECTION_HANDLE;
/** data type for HCI Error Code, as defined in oi_hcispec.h */
typedef OI_UINT8 OI_HCI_ERROR_CODE ;
/**
* The Bluetooth device type is indicated by a 24-bit bitfield, represented as a
* 32-bit number in the stack. The bit layout and values for device class are specified
* in the file oi_bt_assigned_nos.h and in the Bluetooth "Assigned Numbers" specification
* at http://www.bluetooth.org/assigned-numbers/.
*/
typedef OI_UINT32 OI_BT_DEVICE_CLASS ;
#define OI_BT_DEV_CLASS_FORMAT_MASK 0x000003 /**< Bits 0-1 contain format type. */
#define OI_BT_DEV_CLASS_MINOR_DEVICE_MASK 0x0000FC /**< Bits 2-7 contain minor device class value. */
#define OI_BT_DEV_CLASS_MAJOR_DEVICE_MASK 0x001F00 /**< Bits 8-12 contain major device class value. */
#define OI_BT_DEV_CLASS_MAJOR_SERVICE_MASK 0xFFE000 /**< Bits 13-23 contain major service class value. */
/** There is currently only one device class format defined, type 00. */
#define OI_BT_DEV_CLASS_FORMAT_TYPE 00
/** Bit 13 in device class indicates limited discoverability mode (GAP v2.0+EDR, section 4.1.2.2) */
#define OI_BT_DEV_CLASS_LIMITED_DISCO_BIT BIT13
/** macro to test validity of the Device Class Format */
#define OI_BT_VALID_DEVICE_CLASS_FORMAT(class) (OI_BT_DEV_CLASS_FORMAT_TYPE == ((class) & OI_BT_DEV_CLASS_FORMAT_MASK))
/** the time between baseband clock ticks, currently 625 microseconds (one slot) */
#define OI_BT_TICK 625
/** some macros to convert to/from baseband clock ticks - use no floating point! */
#define OI_SECONDS_TO_BT_TICKS(secs) ((secs)*1600)
#define OI_BT_TICKS_TO_SECONDS(ticks) ((ticks)/1600)
#define OI_MSECS_TO_BT_TICKS(msecs) (((msecs)*8)/5)
#define OI_BT_TICKS_TO_MSECS(ticks) (((ticks)*5)/8)
/** EIR byte order */
#define OI_EIR_BYTE_ORDER OI_LITTLE_ENDIAN_BYTE_ORDER
#ifdef __cplusplus
}
#endif
/**@}*/
/*****************************************************************************/
#endif /* _OI_BT_SPEC_H */

View File

@ -0,0 +1,484 @@
/******************************************************************************
*
* Copyright (C) 2014 The Android Open Source Project
* Copyright 2003 - 2004 Open Interface North America, Inc. All rights reserved.
*
* 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.
*
******************************************************************************/
/**********************************************************************************
$Revision: #1 $
***********************************************************************************/
#ifndef _OI_CODEC_SBC_CORE_H
#define _OI_CODEC_SBC_CORE_H
#ifdef __cplusplus
extern "C" {
#endif
/**
@file
Declarations of codec functions, data types, and macros.
@ingroup codec_lib
*/
/**
@addtogroup codec_lib
@{
*/
/* Non-BM3 users of of the codec must include oi_codec_sbc_bm3defs.h prior to
* including this file, or else these includes will fail because the BM3 SDK is
* not in the include path */
#ifndef _OI_CODEC_SBC_BM3DEFS_H
#include "oi_stddefs.h"
#include "oi_status.h"
#endif
#include <stdint.h>
#define SBC_MAX_CHANNELS 2
#define SBC_MAX_BANDS 8
#define SBC_MAX_BLOCKS 16
#define SBC_MIN_BITPOOL 2 /**< Minimum size of the bit allocation pool used to encode the stream */
#define SBC_MAX_BITPOOL 250 /**< Maximum size of the bit allocation pool used to encode the stream */
#define SBC_MAX_ONE_CHANNEL_BPS 320000
#define SBC_MAX_TWO_CHANNEL_BPS 512000
#define SBC_WBS_BITRATE 62000
#define SBC_WBS_BITPOOL 27
#define SBC_WBS_NROF_BLOCKS 16
#define SBC_WBS_FRAME_LEN 62
#define SBC_WBS_SAMPLES_PER_FRAME 128
#define SBC_HEADER_LEN 4
#define SBC_MAX_FRAME_LEN (SBC_HEADER_LEN + \
((SBC_MAX_BANDS * SBC_MAX_CHANNELS / 2) + \
(SBC_MAX_BANDS + SBC_MAX_BLOCKS * SBC_MAX_BITPOOL + 7)/8))
#define SBC_MAX_SAMPLES_PER_FRAME (SBC_MAX_BANDS * SBC_MAX_BLOCKS)
#define SBC_MAX_SCALEFACTOR_BYTES ((4*(SBC_MAX_CHANNELS * SBC_MAX_BANDS) + 7)/8)
#define OI_SBC_SYNCWORD 0x9c
#define OI_SBC_ENHANCED_SYNCWORD 0x9d
/**@name Sampling frequencies */
/**@{*/
#define SBC_FREQ_16000 0 /**< The sampling frequency is 16 kHz. One possible value for the @a frequency parameter of OI_CODEC_SBC_EncoderConfigure() */
#define SBC_FREQ_32000 1 /**< The sampling frequency is 32 kHz. One possible value for the @a frequency parameter of OI_CODEC_SBC_EncoderConfigure() */
#define SBC_FREQ_44100 2 /**< The sampling frequency is 44.1 kHz. One possible value for the @a frequency parameter of OI_CODEC_SBC_EncoderConfigure() */
#define SBC_FREQ_48000 3 /**< The sampling frequency is 48 kHz. One possible value for the @a frequency parameter of OI_CODEC_SBC_EncoderConfigure() */
/**@}*/
/**@name Channel modes */
/**@{*/
#define SBC_MONO 0 /**< The mode of the encoded channel is mono. One possible value for the @a mode parameter of OI_CODEC_SBC_EncoderConfigure() */
#define SBC_DUAL_CHANNEL 1 /**< The mode of the encoded channel is dual-channel. One possible value for the @a mode parameter of OI_CODEC_SBC_EncoderConfigure() */
#define SBC_STEREO 2 /**< The mode of the encoded channel is stereo. One possible value for the @a mode parameter of OI_CODEC_SBC_EncoderConfigure() */
#define SBC_JOINT_STEREO 3 /**< The mode of the encoded channel is joint stereo. One possible value for the @a mode parameter of OI_CODEC_SBC_EncoderConfigure() */
/**@}*/
/**@name Subbands */
/**@{*/
#define SBC_SUBBANDS_4 0 /**< The encoded stream has 4 subbands. One possible value for the @a subbands parameter of OI_CODEC_SBC_EncoderConfigure()*/
#define SBC_SUBBANDS_8 1 /**< The encoded stream has 8 subbands. One possible value for the @a subbands parameter of OI_CODEC_SBC_EncoderConfigure() */
/**@}*/
/**@name Block lengths */
/**@{*/
#define SBC_BLOCKS_4 0 /**< A block size of 4 blocks was used to encode the stream. One possible value for the @a blocks parameter of OI_CODEC_SBC_EncoderConfigure() */
#define SBC_BLOCKS_8 1 /**< A block size of 8 blocks was used to encode the stream is. One possible value for the @a blocks parameter of OI_CODEC_SBC_EncoderConfigure() */
#define SBC_BLOCKS_12 2 /**< A block size of 12 blocks was used to encode the stream. One possible value for the @a blocks parameter of OI_CODEC_SBC_EncoderConfigure() */
#define SBC_BLOCKS_16 3 /**< A block size of 16 blocks was used to encode the stream. One possible value for the @a blocks parameter of OI_CODEC_SBC_EncoderConfigure() */
/**@}*/
/**@name Bit allocation methods */
/**@{*/
#define SBC_LOUDNESS 0 /**< The bit allocation method. One possible value for the @a loudness parameter of OI_CODEC_SBC_EncoderConfigure() */
#define SBC_SNR 1 /**< The bit allocation method. One possible value for the @a loudness parameter of OI_CODEC_SBC_EncoderConfigure() */
/**@}*/
/**
@}
@addtogroup codec_internal
@{
*/
typedef OI_INT16 SBC_BUFFER_T;
/** Used internally. */
typedef struct {
OI_UINT16 frequency; /**< The sampling frequency. Input parameter. */
OI_UINT8 freqIndex;
OI_UINT8 nrof_blocks; /**< The block size used to encode the stream. Input parameter. */
OI_UINT8 blocks;
OI_UINT8 nrof_subbands; /**< The number of subbands of the encoded stream. Input parameter. */
OI_UINT8 subbands;
OI_UINT8 mode; /**< The mode of the encoded channel. Input parameter. */
OI_UINT8 nrof_channels; /**< The number of channels of the encoded stream. */
OI_UINT8 alloc; /**< The bit allocation method. Input parameter. */
OI_UINT8 bitpool; /**< Size of the bit allocation pool used to encode the stream. Input parameter. */
OI_UINT8 crc; /**< Parity check byte used for error detection. */
OI_UINT8 join; /**< Whether joint stereo has been used. */
OI_UINT8 enhanced;
OI_UINT8 min_bitpool; /**< This value is only used when encoding. SBC_MAX_BITPOOL if variable
bitpools are disallowed, otherwise the minimum bitpool size that will
be used by the bit allocator. */
OI_UINT8 cachedInfo; /**< Information about the previous frame */
} OI_CODEC_SBC_FRAME_INFO;
/** Used internally. */
typedef struct {
const OI_CHAR *codecInfo;
OI_CODEC_SBC_FRAME_INFO frameInfo;
OI_INT8 scale_factor[SBC_MAX_CHANNELS * SBC_MAX_BANDS];
OI_UINT32 frameCount;
OI_INT32 *subdata;
SBC_BUFFER_T *filterBuffer[SBC_MAX_CHANNELS];
OI_INT32 filterBufferLen;
OI_UINT filterBufferOffset;
union {
OI_UINT8 uint8[SBC_MAX_CHANNELS * SBC_MAX_BANDS];
OI_UINT32 uint32[SBC_MAX_CHANNELS * SBC_MAX_BANDS / 4];
} bits;
OI_UINT8 maxBitneed; /**< Running maximum bitneed */
OI_BYTE formatByte;
OI_UINT8 pcmStride;
OI_UINT8 maxChannels;
} OI_CODEC_SBC_COMMON_CONTEXT;
/*
* A smaller value reduces RAM usage at the expense of increased CPU usage. Values in the range
* 27..50 are recommended, beyond 50 there is a diminishing return on reduced CPU usage.
*/
#define SBC_CODEC_MIN_FILTER_BUFFERS 16
#define SBC_CODEC_FAST_FILTER_BUFFERS 27
/* Expands to the number of OI_UINT32s needed to ensure enough memory to encode
* or decode streams of numChannels channels, using numBuffers buffers.
* Example:
* OI_UINT32 decoderData[CODEC_DATA_WORDS(SBC_MAX_CHANNELS, SBC_DECODER_FAST_SYNTHESIS_BUFFERS)];
* */
#define CODEC_DATA_WORDS(numChannels, numBuffers) \
((\
(sizeof(OI_INT32) * SBC_MAX_BLOCKS * numChannels * SBC_MAX_BANDS) \
+ (sizeof(SBC_BUFFER_T) * SBC_MAX_CHANNELS * SBC_MAX_BANDS * numBuffers) \
+ (sizeof (OI_UINT32) - 1) \
) / sizeof(OI_UINT32))
/** Opaque parameter to decoding functions; maintains decoder context. */
typedef struct {
OI_CODEC_SBC_COMMON_CONTEXT common;
OI_UINT8 limitFrameFormat; /* Boolean, set by OI_CODEC_SBC_DecoderLimit() */
OI_UINT8 restrictSubbands;
OI_UINT8 enhancedEnabled;
OI_UINT8 bufferedBlocks;
} OI_CODEC_SBC_DECODER_CONTEXT;
typedef struct {
OI_UINT32 data[CODEC_DATA_WORDS(1, SBC_CODEC_FAST_FILTER_BUFFERS)];
} OI_CODEC_SBC_CODEC_DATA_MONO;
typedef struct {
OI_UINT32 data[CODEC_DATA_WORDS(2, SBC_CODEC_FAST_FILTER_BUFFERS)];
} OI_CODEC_SBC_CODEC_DATA_STEREO;
/**
@}
@addtogroup codec_lib
@{
*/
/**
* This function resets the decoder. The context must be reset when
* changing streams, or if the following stream parameters change:
* number of subbands, stereo mode, or frequency.
*
* @param context Pointer to the decoder context structure to be reset.
*
* @param enhanced If true, enhanced SBC operation is enabled. If enabled,
* the codec will recognize the alternative syncword for
* decoding an enhanced SBC stream. Enhancements should not
* be enabled unless the stream is known to be generated
* by an enhanced encoder, or there is a small possibility
* for decoding glitches if synchronization were to be lost.
*/
OI_STATUS OI_CODEC_SBC_DecoderReset(OI_CODEC_SBC_DECODER_CONTEXT *context,
OI_UINT32 *decoderData,
OI_UINT32 decoderDataBytes,
OI_UINT8 maxChannels,
OI_UINT8 pcmStride,
OI_BOOL enhanced);
/**
* This function restricts the kind of SBC frames that the Decoder will
* process. Its use is optional. If used, it must be called after
* calling OI_CODEC_SBC_DecoderReset(). After it is called, any calls
* to OI_CODEC_SBC_DecodeFrame() with SBC frames that do not conform
* to the Subband and Enhanced SBC setting will be rejected with an
* OI_STATUS_INVALID_PARAMETERS return.
*
* @param context Pointer to the decoder context structure to be limited.
*
* @param enhanced If true, all frames passed to the decoder must be
* Enhanced SBC frames. If false, all frames must be
* standard SBC frames.
*
* @param subbands May be set to SBC_SUBBANDS_4 or SBC_SUBBANDS_8. All
* frames passed to the decoder must be encoded with
* the requested number of subbands.
*
*/
OI_STATUS OI_CODEC_SBC_DecoderLimit(OI_CODEC_SBC_DECODER_CONTEXT *context,
OI_BOOL enhanced,
OI_UINT8 subbands);
/**
* This function sets the decoder parameters for a raw decode where the decoder parameters are not
* available in the sbc data stream. OI_CODEC_SBC_DecoderReset must be called
* prior to calling this function.
*
* @param context Decoder context structure. This must be the context must be
* used each time a frame is decoded.
*
* @param enhanced Set to TRUE to enable Qualcomm proprietary
* quality enhancements.
*
* @param frequency One of SBC_FREQ_16000, SBC_FREQ_32000, SBC_FREQ_44100,
* SBC_FREQ_48000
*
* @param mode One of SBC_MONO, SBC_DUAL_CHANNEL, SBC_STEREO,
* SBC_JOINT_STEREO
*
* @param subbands One of SBC_SUBBANDS_4, SBC_SUBBANDS_8
*
* @param blocks One of SBC_BLOCKS_4, SBC_BLOCKS_8, SBC_BLOCKS_12,
* SBC_BLOCKS_16
*
* @param alloc One of SBC_LOUDNESS, SBC_SNR
*
* @param maxBitpool The maximum bitpool size for this context
*/
OI_STATUS OI_CODEC_SBC_DecoderConfigureRaw(OI_CODEC_SBC_DECODER_CONTEXT *context,
OI_BOOL enhanced,
OI_UINT8 frequency,
OI_UINT8 mode,
OI_UINT8 subbands,
OI_UINT8 blocks,
OI_UINT8 alloc,
OI_UINT8 maxBitpool);
/**
* Decode one SBC frame. The frame has no header bytes. The context must have been previously
* initialized by calling OI_CODEC_SBC_DecoderConfigureRaw().
*
* @param context Pointer to a decoder context structure. The same context
* must be used each time when decoding from the same stream.
*
* @param bitpool The actual bitpool size for this frame. Must be <= the maxbitpool specified
* in the call to OI_CODEC_SBC_DecoderConfigureRaw(),
*
* @param frameData Address of a pointer to the SBC data to decode. This
* value will be updated to point to the next frame after
* successful decoding.
*
* @param frameBytes Pointer to a UINT32 containing the number of available
* bytes of frame data. This value will be updated to reflect
* the number of bytes remaining after a decoding operation.
*
* @param pcmData Address of an array of OI_INT16 pairs, which will be
* populated with the decoded audio data. This address
* is not updated.
*
* @param pcmBytes Pointer to a UINT32 in/out parameter. On input, it
* should contain the number of bytes available for pcm
* data. On output, it will contain the number of bytes
* written. Note that this differs from the semantics of
* frameBytes.
*/
OI_STATUS OI_CODEC_SBC_DecodeRaw(OI_CODEC_SBC_DECODER_CONTEXT *context,
OI_UINT8 bitpool,
const OI_BYTE **frameData,
OI_UINT32 *frameBytes,
OI_INT16 *pcmData,
OI_UINT32 *pcmBytes);
/**
* Decode one SBC frame.
*
* @param context Pointer to a decoder context structure. The same context
* must be used each time when decoding from the same stream.
*
* @param frameData Address of a pointer to the SBC data to decode. This
* value will be updated to point to the next frame after
* successful decoding.
*
* @param frameBytes Pointer to a UINT32 containing the number of available
* bytes of frame data. This value will be updated to reflect
* the number of bytes remaining after a decoding operation.
*
* @param pcmData Address of an array of OI_INT16 pairs, which will be
* populated with the decoded audio data. This address
* is not updated.
*
* @param pcmBytes Pointer to a UINT32 in/out parameter. On input, it
* should contain the number of bytes available for pcm
* data. On output, it will contain the number of bytes
* written. Note that this differs from the semantics of
* frameBytes.
*/
OI_STATUS OI_CODEC_SBC_DecodeFrame(OI_CODEC_SBC_DECODER_CONTEXT *context,
const OI_BYTE **frameData,
OI_UINT32 *frameBytes,
OI_INT16 *pcmData,
OI_UINT32 *pcmBytes);
/**
* Calculate the number of SBC frames but don't decode. CRC's are not checked,
* but the Sync word is found prior to count calculation.
*
* @param frameData Pointer to the SBC data.
*
* @param frameBytes Number of bytes avaiable in the frameData buffer
*
*/
OI_UINT8 OI_CODEC_SBC_FrameCount(OI_BYTE *frameData,
OI_UINT32 frameBytes);
/**
* Analyze an SBC frame but don't do the decode.
*
* @param context Pointer to a decoder context structure. The same context
* must be used each time when decoding from the same stream.
*
* @param frameData Address of a pointer to the SBC data to decode. This
* value will be updated to point to the next frame after
* successful decoding.
*
* @param frameBytes Pointer to a UINT32 containing the number of available
* bytes of frame data. This value will be updated to reflect
* the number of bytes remaining after a decoding operation.
*
*/
OI_STATUS OI_CODEC_SBC_SkipFrame(OI_CODEC_SBC_DECODER_CONTEXT *context,
const OI_BYTE **frameData,
OI_UINT32 *frameBytes);
/* Common functions */
/**
Calculate the frame length.
@param frame The frame whose length to calculate
@return the length of an individual encoded frame in
bytes
*/
OI_UINT16 OI_CODEC_SBC_CalculateFramelen(OI_CODEC_SBC_FRAME_INFO *frame);
/**
* Calculate the maximum bitpool size that fits within a given frame length.
*
* @param frame The frame to calculate the bitpool size for
* @param frameLen The frame length to fit the bitpool to
*
* @return the maximum bitpool that will fit in the specified frame length
*/
OI_UINT16 OI_CODEC_SBC_CalculateBitpool(OI_CODEC_SBC_FRAME_INFO *frame,
OI_UINT16 frameLen);
/**
Calculate the bit rate.
@param frame The frame whose bit rate to calculate
@return the approximate bit rate in bits per second,
assuming that stream parameters are constant
*/
OI_UINT32 OI_CODEC_SBC_CalculateBitrate(OI_CODEC_SBC_FRAME_INFO *frame);
/**
Calculate decoded audio data length for one frame.
@param frame The frame whose audio data length to calculate
@return length of decoded audio data for a
single frame, in bytes
*/
OI_UINT16 OI_CODEC_SBC_CalculatePcmBytes(OI_CODEC_SBC_COMMON_CONTEXT *common);
/**
* Get the codec version text.
*
* @return pointer to text string containing codec version text
*
*/
OI_CHAR *OI_CODEC_Version(void);
/**
@}
@addtogroup codec_internal
@{
*/
extern const OI_CHAR *const OI_CODEC_SBC_FreqText[];
extern const OI_CHAR *const OI_CODEC_SBC_ModeText[];
extern const OI_CHAR *const OI_CODEC_SBC_SubbandsText[];
extern const OI_CHAR *const OI_CODEC_SBC_BlocksText[];
extern const OI_CHAR *const OI_CODEC_SBC_AllocText[];
/**
@}
@addtogroup codec_lib
@{
*/
#ifdef OI_DEBUG
void OI_CODEC_SBC_DumpConfig(OI_CODEC_SBC_FRAME_INFO *frameInfo);
#else
#define OI_CODEC_SBC_DumpConfig(f)
#endif
/**
@}
*/
#ifdef __cplusplus
}
#endif
#endif /* _OI_CODEC_SBC_CORE_H */

View File

@ -0,0 +1,229 @@
/******************************************************************************
*
* Copyright (C) 2014 The Android Open Source Project
* Copyright 2003 - 2004 Open Interface North America, Inc. All rights reserved.
*
* 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 _OI_CODEC_SBC_PRIVATE_H
#define _OI_CODEC_SBC_PRIVATE_H
/**********************************************************************************
$Revision: #1 $
***********************************************************************************/
/**
@file
Function prototypes and macro definitions used internally by the codec.
@ingroup codec_internal
*/
/**
@addtogroup codec_internal
@{
*/
#ifdef USE_RESTRICT_KEYWORD
#define RESTRICT restrict
#else
#define RESTRICT
#endif
#ifdef CODEC_DEBUG
#include <stdio.h>
#define ERROR(x) do { printf x; printf("\n"); } while (0)
#else
#define ERROR(x)
#endif
#ifdef TRACE_EXECUTION
#define TRACE(x) do { printf x; printf("\n"); } while (0)
#else
#define TRACE(x)
#endif
#ifndef PRIVATE
#define PRIVATE
#endif
#ifndef INLINE
#define INLINE
#endif
#include "oi_assert.h"
#include "oi_codec_sbc.h"
#ifndef OI_SBC_SYNCWORD
#define OI_SBC_SYNCWORD 0x9c
#endif
#ifndef DIVIDE
#define DIVIDE(a, b) ((a) / (b))
#endif
typedef union {
OI_UINT8 uint8[SBC_MAX_BANDS];
OI_UINT32 uint32[SBC_MAX_BANDS / 4];
} BITNEED_UNION1;
typedef union {
OI_UINT8 uint8[2 * SBC_MAX_BANDS];
OI_UINT32 uint32[2 * SBC_MAX_BANDS / 4];
} BITNEED_UNION2;
static const OI_UINT16 freq_values[] = { 16000, 32000, 44100, 48000 };
static const OI_UINT8 block_values[] = { 4, 8, 12, 16 };
static const OI_UINT8 channel_values[] = { 1, 2, 2, 2 };
static const OI_UINT8 band_values[] = { 4, 8 };
#define TEST_MODE_SENTINEL "OINA"
#define TEST_MODE_SENTINEL_LENGTH 4
/** Used internally. */
typedef struct {
union {
const OI_UINT8 *r;
OI_UINT8 *w;
} ptr;
OI_UINT32 value;
OI_UINT bitPtr;
} OI_BITSTREAM;
#define VALID_INT16(x) (((x) >= OI_INT16_MIN) && ((x) <= OI_INT16_MAX))
#define VALID_INT32(x) (((x) >= OI_INT32_MIN) && ((x) <= OI_INT32_MAX))
#define DCTII_8_SHIFT_IN 0
#define DCTII_8_SHIFT_OUT 16-DCTII_8_SHIFT_IN
#define DCTII_8_SHIFT_0 (DCTII_8_SHIFT_OUT)
#define DCTII_8_SHIFT_1 (DCTII_8_SHIFT_OUT)
#define DCTII_8_SHIFT_2 (DCTII_8_SHIFT_OUT)
#define DCTII_8_SHIFT_3 (DCTII_8_SHIFT_OUT)
#define DCTII_8_SHIFT_4 (DCTII_8_SHIFT_OUT)
#define DCTII_8_SHIFT_5 (DCTII_8_SHIFT_OUT)
#define DCTII_8_SHIFT_6 (DCTII_8_SHIFT_OUT-1)
#define DCTII_8_SHIFT_7 (DCTII_8_SHIFT_OUT-2)
#define DCT_SHIFT 15
#define DCTIII_4_SHIFT_IN 2
#define DCTIII_4_SHIFT_OUT 15
#define DCTIII_8_SHIFT_IN 3
#define DCTIII_8_SHIFT_OUT 14
OI_UINT computeBitneed(OI_CODEC_SBC_COMMON_CONTEXT *common,
OI_UINT8 *bitneeds,
OI_UINT ch,
OI_UINT *preferredBitpool);
void oneChannelBitAllocation(OI_CODEC_SBC_COMMON_CONTEXT *common,
BITNEED_UNION1 *bitneeds,
OI_UINT ch,
OI_UINT bitcount);
OI_INT adjustToFitBitpool(const OI_UINT bitpool,
OI_UINT32 *bitneeds,
const OI_UINT subbands,
OI_UINT bitcount,
OI_UINT *excess);
INLINE OI_INT allocAdjustedBits(OI_UINT8 *dest,
OI_INT bits,
OI_INT excess);
INLINE OI_INT allocExcessBits(OI_UINT8 *dest,
OI_INT excess);
PRIVATE OI_UINT32 internal_CalculateBitrate(OI_CODEC_SBC_FRAME_INFO *frame);
PRIVATE OI_UINT16 internal_CalculateFramelen(OI_CODEC_SBC_FRAME_INFO *frame);
void monoBitAllocation(OI_CODEC_SBC_COMMON_CONTEXT *common);
typedef void (*BIT_ALLOC)(OI_CODEC_SBC_COMMON_CONTEXT *common);
PRIVATE OI_STATUS internal_DecodeRaw(OI_CODEC_SBC_DECODER_CONTEXT *context,
OI_UINT8 bitpool,
const OI_BYTE **frameData,
OI_UINT32 *frameBytes,
OI_INT16 *pcmData,
OI_UINT32 *pcmBytes);
INLINE OI_STATUS internal_DecoderReset(OI_CODEC_SBC_DECODER_CONTEXT *context,
OI_UINT32 *decoderData,
OI_UINT32 decoderDataBytes,
OI_BYTE maxChannels,
OI_BYTE pcmStride,
OI_BOOL enhanced);
INLINE OI_UINT16 OI_SBC_CalculateFrameAndHeaderlen(OI_CODEC_SBC_FRAME_INFO *frame, OI_UINT *headerLen_);
PRIVATE OI_UINT32 OI_SBC_MaxBitpool(OI_CODEC_SBC_FRAME_INFO *frame);
PRIVATE void OI_SBC_ComputeBitAllocation(OI_CODEC_SBC_COMMON_CONTEXT *frame);
PRIVATE OI_UINT8 OI_SBC_CalculateChecksum(OI_CODEC_SBC_FRAME_INFO *frame, OI_BYTE const *data);
/* Transform functions */
PRIVATE void shift_buffer(SBC_BUFFER_T *dest, SBC_BUFFER_T *src, OI_UINT wordCount);
PRIVATE void cosineModulateSynth4(SBC_BUFFER_T *RESTRICT out, OI_INT32 const *RESTRICT in);
PRIVATE void SynthWindow40_int32_int32_symmetry_with_sum(OI_INT16 *pcm, SBC_BUFFER_T buffer[80], OI_UINT strideShift);
INLINE void dct3_4(OI_INT32 *RESTRICT out, OI_INT32 const *RESTRICT in);
PRIVATE void analyze4_generated(SBC_BUFFER_T analysisBuffer[RESTRICT 40],
OI_INT16 *pcm,
OI_UINT strideShift,
OI_INT32 subband[4]);
INLINE void dct3_8(OI_INT32 *RESTRICT out, OI_INT32 const *RESTRICT in);
PRIVATE void analyze8_generated(SBC_BUFFER_T analysisBuffer[RESTRICT 80],
OI_INT16 *pcm,
OI_UINT strideShift,
OI_INT32 subband[8]);
#ifdef SBC_ENHANCED
PRIVATE void analyze8_enhanced_generated(SBC_BUFFER_T analysisBuffer[RESTRICT 112],
OI_INT16 *pcm,
OI_UINT strideShift,
OI_INT32 subband[8]);
#endif
/* Decoder functions */
INLINE void OI_SBC_ReadHeader(OI_CODEC_SBC_COMMON_CONTEXT *common, const OI_BYTE *data);
PRIVATE void OI_SBC_ReadScalefactors(OI_CODEC_SBC_COMMON_CONTEXT *common, const OI_BYTE *b, OI_BITSTREAM *bs);
PRIVATE void OI_SBC_ReadSamples(OI_CODEC_SBC_DECODER_CONTEXT *common, OI_BITSTREAM *ob);
PRIVATE void OI_SBC_ReadSamplesJoint(OI_CODEC_SBC_DECODER_CONTEXT *common, OI_BITSTREAM *global_bs);
PRIVATE void OI_SBC_SynthFrame(OI_CODEC_SBC_DECODER_CONTEXT *context, OI_INT16 *pcm, OI_UINT start_block, OI_UINT nrof_blocks);
INLINE OI_INT32 OI_SBC_Dequant(OI_UINT32 raw, OI_UINT scale_factor, OI_UINT bits);
PRIVATE OI_BOOL OI_SBC_ExamineCommandPacket(OI_CODEC_SBC_DECODER_CONTEXT *context, const OI_BYTE *data, OI_UINT32 len);
PRIVATE void OI_SBC_GenerateTestSignal(OI_INT16 pcmData[][2], OI_UINT32 sampleCount);
PRIVATE void OI_SBC_ExpandFrameFields(OI_CODEC_SBC_FRAME_INFO *frame);
PRIVATE OI_STATUS OI_CODEC_SBC_Alloc(OI_CODEC_SBC_COMMON_CONTEXT *common,
OI_UINT32 *codecDataAligned,
OI_UINT32 codecDataBytes,
OI_UINT8 maxChannels,
OI_UINT8 pcmStride);
/**
@}
*/
#endif /* _OI_CODEC_SBC_PRIVATE_H */

View File

@ -0,0 +1,43 @@
/******************************************************************************
*
* Copyright (C) 2014 The Android Open Source Project
* Copyright 2002 - 2004 Open Interface North America, Inc. All rights reserved.
*
* 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 _OI_COMMON_H
#define _OI_COMMON_H
/**
* @file
*
* This file is used to group commonly used BLUEmagic 3.0 software
* header files.
*
* This file should be included in application source code along with the header
* files for the specific modules of the protocol stack being used.
*/
/**********************************************************************************
$Revision: #1 $
***********************************************************************************/
#include "oi_bt_spec.h"
#include "oi_stddefs.h"
#include "oi_status.h"
#include "oi_time.h"
#include "oi_osinterface.h"
/*****************************************************************************/
#endif /* _OI_COMMON_H */

View File

@ -0,0 +1,505 @@
/******************************************************************************
*
* Copyright (C) 2014 The Android Open Source Project
* Copyright 2002 - 2004 Open Interface North America, Inc. All rights reserved.
*
* 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 _OI_CPU_DEP_H
#define _OI_CPU_DEP_H
/**
* @file
* This file contains definitions for characteristics of the target CPU and
* compiler, including primitive data types and endianness.
*
* This file defines the byte order and primitive data types for various
* CPU families. The preprocessor symbol 'CPU' must be defined to be an
* appropriate value or this header will generate a compile-time error.
*
* @note The documentation for this header file uses the x86 family of processors
* as an illustrative example for CPU/compiler-dependent data type definitions.
* Go to the source code of this header file to see the details of primitive type
* definitions for each platform.
*
* Additional information is available in the @ref data_types_docpage section.
*/
/**********************************************************************************
$Revision: #1 $
***********************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
/** \addtogroup Misc Miscellaneous APIs */
/**@{*/
/** @name Definitions indicating family of target OI_CPU_TYPE
* @{
*/
#define OI_CPU_X86 1 /**< x86 processor family */
#define OI_CPU_ARM 2 /**< ARM processor family.
@deprecated Use #OI_CPU_ARM7_LEND or
#OI_CPU_ARM7_BEND. */
#define OI_CPU_ARC 3 /**< ARC processor family.
@deprecated Use #OI_CPU_ARC_LEND or
#OI_CPU_ARC_BEND. */
#define OI_CPU_SH3 4 /**< Hitachi SH-3 processor family */
#define OI_CPU_H8 5 /**< Hitachi H8 processor family */
#define OI_CPU_MIPS 6 /**< MIPS processor family */
#define OI_CPU_SPARC 7 /**< SPARC processor family */
#define OI_CPU_M68000 8 /**< Motorola M68000 processor family */
#define OI_CPU_PPC 9 /**< PowerPC (PPC) processor family */
#define OI_CPU_SH4_7750 10 /**< Hitachi SH7750 series in SH-4 processor family */
#define OI_CPU_SH2 11 /**< Hitachi SH-2 processor family */
#define OI_CPU_ARM7_LEND 12 /**< ARM7, little-endian */
#define OI_CPU_ARM7_BEND 13 /**< ARM7, big-endian */
#define OI_CPU_GDM1202 14 /**< GCT GDM1202 */
#define OI_CPU_ARC_LEND 15 /**< ARC processor family, little-endian */
#define OI_CPU_ARC_BEND 16 /**< ARC processor family, big-endian */
#define OI_CPU_M30833F 17 /**< Mitsubishi M308 processor family */
#define OI_CPU_CR16C 18 /**< National Semiconductor 16 bit processor family */
#define OI_CPU_M64111 19 /**< Renesas M64111 processor (M32R family) */
#define OI_CPU_ARMV5_LEND 20 //*< ARM5, little-endian */
#define OI_CPU_TYPE 12
#ifndef OI_CPU_TYPE
#error "OI_CPU_TYPE type not defined"
#endif
/**@}*/
/** @name Definitions indicating byte-wise endianness of target CPU
* @{
*/
#define OI_BIG_ENDIAN_BYTE_ORDER 0 /**< Multiple-byte values are stored in memory beginning with the most significant byte at the lowest address. */
#define OI_LITTLE_ENDIAN_BYTE_ORDER 1 /**< Multiple-byte values are stored in memory beginning with the least significant byte at the lowest address. */
/**@}*/
/** @name CPU/compiler-independent primitive data type definitions
* @{
*/
typedef int OI_BOOL; /**< Boolean values use native integer data type for target CPU. */
typedef int OI_INT; /**< Integer values use native integer data type for target CPU. */
typedef unsigned int OI_UINT; /**< Unsigned integer values use native unsigned integer data type for target CPU. */
typedef unsigned char OI_BYTE; /**< Raw bytes type uses native character data type for target CPU. */
/**@}*/
/*********************************************************************************/
#if OI_CPU_TYPE==OI_CPU_X86
#define OI_CPU_BYTE_ORDER OI_LITTLE_ENDIAN_BYTE_ORDER /**< x86 platform byte ordering is little-endian */
/** @name CPU/compiler-dependent primitive data type definitions for x86 processor family
* @{
*/
typedef signed char OI_INT8; /**< 8-bit signed integer values use native signed character data type for x86 processor. */
typedef signed short OI_INT16; /**< 16-bit signed integer values use native signed short integer data type for x86 processor. */
typedef signed long OI_INT32; /**< 32-bit signed integer values use native signed long integer data type for x86 processor. */
typedef unsigned char OI_UINT8; /**< 8-bit unsigned integer values use native unsigned character data type for x86 processor. */
typedef unsigned short OI_UINT16; /**< 16-bit unsigned integer values use native unsigned short integer data type for x86 processor. */
typedef unsigned long OI_UINT32; /**< 32-bit unsigned integer values use native unsigned long integer data type for x86 processor. */
typedef OI_UINT32 OI_ELEMENT_UNION; /**< Type for first element of a union to support all data types up to pointer width. */
/**@}*/
#endif
/*********************************************************************************/
#if OI_CPU_TYPE==OI_CPU_ARM
/* This CPU type is deprecated (removed from use). Instead, use OI_CPU_ARM7_LEND or OI_CPU_ARM7_BEND for
little-endian or big-endian configurations of the ARM7, respectively. */
#error OI_CPU_ARM is deprecated
#endif
/*********************************************************************************/
#if OI_CPU_TYPE==OI_CPU_ARC
/* This CPU type is deprecated (removed from use). Instead, use OI_CPU_ARC_LEND or OI_CPU_ARC_BEND for
little-endian or big-endian configurations of the ARC, respectively. */
#error OI_CPU_ARC is deprecated
#endif
/*********************************************************************************/
#if OI_CPU_TYPE==OI_CPU_SH3
/* The Hitachi SH C compiler defines _LIT or _BIG, depending on the endianness
specified to the compiler on the command line. */
#if defined(_LIT)
#define OI_CPU_BYTE_ORDER OI_LITTLE_ENDIAN_BYTE_ORDER /**< If _LIT is defined, SH-3 platform byte ordering is little-endian. */
#elif defined(_BIG)
#define OI_CPU_BYTE_ORDER OI_BIG_ENDIAN_BYTE_ORDER /**< If _BIG is defined, SH-3 platform byte ordering is big-endian. */
#else
#error SH compiler endianness undefined
#endif
/** @name CPU/compiler-dependent primitive data type definitions for SH-3 processor family
* @{
*/
typedef signed char OI_INT8; /**< 8-bit signed integer values use native signed character data type for SH-3 processor. */
typedef signed short OI_INT16; /**< 16-bit signed integer values use native signed short integer data type for SH-3 processor. */
typedef signed long OI_INT32; /**< 32-bit signed integer values use native signed long integer data type for SH-3 processor. */
typedef unsigned char OI_UINT8; /**< 8-bit unsigned integer values use native unsigned character data type for SH-3 processor. */
typedef unsigned short OI_UINT16; /**< 16-bit unsigned integer values use native unsigned short integer data type for SH-3 processor. */
typedef unsigned long OI_UINT32; /**< 32-bit unsigned integer values use native unsigned long integer data type for SH-3 processor. */
typedef OI_UINT32 OI_ELEMENT_UNION; /**< Type for first element of a union to support all data types up to pointer width. */
/**@}*/
#endif
/*********************************************************************************/
#if OI_CPU_TYPE==OI_CPU_SH2
#define OI_CPU_BYTE_ORDER OI_BIG_ENDIAN_BYTE_ORDER /**< SH-2 platform byte ordering is big-endian. */
/** @name CPU/compiler-dependent primitive data type definitions for SH-2 processor family
* @{
*/
typedef signed char OI_INT8; /**< 8-bit signed integer values use native signed character data type for SH-2 processor. */
typedef signed short OI_INT16; /**< 16-bit signed integer values use native signed short integer data type for SH-2 processor. */
typedef signed long OI_INT32; /**< 32-bit signed integer values use native signed long integer data type for SH-2 processor. */
typedef unsigned char OI_UINT8; /**< 8-bit unsigned integer values use native unsigned character data type for SH-2 processor. */
typedef unsigned short OI_UINT16; /**< 16-bit unsigned integer values use native unsigned short integer data type for SH-2 processor. */
typedef unsigned long OI_UINT32; /**< 32-bit unsigned integer values use native unsigned long integer data type for SH-2 processor. */
typedef OI_UINT32 OI_ELEMENT_UNION; /**< Type for first element of a union to support all data types up to pointer width. */
/**@}*/
#endif
/*********************************************************************************/
#if OI_CPU_TYPE==OI_CPU_H8
#define OI_CPU_BYTE_ORDER OI_BIG_ENDIAN_BYTE_ORDER
#error basic types not defined
#endif
/*********************************************************************************/
#if OI_CPU_TYPE==OI_CPU_MIPS
#define OI_CPU_BYTE_ORDER OI_LITTLE_ENDIAN_BYTE_ORDER
/** @name CPU/compiler-dependent primitive data type definitions for MIPS processor family
* @{
*/
typedef signed char OI_INT8; /**< 8-bit signed integer values use native signed character data type for ARM7 processor. */
typedef signed short OI_INT16; /**< 16-bit signed integer values use native signed short integer data type for ARM7 processor. */
typedef signed long OI_INT32; /**< 32-bit signed integer values use native signed long integer data type for ARM7 processor. */
typedef unsigned char OI_UINT8; /**< 8-bit unsigned integer values use native unsigned character data type for ARM7 processor. */
typedef unsigned short OI_UINT16; /**< 16-bit unsigned integer values use native unsigned short integer data type for ARM7 processor. */
typedef unsigned long OI_UINT32; /**< 32-bit unsigned integer values use native unsigned long integer data type for ARM7 processor. */
typedef OI_UINT32 OI_ELEMENT_UNION; /**< Type for first element of a union to support all data types up to pointer width. */
/**@}*/
#endif
/*********************************************************************************/
#if OI_CPU_TYPE==OI_CPU_SPARC
#define OI_CPU_BYTE_ORDER OI_LITTLE_ENDIAN_BYTE_ORDER
#error basic types not defined
#endif
/*********************************************************************************/
#if OI_CPU_TYPE==OI_CPU_M68000
#define OI_CPU_BYTE_ORDER OI_BIG_ENDIAN_BYTE_ORDER /**< M68000 platform byte ordering is big-endian. */
/** @name CPU/compiler-dependent primitive data type definitions for M68000 processor family
* @{
*/
typedef signed char OI_INT8; /**< 8-bit signed integer values use native signed character data type for M68000 processor. */
typedef signed short OI_INT16; /**< 16-bit signed integer values use native signed short integer data type for M68000 processor. */
typedef signed long OI_INT32; /**< 32-bit signed integer values use native signed long integer data type for M68000 processor. */
typedef unsigned char OI_UINT8; /**< 8-bit unsigned integer values use native unsigned character data type for M68000 processor. */
typedef unsigned short OI_UINT16; /**< 16-bit unsigned integer values use native unsigned short integer data type for M68000 processor. */
typedef unsigned long OI_UINT32; /**< 32-bit unsigned integer values use native unsigned long integer data type for M68000 processor. */
typedef OI_UINT32 OI_ELEMENT_UNION; /**< Type for first element of a union to support all data types up to pointer width. */
/**@}*/
#endif
/*********************************************************************************/
#if OI_CPU_TYPE==OI_CPU_PPC
#define OI_CPU_BYTE_ORDER OI_BIG_ENDIAN_BYTE_ORDER
/** @name CPU/compiler-dependent primitive data type definitions for PPC 8XX processor family
* @{
*/
typedef signed char OI_INT8; /**< 8-bit signed integer values use native signed character data type for PPC8XX processor. */
typedef signed short OI_INT16; /**< 16-bit signed integer values use native signed short integer data type for PPC8XX processor. */
typedef signed long OI_INT32; /**< 32-bit signed integer values use native signed long integer data type for PPC8XX processor. */
typedef unsigned char OI_UINT8; /**< 8-bit unsigned integer values use native unsigned character data type for PPC8XX processor. */
typedef unsigned short OI_UINT16; /**< 16-bit unsigned integer values use native unsigned short integer data type for PPC8XX processor. */
typedef unsigned long OI_UINT32; /**< 32-bit unsigned integer values use native unsigned long integer data type for PPC8XX processor. */
typedef OI_UINT32 OI_ELEMENT_UNION; /**< Type for first element of a union to support all data types up to pointer width. */
/**@}*/
#endif
/*********************************************************************************/
#if OI_CPU_TYPE==OI_CPU_SH4_7750
#define OI_CPU_BYTE_ORDER OI_BIG_ENDIAN_BYTE_ORDER /**< SH7750 platform byte ordering is big-endian. */
/** @name CPU/compiler-dependent primitive data type definitions for SH7750 processor series of the SH-4 processor family
* @{
*/
typedef signed char OI_INT8; /**< 8-bit signed integer values use native signed character data type for SH7750 SH-4 processor. */
typedef signed short OI_INT16; /**< 16-bit signed integer values use native signed short integer data type for SH7750 SH-4 processor. */
typedef signed long OI_INT32; /**< 32-bit signed integer values use native signed long integer data type for SH7750 SH-4 processor. */
typedef unsigned char OI_UINT8; /**< 8-bit unsigned integer values use native unsigned character data type for SH7750 SH-4 processor. */
typedef unsigned short OI_UINT16; /**< 16-bit unsigned integer values use native unsigned short integer data type for SH7750 SH-4 processor. */
typedef unsigned long OI_UINT32; /**< 32-bit unsigned integer values use native unsigned long integer data type for SH7750 SH-4 processor. */
typedef OI_UINT32 OI_ELEMENT_UNION; /**< Type for first element of a union to support all data types up to pointer width. */
/**@}*/
#endif
/*********************************************************************************/
#if OI_CPU_TYPE==OI_CPU_ARM7_LEND
#define OI_CPU_BYTE_ORDER OI_LITTLE_ENDIAN_BYTE_ORDER
/** @name little-endian CPU/compiler-dependent primitive data type definitions for the ARM7 processor family
* @{
*/
typedef signed char OI_INT8; /**< 8-bit signed integer values use native signed character data type for ARM7 processor. */
typedef signed short OI_INT16; /**< 16-bit signed integer values use native signed short integer data type for ARM7 processor. */
typedef signed long OI_INT32; /**< 32-bit signed integer values use native signed long integer data type for ARM7 processor. */
typedef unsigned char OI_UINT8; /**< 8-bit unsigned integer values use native unsigned character data type for ARM7 processor. */
typedef unsigned short OI_UINT16; /**< 16-bit unsigned integer values use native unsigned short integer data type for ARM7 processor. */
typedef unsigned long OI_UINT32; /**< 32-bit unsigned integer values use native unsigned long integer data type for ARM7 processor. */
typedef void *OI_ELEMENT_UNION; /**< Type for first element of a union to support all data types up to pointer width. */
/**@}*/
#endif
/*********************************************************************************/
#if OI_CPU_TYPE==OI_CPU_ARM7_BEND
#define OI_CPU_BYTE_ORDER OI_BIG_ENDIAN_BYTE_ORDER
/** @name big-endian CPU/compiler-dependent primitive data type definitions for the ARM7 processor family
* @{
*/
typedef signed char OI_INT8; /**< 8-bit signed integer values use native signed character data type for ARM7 processor. */
typedef signed short OI_INT16; /**< 16-bit signed integer values use native signed short integer data type for ARM7 processor. */
typedef signed long OI_INT32; /**< 32-bit signed integer values use native signed long integer data type for ARM7 processor. */
typedef unsigned char OI_UINT8; /**< 8-bit unsigned integer values use native unsigned character data type for ARM7 processor. */
typedef unsigned short OI_UINT16; /**< 16-bit unsigned integer values use native unsigned short integer data type for ARM7 processor. */
typedef unsigned long OI_UINT32; /**< 32-bit unsigned integer values use native unsigned long integer data type for ARM7 processor. */
typedef void *OI_ELEMENT_UNION; /**< Type for first element of a union to support all data types up to pointer width. */
/**@}*/
#endif
/*********************************************************************************/
#if OI_CPU_TYPE==OI_CPU_GDM1202
#define OI_CPU_BYTE_ORDER OI_BIG_ENDIAN_BYTE_ORDER
typedef signed char OI_INT8; /**< 8-bit signed integer. */
typedef signed short OI_INT16; /**< 16-bit signed integer. */
typedef signed long OI_INT32; /**< 32-bit signed integer. */
typedef unsigned char OI_UINT8; /**< 8-bit unsigned integer. */
typedef unsigned short OI_UINT16; /**< 16-bit unsigned integer. */
typedef unsigned long OI_UINT32; /**< 32-bit unsigned integer. */
typedef OI_UINT32 OI_ELEMENT_UNION; /**< Type for first element of a union to support all data types up to pointer width. */
#endif
/*********************************************************************************/
#if OI_CPU_TYPE==OI_CPU_ARC_LEND
#define OI_CPU_BYTE_ORDER OI_LITTLE_ENDIAN_BYTE_ORDER
/** @name CPU/compiler-dependent primitive data type definitions for ARC processor family
* @{
*/
typedef signed char OI_INT8; /**< 8-bit signed integer values use native signed character data type for ARC processor. */
typedef signed short OI_INT16; /**< 16-bit signed integer values use native signed short integer data type for ARC processor. */
typedef signed long OI_INT32; /**< 32-bit signed integer values use native signed long integer data type for ARC processor. */
typedef unsigned char OI_UINT8; /**< 8-bit unsigned integer values use native unsigned character data type for ARC processor. */
typedef unsigned short OI_UINT16; /**< 16-bit unsigned integer values use native unsigned short integer data type for ARC processor. */
typedef unsigned long OI_UINT32; /**< 32-bit unsigned integer values use native unsigned long integer data type for ARC processor. */
typedef OI_UINT32 OI_ELEMENT_UNION; /**< Type for first element of a union to support all data types up to pointer width. */
/**@}*/
#endif
/*********************************************************************************/
#if OI_CPU_TYPE==OI_CPU_ARC_BEND
#define OI_CPU_BYTE_ORDER OI_BIG_ENDIAN_BYTE_ORDER
/** @name CPU/compiler-dependent primitive data type definitions for ARC processor family
* @{
*/
typedef signed char OI_INT8; /**< 8-bit signed integer values use native signed character data type for ARC processor. */
typedef signed short OI_INT16; /**< 16-bit signed integer values use native signed short integer data type for ARC processor. */
typedef signed long OI_INT32; /**< 32-bit signed integer values use native signed long integer data type for ARC processor. */
typedef unsigned char OI_UINT8; /**< 8-bit unsigned integer values use native unsigned character data type for ARC processor. */
typedef unsigned short OI_UINT16; /**< 16-bit unsigned integer values use native unsigned short integer data type for ARC processor. */
typedef unsigned long OI_UINT32; /**< 32-bit unsigned integer values use native unsigned long integer data type for ARC processor. */
typedef OI_UINT32 OI_ELEMENT_UNION; /**< Type for first element of a union to support all data types up to pointer width. */
/**@}*/
#endif
/*********************************************************************************/
#if OI_CPU_TYPE==OI_CPU_M30833F
#define OI_CPU_BYTE_ORDER OI_LITTLE_ENDIAN_BYTE_ORDER
/** @name CPU/compiler-dependent primitive data type definitions for Mitsubishi M308 processor family
* @{
*/
typedef signed char OI_INT8; /**< 8-bit signed integer values use native signed character data type for M308 processor. */
typedef signed short OI_INT16; /**< 16-bit signed integer values use native signed short integer data type for M308 processor. */
typedef signed long OI_INT32; /**< 32-bit signed integer values use native signed long integer data type for M308 processor. */
typedef unsigned char OI_UINT8; /**< 8-bit unsigned integer values use native unsigned character data type for M308 processor. */
typedef unsigned short OI_UINT16; /**< 16-bit unsigned integer values use native unsigned short integer data type for M308 processor. */
typedef unsigned long OI_UINT32; /**< 32-bit unsigned integer values use native unsigned long integer data type for M308 processor. */
typedef OI_UINT32 OI_ELEMENT_UNION; /**< Type for first element of a union to support all data types up to pointer width. */
/**@}*/
#endif
/*********************************************************************************/
#if OI_CPU_TYPE==OI_CPU_CR16C
#define OI_CPU_BYTE_ORDER OI_LITTLE_ENDIAN_BYTE_ORDER
/** @name CPU/compiler-dependent primitive data type definitions for National Semicnductor processor family
* @{
*/
typedef signed char OI_INT8; /**< 8-bit signed integer values use native signed character data type for CR16C processor. */
typedef signed short OI_INT16; /**< 16-bit signed integer values use native signed short integer data type for CR16C processor. */
typedef signed long OI_INT32; /**< 32-bit signed integer values use native signed long integer data type for CR16C processor. */
typedef unsigned char OI_UINT8; /**< 8-bit unsigned integer values use native unsigned character data type for CR16C processor. */
typedef unsigned short OI_UINT16; /**< 16-bit unsigned integer values use native unsigned short integer data type for CR16C processor. */
typedef unsigned long OI_UINT32; /**< 32-bit unsigned integer values use native unsigned long integer data type for CR16C processor. */
typedef OI_UINT32 OI_ELEMENT_UNION; /**< Type for first element of a union to support all data types up to pointer width. */
/**@}*/
#endif
/*********************************************************************************/
#if OI_CPU_TYPE==OI_CPU_M64111
#define OI_CPU_BYTE_ORDER OI_BIG_ENDIAN_BYTE_ORDER
/** @name CPU/compiler-dependent primitive data type definitions for Renesas M32R processor family
* @{
*/
typedef signed char OI_INT8; /**< 8-bit signed integer values use native signed character data type for M64111 processor. */
typedef signed short OI_INT16; /**< 16-bit signed integer values use native signed short integer data type for M64111 processor. */
typedef signed long OI_INT32; /**< 32-bit signed integer values use native signed long integer data type for M64111 processor. */
typedef unsigned char OI_UINT8; /**< 8-bit unsigned integer values use native unsigned character data type for M64111 processor. */
typedef unsigned short OI_UINT16; /**< 16-bit unsigned integer values use native unsigned short integer data type for M64111 processor. */
typedef unsigned long OI_UINT32; /**< 32-bit unsigned integer values use native unsigned long integer data type for M64111 processor. */
typedef OI_UINT32 OI_ELEMENT_UNION; /**< Type for first element of a union to support all data types up to pointer width. */
/**@}*/
#endif
/*********************************************************************************/
#if OI_CPU_TYPE==OI_CPU_ARMV5_LEND
#define OI_CPU_BYTE_ORDER OI_LITTLE_ENDIAN_BYTE_ORDER
/** @name little-endian CPU/compiler-dependent primitive data type definitions for the ARM7 processor family
* @{
*/
typedef signed char OI_INT8; /**< 8-bit signed integer values use native signed character data type for ARM7 processor. */
typedef signed short OI_INT16; /**< 16-bit signed integer values use native signed short integer data type for ARM7 processor. */
typedef signed long OI_INT32; /**< 32-bit signed integer values use native signed long integer data type for ARM7 processor. */
typedef unsigned char OI_UINT8; /**< 8-bit unsigned integer values use native unsigned character data type for ARM7 processor. */
typedef unsigned short OI_UINT16; /**< 16-bit unsigned integer values use native unsigned short integer data type for ARM7 processor. */
typedef unsigned long OI_UINT32; /**< 32-bit unsigned integer values use native unsigned long integer data type for ARM7 processor. */
typedef OI_UINT32 OI_ELEMENT_UNION; /**< Type for first element of a union to support all data types up to pointer width. */
/**@}*/
#endif
/*********************************************************************************/
#ifndef OI_CPU_BYTE_ORDER
#error "Byte order (endian-ness) not defined"
#endif
/**@}*/
#ifdef __cplusplus
}
#endif
/*********************************************************************************/
#endif /* _OI_CPU_DEP_H */

View File

@ -0,0 +1,171 @@
/******************************************************************************
*
* Copyright (C) 2014 The Android Open Source Project
* Copyright 2002 - 2004 Open Interface North America, Inc. All rights reserved.
*
* 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 _OI_MODULES_H
#define _OI_MODULES_H
/**
* @file
*
* Enumeration type defining the inidivual stack components.
*
*/
/**********************************************************************************
$Revision: #1 $
***********************************************************************************/
/** \addtogroup Misc Miscellaneous APIs */
/**@{*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* This enumeration lists constants for referencing the components of
* the BLUEmagic 3.0 protocol stack, profiles, and other functionalities.
*
* In order to distinguish types of modules, items are grouped with markers to
* delineate start and end of the groups
*
* The module type is used for various purposes:
* identification in debug print statements
* access to initialization flags
* access to the configuration table
*/
typedef enum {
/* profiles and protocols --> Updates to oi_debug.c and oi_config_table.c */
/* XX --> Keep Enum values up-to-date! */
OI_MODULE_AT, /**< 00 AT command processing */
OI_MODULE_A2DP, /**< 01 Advanced Audio Distribution Profile */
OI_MODULE_AVCTP, /**< 02 Audio-Visual Control Transport Profile */
OI_MODULE_AVDTP, /**< 03 Audio-Visual Distribution Protocol */
OI_MODULE_AVRCP, /**< 04 Audio-Visual Remote Control Profile */
OI_MODULE_BIP_CLI, /**< 05 Basic Imaging Profile protocol client */
OI_MODULE_BIP_SRV, /**< 06 Basic Imaging Profile protocol server */
OI_MODULE_BNEP, /**< 07 Bluetooth Network Encapsulation Protocol */
OI_MODULE_BPP_SENDER, /**< 08 Basic Printing Profile */
OI_MODULE_BPP_PRINTER, /**< 09 Basic Printing Profile */
OI_MODULE_CTP, /**< 10 Cordless Telephony Profile */
OI_MODULE_DUN, /**< 11 Dial-Up Networking Profile */
OI_MODULE_FAX, /**< 12 Fax Profile */
OI_MODULE_FTP_CLI, /**< 13 File Transfer Profile protocol client */
OI_MODULE_FTP_SRV, /**< 14 File Transfer Profile protocol server */
OI_MODULE_HANDSFREE, /**< 15 Hands-Free Profile */
OI_MODULE_HANDSFREE_AG, /**< 16 Hands-Free Profile */
OI_MODULE_HCRP_CLI, /**< 17 Hardcopy Cable Replacement Profile */
OI_MODULE_HCRP_SRV, /**< 18 Hardcopy Cable Replacement Profile */
OI_MODULE_HEADSET, /**< 19 Headset Profile */
OI_MODULE_HEADSET_AG, /**< 20 Headset Profile */
OI_MODULE_HID, /**< 21 Human Interface Device profile */
OI_MODULE_INTERCOM, /**< 22 Intercom Profile */
OI_MODULE_OBEX_CLI, /**< 23 OBEX protocol client, Generic Object Exchange Profile */
OI_MODULE_OBEX_SRV, /**< 24 OBEX protocol server, Generic Object Exchange Profile */
OI_MODULE_OPP_CLI, /**< 25 Object Push Profile protocol client */
OI_MODULE_OPP_SRV, /**< 26 Object Push Profile protocol server */
OI_MODULE_PAN, /**< 27 PAN profile */
OI_MODULE_PBAP_CLI, /**< 28 Phonebook Access Profile client */
OI_MODULE_PBAP_SRV, /**< 29 Phonebook Access Profile server */
OI_MODULE_SAP_CLI, /**< 30 SIM Access Profile */
OI_MODULE_SAP_SRV, /**< 31 SIM Access Profile */
OI_MODULE_SPP, /**< 32 Serial Port Profile */
OI_MODULE_SYNC_CLI, /**< 33 Synchronization Profile */
OI_MODULE_SYNC_SRV, /**< 34 Synchronization Profile */
OI_MODULE_SYNC_CMD_CLI, /**< 35 Synchronization Profile */
OI_MODULE_SYNC_CMD_SRV, /**< 36 Synchronization Profile */
OI_MODULE_SYNCML, /**< 37 SyncML Profile */
OI_MODULE_TCS, /**< 38 TCS Binary */
OI_MODULE_VDP, /**< 39 Video Distribution Profile */
/* corestack components --> Updates to oi_debug.c and oi_config_table.c */
OI_MODULE_COMMON_CONFIG, /**< 40 Common configuration, module has no meaning other than for config struct */
OI_MODULE_CMDCHAIN, /**< 41 Command chaining utility */
OI_MODULE_DISPATCH, /**< 42 Dispatcher */
OI_MODULE_DATAELEM, /**< 43 Data Elements, marshaller */
OI_MODULE_DEVMGR, /**< 44 Device Manager */
OI_MODULE_DEVMGR_MODES, /**< 45 Device Manager connectability/discoverability modes */
OI_MODULE_HCI, /**< 46 Host Controller Interface command layer */
OI_MODULE_L2CAP, /**< 47 L2CAP */
OI_MODULE_MEMMGR, /**< 48 modules that do memory management */
OI_MODULE_POLICYMGR, /**< 49 Policy Manager */
OI_MODULE_RFCOMM, /**< 50 RFCOMM */
OI_MODULE_RFCOMM_SD, /**< 51 RFCOMM Service discovery */
OI_MODULE_SDP_CLI, /**< 52 Service Discovery Protocol client */
OI_MODULE_SDP_SRV, /**< 53 Service Discovery Protocol server */
OI_MODULE_SDPDB, /**< 54 Service Discovery Protocol database */
OI_MODULE_SECMGR, /**< 55 Security Manager */
OI_MODULE_SNIFFLOG, /**< 56 sniff log */
OI_MODULE_SUPPORT, /**< 57 support functions, including CThru Dispatcher, time functions, and stack initialization */
OI_MODULE_TRANSPORT, /**< 58 transport layer between HCI command layer and driver */
OI_MODULE_TEST, /**< 59 used to debug output from internal test programs */
OI_MODULE_XML, /**< 60 XML/CSS parser */
OI_MODULE_DI, /**< 61 Device Identification Profile */
// bhapi components --> Updates to oi_debug.c
OI_MODULE_BHAPI, /**< 62 BLUEmagic Host API generic */
OI_MODULE_BHCLI, /**< 63 BLUEmagic Host API client side */
OI_MODULE_BHSRV, /**< 64 BLUEmagic Host API server side */
OI_MODULE_MSGQ, /**< 65 module that handles message queuing */
OI_MODULE_BHAPI_TRANSPORT, /**< 66 module that handles message queuing */
OI_MODULE_BLST_SRV, /**< 67 module that provides server side BHAPI Lightweight Serial Transport */
OI_MODULE_BLST_CLI, /**< 68 module that provides client side BHAPI Lightweight Serial Transport */
// OEM files --> Updates to oi_debug.c
OI_MODULE_OEM, /**< 69 Application Memory allocation */
// Application glue --> Updates to oi_debug.c
OI_MODULE_APP, /**< 70 Application Memory allocation */
/* various pieces of code depend on these last 2 elements occuring in a specific order:
OI_MODULE_ALL must be the 2nd to last element
OI_MODULE_UNKNOWN must be the last element
*/
OI_MODULE_ALL, /**< 71 special value identifying all modules - used for control of debug print statements */
OI_MODULE_UNKNOWN /**< 72 special value - used for debug print statements */
} OI_MODULE;
/**
* This constant is the number of actual modules in the list. ALL and UNKNOWN are
* special values that are not actually modules.
* Used for debug print and memmgr profiling
*/
#define OI_NUM_MODULES OI_MODULE_ALL
/**
* This constant is the number of profile and core components. It is used to size
* the initialization and configuration tables.
*/
#define OI_NUM_STACK_MODULES OI_MODULE_BHAPI
#ifdef __cplusplus
}
#endif
/**@}*/
#endif /* _OI_MODULES_H */

Some files were not shown because too many files have changed in this diff Show More