Compare commits

..

No commits in common. "custom-buttons" and "main" have entirely different histories.

18 changed files with 389 additions and 705 deletions

View file

@ -17,17 +17,11 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Build images
id: build
uses: redhat-actions/buildah-build@v2
with:
image: ${{ github.repository }}
platforms: linux/amd64, linux/arm64
context: /
tags: ${{ contains(github.ref_name, 'main') && 'latest' || github.ref_name }}-sdk
containerfiles: /Dockerfile

View file

@ -12,6 +12,6 @@ jobs:
run: cd /usr/src/ && ./build.sh || cat /usr/src/log.txt
- name: Archive produced firmware
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
path: /usr/src/out/open_source/open_source.bin

View file

@ -41,11 +41,6 @@ RUN apt-get update \
&& curl \
https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/9-2019q4/gcc-arm-none-eabi-9-2019-q4-major-$(arch)-linux.tar.bz2 | tar -xj -C /src/
RUN apt-get update \
&& apt-get install -y \
minicom \
sudo
ENV PATH="${PATH}:/src/gcc-arm-none-eabi-9-2019-q4-major/bin"
COPY --from=rust_build /usr/src/bestool/bestool/target/release/bestool /usr/local/bin/bestool
COPY . /usr/src

View file

@ -25,7 +25,6 @@ endif
ifeq ($(ANC_ASSIST_ENABLED),1)
CFLAGS_app_anc.o += -DANC_ASSIST_ENABLED
CFLAGS_anc_assist.o += -DANC_ASSIST_ENABLED
ifeq ($(ANC_ASSIST_WNR_ENABLED),1)
CFLAGS_anc_assist.o += -DANC_ASSIST_WNR_ENABLED

View file

@ -47,8 +47,8 @@
#endif
#include "co_math.h"
// #define ANC_MODE_SWITCH_WITHOUT_FADE //Comment this line if you need fade
// function between anc mode
//#define ANC_MODE_SWITCH_WITHOUT_FADE //Comment this line if you need fade
// function between anc mode
#ifndef _ANC_FADE_STACK_SIZE
#define _ANC_FADE_STACK_SIZE (1 * 1024)
@ -1060,41 +1060,31 @@ void app_anc_open_anc(void) {
capture_rate = anc_sample_rate[AUD_STREAM_CAPTURE];
pmu_anc_config(1);
int result = 0;
#ifdef ANC_FF_ENABLED
result = af_anc_open(ANC_FEEDFORWARD, playback_rate, capture_rate, handler);
TRACE(2, "af_anc_open %s %d -> %d\n", __FUNCTION__, __LINE__, result);
result = anc_open(ANC_FEEDFORWARD);
TRACE(2, "anc_open %s %d -> %d\n", __FUNCTION__, __LINE__, result);
result = anc_select_coef(anc_sample_rate[AUD_STREAM_PLAYBACK], anc_coef_idx,
ANC_FEEDFORWARD, ANC_GAIN_DELAY);
TRACE(2, "anc_select_coef %s %d -> %d\n", __FUNCTION__, __LINE__, result);
af_anc_open(ANC_FEEDFORWARD, playback_rate, capture_rate, handler);
anc_open(ANC_FEEDFORWARD);
anc_select_coef(anc_sample_rate[AUD_STREAM_PLAYBACK], anc_coef_idx,
ANC_FEEDFORWARD, ANC_GAIN_DELAY);
#endif
#ifdef ANC_FB_ENABLED
result = af_anc_open(ANC_FEEDBACK, playback_rate, capture_rate, handler);
TRACE(2, "anc_open %s %d -> %d\n", __FUNCTION__, __LINE__, result);
result = anc_open(ANC_FEEDBACK);
TRACE(2, "anc_open %s %d -> %d\n", __FUNCTION__, __LINE__, result);
result = anc_select_coef(anc_sample_rate[AUD_STREAM_PLAYBACK], anc_coef_idx,
ANC_FEEDBACK, ANC_GAIN_DELAY);
TRACE(2, "anc_select_coef %s %d -> %d\n", __FUNCTION__, __LINE__, result);
af_anc_open(ANC_FEEDBACK, playback_rate, capture_rate, handler);
anc_open(ANC_FEEDBACK);
anc_select_coef(anc_sample_rate[AUD_STREAM_PLAYBACK], anc_coef_idx,
ANC_FEEDBACK, ANC_GAIN_DELAY);
#endif
#ifdef AUDIO_ANC_FB_MC_HW
result = anc_open(ANC_MUSICCANCLE);
TRACE(2, "anc_open %s %d -> %d\n", __FUNCTION__, __LINE__, result);
result = anc_select_coef(anc_sample_rate[AUD_STREAM_PLAYBACK], anc_coef_idx,
ANC_MUSICCANCLE, ANC_GAIN_NO_DELAY);
TRACE(2, "anc_select_coef %s %d -> %d\n", __FUNCTION__, __LINE__, result);
anc_open(ANC_MUSICCANCLE);
anc_select_coef(anc_sample_rate[AUD_STREAM_PLAYBACK], anc_coef_idx,
ANC_MUSICCANCLE, ANC_GAIN_NO_DELAY);
#endif
#if defined(AUDIO_ANC_TT_HW)
anc_open(ANC_TALKTHRU);
TRACE(2, "anc_open %s %d -> %d\n", __FUNCTION__, __LINE__, result);
result = anc_select_coef(anc_sample_rate[AUD_STREAM_PLAYBACK], anc_coef_idx,
ANC_TALKTHRU, ANC_GAIN_NO_DELAY);
TRACE(2, "anc_select_coef %s %d -> %d\n", __FUNCTION__, __LINE__, result);
anc_select_coef(anc_sample_rate[AUD_STREAM_PLAYBACK], anc_coef_idx,
ANC_TALKTHRU, ANC_GAIN_NO_DELAY);
#endif
#ifdef AUDIO_ANC_FB_MC_HW
@ -1531,6 +1521,13 @@ void app_anc_key(APP_KEY_STATUS *status, void *param) {
bool flag = app_anc_work_status();
#if defined(IBRT)
ibrt_ctrl_t *p_ibrt_ctrl = app_tws_ibrt_get_bt_ctrl_ctx();
TRACE(2, "[%s] current_role: %d", __func__, p_ibrt_ctrl->current_role);
if (p_ibrt_ctrl->current_role == IBRT_SLAVE) {
app_anc_notify_master_to_exchange_coef(0, 0);
return;
}
app_anc_status_sync(!flag);
#endif
app_anc_status_post(!flag);

View file

@ -118,12 +118,6 @@ void send_prev_track(void) {
uint8_t action[] = {IBRT_ACTION_BACKWARD};
app_ibrt_if_start_user_action(action, sizeof(action));
}
void send_enable_disable_anc(void) {
uint8_t action[] = {IBRT_ACTION_ANC_NOTIRY_MASTER_EXCHANGE_COEF};
app_ibrt_if_start_user_action(action, sizeof(action));
}
void app_key_single_tap(APP_KEY_STATUS *status, void *param) {
TRACE(2, "%s event %d", __func__, status->event);
@ -150,17 +144,17 @@ void app_key_double_tap(APP_KEY_STATUS *status, void *param) {
if (!app_tws_ibrt_tws_link_connected()) {
// No other bud paired
TRACE(0, "Handling %s in single bud mode", __func__);
send_vol_down();
send_next_track();
} else {
// Bud's are working as a pair
if (app_tws_is_left_side()) {
TRACE(0, "Handling %s as left bud", __func__);
// Lefty
send_vol_down();
send_prev_track();
} else {
TRACE(0, "Handling %s as right bud", __func__);
// Righty
send_vol_up();
send_next_track();
}
}
}
@ -172,7 +166,7 @@ void app_key_triple_tap(APP_KEY_STATUS *status, void *param) {
// No other bud paired
TRACE(0, "Handling %s in single bud mode", __func__);
send_vol_up();
}/* else {
} else {
// Bud's are working as a pair
if (app_tws_is_left_side()) {
TRACE(0, "Handling %s as left bud", __func__);
@ -183,9 +177,9 @@ void app_key_triple_tap(APP_KEY_STATUS *status, void *param) {
// Righty
send_vol_up();
}
}*/
}
}
/*void app_key_quad_tap(APP_KEY_STATUS *status, void *param) {
void app_key_quad_tap(APP_KEY_STATUS *status, void *param) {
TRACE(2, "%s event %d", __func__, status->event);
if (!app_tws_ibrt_tws_link_connected()) {
@ -202,7 +196,7 @@ void app_key_triple_tap(APP_KEY_STATUS *status, void *param) {
// Righty
}
}
}*/
}
void app_key_long_press_down(APP_KEY_STATUS *status, void *param) {
TRACE(2, "%s event %d", __func__, status->event);
@ -210,10 +204,10 @@ void app_key_long_press_down(APP_KEY_STATUS *status, void *param) {
if (!app_tws_ibrt_tws_link_connected()) {
// No other bud paired
TRACE(0, "Handling %s in single bud mode", __func__);
//send_prev_track();
send_prev_track();
} else {
// Bud's are working as a pair
send_enable_disable_anc();
app_anc_key(status, param);
}
}
@ -237,10 +231,10 @@ void app_key_init(void) {
"",
app_key_triple_tap,
NULL},
/*{{APP_KEY_CODE_PWR, APP_KEY_EVENT_ULTRACLICK},
{{APP_KEY_CODE_PWR, APP_KEY_EVENT_ULTRACLICK},
"",
app_key_quad_tap,
NULL},*/
NULL},
{{APP_KEY_CODE_PWR, APP_KEY_EVENT_LONGPRESS},
"",
app_key_long_press_down,
@ -274,4 +268,4 @@ void app_key_init_on_charging(void) {
for (i = 0; i < (sizeof(key_cfg) / sizeof(APP_KEY_HANDLE)); i++) {
app_key_handle_registration(&key_cfg[i]);
}
}
}

