Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
a2dp_codec_sbc.h File Reference

Advance Audio Distribution Profile - SBC Codec header. More...

Go to the source code of this file.

Data Structures

struct  bt_a2dp_codec_sbc_params
 SBC Codec. More...
 

Macros

#define A2DP_SBC_SAMP_FREQ_16000   BIT(7)
 
#define A2DP_SBC_SAMP_FREQ_32000   BIT(6)
 
#define A2DP_SBC_SAMP_FREQ_44100   BIT(5)
 
#define A2DP_SBC_SAMP_FREQ_48000   BIT(4)
 
#define A2DP_SBC_CH_MODE_MONO   BIT(3)
 
#define A2DP_SBC_CH_MODE_DUAL   BIT(2)
 
#define A2DP_SBC_CH_MODE_STREO   BIT(1)
 
#define A2DP_SBC_CH_MODE_JOINT   BIT(0)
 
#define A2DP_SBC_BLK_LEN_4   BIT(7)
 
#define A2DP_SBC_BLK_LEN_8   BIT(6)
 
#define A2DP_SBC_BLK_LEN_12   BIT(5)
 
#define A2DP_SBC_BLK_LEN_16   BIT(4)
 
#define A2DP_SBC_SUBBAND_4   BIT(3)
 
#define A2DP_SBC_SUBBAND_8   BIT(2)
 
#define A2DP_SBC_ALLOC_MTHD_SNR   BIT(1)
 
#define A2DP_SBC_ALLOC_MTHD_LOUDNESS   BIT(0)
 
#define BT_A2DP_SBC_SAMP_FREQ(cap)
 
#define BT_A2DP_SBC_CHAN_MODE(cap)
 
#define BT_A2DP_SBC_BLK_LEN(cap)
 
#define BT_A2DP_SBC_SUB_BAND(cap)
 
#define BT_A2DP_SBC_ALLOC_MTHD(cap)
 
#define BT_A2DP_SBC_MEDIA_HDR_NUM_FRAMES_GET(hdr)
 If the F bit is set to 0, this field indicates the number of frames contained in this packet.
 
#define BT_A2DP_SBC_MEDIA_HDR_L_GET(hdr)
 Set to 1 for the last packet of a fragmented SBC frame, otherwise set to 0.
 
#define BT_A2DP_SBC_MEDIA_HDR_S_GET(hdr)
 Set to 1 for the starting packet of a fragmented SBC frame, otherwise set to 0.
 
#define BT_A2DP_SBC_MEDIA_HDR_F_GET(hdr)
 Set to 1 if the SBC frame is fragmented, otherwise set to 0.
 
#define BT_A2DP_SBC_MEDIA_HDR_NUM_FRAMES_SET(hdr, val)
 If the F bit is set to 0, this field indicates the number of frames contained in this packet.
 
#define BT_A2DP_SBC_MEDIA_HDR_L_SET(hdr, val)
 Set to 1 for the last packet of a fragmented SBC frame, otherwise set to 0.
 
#define BT_A2DP_SBC_MEDIA_HDR_S_SET(hdr, val)
 Set to 1 for the starting packet of a fragmented SBC frame, otherwise set to 0.
 
#define BT_A2DP_SBC_MEDIA_HDR_F_SET(hdr, val)
 Set to 1 if the SBC frame is fragmented, otherwise set to 0.
 
#define BT_A2DP_SBC_MEDIA_HDR_ENCODE(num_frames, l, s, f)
 

Functions

uint8_t bt_a2dp_sbc_get_channel_num (struct bt_a2dp_codec_sbc_params *sbc_codec)
 get channel num of a2dp sbc config.
 
uint32_t bt_a2dp_sbc_get_sampling_frequency (struct bt_a2dp_codec_sbc_params *sbc_codec)
 get sample rate of a2dp sbc config.
 

Detailed Description

Advance Audio Distribution Profile - SBC Codec header.

