Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0bbf394f authored by shihchienc's avatar shihchienc
Browse files

[HFP1.9] Add LC3 SCO Parameters

Add LC3 codec and related parameters on eSCO.

Tag: #feature
Bug: 277338500
Test: manual
Change-Id: I51013540b5e9d39ceed6d20889f0d179124dc04f
parent 10e396c9
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ typedef enum {
  SCO_CODEC_NONE = 0x0000,
  SCO_CODEC_CVSD = 0x0001,
  SCO_CODEC_MSBC = 0x0002,
  SCO_CODEC_LC3 = 0x0003,
} sco_codec_t;

typedef enum {
@@ -35,9 +36,11 @@ typedef enum {
  ESCO_CODEC_CVSD_S4,
  ESCO_CODEC_MSBC_T1,
  ESCO_CODEC_MSBC_T2,
  ESCO_CODEC_LC3_T1,
  ESCO_CODEC_LC3_T2,
} esco_codec_t;

#define ESCO_NUM_CODECS 5
#define ESCO_NUM_CODECS 7

// Coding Formats (BT 4.1 or later Assigned numbers)
#define ESCO_CODING_FORMAT_ULAW ((uint8_t)0x00)     /* u-Law log    */
@@ -46,6 +49,7 @@ typedef enum {
#define ESCO_CODING_FORMAT_TRANSPNT ((uint8_t)0x03) /* Transparent  */
#define ESCO_CODING_FORMAT_LINEAR ((uint8_t)0x04)   /* Linear PCM   */
#define ESCO_CODING_FORMAT_MSBC ((uint8_t)0x05)     /* MSBC PCM   */
#define ESCO_CODING_FORMAT_LC3 ((uint8_t)0x06)      /* LC3 PCM   */
#define ESCO_CODING_FORMAT_VS ((uint8_t)0xFF)       /* Specifies VSC used */
typedef uint8_t esco_coding_format_t;

@@ -70,6 +74,7 @@ typedef uint32_t esco_txrx_bandwidth_t;

#define INPUT_OUTPUT_64K_RATE 0x00003E80  /* 16000 Bytes/sec over transport */
#define INPUT_OUTPUT_128K_RATE 0x00007D00 /* 32000 Bytes/sec over transport */
#define INPUT_OUTPUT_256K_RATE 0x0000FA00 /* 64000 Bytes/sec over transport */
typedef uint32_t esco_io_bandwidth_t;

// Retransmission effort
+73 −0
Original line number Diff line number Diff line
@@ -209,6 +209,79 @@ static const enh_esco_params_t default_esco_parameters[ESCO_NUM_CODECS] = {
             ESCO_PKT_TYPES_MASK_NO_2_EV5 | ESCO_PKT_TYPES_MASK_NO_3_EV5),
        .retransmission_effort = ESCO_RETRANSMISSION_QUALITY,
    },
    // LC3 T1
    {
        .transmit_bandwidth = TXRX_64KBITS_RATE,
        .receive_bandwidth = TXRX_64KBITS_RATE,
        .transmit_coding_format = {.coding_format = ESCO_CODING_FORMAT_LC3,
                                   .company_id = 0x0000,
                                   .vendor_specific_codec_id = 0x0000},
        .receive_coding_format = {.coding_format = ESCO_CODING_FORMAT_LC3,
                                  .company_id = 0x0000,
                                  .vendor_specific_codec_id = 0x0000},
        .transmit_codec_frame_size = 60,
        .receive_codec_frame_size = 60,
        .input_bandwidth = INPUT_OUTPUT_256K_RATE,
        .output_bandwidth = INPUT_OUTPUT_256K_RATE,
        .input_coding_format = {.coding_format = ESCO_CODING_FORMAT_LINEAR,
                                .company_id = 0x0000,
                                .vendor_specific_codec_id = 0x0000},
        .output_coding_format = {.coding_format = ESCO_CODING_FORMAT_LINEAR,
                                 .company_id = 0x0000,
                                 .vendor_specific_codec_id = 0x0000},
        .input_coded_data_size = 16,
        .output_coded_data_size = 16,
        .input_pcm_data_format = ESCO_PCM_DATA_FORMAT_2_COMP,
        .output_pcm_data_format = ESCO_PCM_DATA_FORMAT_2_COMP,
        .input_pcm_payload_msb_position = 0,
        .output_pcm_payload_msb_position = 0,
        .input_data_path = ESCO_DATA_PATH_PCM,
        .output_data_path = ESCO_DATA_PATH_PCM,
        .input_transport_unit_size = 0x00,
        .output_transport_unit_size = 0x00,
        .max_latency_ms = 8,
        .packet_types =
            (ESCO_PKT_TYPES_MASK_EV3 | ESCO_PKT_TYPES_MASK_NO_3_EV3 |
             ESCO_PKT_TYPES_MASK_NO_2_EV5 | ESCO_PKT_TYPES_MASK_NO_3_EV5 |
             ESCO_PKT_TYPES_MASK_NO_2_EV3),
        .retransmission_effort = ESCO_RETRANSMISSION_QUALITY,
    },
    // LC3 T2
    {
        .transmit_bandwidth = TXRX_64KBITS_RATE,
        .receive_bandwidth = TXRX_64KBITS_RATE,
        .transmit_coding_format = {.coding_format = ESCO_CODING_FORMAT_LC3,
                                   .company_id = 0x0000,
                                   .vendor_specific_codec_id = 0x0000},
        .receive_coding_format = {.coding_format = ESCO_CODING_FORMAT_LC3,
                                  .company_id = 0x0000,
                                  .vendor_specific_codec_id = 0x0000},
        .transmit_codec_frame_size = 60,
        .receive_codec_frame_size = 60,
        .input_bandwidth = INPUT_OUTPUT_256K_RATE,
        .output_bandwidth = INPUT_OUTPUT_256K_RATE,
        .input_coding_format = {.coding_format = ESCO_CODING_FORMAT_LINEAR,
                                .company_id = 0x0000,
                                .vendor_specific_codec_id = 0x0000},
        .output_coding_format = {.coding_format = ESCO_CODING_FORMAT_LINEAR,
                                 .company_id = 0x0000,
                                 .vendor_specific_codec_id = 0x0000},
        .input_coded_data_size = 16,
        .output_coded_data_size = 16,
        .input_pcm_data_format = ESCO_PCM_DATA_FORMAT_2_COMP,
        .output_pcm_data_format = ESCO_PCM_DATA_FORMAT_2_COMP,
        .input_pcm_payload_msb_position = 0,
        .output_pcm_payload_msb_position = 0,
        .input_data_path = ESCO_DATA_PATH_PCM,
        .output_data_path = ESCO_DATA_PATH_PCM,
        .input_transport_unit_size = 0x00,
        .output_transport_unit_size = 0x00,
        .max_latency_ms = 13,
        .packet_types =
            (ESCO_PKT_TYPES_MASK_NO_3_EV3 | ESCO_PKT_TYPES_MASK_NO_2_EV5 |
             ESCO_PKT_TYPES_MASK_NO_3_EV5),
        .retransmission_effort = ESCO_RETRANSMISSION_QUALITY,
    },
};

enh_esco_params_t esco_parameters_for_codec(esco_codec_t codec, bool offload) {