| # Copyright 2023 The Pigweed Authors |
| # |
| # 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 |
| # |
| # https://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 Emboss packet definitions for extensions to the Bluetooth |
| # Host-Controller interface. These extensions are not standardized through the |
| # Bluetooth SIG. |
| # |
| # NOTE: The definitions below are incomplete. They get added as needed. |
| # This list will grow as we support more vendor features. |
| |
| import "hci_common.emb" as hci |
| |
| [$default byte_order: "LittleEndian"] |
| [(cpp) namespace: "pw::bluetooth::vendor::android_hci"] |
| # ========================= HCI packet headers ========================== |
| |
| |
| struct AndroidCommandHeader: |
| -- HCI Vendor Command packet header. |
| let hdr_size = hci.CommandHeader.$size_in_bytes |
| 0 [+hdr_size] hci.CommandHeader header |
| $next [+1] UInt sub_opcode |
| |
| # ======================= Android HCI extensions ======================== |
| # Documentation: https://source.android.com/devices/bluetooth/hci_requirements |
| |
| |
| enum Capability: |
| [maximum_bits: 8] |
| NOT_CAPABLE = 0x00 |
| CAPABLE = 0x01 |
| |
| |
| bits AudioCodecSupportMask: |
| 0 [+1] Flag sbc |
| 1 [+1] Flag aac |
| 2 [+1] Flag aptx |
| 3 [+1] Flag aptx_hd |
| 4 [+1] Flag ldac |
| |
| |
| enum A2dpCodecType: |
| [maximum_bits: 8] |
| SBC = 0x01 |
| AAC = 0x02 |
| APTX = 0x04 |
| APTX_HD = 0x08 |
| LDAC = 0x10 |
| |
| |
| struct A2dpScmsTEnable: |
| 0 [+1] hci.GenericEnableParam enabled |
| $next [+1] UInt header |
| |
| |
| enum A2dpSamplingFrequency: |
| [maximum_bits: 8] |
| HZ_44100 = 0x01 |
| HZ_48000 = 0x02 |
| HZ_88200 = 0x04 |
| HZ_96000 = 0x08 |
| |
| |
| enum A2dpBitsPerSample: |
| [maximum_bits: 8] |
| BITS_PER_SAMPLE_16 = 0x01 |
| BITS_PER_SAMPLE_24 = 0x02 |
| BITS_PER_SAMPLE_32 = 0x04 |
| |
| |
| enum A2dpChannelMode: |
| [maximum_bits: 8] |
| MONO = 0x01 |
| STEREO = 0x02 |
| |
| |
| enum SbcSamplingFrequency: |
| [maximum_bits: 4] |
| HZ_48000 = 0x01 |
| HZ_44100 = 0x02 |
| HZ_32000 = 0x04 |
| HZ_16000 = 0x08 |
| |
| |
| enum SbcChannelMode: |
| [maximum_bits: 4] |
| JOINT_STEREO = 0x01 |
| STEREO = 0x02 |
| DUAL_CHANNEL = 0x04 |
| MONO = 0x08 |
| |
| |
| enum SbcBlockLen: |
| [maximum_bits: 4] |
| BLOCK_LEN_16 = 0x01 |
| BLOCK_LEN_12 = 0x02 |
| BLOCK_LEN_8 = 0x04 |
| BLOCK_LEN_4 = 0x08 |
| |
| |
| enum SbcSubBands: |
| [maximum_bits: 2] |
| SUBBANDS_8 = 0x01 |
| SUBBANDS_4 = 0x02 |
| |
| |
| enum SbcAllocationMethod: |
| [maximum_bits: 2] |
| LOUNDNESS = 0x01 |
| SNR = 0x02 |
| |
| |
| enum AacEnableVariableBitRate: |
| -- 1-octet boolean "enable"/"disable" parameter for AAC variable bitrate |
| [maximum_bits: 8] |
| DISABLE = 0x00 |
| ENABLE = 0x80 |
| |
| |
| enum LdacBitrateIndex: |
| -- Values 0x03 - 0x7E are reserved |
| -- Values 0x80 - 0xFF are reserved |
| [maximum_bits: 8] |
| HIGH = 0x00 |
| MID = 0x01 |
| LOW = 0x02 |
| ADAPTIVE_BITRATE = 0x7F |
| |
| |
| bits LdacChannelMode: |
| -- Bitmask values for LDAC Channel Mode |
| 0 [+1] Flag stereo |
| 1 [+1] Flag dual |
| 2 [+1] Flag mono |
| |
| |
| struct SbcCodecInformation: |
| 0 [+1] bits: |
| 0 [+2] SbcAllocationMethod allocation_method |
| $next [+2] SbcSubBands subbands |
| $next [+4] SbcBlockLen block_length |
| |
| $next [+1] UInt min_bitpool_value |
| $next [+1] UInt max_bitpool_value |
| $next [+1] bits: |
| 0 [+4] SbcChannelMode channel_mode |
| $next [+4] SbcSamplingFrequency sampling_frequency |
| |
| $next [+28] UInt:8[28] reserved |
| |
| |
| struct AacCodecInformation: |
| 0 [+1] UInt object_type |
| $next [+1] AacEnableVariableBitRate variable_bit_rate |
| $next [+30] UInt:8[30] reserved |
| |
| |
| struct LdacCodecInformation: |
| 0 [+4] UInt vendor_id |
| -- Must always be set to kLdacVendorId |
| |
| $next [+2] UInt codec_id |
| -- Must always be set to kLdacCodecId |
| -- All other values are reserved |
| |
| $next [+1] LdacBitrateIndex bitrate_index |
| -- See enum class LdacBitrateIndex in this file for possible values |
| |
| $next [+1] bits: |
| 0 [+3] LdacChannelMode ldac_channel_mode |
| -- Bitmask: LDAC channel mode (see LdacChannelMode for bitmask values) |
| |
| $next [+24] UInt:8[24] reserved |
| |
| # ============ Commands ============ |
| |
| |
| struct StartA2dpOffloadCommand: |
| let vendor_size = AndroidCommandHeader.$size_in_bytes |
| |
| 0 [+vendor_size] AndroidCommandHeader vendor_command |
| |
| $next [+4] bits: |
| |
| 0 [+8] A2dpCodecType codec_type |
| -- See enum class A2dpCodecType in this file for possible values |
| |
| $next [+2] UInt max_latency |
| -- Max latency allowed in ms. A value of zero disables flush. |
| |
| $next [+2] A2dpScmsTEnable scms_t_enable |
| |
| $next [+4] bits: |
| |
| 0 [+8] A2dpSamplingFrequency sampling_frequency |
| -- See enum class A2dpSamplingFrequency in this file for possible values |
| |
| $next [+1] A2dpBitsPerSample bits_per_sample |
| -- See enum class A2dpBitsPerSample in this file for possible values |
| |
| $next [+1] A2dpChannelMode channel_mode |
| -- See enum class A2dpChannelMode in this file for possible values |
| |
| $next [+4] UInt encoded_audio_bitrate |
| -- The encoded audio bitrate in bits per second |
| -- 0x00000000 - The audio bitrate is not specified / unused |
| -- 0x00000001 - 0x00FFFFFF - Encoded audio bitrate in bits per second |
| -- 0x01000000 - 0xFFFFFFFF - Reserved |
| [requires: 0x00000000 <= this <= 0x00FFFFFF] |
| |
| $next [+2] UInt connection_handle |
| -- Connection handle of A2DP connection being configured (only the lower 12-bits are meaningful) |
| -- Range: 0x0000 to 0x0EFF |
| [requires: 0x0000 <= this <= 0x0EFF] |
| |
| $next [+2] UInt l2cap_channel_id |
| -- L2CAP channel ID to be used for this A2DP connection |
| |
| $next [+2] UInt l2cap_mtu_size |
| -- Maximum size of L2CAP MTU containing encoded audio packets |
| |
| if codec_type == A2dpCodecType.SBC: |
| 28 [+32] SbcCodecInformation sbc_codec_information |
| |
| if codec_type == A2dpCodecType.AAC: |
| 28 [+32] AacCodecInformation aac_codec_information |
| |
| if codec_type == A2dpCodecType.LDAC: |
| 28 [+32] LdacCodecInformation ldac_codec_information |
| |
| if codec_type == A2dpCodecType.APTX || codec_type == A2dpCodecType.APTX_HD: |
| 28 [+32] UInt:8[32] reserved |
| |
| |
| struct StopA2dpOffloadCommand: |
| let vendor_size = AndroidCommandHeader.$size_in_bytes |
| 0 [+vendor_size] AndroidCommandHeader vendor_command |
| |
| |
| struct LEMultiAdvtEnableCommand: |
| -- LE multi-advertising enable command. |
| let vendor_size = AndroidCommandHeader.$size_in_bytes |
| 0 [+vendor_size] AndroidCommandHeader vendor_command |
| $next [+1] hci.GenericEnableParam enable |
| $next [+1] UInt advertising_handle |
| |
| |
| struct LEGetVendorCapabilitiesCommand: |
| let hdr_size = hci.CommandHeader.$size_in_bytes |
| 0 [+hdr_size] hci.CommandHeader header |
| |
| # ============ Events ============ |
| |
| |
| struct LEMultiAdvtStateChangeSubevent: |
| -- LE multi-advertising state change subevent. |
| 0 [+hci.VendorDebugEvent.$size_in_bytes] hci.VendorDebugEvent vendor_event |
| $next [+1] UInt advertising_handle |
| -- Handle used to identify an advertising set. |
| |
| $next [+1] hci.StatusCode status |
| -- Reason for state change. Currently will always be 0x00. |
| -- 0x00: Connection received. |
| |
| $next [+2] UInt connection_handle |
| -- Handle used to identify the connection that caused the state change (i.e. |
| -- advertising instance to be disabled). Value will be 0xFFFF if invalid. |
| |
| |
| struct LEGetVendorCapabilitiesCommandCompleteEvent: |
| let hdr_size = hci.CommandCompleteEvent.$size_in_bytes |
| 0 [+hdr_size] hci.CommandCompleteEvent command_complete |
| $next [+1] hci.StatusCode status |
| $next [+1] UInt max_advt_instances |
| -- Number of advertisement instances supported |
| -- Deprecated in Google feature spec v0.98 and higher |
| |
| $next [+1] Capability offloaded_resolution_of_private_address |
| -- BT chip capability of RPA |
| -- Deprecated in Google feature spec v0.98 and higher |
| |
| $next [+2] UInt total_scan_results_storage |
| -- Storage for scan results in bytes |
| |
| $next [+1] UInt max_irk_list_sz |
| -- Number of IRK entries supported in the firmware |
| |
| $next [+1] Capability filtering_support |
| -- Support for filtering in the controller |
| |
| $next [+1] UInt max_filter |
| -- Number of filters supported |
| |
| $next [+1] Capability activity_energy_info_support |
| -- Supports reporting of activity and energy information |
| |
| $next [+2] bits version_supported: |
| -- Specifies the version of the Google feature spec supported |
| 0 [+8] UInt major_number |
| $next [+8] UInt minor_number |
| |
| $next [+2] UInt total_num_of_advt_tracked |
| -- Total number of advertisers tracked for OnLost/OnFound purposes |
| |
| $next [+1] Capability extended_scan_support |
| -- Supports extended scan window and interval |
| |
| $next [+1] Capability debug_logging_supported |
| -- Supports logging of binary debug information from controller |
| |
| $next [+1] Capability le_address_generation_offloading_support |
| -- Deprecated in Google feature spec v0.98 and higher |
| |
| $next [+4] bits: |
| 0 [+5] AudioCodecSupportMask a2dp_source_offload_capability_mask |
| |
| $next [+1] Capability bluetooth_quality_report_support |
| -- Supports reporting of Bluetooth Quality events |
| |
| $next [+4] bits: |
| 0 [+5] AudioCodecSupportMask dynamic_audio_buffer_support |