21#ifndef ZEPHYR_INCLUDE_BLUETOOTH_A2DP_CODEC_H_ 
   22#define ZEPHYR_INCLUDE_BLUETOOTH_A2DP_CODEC_H_ 
   29#define A2DP_SBC_SAMP_FREQ_16000 BIT(7) 
   30#define A2DP_SBC_SAMP_FREQ_32000 BIT(6) 
   31#define A2DP_SBC_SAMP_FREQ_44100 BIT(5) 
   32#define A2DP_SBC_SAMP_FREQ_48000 BIT(4) 
   35#define A2DP_SBC_CH_MODE_MONO   BIT(3) 
   36#define A2DP_SBC_CH_MODE_DUAL   BIT(2) 
   37#define A2DP_SBC_CH_MODE_STEREO BIT(1) 
   38#define A2DP_SBC_CH_MODE_JOINT  BIT(0) 
   41#define A2DP_SBC_BLK_LEN_4  BIT(7) 
   42#define A2DP_SBC_BLK_LEN_8  BIT(6) 
   43#define A2DP_SBC_BLK_LEN_12 BIT(5) 
   44#define A2DP_SBC_BLK_LEN_16 BIT(4) 
   47#define A2DP_SBC_SUBBAND_4 BIT(3) 
   48#define A2DP_SBC_SUBBAND_8 BIT(2) 
   51#define A2DP_SBC_ALLOC_MTHD_SNR      BIT(1) 
   52#define A2DP_SBC_ALLOC_MTHD_LOUDNESS BIT(0) 
   54#define BT_A2DP_SBC_SAMP_FREQ(cap)    ((cap->config[0] >> 4) & 0x0f) 
   55#define BT_A2DP_SBC_CHAN_MODE(cap)    ((cap->config[0]) & 0x0f) 
   56#define BT_A2DP_SBC_BLK_LEN(cap)      ((cap->config[1] >> 4) & 0x0f) 
   57#define BT_A2DP_SBC_SUB_BAND(cap)     ((cap->config[1] >> 2) & 0x03) 
   58#define BT_A2DP_SBC_ALLOC_MTHD(cap)   ((cap->config[1]) & 0x03) 
   59#define BT_A2DP_SBC_MIN_BITPOOL_VALUE  2 
   60#define BT_A2DP_SBC_MAX_BITPOOL_VALUE  250 
   77#define BT_A2DP_SBC_MEDIA_HDR_NUM_FRAMES_GET(hdr) FIELD_GET(GENMASK(3, 0), (hdr)) 
   79#define BT_A2DP_SBC_MEDIA_HDR_L_GET(hdr)          FIELD_GET(BIT(5), (hdr)) 
   81#define BT_A2DP_SBC_MEDIA_HDR_S_GET(hdr)          FIELD_GET(BIT(6), (hdr)) 
   83#define BT_A2DP_SBC_MEDIA_HDR_F_GET(hdr)          FIELD_GET(BIT(7), (hdr)) 
   90#define BT_A2DP_SBC_MEDIA_HDR_NUM_FRAMES_SET(hdr, val)\ 
   91        hdr = ((hdr) & ~GENMASK(3, 0)) | FIELD_PREP(GENMASK(3, 0), (val)) 
 
   93#define BT_A2DP_SBC_MEDIA_HDR_L_SET(hdr, val)\ 
   94        hdr = ((hdr) & ~BIT(5)) | FIELD_PREP(BIT(5), (val)) 
 
   96#define BT_A2DP_SBC_MEDIA_HDR_S_SET(hdr, val)\ 
   97        hdr = ((hdr) & ~BIT(6)) | FIELD_PREP(BIT(6), (val)) 
 
   99#define BT_A2DP_SBC_MEDIA_HDR_F_SET(hdr, val)\ 
  100        hdr = ((hdr) & ~BIT(7)) | FIELD_PREP(BIT(7), (val)) 
 
  102#define BT_A2DP_SBC_MEDIA_HDR_ENCODE(num_frames, l, s, f)\ 
  103        FIELD_PREP(GENMASK(3, 0), num_frames) | FIELD_PREP(BIT(5), l) |\ 
  104        FIELD_PREP(BIT(6), s) | FIELD_PREP(BIT(7), f) 
 
uint32_t bt_a2dp_sbc_get_sampling_frequency(struct bt_a2dp_codec_sbc_params *sbc_codec)
get sample rate of a2dp sbc config.
uint8_t bt_a2dp_sbc_get_channel_num(struct bt_a2dp_codec_sbc_params *sbc_codec)
get channel num of a2dp sbc config.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
SBC Codec.
Definition a2dp_codec_sbc.h:63
uint8_t min_bitpool
Minimum Bitpool Value.
Definition a2dp_codec_sbc.h:67
uint8_t max_bitpool
Maximum Bitpool Value.
Definition a2dp_codec_sbc.h:69
uint8_t config[2]
First two octets of configuration.
Definition a2dp_codec_sbc.h:65