View file

@ -7,13 +7,9 @@ MBED ?= 0
RTOS ?= 1
#KERNEL ?= FREERTOS
# We have powerkey input
NO_PWRKEY = 0
LIBC_ROM ?= 1
# Extas added by Open source community
CONNECTED_BLUE_LIGHT = 1 # if set to 1, the blue light will flash when connected
# end our extras
NO_PWRKEY = 0 # We have powerkey input
LIBC_ROM ?= 1
export USER_SECURE_BOOT ?= 0
# enable:1
@ -58,38 +54,25 @@ export BT_DEBUG_TPORTS ?= 0
TPORTS_KEY_COEXIST ?= 0
export SNIFF_MODE_CHECK ?= 0
# Merge L+R stream down to mono
AUDIO_OUTPUT_MONO ?= 0
AUDIO_OUTPUT_DIFF ?= 0
# Raise mic bias from 2.2V to 3.3V
DIGMIC_HIGH_VOLT ?= 0
#### ANC DEFINE START ######
export ANC_APP ?= 1
# Feed Forward ANC configuration (external mic)
export ANC_FF_ENABLED ?= 1
# Feed Backward ANC configuration (internal mic)
export ANC_FB_ENABLED ?= 1
# Wind noise reduction mode
export ANC_WNR_ENABLED ?= 0
# Music cancel mode. Conflicts with audio resampling
export AUDIO_ANC_FB_MC ?= 0
export AUDIO_SECTION_SUPPT ?= 0
export AUD_SECTION_STRUCT_VERSION ?= 2
# Music cancel hardware?
export AUDIO_ANC_FB_MC_HW ?=0
export APP_ANC_KEY ?= 1
# Feedback check for feedforward mic. Locked on due to blobs
export ANC_FB_CHECK ?= 1
# Build in ANC testing app (closed source)
APP_ANC_TEST ?= 0
export ANC_ASSIST_ENABLED ?= 0
##### ANC DEFINE END ######
# Allow test commands via bluetooth
APP_ANC_TEST ?= 0
TEST_OVER_THE_AIR ?= 0
HW_FIR_EQ_PROCESS ?= 0
@ -110,7 +93,7 @@ PC_CMD_UART ?= 0
AUDIO_SECTION_ENABLE ?= 0
AUDIO_RESAMPLE ?= 0
AUDIO_RESAMPLE ?= 1
RESAMPLE_ANY_SAMPLE_RATE ?= 1
@ -223,8 +206,8 @@ TILE_DATAPATH_ENABLED ?= 0
CUSTOM_INFORMATION_TILE_ENABLE ?= 0
INTERCONNECTION ?= 0
# Looks like Find-My-Device support?
INTERACTION ?= 0
INTERACTION ?= 0 # Looks like Find-My-Device support?
INTERACTION_FASTPAIR ?= 0
@ -245,7 +228,7 @@ A2DP_LHDC_LARC ?= 1
export FLASH_UNIQUE_ID ?= 1
endif
A2DP_LDAC_ON ?= 1
A2DP_LDAC_ON ?= 0
export TX_RX_PCM_MASK ?= 0
@ -360,8 +343,6 @@ export BT_EXT_PA ?=0
ifeq ($(A2DP_LHDC_ON),1)
AUDIO_BUFFER_SIZE := 140*1024
else ifeq ($(A2DP_LDAC_ON),1)
AUDIO_BUFFER_SIZE := 140*1024
else
AUDIO_BUFFER_SIZE := 100*1024
endif

View file