Macro Definition Documentation

◆ A2DP_SBC_ALLOC_MTHD_LOUDNESS

#define A2DP_SBC_ALLOC_MTHD_LOUDNESS   BIT(0)

◆ A2DP_SBC_ALLOC_MTHD_SNR

#define A2DP_SBC_ALLOC_MTHD_SNR   BIT(1)

◆ A2DP_SBC_BLK_LEN_12

#define A2DP_SBC_BLK_LEN_12   BIT(5)

◆ A2DP_SBC_BLK_LEN_16

#define A2DP_SBC_BLK_LEN_16   BIT(4)

◆ A2DP_SBC_BLK_LEN_4

#define A2DP_SBC_BLK_LEN_4   BIT(7)

◆ A2DP_SBC_BLK_LEN_8

#define A2DP_SBC_BLK_LEN_8   BIT(6)

◆ A2DP_SBC_CH_MODE_DUAL

#define A2DP_SBC_CH_MODE_DUAL   BIT(2)

◆ A2DP_SBC_CH_MODE_JOINT

#define A2DP_SBC_CH_MODE_JOINT   BIT(0)

◆ A2DP_SBC_CH_MODE_MONO

#define A2DP_SBC_CH_MODE_MONO   BIT(3)

◆ A2DP_SBC_CH_MODE_STREO

#define A2DP_SBC_CH_MODE_STREO   BIT(1)

◆ A2DP_SBC_SAMP_FREQ_16000

#define A2DP_SBC_SAMP_FREQ_16000   BIT(7)

◆ A2DP_SBC_SAMP_FREQ_32000

#define A2DP_SBC_SAMP_FREQ_32000   BIT(6)

◆ A2DP_SBC_SAMP_FREQ_44100

#define A2DP_SBC_SAMP_FREQ_44100   BIT(5)

◆ A2DP_SBC_SAMP_FREQ_48000

#define A2DP_SBC_SAMP_FREQ_48000   BIT(4)

◆ A2DP_SBC_SUBBAND_4

#define A2DP_SBC_SUBBAND_4   BIT(3)

◆ A2DP_SBC_SUBBAND_8

#define A2DP_SBC_SUBBAND_8   BIT(2)

◆ BT_A2DP_SBC_ALLOC_MTHD

#define BT_A2DP_SBC_ALLOC_MTHD ( cap)
Value:
((cap->config[1]) & 0x03)

◆ BT_A2DP_SBC_BLK_LEN

#define BT_A2DP_SBC_BLK_LEN ( cap)
Value:
((cap->config[1] >> 4) & 0x0f)

◆ BT_A2DP_SBC_CHAN_MODE

#define BT_A2DP_SBC_CHAN_MODE ( cap)
Value:
((cap->config[0]) & 0x0f)

◆ BT_A2DP_SBC_MEDIA_HDR_ENCODE

#define BT_A2DP_SBC_MEDIA_HDR_ENCODE ( num_frames,
l,
s,
f )
Value:
FIELD_PREP(GENMASK(3, 0), num_frames) | FIELD_PREP(BIT(5), l) |\
FIELD_PREP(BIT(6), s) | FIELD_PREP(BIT(7), f)
irp nz macro MOVR cc s mov cc s endm endr irp aw macro LDR aa s
Definition asm-macro-32-bit-gnu.h:17
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition util_macro.h:44
#define GENMASK(h, l)
Create a contiguous bitmask starting at bit position l and ending at position h.
Definition util.h:79
#define FIELD_PREP(mask, value)
Prepare a bitfield element using value with mask representing its field position and width.
Definition util_macro.h:110

◆ BT_A2DP_SBC_MEDIA_HDR_F_GET

#define BT_A2DP_SBC_MEDIA_HDR_F_GET ( hdr)
Value:
FIELD_GET(BIT(7), (hdr))
#define FIELD_GET(mask, value)
Extract a bitfield element from value corresponding to the field mask mask.
Definition util_macro.h:103

Set to 1 if the SBC frame is fragmented, otherwise set to 0.

◆ BT_A2DP_SBC_MEDIA_HDR_F_SET

#define BT_A2DP_SBC_MEDIA_HDR_F_SET ( hdr,
val )
Value:
hdr = ((hdr) & ~BIT(7)) | FIELD_PREP(BIT(7), (val))

Set to 1 if the SBC frame is fragmented, otherwise set to 0.

◆ BT_A2DP_SBC_MEDIA_HDR_L_GET

#define BT_A2DP_SBC_MEDIA_HDR_L_GET ( hdr)
Value:
FIELD_GET(BIT(5), (hdr))

Set to 1 for the last packet of a fragmented SBC frame, otherwise set to 0.

◆ BT_A2DP_SBC_MEDIA_HDR_L_SET

#define BT_A2DP_SBC_MEDIA_HDR_L_SET ( hdr,
val )
Value:
hdr = ((hdr) & ~BIT(5)) | FIELD_PREP(BIT(5), (val))

Set to 1 for the last packet of a fragmented SBC frame, otherwise set to 0.

◆ BT_A2DP_SBC_MEDIA_HDR_NUM_FRAMES_GET

#define BT_A2DP_SBC_MEDIA_HDR_NUM_FRAMES_GET ( hdr)
Value:
FIELD_GET(GENMASK(3, 0), (hdr))

If the F bit is set to 0, this field indicates the number of frames contained in this packet.

If the F bit is set to 1, this field indicates the number of remaining fragments, including the current fragment. Therefore, the last counter value shall be one.

◆ BT_A2DP_SBC_MEDIA_HDR_NUM_FRAMES_SET

#define BT_A2DP_SBC_MEDIA_HDR_NUM_FRAMES_SET ( hdr,
val )
Value:
hdr = ((hdr) & ~GENMASK(3, 0)) | FIELD_PREP(GENMASK(3, 0), (val))

If the F bit is set to 0, this field indicates the number of frames contained in this packet.

If the F bit is set to 1, this field indicates the number of remaining fragments, including the current fragment. Therefore, the last counter value shall be one.

◆ BT_A2DP_SBC_MEDIA_HDR_S_GET

#define BT_A2DP_SBC_MEDIA_HDR_S_GET ( hdr)
Value:
FIELD_GET(BIT(6), (hdr))

Set to 1 for the starting packet of a fragmented SBC frame, otherwise set to 0.

◆ BT_A2DP_SBC_MEDIA_HDR_S_SET

#define BT_A2DP_SBC_MEDIA_HDR_S_SET ( hdr,
val )
Value:
hdr = ((hdr) & ~BIT(6)) | FIELD_PREP(BIT(6), (val))

Set to 1 for the starting packet of a fragmented SBC frame, otherwise set to 0.

◆ BT_A2DP_SBC_SAMP_FREQ

#define BT_A2DP_SBC_SAMP_FREQ ( cap)
Value:
((cap->config[0] >> 4) & 0x0f)

◆ BT_A2DP_SBC_SUB_BAND

#define BT_A2DP_SBC_SUB_BAND ( cap)
Value:
((cap->config[1] >> 2) & 0x03)

Function Documentation

◆ bt_a2dp_sbc_get_channel_num()

uint8_t bt_a2dp_sbc_get_channel_num ( struct bt_a2dp_codec_sbc_params * sbc_codec)

get channel num of a2dp sbc config.

Parameters
sbc_codecThe a2dp sbc parameter.
Returns
the channel num.

◆ bt_a2dp_sbc_get_sampling_frequency()

uint32_t bt_a2dp_sbc_get_sampling_frequency ( struct bt_a2dp_codec_sbc_params * sbc_codec)

get sample rate of a2dp sbc config.

Parameters
sbc_codecThe a2dp sbc parameter.
Returns
the sample rate.