@ -104,7 +104,7 @@ const struct HAL_KEY_GPIOKEY_CFG_T cfg_hw_gpio_key_cfg[CFG_HW_GPIOKEY_NUM] = {
// bt config
// const char *BT_LOCAL_NAME = TO_STRING(BT_DEV_NAME) "\0";
const char *BT_LOCAL_NAME = "PineBuds Pro";
const char *BLE_DEFAULT_NAME = "PineBuds Pro BLE";
const char *BLE_DEFAULT_NAME = "BES_BLE";
uint8_t ble_addr[6] = {
#ifdef BLE_DEV_ADDR
BLE_DEV_ADDR
@ -122,7 +122,6 @@ uint8_t bt_addr[6] = {
#endif
};
/// True Wireless side configuration using resistor fitment
const struct HAL_IOMUX_PIN_FUNCTION_MAP cfg_hw_tws_channel_cfg = {
HAL_IOMUX_PIN_P1_4, HAL_IOMUX_FUNC_AS_GPIO, HAL_IOMUX_PIN_VOLTAGE_VIO,
HAL_IOMUX_PIN_PULLUP_ENABLE};
@ -160,22 +159,21 @@ const struct CODEC_DAC_VOL_T codec_dac_vol[TGT_VOLUME_LEVEL_QTY] = {
{TX_PA_GAIN, 0x03, -3}, {TX_PA_GAIN, 0x03, 0}, // 0dBm
};
// MIC and channel configurations
// Pinebuds pro have the following mic's and biases
/*
* User Voice (Talking) = MIC5 input and VMIC3 Bias
* ANC Feed Forward = MIC1 input and VMIC2 Bias
* ANC Feed Backward = MIC3 input and VMIC2 Bias
*
* Note that AUD_CHANNEL_MAP is offset by 1 (0 start)
*/
#define USER_TALK_MIC AUD_CHANNEL_MAP_CH4
#define USER_TALK_VMIC_CFG AUD_VMIC_MAP_VMIC3
#define CFG_HW_AUD_INPUT_PATH_MAINMIC_DEV (USER_TALK_MIC | USER_TALK_VMIC_CFG)
#if SPEECH_CODEC_CAPTURE_CHANNEL_NUM == 2
#define CFG_HW_AUD_INPUT_PATH_MAINMIC_DEV \
(AUD_CHANNEL_MAP_CH0 | AUD_CHANNEL_MAP_CH4 | AUD_VMIC_MAP_VMIC2 | \
AUD_VMIC_MAP_VMIC3)
#elif SPEECH_CODEC_CAPTURE_CHANNEL_NUM == 3
#define CFG_HW_AUD_INPUT_PATH_MAINMIC_DEV \
(AUD_CHANNEL_MAP_CH0 | AUD_CHANNEL_MAP_CH1 | AUD_CHANNEL_MAP_CH4 | \
AUD_VMIC_MAP_VMIC1)
#else
#define CFG_HW_AUD_INPUT_PATH_MAINMIC_DEV \
(AUD_CHANNEL_MAP_CH4 | AUD_VMIC_MAP_VMIC3)
#endif
#define CFG_HW_AUD_INPUT_PATH_LINEIN_DEV \
(AUD_CHANNEL_MAP_CH0 | AUD_CHANNEL_MAP_CH1)
#ifdef VOICE_DETECTOR_EN
#define CFG_HW_AUD_INPUT_PATH_VADMIC_DEV \
(AUD_CHANNEL_MAP_CH4 | AUD_VMIC_MAP_VMIC1)
@ -186,23 +184,32 @@ const struct CODEC_DAC_VOL_T codec_dac_vol[TGT_VOLUME_LEVEL_QTY] = {
const struct AUD_IO_PATH_CFG_T
cfg_audio_input_path_cfg[CFG_HW_AUD_INPUT_PATH_NUM] = {
#if defined(SPEECH_TX_AEC_CODEC_REF)
// NOTE: If enable Ch5 and CH6, need to add channel_num when setup
// audioflinger stream
{
AUD_INPUT_PATH_MAINMIC,
CFG_HW_AUD_INPUT_PATH_MAINMIC_DEV | AUD_CHANNEL_MAP_CH4,
},
#else
{
AUD_INPUT_PATH_MAINMIC,
CFG_HW_AUD_INPUT_PATH_MAINMIC_DEV,
},
#endif
{
AUD_INPUT_PATH_LINEIN,
CFG_HW_AUD_INPUT_PATH_MAINMIC_DEV,
CFG_HW_AUD_INPUT_PATH_LINEIN_DEV,
},
#ifdef VOICE_DETECTOR_EN
{
AUD_INPUT_PATH_VADMIC,
CFG_HW_AUD_INPUT_PATH_MAINMIC_DEV,
CFG_HW_AUD_INPUT_PATH_VADMIC_DEV,
},
#else
{
AUD_INPUT_PATH_ASRMIC,
CFG_HW_AUD_INPUT_PATH_MAINMIC_DEV,
CFG_HW_AUD_INPUT_PATH_ASRMIC_DEV,
},
#endif
};
@ -226,18 +233,28 @@ HAL_IOMUX_PIN_PULLUP_ENABLE
};
*/
#define IIR_COUNTER_FF_L (8)
#define IIR_COUNTER_FF_R (8)
#define IIR_COUNTER_FB_L (6)
#define IIR_COUNTER_FB_R (6)
// const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_I2C_SDA ={
// HAL_IOMUX_PIN_P2_1, HAL_IOMUX_FUNC_AS_GPIO, HAL_IOMUX_PIN_VOLTAGE_VIO,
// HAL_IOMUX_PIN_PULLUP_ENABLE
// };
// const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_I2C_SCL ={
// HAL_IOMUX_PIN_P2_0, HAL_IOMUX_FUNC_AS_GPIO, HAL_IOMUX_PIN_VOLTAGE_VIO,
// HAL_IOMUX_PIN_PULLUP_ENABLE
// };
#define IIR_COUNTER_FF_L (6)
#define IIR_COUNTER_FF_R (6)
#define IIR_COUNTER_FB_L (5)
#define IIR_COUNTER_FB_R (5)
static const struct_anc_cfg POSSIBLY_UNUSED
AncFirCoef_50p7k_mode0 =
{
.anc_cfg_ff_l =
{
.total_gain = 440,
// .total_gain = 350,
// .total_gain = 440,
.total_gain = 350,
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FF_L,
@ -268,12 +285,12 @@ static const struct_anc_cfg POSSIBLY_UNUSED
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (2) * 4,
.adc_gain_offset = (0) * 4,
},
.anc_cfg_ff_r =
{
.total_gain = 382,
// .total_gain = 350,
// .total_gain = 382,
.total_gain = 350,
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FF_R,
@ -304,7 +321,7 @@ static const struct_anc_cfg POSSIBLY_UNUSED
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (2) * 4,
.adc_gain_offset = (0) * 4,
},
/*
@ -358,7 +375,7 @@ static const struct_anc_cfg POSSIBLY_UNUSED
*/
.dac_gain_offset = 0,
.adc_gain_offset = (2) * 4,
.adc_gain_offset = (0) * 4,
},
.anc_cfg_fb_r =
{
@ -393,51 +410,75 @@ static const struct_anc_cfg POSSIBLY_UNUSED
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (2) * 4,
.adc_gain_offset = (0) * 4,
},
};
/*
//ff
Filter1_B=[ 42463913, -84860822, 42396935];
Filter1_A=[ 134217728, -268353516, 134135801];
Filter2_B=[ 136002894, -267154076, 131168209];
Filter2_A=[ 134217728, -267154076, 132953376];
Filter3_B=[ 132863566, -263674901, 130888668];
Filter3_A=[ 134217728, -263674901, 129534506];
Filter4_B=[ 131621817, -256639526, 125746382];
Filter4_A=[ 134217728, -256639526, 123150471];
*/
static const struct_anc_cfg POSSIBLY_UNUSED
AncFirCoef_48k_mode0 =
{
.anc_cfg_ff_l =
{
.total_gain = 302,
// .total_gain = 312,
// .total_gain = 440,
.total_gain = 312,
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FF_L,
.iir_coef[0].coef_b = {47756600, -94784525, 47030952},
.iir_coef[0].coef_a = {134217728, -267141655, 132927324},
.iir_coef[0].coef_b = {42463913, -84860822, 42396935},
.iir_coef[0].coef_a = {134217728, -268353516, 134135801},
.iir_coef[1].coef_b = {95026235, -189959646, 94933615},
.iir_coef[1].coef_a = {134217728, -268325174, 134107649},
.iir_coef[1].coef_b = {136002894, -267154076, 131168209},
.iir_coef[1].coef_a = {134217728, -267154076, 132953376},
.iir_coef[2].coef_b = {137182418, -258280236, 121193611},
.iir_coef[2].coef_a = {134217728, -258309065, 124129473},
.iir_coef[2].coef_b = {132863566, -263674901, 130888668},
.iir_coef[2].coef_a = {134217728, -263674901, 129534506},
.iir_coef[3].coef_b = {119863779, -218243094, 100875648},
.iir_coef[3].coef_a = {134217728, -218243094, 86521699},
.iir_coef[3].coef_b = {131621817, -256639526, 125746382},
.iir_coef[3].coef_a = {134217728, -256639526, 123150471},
.iir_coef[4].coef_b = {118677290, -210108781, 98119610},
.iir_coef[4].coef_a = {134217728, -210108781, 82579171},
.iir_coef[4].coef_b = {0x8000000, 0, 0},
.iir_coef[4].coef_a = {0x8000000, 0, 0},
.iir_coef[5].coef_b = {133493787, -264941439, 131633425},
.iir_coef[5].coef_a = {134217728, -264941439, 130909484},
.iir_coef[6].coef_b = {134779906, -266962984, 132210881},
.iir_coef[6].coef_a = {134217728, -266962984, 132773059},
.iir_coef[7].coef_b = {134235269, -268350403, 134115242},
.iir_coef[7].coef_a = {134217728, -268350430, 134132755},
.iir_coef[5].coef_b = {0x8000000, 0, 0},
.iir_coef[5].coef_a = {0x8000000, 0, 0},
/* .fir_bypass_flag=1,
.fir_len = AUD_COEF_LEN,
.fir_coef =
{
32767,
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = -24,
.adc_gain_offset = (0) * 4,
},
.anc_cfg_ff_r =
{
.total_gain = 382,
// .total_gain = 288,
// .total_gain = 382,
.total_gain = 288,
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FF_R,
@ -467,36 +508,60 @@ static const struct_anc_cfg POSSIBLY_UNUSED
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (2) * 4,
.adc_gain_offset = (0) * 4,
},
/*
Filter1_B=[ 27172676, -53803459, 26691412];
Filter1_A=[ 134217728, -214195429, 80219070];
Filter2_B=[ 138529480, -267551490, 129040578];
Filter2_A=[ 134217728, -267551490, 133352330];
Filter3_B=[ 134516353, -268162980, 133647489];
Filter3_A=[ 134217728, -268162980, 133946114];
Filter4_B=[ 133595549, -264581113, 131087955];
Filter4_A=[ 134217728, -264581113, 130465777];
*/
.anc_cfg_fb_l =
{
.total_gain = 512,
.total_gain = 511,
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FB_L,
.iir_coef[0].coef_b = {75662976, -150466868, 74809339},
.iir_coef[0].coef_a = {134217728, -267572133, 133364091},
.iir_coef[0].coef_b = {27172676, -53803459, 26691412},
.iir_coef[0].coef_a = {134217728, -214195429, 80219070},
.iir_coef[1].coef_b = {136259446, -267048746, 130806222},
.iir_coef[1].coef_a = {134217728, -267048746, 132847940},
.iir_coef[1].coef_b = {138529480, -267551490, 129040578},
.iir_coef[1].coef_a = {134217728, -267551490, 133352330},
.iir_coef[2].coef_b = {134365088, -267930698, 133570324},
.iir_coef[2].coef_a = {134217728, -267932117, 133716266},
.iir_coef[2].coef_b = {134516353, -268162980, 133647489},
.iir_coef[2].coef_a = {134217728, -268162980, 133946114},
.iir_coef[3].coef_b = {124587325, -241835594, 118126292},
.iir_coef[3].coef_a = {134217728, -241835594, 108495889},
.iir_coef[3].coef_b = {133595549, -264581113, 131087955},
.iir_coef[3].coef_a = {134217728, -264581113, 130465777},
.iir_coef[4].coef_b = {130235205, -255036797, 124966921},
.iir_coef[4].coef_a = {134217728, -255036797, 120984398},
.iir_coef[4].coef_b = {0x8000000, 0, 0},
.iir_coef[4].coef_a = {0x8000000, 0, 0},
.iir_coef[5].coef_b = {134327171, -268333985, 134007055},
.iir_coef[5].coef_a = {134217728, -268333985, 134116498},
.iir_coef[5].coef_b = {0x8000000, 0, 0},
.iir_coef[5].coef_a = {0x8000000, 0, 0},
/* .fir_bypass_flag=1,
.fir_len = AUD_COEF_LEN,
.fir_coef =
{
32767,
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = -24,
.adc_gain_offset = (0) * 4,
},
.anc_cfg_fb_r =
{
@ -531,7 +596,7 @@ static const struct_anc_cfg POSSIBLY_UNUSED
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (2) * 4,
.adc_gain_offset = (0) * 4,
},
#if (AUD_SECTION_STRUCT_VERSION == 2)
@ -610,7 +675,7 @@ static const struct_anc_cfg POSSIBLY_UNUSED
.iir_coef[5].coef_a = {0x8000000, 0, 0},
.dac_gain_offset = 0,
.adc_gain_offset = (2) * 4,
.adc_gain_offset = (0) * 4,
},
.anc_cfg_mc_r =
{
@ -638,321 +703,269 @@ static const struct_anc_cfg POSSIBLY_UNUSED
.iir_coef[5].coef_a = {0x8000000, 0, 0},
.dac_gain_offset = 0,
.adc_gain_offset = (2) * 4,
.adc_gain_offset = (0) * 4,
},
#endif
};
/*
//ff
Filter1_B=[ 42465729, -84858529, 42392831];
Filter1_A=[ 134217728, -268346271, 134128558];
Filter2_B=[ 136159949, -267039705, 130899919];
Filter2_A=[ 134217728, -267039705, 132842140];
Filter3_B=[ 132746107, -263254540, 130599907];
Filter3_A=[ 134217728, -263254540, 129128286];
Filter4_B=[ 131402980, -255575175, 125032243];
Filter4_A=[ 134217728, -255575175, 122217496];
*/
static const struct_anc_cfg POSSIBLY_UNUSED
AncFirCoef_44p1k_mode0 = {
.anc_cfg_ff_l =
{
.total_gain = 512,
// .total_gain = 312,
AncFirCoef_44p1k_mode0 =
{
.anc_cfg_ff_l =
{
// .total_gain = 440,
.total_gain = 312,
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FF_L,
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FF_L,
.iir_coef[0].coef_b = {47768463, -94743857, 46978979},
.iir_coef[0].coef_a = {134217728, -267027510, 132813804},
.iir_coef[0].coef_b = {42465729, -84858529, 42392831},
.iir_coef[0].coef_a = {134217728, -268346271, 134128558},
.iir_coef[1].coef_b = {95026887, -189952726, 94926080},
.iir_coef[1].coef_a = {134217728, -268315406, 134097919},
.iir_coef[1].coef_b = {136159949, -267039705, 130899919},
.iir_coef[1].coef_a = {134217728, -267039705, 132842140},
.iir_coef[2].coef_b = {137435276, -257412413, 120090247},
.iir_coef[2].coef_a = {134217728, -257446453, 123273755},
.iir_coef[2].coef_b = {132746107, -263254540, 130599907},
.iir_coef[2].coef_a = {134217728, -263254540, 129128286},
.iir_coef[3].coef_b = {118844778, -214442434, 98508661},
.iir_coef[3].coef_a = {134217728, -214442434, 83135711},
.iir_coef[3].coef_b = {131402980, -255575175, 125032243},
.iir_coef[3].coef_a = {134217728, -255575175, 122217496},
.iir_coef[4].coef_b = {117611223, -205468073, 95643298},
.iir_coef[4].coef_a = {134217728, -205468073, 79036793},
.iir_coef[4].coef_b = {0x8000000, 0, 0},
.iir_coef[4].coef_a = {0x8000000, 0, 0},
.iir_coef[5].coef_b = {133430657, -264618880, 131408063},
.iir_coef[5].coef_a = {134217728, -264618880, 130620992},
.iir_coef[5].coef_b = {0x8000000, 0, 0},
.iir_coef[5].coef_a = {0x8000000, 0, 0},
.iir_coef[6].coef_b = {134829328, -266830863, 132034457},
.iir_coef[6].coef_a = {134217728, -266830863, 132646057},
/* .fir_bypass_flag=1,
.fir_len = AUD_COEF_LEN,
.fir_coef =
{
32767,
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (0) * 4,
},
.anc_cfg_ff_r =
{
// .total_gain = 382,
.total_gain = 288,
.iir_coef[7].coef_b = {134236821, -268342876, 134106183},
.iir_coef[7].coef_a = {134217728, -268342908, 134125243},
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FF_R,
// .fir_bypass_flag = 0,
// .fir_len = AUD_COEF_LEN,
// .fir_coef =
// {
// 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, -6144, 0, 0, 0,
// 1, 0, 2048, -13511, -4060, -9831, 2011, 0,
// 2048, -13511, -4060, -9831, 2011, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, -6144, 512, 0, 0, 6, -14642,
// 1154, -18440, -2296, -26004, 1140, 0, 2048,
// 22833, -4082, -11362, 2033, -6957, 2081, 2958,
// -4073, 24038, 1991, 0, 2048, 2958, -4073,
// 17081, 2025, 29362, 2050, 25335, -4088, 16424,
// 2037, 0, 2048, 23654, -4088, -21431, 2039,
// 28309, 1889, 16812, -3657, 3193, 1783, 0, 2048,
// 16812, -3657, 31503, 1624, 9636, 1982, -13421,
// -3875, 2188, 1895, 0, 2048, -13421, -3875,
// 11824, 1829, -11954, 2049, -20607, -4095, -32689,
// 2044, 0, 2048, -20607, -4095, 20894, 2046, 0,
// 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, -6144, 0,
// 0, 0, 1, 0, 2048, -13511, -4060,
// -9831, 2011, 0, 2048, -13511, -4060, -9831,
// 2011, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0,
// },
.reserved_for_drc =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
},
.dac_gain_offset = 0,
.adc_gain_offset = -24,
},
.anc_cfg_ff_r =
{
.total_gain = 382,
// .total_gain = 288,
.iir_coef[0].coef_b = {42465729, -84858529, 42392831},
.iir_coef[0].coef_a = {134217728, -268346271, 134128558},
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FF_R,
.iir_coef[1].coef_b = {136159949, -267039705, 130899919},
.iir_coef[1].coef_a = {134217728, -267039705, 132842140},
.iir_coef[0].coef_b = {42465729, -84858529, 42392831},
.iir_coef[0].coef_a = {134217728, -268346271, 134128558},
.iir_coef[2].coef_b = {132746107, -263254540, 130599907},
.iir_coef[2].coef_a = {134217728, -263254540, 129128286},
.iir_coef[1].coef_b = {136159949, -267039705, 130899919},
.iir_coef[1].coef_a = {134217728, -267039705, 132842140},
.iir_coef[3].coef_b = {131402980, -255575175, 125032243},
.iir_coef[3].coef_a = {134217728, -255575175, 122217496},
.iir_coef[2].coef_b = {132746107, -263254540, 130599907},
.iir_coef[2].coef_a = {134217728, -263254540, 129128286},
.iir_coef[4].coef_b = {0x8000000, 0, 0},
.iir_coef[4].coef_a = {0x8000000, 0, 0},
.iir_coef[3].coef_b = {131402980, -255575175, 125032243},
.iir_coef[3].coef_a = {134217728, -255575175, 122217496},
.iir_coef[5].coef_b = {0x8000000, 0, 0},
.iir_coef[5].coef_a = {0x8000000, 0, 0},
.iir_coef[4].coef_b = {0x8000000, 0, 0},
.iir_coef[4].coef_a = {0x8000000, 0, 0},
/* .fir_bypass_flag=1,
.fir_len = AUD_COEF_LEN,
.fir_coef =
{
32767,
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (0) * 4,
},
.iir_coef[5].coef_b = {0x8000000, 0, 0},
.iir_coef[5].coef_a = {0x8000000, 0, 0},
/*
/* .fir_bypass_flag=1,
.fir_len = AUD_COEF_LEN,
.fir_coef =
{
32767,
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (2) * 4,
},
Filter1_B=[ 26719020, -52852829, 26204379];
Filter1_A=[ 134217728, -210410903, 76474119];
/*
Filter2_B=[ 138909433, -267471808, 128584365];
Filter2_A=[ 134217728, -267471808, 133276071];
Filter1_B=[ 26719020, -52852829, 26204379];
Filter1_A=[ 134217728, -210410903, 76474119];
Filter3_B=[ 134542733, -268138827, 133597115];
Filter3_A=[ 134217728, -268138827, 133922120];
Filter2_B=[ 138909433, -267471808, 128584365];
Filter2_A=[ 134217728, -267471808, 133276071];
Filter4_B=[ 133541379, -264235686, 130815458];
Filter4_A=[ 134217728, -264235686, 130139109];
Filter3_B=[ 134542733, -268138827, 133597115];
Filter3_A=[ 134217728, -268138827, 133922120];
*/
Filter4_B=[ 133541379, -264235686, 130815458];
Filter4_A=[ 134217728, -264235686, 130139109];
.anc_cfg_fb_l =
{
.total_gain = 511,
*/
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FB_L,
.anc_cfg_fb_l =
{
.total_gain = 512,
.iir_coef[0].coef_b = {26719020, -52852829, 26204379},
.iir_coef[0].coef_a = {134217728, -210410903, 76474119},
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FB_L,
.iir_coef[1].coef_b = {138909433, -267471808, 128584365},
.iir_coef[1].coef_a = {134217728, -267471808, 133276071},
.iir_coef[0].coef_b = {75679438, -150423560, 74750572},
.iir_coef[0].coef_a = {134217728, -267495119, 133288862},
.iir_coef[2].coef_b = {134542733, -268138827, 133597115},
.iir_coef[2].coef_a = {134217728, -268138827, 133922120},
.iir_coef[1].coef_b = {136438995, -266925170, 130506214},
.iir_coef[1].coef_a = {134217728, -266925170, 132727481},
.iir_coef[3].coef_b = {133541379, -264235686, 130815458},
.iir_coef[3].coef_a = {134217728, -264235686, 130139109},
.iir_coef[2].coef_b = {134378162, -267885833, 133513256},
.iir_coef[2].coef_a = {134217728, -267887514, 133672009},
.iir_coef[4].coef_b = {0x8000000, 0, 0},
.iir_coef[4].coef_a = {0x8000000, 0, 0},
.iir_coef[3].coef_b = {123825813, -239648340, 116853881},
.iir_coef[3].coef_a = {134217728, -239648340, 106461967},
.iir_coef[5].coef_b = {0x8000000, 0, 0},
.iir_coef[5].coef_a = {0x8000000, 0, 0},
.iir_coef[4].coef_b = {129901988, -253899885, 124192908},
.iir_coef[4].coef_a = {134217728, -253899885, 119877168},
/* .fir_bypass_flag=1,
.fir_len = AUD_COEF_LEN,
.fir_coef =
{
32767,
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (0) * 4,
},
.anc_cfg_fb_r =
{
.total_gain = 511,
.iir_coef[5].coef_b = {134336846, -268324991, 133988431},
.iir_coef[5].coef_a = {134217728, -268324991, 134107550},
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FB_R,
/* .fir_bypass_flag=1,
.fir_len = AUD_COEF_LEN,
.fir_coef =
{
32767,
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = -24,
},
.anc_cfg_fb_r =
{
.total_gain = 511,
.iir_coef[0].coef_b = {26719020, -52852829, 26204379},
.iir_coef[0].coef_a = {134217728, -210410903, 76474119},
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FB_R,
.iir_coef[1].coef_b = {138909433, -267471808, 128584365},
.iir_coef[1].coef_a = {134217728, -267471808, 133276071},
.iir_coef[0].coef_b = {26719020, -52852829, 26204379},
.iir_coef[0].coef_a = {134217728, -210410903, 76474119},
.iir_coef[2].coef_b = {134542733, -268138827, 133597115},
.iir_coef[2].coef_a = {134217728, -268138827, 133922120},
.iir_coef[1].coef_b = {138909433, -267471808, 128584365},
.iir_coef[1].coef_a = {134217728, -267471808, 133276071},
.iir_coef[3].coef_b = {133541379, -264235686, 130815458},
.iir_coef[3].coef_a = {134217728, -264235686, 130139109},
.iir_coef[2].coef_b = {134542733, -268138827, 133597115},
.iir_coef[2].coef_a = {134217728, -268138827, 133922120},
.iir_coef[4].coef_b = {0x8000000, 0, 0},
.iir_coef[4].coef_a = {0x8000000, 0, 0},
.iir_coef[3].coef_b = {133541379, -264235686, 130815458},
.iir_coef[3].coef_a = {134217728, -264235686, 130139109},
.iir_coef[5].coef_b = {0x8000000, 0, 0},
.iir_coef[5].coef_a = {0x8000000, 0, 0},
.iir_coef[4].coef_b = {0x8000000, 0, 0},
.iir_coef[4].coef_a = {0x8000000, 0, 0},
.iir_coef[5].coef_b = {0x8000000, 0, 0},
.iir_coef[5].coef_a = {0x8000000, 0, 0},
/* .fir_bypass_flag=1,
.fir_len = AUD_COEF_LEN,
.fir_coef =
{
32767,
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (2) * 4,
},
/* .fir_bypass_flag=1,
.fir_len = AUD_COEF_LEN,
.fir_coef =
{
32767,
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (0) * 4,
},
#if (AUD_SECTION_STRUCT_VERSION == 2)
/*
/*
Filter1_B=[ 19847881, -39594823, 19747071];
Filter1_A=[ 16777216, -33314517, 16538159];
Filter1_B=[ 19847881, -39594823, 19747071];
Filter1_A=[ 16777216, -33314517, 16538159];
Filter2_B=[ 9442890, -16603187, 7330251];
Filter2_A=[ 16777216, -16603187, -4075];
Filter2_B=[ 9442890, -16603187, 7330251];
Filter2_A=[ 16777216, -16603187, -4075];
Filter3_B=[ 18107639, -32779315, 14701642];
Filter3_A=[ 16777216, -32779315, 16032065];
Filter3_B=[ 18107639, -32779315, 14701642];
Filter3_A=[ 16777216, -32779315, 16032065];
Filter4_B=[ 12666347, -24058210, 11437046];
Filter4_A=[ 16777216, -32089673, 15357640];
Filter4_B=[ 12666347, -24058210, 11437046];
Filter4_A=[ 16777216, -32089673, 15357640];
Filter5_B=[ 16466312, -31915122, 15523589];
Filter5_A=[ 16777216, -31915122, 15212684];
*/
Filter5_B=[ 16466312, -31915122, 15523589];
Filter5_A=[ 16777216, -31915122, 15212684];
*/
.anc_cfg_mc_l =
{
.total_gain = 1228,
.anc_cfg_mc_l =
{
.total_gain = 1228,
.iir_bypass_flag = 0,
.iir_counter = 5,
.iir_bypass_flag = 0,
.iir_counter = 5,
.iir_coef[0].coef_b = {19847881, -39594823, 19747071},
.iir_coef[0].coef_a = {16777216, -33314517, 16538159},
.iir_coef[0].coef_b = {19847881, -39594823, 19747071},
.iir_coef[0].coef_a = {16777216, -33314517, 16538159},
.iir_coef[1].coef_b = {9442890, -16603187, 7330251},
.iir_coef[1].coef_a = {16777216, -16603187, -4075},
.iir_coef[1].coef_b = {9442890, -16603187, 7330251},
.iir_coef[1].coef_a = {16777216, -16603187, -4075},
.iir_coef[2].coef_b = {18107639, -32779315, 14701642},
.iir_coef[2].coef_a = {16777216, -32779315, 16032065},
.iir_coef[2].coef_b = {18107639, -32779315, 14701642},
.iir_coef[2].coef_a = {16777216, -32779315, 16032065},
.iir_coef[3].coef_b = {12666347, -24058210, 11437046},
.iir_coef[3].coef_a = {16777216, -32089673, 15357640},
.iir_coef[3].coef_b = {12666347, -24058210, 11437046},
.iir_coef[3].coef_a = {16777216, -32089673, 15357640},
.iir_coef[4].coef_b = {16466312, -31915122, 15523589},
.iir_coef[4].coef_a = {16777216, -31915122, 15212684},
.iir_coef[4].coef_b = {16466312, -31915122, 15523589},
.iir_coef[4].coef_a = {16777216, -31915122, 15212684},
.iir_coef[5].coef_b = {0x8000000, 0, 0},
.iir_coef[5].coef_a = {0x8000000, 0, 0},
.iir_coef[5].coef_b = {0x8000000, 0, 0},
.iir_coef[5].coef_a = {0x8000000, 0, 0},
.dac_gain_offset = 0,
.adc_gain_offset = (2) * 4,
},
.anc_cfg_mc_r =
{
.total_gain = 1331,
.dac_gain_offset = 0,
.adc_gain_offset = (0) * 4,
},
.anc_cfg_mc_r =
{
.total_gain = 1331,
.iir_bypass_flag = 0,
.iir_counter = 5,
.iir_bypass_flag = 0,
.iir_counter = 5,
.iir_coef[0].coef_b = {19847881, -39594823, 19747071},
.iir_coef[0].coef_a = {16777216, -33314517, 16538159},
.iir_coef[0].coef_b = {19847881, -39594823, 19747071},
.iir_coef[0].coef_a = {16777216, -33314517, 16538159},
.iir_coef[1].coef_b = {9442890, -16603187, 7330251},
.iir_coef[1].coef_a = {16777216, -16603187, -4075},
.iir_coef[1].coef_b = {9442890, -16603187, 7330251},
.iir_coef[1].coef_a = {16777216, -16603187, -4075},
.iir_coef[2].coef_b = {18107639, -32779315, 14701642},
.iir_coef[2].coef_a = {16777216, -32779315, 16032065},
.iir_coef[2].coef_b = {18107639, -32779315, 14701642},
.iir_coef[2].coef_a = {16777216, -32779315, 16032065},
.iir_coef[3].coef_b = {12666347, -24058210, 11437046},
.iir_coef[3].coef_a = {16777216, -32089673, 15357640},
.iir_coef[3].coef_b = {12666347, -24058210, 11437046},
.iir_coef[3].coef_a = {16777216, -32089673, 15357640},
.iir_coef[4].coef_b = {16466312, -31915122, 15523589},
.iir_coef[4].coef_a = {16777216, -31915122, 15212684},
.iir_coef[4].coef_b = {16466312, -31915122, 15523589},
.iir_coef[4].coef_a = {16777216, -31915122, 15212684},
.iir_coef[5].coef_b = {0x8000000, 0, 0},
.iir_coef[5].coef_a = {0x8000000, 0, 0},
.iir_coef[5].coef_b = {0x8000000, 0, 0},
.iir_coef[5].coef_a = {0x8000000, 0, 0},
.dac_gain_offset = 0,
.adc_gain_offset = (2) * 4,
},
.dac_gain_offset = 0,
.adc_gain_offset = (0) * 4,
},
#endif
};

View file

@ -96,25 +96,10 @@ extern const struct HAL_KEY_GPIOKEY_CFG_T cfg_hw_gpio_key_cfg[CFG_HW_GPIOKEY_NUM
#define ANC_COEF_LIST_NUM (ANC_COEF_NUM)
#endif
// MIC and channel configurations
// Pinebuds pro have the following mic's and biases
/*
* User Voice (Talking) = MIC5 input and VMIC3 Bias
* ANC Feed Forward = MIC1 input and VMIC2 Bias
* ANC Feed Backward = MIC3 input and VMIC2 Bias
*
* Note that AUD_CHANNEL_MAP is offset by 1 (0 start)
*/
#define ANC_FF_MIC AUD_CHANNEL_MAP_CH0
#define ANC_FB_MIC AUD_CHANNEL_MAP_CH2
#define ANC_FF_MIC_CH_L ANC_FF_MIC
#define ANC_FF_MIC_CH_R 0
#define ANC_FB_MIC_CH_L ANC_FB_MIC
#define ANC_FB_MIC_CH_R 0
#define ANC_VMIC_CFG AUD_VMIC_MAP_VMIC2
#define ANC_FF_MIC_CH_L AUD_CHANNEL_MAP_CH0
#define ANC_FF_MIC_CH_R AUD_CHANNEL_MAP_CH1
#define ANC_FB_MIC_CH_L AUD_CHANNEL_MAP_CH2
#define ANC_FB_MIC_CH_R AUD_CHANNEL_MAP_CH3
// audio codec
#define CFG_HW_AUD_INPUT_PATH_NUM 3
@ -122,7 +107,7 @@ extern const struct AUD_IO_PATH_CFG_T cfg_audio_input_path_cfg[CFG_HW_AUD_INPUT_
#define CFG_HW_AUD_OUTPUT_PATH_SPEAKER_DEV (AUD_CHANNEL_MAP_CH0)
#define CFG_HW_AUD_SIDETONE_MIC_DEV (AUD_CHANNEL_MAP_CH4)
#define CFG_HW_AUD_SIDETONE_MIC_DEV (AUD_CHANNEL_MAP_CH0)
#define CFG_HW_AUD_SIDETONE_GAIN_DBVAL (-20)
//bt config
@ -154,6 +139,8 @@ extern const struct HAL_IOMUX_PIN_FUNCTION_MAP app_battery_ext_charger_indicator
extern bool tgt_tws_get_channel_is_right(void);
extern const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_I2C_SDA;
extern const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_I2C_SCL;
#ifdef __cplusplus
}
#endif

View file

@ -1 +0,0 @@
target/

View file

@ -1,119 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "anc_decoder"
version = "0.1.0"
dependencies = [
"declio",
]
[[package]]
name = "darling"
version = "0.13.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c"
dependencies = [
"darling_core",
"darling_macro",
]
[[package]]
name = "darling_core"
version = "0.13.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610"
dependencies = [
"fnv",
"ident_case",
"proc-macro2",
"quote",
"strsim",
"syn",
]
[[package]]
name = "darling_macro"
version = "0.13.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835"
dependencies = [
"darling_core",
"quote",
"syn",
]
[[package]]
name = "declio"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae2d0ab09a05314050f1b66e78c2497af54dad2335e15b815f208d1594c85264"
dependencies = [
"declio_derive",
]
[[package]]
name = "declio_derive"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5eb284008990d1298ed56c741ca8823481789d72ff055031bf21ceaeb61c0053"
dependencies = [
"darling",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "ident_case"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "proc-macro2"
version = "1.0.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105"
dependencies = [
"proc-macro2",
]
[[package]]
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73"

View file

@ -1,9 +0,0 @@
[package]
name = "anc_decoder"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
declio = "0.2.0"

View file

@ -1,132 +0,0 @@
use declio::ctx::Endian;
use declio::{Decode, Encode};
use std::fs::File;
use std::io::Read;
//Super experimental dumb tooling for parsing out the ANC data
// This is not production code, expect panics
const AUDIO_START: usize = 0x003EE000;
const AUDIO_LEN: usize = 16;
const AUD_IIR_NUM: usize = 8;
const AUD_COEF_LEN: usize = 0;
#[derive(Debug, PartialEq, Encode, Decode, Copy, Clone, Default)]
struct AudSectionHead {
#[declio(ctx = "Endian::Little")]
magic: u16,
#[declio(ctx = "Endian::Little")]
vesrion: u16,
#[declio(ctx = "Endian::Little")]
crc: u32,
#[declio(ctx = "Endian::Little")]
reserved0: u32,
#[declio(ctx = "Endian::Little")]
reserved1: u32,
}
#[derive(Debug, PartialEq, Encode, Decode, Copy, Clone, Default)]
struct AudSectionBodyIdent {
anc_ver: [u8; 16], // These are actually char* but honestly doesnt matter as seem to always be 0x00
batch_info: [u8; 16], // These are actually char* but honestly doesnt matter as seem to always be 0x00
serial: [u8; 16], // These are actually char* but honestly doesnt matter as seem to always be 0x00
}
#[derive(Debug, PartialEq, Encode, Decode, Copy, Clone, Default)]
struct anc_iir_coefs {
#[declio(ctx = "Endian::Little")]
coef_b: [i32; 3],
#[declio(ctx = "Endian::Little")]
coef_a: [i32; 3],
}
#[derive(Debug, PartialEq, Encode, Decode, Copy, Clone, Default)]
struct aud_item {
#[declio(ctx = "Endian::Little")]
total_gain: u32,
#[declio(ctx = "Endian::Little")]
iir_bypass_flag: u16,
#[declio(ctx = "Endian::Little")]
iir_counter: u16,
iir_coef: [anc_iir_coefs; AUD_IIR_NUM],
// #if (AUD_SECTION_STRUCT_VERSION == 1)
// #[declio(ctx = "Endian::Little")]
// fir_bypass_flag: u16,
// #[declio(ctx = "Endian::Little")]
// fir_len: u16,
// #[declio(ctx = "Endian::Little")]
// fir_coef: [i16; AUD_COEF_LEN],
// pos_tab: [i8; 16],
// #elif (AUD_SECTION_STRUCT_VERSION == 2)
#[declio(ctx = "Endian::Little")]
reserved_for_drc: [u32; 32],
// #elif (AUD_SECTION_STRUCT_VERSION == 3)
// #endif
#[declio(ctx = "Endian::Little")]
reserved1: i16,
dac_gain_offset: i8, // in qdb (quater of dB)
adc_gain_offset: i8, // in qdb (quater of dB)
}
#[derive(Debug, PartialEq, Encode, Decode, Copy, Clone, Default)]
struct struct_anc_cfg {
//V1+
anc_cfg_ff_l: aud_item,
anc_cfg_ff_r: aud_item,
anc_cfg_fb_l: aud_item,
anc_cfg_fb_r: aud_item,
//V2
anc_cfg_tt_l: aud_item,
anc_cfg_tt_r: aud_item,
anc_cfg_mc_l: aud_item,
anc_cfg_mc_r: aud_item,
}
#[derive(Debug, PartialEq, Encode, Decode, Copy, Clone, Default)]
struct pctool_struct_anc_cfg {
//
anc_cfg: [struct_anc_cfg; 2], //0 == 41k, 2==44k
}
#[derive(Debug, PartialEq, Encode, Decode, Copy, Clone, Default)]
struct AudSectionBodyConfig {
anc_config_arr: [pctool_struct_anc_cfg; 1], // we may only use first of 4 entries
}
#[derive(Debug, PartialEq, Encode, Decode, Copy, Clone, Default)]
struct AudSectionBody {
anc_ident: AudSectionBodyIdent,
anc_config: AudSectionBodyConfig,
}
#[derive(Debug, PartialEq, Encode, Decode, Copy, Clone, Default)]
struct PctoolAudSection {
header: AudSectionHead,
body: AudSectionBody,
}
fn main() {
println!("Super dumb anc firmware details dumper");
println!("By Ralim <ralim@ralimtek.com>");
println!("Reading firmware.bin");
let file_contents = get_firmware_file("firmware.bin");
println!("Running decoder");
let dummy_init: PctoolAudSection = PctoolAudSection::default();
let dummy_serialised = declio::to_bytes(dummy_init).unwrap();
let decoded: PctoolAudSection =
declio::from_bytes(&file_contents[AUDIO_START..AUDIO_START + dummy_serialised.len()])
.expect("decode failed");
println!("Decoded {:#?}", decoded)
}
fn get_firmware_file(filename: &str) -> Vec<u8> {
let mut f = File::open(&filename).expect("no file found");
let mut buffer = Vec::new();
// read the whole file
f.read_to_end(&mut buffer).expect("could not read file");
buffer
}

View file

@ -123,7 +123,6 @@
#endif
#ifndef ANC_VMIC_CFG
#error "No ANC VMIC configured"
#define ANC_VMIC_CFG (AUD_VMIC_MAP_VMIC1)
#endif

View file

@ -205,7 +205,7 @@ enum AUD_STREAM_ID_T {
AUD_STREAM_ID_0 = 0,
AUD_STREAM_ID_1,
AUD_STREAM_ID_2,
#ifdef ANC_ASSIST_ENABLED
#ifdef __ANC_ASSIST__
AUD_STREAM_ID_3,
#endif
AUD_STREAM_ID_NUM,
@ -230,7 +230,7 @@ enum AUD_IO_PATH_T {
AUD_INPUT_PATH_NTMIC,
AUD_INPUT_PATH_ANC_WNR, // Wind Noise Reduction
AUD_INPUT_PATH_USBAUDIO,
#ifdef ANC_ASSIST_ENABLED
#ifdef __ANC_ASSIST__
AUD_INPUT_PATH_AF_ANC,
#endif
// Output path

View file

@ -279,7 +279,6 @@ void app_ibrt_ui_perform_user_action(uint8_t *p_buff, uint16_t length) {
ibrt_ctrl_t *p_ibrt_ctrl = app_tws_ibrt_get_bt_ctrl_ctx();
#ifdef ANC_APP
//Doesnt actully get used!!!
app_anc_cmd_receive_process(p_buff, length);
#endif
#ifdef ANC_WNR_ENABLED
@ -353,9 +352,6 @@ void app_ibrt_ui_perform_user_action(uint8_t *p_buff, uint16_t length) {
app_bt_volumedown();
app_ibrt_sync_volume_info();
break;
case IBRT_ACTION_ANC_NOTIRY_MASTER_EXCHANGE_COEF:
app_anc_key(NULL, NULL);
break;
default:
TRACE(2, "%s unknown user action %d\n", __func__, p_buff[0]);
break;

View file

@ -3866,9 +3866,7 @@ int bt_sbc_player(enum PLAYER_OPER_T on, enum APP_SYSFREQ_FREQ_T freq) {
}
#endif
#endif
if (freq < APP_SYSFREQ_52M) {
freq = APP_SYSFREQ_52M;
}
freq = APP_SYSFREQ_52M;
app_sysfreq_req(APP_SYSFREQ_USER_BT_A2DP, freq);
TRACE_AUD_STREAM_I("[A2DP_PLAYER] sysfreq %d", freq);
TRACE_AUD_STREAM_I("[A2DP_PLAYER] sysfreq calc : %d\n",
@ -3888,10 +3886,8 @@ int bt_sbc_player(enum PLAYER_OPER_T on, enum APP_SYSFREQ_FREQ_T freq) {
else if (codec_type == BTIF_AVDTP_CODEC_TYPE_NON_A2DP) {
TRACE(1, "current_a2dp_non_type %d", current_a2dp_non_type);
if (0) {
}
#if defined(A2DP_LHDC_ON)
else if (current_a2dp_non_type == A2DP_NON_CODEC_TYPE_LHDC) {
if (current_a2dp_non_type == A2DP_NON_CODEC_TYPE_LHDC) {
app_overlay_select(APP_OVERLAY_A2DP_LHDC);
}
#endif

View file

@ -1,11 +1,5 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
rightbud=/dev/serial/by-id/usb-wch.cn_USB_Dual_Serial_0123456789-if00
leftbud=/dev/serial/by-id/usb-wch.cn_USB_Dual_Serial_0123456789-if02
read -p "Which bud do you want to connect to UART for? L/R (default L): " -n 1 -r
ttydev=$leftbud
if [[ $REPLY =~ ^[Rr]$ ]]; then
ttydev=$rightbud
fi
sudo minicom -D $ttydev -b 2000000
num=$(find /dev -name 'ttyUSB*' | rev | cut -c 1)
echo "$num"
sudo minicom "port$num"