Compare commits

...

31 Commits

Author SHA1 Message Date
Rudis Muiznieks f0bf978454
custom key mappings 2024-06-03 11:55:53 -05:00
Ben V. Brown f64468868c Fix ability to build anc_assist 2024-05-13 19:12:26 +10:00
Ben V. Brown 850cb666c4 Notes 2024-05-13 18:43:15 +10:00
Ben V. Brown 833de0f666 Make LED toggle part of config 2024-05-12 20:25:04 +10:00
Ben V. Brown 7365d8e6b8 Merge branch 'main' into anc-testing 2024-05-12 19:14:16 +10:00
Ben V. Brown 0751b1cf75
Merge pull request #101 from nicka101/main
Functional UART logging both inside and outside dev container
2024-05-12 18:57:33 +10:00
Nick Anstee b61712a01c Functional UART logging both inside and outside dev container
Adds minicom and sudo to the docker image
Switches the shebang line to bash to fix a bug in uart_log.sh when
 inside the container (-n option to read requires bash)
2024-05-10 18:05:30 +02:00
Ben V. Brown d8be791cad
Merge pull request #100 from nicka101/main
Enable LDAC in the build
2024-05-10 13:22:05 +10:00
nicka101 839d513367 Enable LDAC in the build
Permit LDAC to be enabled independenly of LHDC
Fix a bug/oversight in bt_sbc_player which caused system frequencies above 52M to be ignored
2024-05-10 04:22:21 +02:00
Ben V. Brown 61f736b66b
Merge pull request #99 from nicka101/patch-1
Update uart_log.sh for easier debugging
2024-05-10 08:47:37 +10:00
Nick Anstee 3e95c41c0d
Update uart_log.sh
Pick the serial device by ID, allowing us to safely predict the paths to find the left and right bud at
Also improve the script so it asks which bud we'd like to debug
Specify necessary minicom options, so it opens even if the default configuration is invalid
2024-05-09 19:00:34 +02:00
Ben V. Brown ea0d5b067a Update target.mk 2024-02-07 12:04:14 +11:00
Haxk20 851fb95dcb anc: Fix enable/disable from slave bud
Switching ANC on or off from master bud has always worked
since we could just straight up enable it and no command had to be
sent.

When switching from slave bud we had to send the command to enable
or disable it via app_anc_key. Issue is the handling of this request
is from app_anc_cmd_receive_process which is not called without
APP_ANC being defined.

This commit cleans up the way ANC is enabled and also fixes slave
bud ANC switching by implementing the actual code path :)
2024-02-07 12:04:14 +11:00
Ben V. Brown bc68d1628e Turn off resample for now (to avoid 56k profile) 2024-02-07 12:03:38 +11:00
Ben V. Brown 9f5d2d6956 Port fb tuning values 2024-02-07 12:03:38 +11:00
Ben V. Brown c76a31e13a Update decoder 2024-02-07 12:03:38 +11:00
Ben V. Brown 5bc29ea41e Port some rough anc numbers from firmware dump 2024-02-07 12:03:38 +11:00
Ben V. Brown b540007bcc Scratching debug tool for anc poking 2024-02-07 12:03:38 +11:00
Ben V. Brown 802822fbb6 Note WNR is off 2024-02-07 12:03:38 +11:00
Ben V. Brown fd2c9386c7 Try higher gain for anc 2024-02-07 12:03:38 +11:00
Ben V. Brown 725dcc4421 Update target.mk 2024-02-07 12:03:38 +11:00
Ben V. Brown c1dd03c127 Update target.mk 2024-02-07 12:03:38 +11:00
Ben V. Brown 68c0f2e047 Update analog_best2300p.c 2024-02-07 12:03:38 +11:00
Ben V. Brown b63b1b3a39 Add logging to anc init 2024-02-07 12:03:38 +11:00
Ben V. Brown 9f525debd0 Cant do inline comments on makefile target config 2024-02-07 12:03:38 +11:00
Ben V. Brown fb1dd221d5 Make warning on no anc VMIC 2024-02-07 12:03:38 +11:00
Ben V. Brown 7b21c7bcb5 Edit config for mics 2024-02-07 12:03:38 +11:00
Ben V. Brown eb232e87ed Annotate config options 2024-02-07 12:03:38 +11:00
Ben Brown 124f0545f8 Creating Multi Arch Container 2024-01-26 09:47:47 +11:00
Ben V. Brown 42451f7f7d
Merge pull request #85 from pine64/dependabot/github_actions/actions/upload-artifact-4
chore(ci): bump actions/upload-artifact from 3 to 4
2023-12-18 12:46:25 +11:00
dependabot[bot] 2cb04b7925
chore(ci): bump actions/upload-artifact from 3 to 4
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-18 01:21:21 +00:00
18 changed files with 722 additions and 406 deletions

View File

@ -17,11 +17,17 @@ 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@v3
uses: actions/upload-artifact@v4
with:
path: /usr/src/out/open_source/open_source.bin

View File

@ -41,6 +41,11 @@ 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,6 +25,7 @@ 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,31 +1060,41 @@ 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
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);
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);
#endif
#ifdef ANC_FB_ENABLED
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);
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);
#endif
#ifdef AUDIO_ANC_FB_MC_HW
anc_open(ANC_MUSICCANCLE);
anc_select_coef(anc_sample_rate[AUD_STREAM_PLAYBACK], anc_coef_idx,
ANC_MUSICCANCLE, ANC_GAIN_NO_DELAY);
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);
#endif
#if defined(AUDIO_ANC_TT_HW)
anc_open(ANC_TALKTHRU);
anc_select_coef(anc_sample_rate[AUD_STREAM_PLAYBACK], anc_coef_idx,
ANC_TALKTHRU, ANC_GAIN_NO_DELAY);
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);
#endif
#ifdef AUDIO_ANC_FB_MC_HW
@ -1521,13 +1531,6 @@ 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,6 +118,12 @@ 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);
@ -144,28 +150,7 @@ 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_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_prev_track();
} else {
TRACE(0, "Handling %s as right bud", __func__);
// Righty
send_next_track();
}
}
}
void app_key_triple_tap(APP_KEY_STATUS *status, void *param) {
TRACE(2, "%s event %d", __func__, status->event);
if (!app_tws_ibrt_tws_link_connected()) {
// No other bud paired
TRACE(0, "Handling %s in single bud mode", __func__);
send_vol_up();
send_vol_down();
} else {
// Bud's are working as a pair
if (app_tws_is_left_side()) {
@ -179,7 +164,28 @@ void app_key_triple_tap(APP_KEY_STATUS *status, void *param) {
}
}
}
void app_key_quad_tap(APP_KEY_STATUS *status, void *param) {
void app_key_triple_tap(APP_KEY_STATUS *status, void *param) {
TRACE(2, "%s event %d", __func__, status->event);
if (!app_tws_ibrt_tws_link_connected()) {
// No other bud paired
TRACE(0, "Handling %s in single bud mode", __func__);
send_vol_up();
}/* 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();
} else {
TRACE(0, "Handling %s as right bud", __func__);
// Righty
send_vol_up();
}
}*/
}
/*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()) {
@ -196,7 +202,7 @@ void app_key_quad_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);
@ -204,10 +210,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
app_anc_key(status, param);
send_enable_disable_anc();
}
}
@ -231,10 +237,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,
@ -268,4 +274,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,10 +7,14 @@ MBED ?= 0
RTOS ?= 1
#KERNEL ?= FREERTOS
NO_PWRKEY = 0 # We have powerkey input
# 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
export USER_SECURE_BOOT ?= 0
# enable:1
# disable:0
@ -54,25 +58,38 @@ 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 ######
APP_ANC_TEST ?= 0
# Allow test commands via bluetooth
TEST_OVER_THE_AIR ?= 0
HW_FIR_EQ_PROCESS ?= 0
@ -93,7 +110,7 @@ PC_CMD_UART ?= 0
AUDIO_SECTION_ENABLE ?= 0
AUDIO_RESAMPLE ?= 1
AUDIO_RESAMPLE ?= 0
RESAMPLE_ANY_SAMPLE_RATE ?= 1
@ -206,8 +223,8 @@ TILE_DATAPATH_ENABLED ?= 0
CUSTOM_INFORMATION_TILE_ENABLE ?= 0
INTERCONNECTION ?= 0
INTERACTION ?= 0 # Looks like Find-My-Device support?
# Looks like Find-My-Device support?
INTERACTION ?= 0
INTERACTION_FASTPAIR ?= 0
@ -228,7 +245,7 @@ A2DP_LHDC_LARC ?= 1
export FLASH_UNIQUE_ID ?= 1
endif
A2DP_LDAC_ON ?= 0
A2DP_LDAC_ON ?= 1
export TX_RX_PCM_MASK ?= 0
@ -343,6 +360,8 @@ 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 = "BES_BLE";
const char *BLE_DEFAULT_NAME = "PineBuds Pro BLE";
uint8_t ble_addr[6] = {
#ifdef BLE_DEV_ADDR
BLE_DEV_ADDR
@ -122,6 +122,7 @@ 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};
@ -159,21 +160,22 @@ const struct CODEC_DAC_VOL_T codec_dac_vol[TGT_VOLUME_LEVEL_QTY] = {
{TX_PA_GAIN, 0x03, -3}, {TX_PA_GAIN, 0x03, 0}, // 0dBm
};
#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
// 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)
#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)
@ -184,32 +186,23 @@ 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_LINEIN_DEV,
CFG_HW_AUD_INPUT_PATH_MAINMIC_DEV,
},
#ifdef VOICE_DETECTOR_EN
{
AUD_INPUT_PATH_VADMIC,
CFG_HW_AUD_INPUT_PATH_VADMIC_DEV,
CFG_HW_AUD_INPUT_PATH_MAINMIC_DEV,
},
#else
{
AUD_INPUT_PATH_ASRMIC,
CFG_HW_AUD_INPUT_PATH_ASRMIC_DEV,
CFG_HW_AUD_INPUT_PATH_MAINMIC_DEV,
},
#endif
};
@ -233,28 +226,18 @@ HAL_IOMUX_PIN_PULLUP_ENABLE
};
*/
// 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)
#define IIR_COUNTER_FF_L (8)
#define IIR_COUNTER_FF_R (8)
#define IIR_COUNTER_FB_L (6)
#define IIR_COUNTER_FB_R (6)
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,
@ -285,12 +268,12 @@ static const struct_anc_cfg POSSIBLY_UNUSED
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (0) * 4,
.adc_gain_offset = (2) * 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,
@ -321,7 +304,7 @@ static const struct_anc_cfg POSSIBLY_UNUSED
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (0) * 4,
.adc_gain_offset = (2) * 4,
},
/*
@ -375,7 +358,7 @@ static const struct_anc_cfg POSSIBLY_UNUSED
*/
.dac_gain_offset = 0,
.adc_gain_offset = (0) * 4,
.adc_gain_offset = (2) * 4,
},
.anc_cfg_fb_r =
{
@ -410,75 +393,51 @@ static const struct_anc_cfg POSSIBLY_UNUSED
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (0) * 4,
.adc_gain_offset = (2) * 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 = 440,
.total_gain = 312,
.total_gain = 302,
// .total_gain = 312,
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FF_L,
.iir_coef[0].coef_b = {42463913, -84860822, 42396935},
.iir_coef[0].coef_a = {134217728, -268353516, 134135801},
.iir_coef[0].coef_b = {47756600, -94784525, 47030952},
.iir_coef[0].coef_a = {134217728, -267141655, 132927324},
.iir_coef[1].coef_b = {136002894, -267154076, 131168209},
.iir_coef[1].coef_a = {134217728, -267154076, 132953376},
.iir_coef[1].coef_b = {95026235, -189959646, 94933615},
.iir_coef[1].coef_a = {134217728, -268325174, 134107649},
.iir_coef[2].coef_b = {132863566, -263674901, 130888668},
.iir_coef[2].coef_a = {134217728, -263674901, 129534506},
.iir_coef[2].coef_b = {137182418, -258280236, 121193611},
.iir_coef[2].coef_a = {134217728, -258309065, 124129473},
.iir_coef[3].coef_b = {131621817, -256639526, 125746382},
.iir_coef[3].coef_a = {134217728, -256639526, 123150471},
.iir_coef[3].coef_b = {119863779, -218243094, 100875648},
.iir_coef[3].coef_a = {134217728, -218243094, 86521699},
.iir_coef[4].coef_b = {0x8000000, 0, 0},
.iir_coef[4].coef_a = {0x8000000, 0, 0},
.iir_coef[4].coef_b = {118677290, -210108781, 98119610},
.iir_coef[4].coef_a = {134217728, -210108781, 82579171},
.iir_coef[5].coef_b = {0x8000000, 0, 0},
.iir_coef[5].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},
/* .fir_bypass_flag=1,
.fir_len = AUD_COEF_LEN,
.fir_coef =
{
32767,
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (0) * 4,
.adc_gain_offset = -24,
},
.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,
@ -508,60 +467,36 @@ static const struct_anc_cfg POSSIBLY_UNUSED
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (0) * 4,
.adc_gain_offset = (2) * 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 = 511,
.total_gain = 512,
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FB_L,
.iir_coef[0].coef_b = {27172676, -53803459, 26691412},
.iir_coef[0].coef_a = {134217728, -214195429, 80219070},
.iir_coef[0].coef_b = {75662976, -150466868, 74809339},
.iir_coef[0].coef_a = {134217728, -267572133, 133364091},
.iir_coef[1].coef_b = {138529480, -267551490, 129040578},
.iir_coef[1].coef_a = {134217728, -267551490, 133352330},
.iir_coef[1].coef_b = {136259446, -267048746, 130806222},
.iir_coef[1].coef_a = {134217728, -267048746, 132847940},
.iir_coef[2].coef_b = {134516353, -268162980, 133647489},
.iir_coef[2].coef_a = {134217728, -268162980, 133946114},
.iir_coef[2].coef_b = {134365088, -267930698, 133570324},
.iir_coef[2].coef_a = {134217728, -267932117, 133716266},
.iir_coef[3].coef_b = {133595549, -264581113, 131087955},
.iir_coef[3].coef_a = {134217728, -264581113, 130465777},
.iir_coef[3].coef_b = {124587325, -241835594, 118126292},
.iir_coef[3].coef_a = {134217728, -241835594, 108495889},
.iir_coef[4].coef_b = {0x8000000, 0, 0},
.iir_coef[4].coef_a = {0x8000000, 0, 0},
.iir_coef[4].coef_b = {130235205, -255036797, 124966921},
.iir_coef[4].coef_a = {134217728, -255036797, 120984398},
.iir_coef[5].coef_b = {0x8000000, 0, 0},
.iir_coef[5].coef_a = {0x8000000, 0, 0},
.iir_coef[5].coef_b = {134327171, -268333985, 134007055},
.iir_coef[5].coef_a = {134217728, -268333985, 134116498},
/* .fir_bypass_flag=1,
.fir_len = AUD_COEF_LEN,
.fir_coef =
{
32767,
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (0) * 4,
.adc_gain_offset = -24,
},
.anc_cfg_fb_r =
{
@ -596,7 +531,7 @@ static const struct_anc_cfg POSSIBLY_UNUSED
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (0) * 4,
.adc_gain_offset = (2) * 4,
},
#if (AUD_SECTION_STRUCT_VERSION == 2)
@ -675,7 +610,7 @@ static const struct_anc_cfg POSSIBLY_UNUSED
.iir_coef[5].coef_a = {0x8000000, 0, 0},
.dac_gain_offset = 0,
.adc_gain_offset = (0) * 4,
.adc_gain_offset = (2) * 4,
},
.anc_cfg_mc_r =
{
@ -703,269 +638,321 @@ static const struct_anc_cfg POSSIBLY_UNUSED
.iir_coef[5].coef_a = {0x8000000, 0, 0},
.dac_gain_offset = 0,
.adc_gain_offset = (0) * 4,
.adc_gain_offset = (2) * 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 = 440,
.total_gain = 312,
AncFirCoef_44p1k_mode0 = {
.anc_cfg_ff_l =
{
.total_gain = 512,
// .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 = {42465729, -84858529, 42392831},
.iir_coef[0].coef_a = {134217728, -268346271, 134128558},
.iir_coef[0].coef_b = {47768463, -94743857, 46978979},
.iir_coef[0].coef_a = {134217728, -267027510, 132813804},
.iir_coef[1].coef_b = {136159949, -267039705, 130899919},
.iir_coef[1].coef_a = {134217728, -267039705, 132842140},
.iir_coef[1].coef_b = {95026887, -189952726, 94926080},
.iir_coef[1].coef_a = {134217728, -268315406, 134097919},
.iir_coef[2].coef_b = {132746107, -263254540, 130599907},
.iir_coef[2].coef_a = {134217728, -263254540, 129128286},
.iir_coef[2].coef_b = {137435276, -257412413, 120090247},
.iir_coef[2].coef_a = {134217728, -257446453, 123273755},
.iir_coef[3].coef_b = {131402980, -255575175, 125032243},
.iir_coef[3].coef_a = {134217728, -255575175, 122217496},
.iir_coef[3].coef_b = {118844778, -214442434, 98508661},
.iir_coef[3].coef_a = {134217728, -214442434, 83135711},
.iir_coef[4].coef_b = {0x8000000, 0, 0},
.iir_coef[4].coef_a = {0x8000000, 0, 0},
.iir_coef[4].coef_b = {117611223, -205468073, 95643298},
.iir_coef[4].coef_a = {134217728, -205468073, 79036793},
.iir_coef[5].coef_b = {0x8000000, 0, 0},
.iir_coef[5].coef_a = {0x8000000, 0, 0},
.iir_coef[5].coef_b = {133430657, -264618880, 131408063},
.iir_coef[5].coef_a = {134217728, -264618880, 130620992},
/* .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[6].coef_b = {134829328, -266830863, 132034457},
.iir_coef[6].coef_a = {134217728, -266830863, 132646057},
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FF_R,
.iir_coef[7].coef_b = {134236821, -268342876, 134106183},
.iir_coef[7].coef_a = {134217728, -268342908, 134125243},
.iir_coef[0].coef_b = {42465729, -84858529, 42392831},
.iir_coef[0].coef_a = {134217728, -268346271, 134128558},
// .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[1].coef_b = {136159949, -267039705, 130899919},
.iir_coef[1].coef_a = {134217728, -267039705, 132842140},
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FF_R,
.iir_coef[2].coef_b = {132746107, -263254540, 130599907},
.iir_coef[2].coef_a = {134217728, -263254540, 129128286},
.iir_coef[0].coef_b = {42465729, -84858529, 42392831},
.iir_coef[0].coef_a = {134217728, -268346271, 134128558},
.iir_coef[3].coef_b = {131402980, -255575175, 125032243},
.iir_coef[3].coef_a = {134217728, -255575175, 122217496},
.iir_coef[1].coef_b = {136159949, -267039705, 130899919},
.iir_coef[1].coef_a = {134217728, -267039705, 132842140},
.iir_coef[4].coef_b = {0x8000000, 0, 0},
.iir_coef[4].coef_a = {0x8000000, 0, 0},
.iir_coef[2].coef_b = {132746107, -263254540, 130599907},
.iir_coef[2].coef_a = {134217728, -263254540, 129128286},
.iir_coef[5].coef_b = {0x8000000, 0, 0},
.iir_coef[5].coef_a = {0x8000000, 0, 0},
.iir_coef[3].coef_b = {131402980, -255575175, 125032243},
.iir_coef[3].coef_a = {134217728, -255575175, 122217496},
/* .fir_bypass_flag=1,
.fir_len = AUD_COEF_LEN,
.fir_coef =
{
32767,
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (0) * 4,
},
.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},
Filter1_B=[ 26719020, -52852829, 26204379];
Filter1_A=[ 134217728, -210410903, 76474119];
/* .fir_bypass_flag=1,
.fir_len = AUD_COEF_LEN,
.fir_coef =
{
32767,
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (2) * 4,
},
Filter2_B=[ 138909433, -267471808, 128584365];
Filter2_A=[ 134217728, -267471808, 133276071];
/*
Filter3_B=[ 134542733, -268138827, 133597115];
Filter3_A=[ 134217728, -268138827, 133922120];
Filter1_B=[ 26719020, -52852829, 26204379];
Filter1_A=[ 134217728, -210410903, 76474119];
Filter4_B=[ 133541379, -264235686, 130815458];
Filter4_A=[ 134217728, -264235686, 130139109];
Filter2_B=[ 138909433, -267471808, 128584365];
Filter2_A=[ 134217728, -267471808, 133276071];
*/
Filter3_B=[ 134542733, -268138827, 133597115];
Filter3_A=[ 134217728, -268138827, 133922120];
.anc_cfg_fb_l =
{
.total_gain = 511,
Filter4_B=[ 133541379, -264235686, 130815458];
Filter4_A=[ 134217728, -264235686, 130139109];
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FB_L,
*/
.iir_coef[0].coef_b = {26719020, -52852829, 26204379},
.iir_coef[0].coef_a = {134217728, -210410903, 76474119},
.anc_cfg_fb_l =
{
.total_gain = 512,
.iir_coef[1].coef_b = {138909433, -267471808, 128584365},
.iir_coef[1].coef_a = {134217728, -267471808, 133276071},
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FB_L,
.iir_coef[2].coef_b = {134542733, -268138827, 133597115},
.iir_coef[2].coef_a = {134217728, -268138827, 133922120},
.iir_coef[0].coef_b = {75679438, -150423560, 74750572},
.iir_coef[0].coef_a = {134217728, -267495119, 133288862},
.iir_coef[3].coef_b = {133541379, -264235686, 130815458},
.iir_coef[3].coef_a = {134217728, -264235686, 130139109},
.iir_coef[1].coef_b = {136438995, -266925170, 130506214},
.iir_coef[1].coef_a = {134217728, -266925170, 132727481},
.iir_coef[4].coef_b = {0x8000000, 0, 0},
.iir_coef[4].coef_a = {0x8000000, 0, 0},
.iir_coef[2].coef_b = {134378162, -267885833, 133513256},
.iir_coef[2].coef_a = {134217728, -267887514, 133672009},
.iir_coef[5].coef_b = {0x8000000, 0, 0},
.iir_coef[5].coef_a = {0x8000000, 0, 0},
.iir_coef[3].coef_b = {123825813, -239648340, 116853881},
.iir_coef[3].coef_a = {134217728, -239648340, 106461967},
/* .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[4].coef_b = {129901988, -253899885, 124192908},
.iir_coef[4].coef_a = {134217728, -253899885, 119877168},
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FB_R,
.iir_coef[5].coef_b = {134336846, -268324991, 133988431},
.iir_coef[5].coef_a = {134217728, -268324991, 134107550},
.iir_coef[0].coef_b = {26719020, -52852829, 26204379},
.iir_coef[0].coef_a = {134217728, -210410903, 76474119},
/* .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[1].coef_b = {138909433, -267471808, 128584365},
.iir_coef[1].coef_a = {134217728, -267471808, 133276071},
.iir_bypass_flag = 0,
.iir_counter = IIR_COUNTER_FB_R,
.iir_coef[2].coef_b = {134542733, -268138827, 133597115},
.iir_coef[2].coef_a = {134217728, -268138827, 133922120},
.iir_coef[0].coef_b = {26719020, -52852829, 26204379},
.iir_coef[0].coef_a = {134217728, -210410903, 76474119},
.iir_coef[3].coef_b = {133541379, -264235686, 130815458},
.iir_coef[3].coef_a = {134217728, -264235686, 130139109},
.iir_coef[1].coef_b = {138909433, -267471808, 128584365},
.iir_coef[1].coef_a = {134217728, -267471808, 133276071},
.iir_coef[4].coef_b = {0x8000000, 0, 0},
.iir_coef[4].coef_a = {0x8000000, 0, 0},
.iir_coef[2].coef_b = {134542733, -268138827, 133597115},
.iir_coef[2].coef_a = {134217728, -268138827, 133922120},
.iir_coef[5].coef_b = {0x8000000, 0, 0},
.iir_coef[5].coef_a = {0x8000000, 0, 0},
.iir_coef[3].coef_b = {133541379, -264235686, 130815458},
.iir_coef[3].coef_a = {134217728, -264235686, 130139109},
/* .fir_bypass_flag=1,
.fir_len = AUD_COEF_LEN,
.fir_coef =
{
32767,
},
*/
.dac_gain_offset = 0,
.adc_gain_offset = (0) * 4,
},
.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,
},
#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 = (0) * 4,
},
.anc_cfg_mc_r =
{
.total_gain = 1331,
.dac_gain_offset = 0,
.adc_gain_offset = (2) * 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 = (0) * 4,
},
.dac_gain_offset = 0,
.adc_gain_offset = (2) * 4,
},
#endif
};

View File

@ -96,10 +96,25 @@ 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
#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
// 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
// audio codec
#define CFG_HW_AUD_INPUT_PATH_NUM 3
@ -107,7 +122,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_CH0)
#define CFG_HW_AUD_SIDETONE_MIC_DEV (AUD_CHANNEL_MAP_CH4)
#define CFG_HW_AUD_SIDETONE_GAIN_DBVAL (-20)
//bt config
@ -139,8 +154,6 @@ 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

1
dev_tools/anc_decoder/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
target/

119
dev_tools/anc_decoder/Cargo.lock generated Normal file
View File

@ -0,0 +1,119 @@
# 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

@ -0,0 +1,9 @@
[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

@ -0,0 +1,132 @@
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,6 +123,7 @@
#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__
#ifdef ANC_ASSIST_ENABLED
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__
#ifdef ANC_ASSIST_ENABLED
AUD_INPUT_PATH_AF_ANC,
#endif
// Output path

View File

@ -279,6 +279,7 @@ 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
@ -352,6 +353,9 @@ 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,7 +3866,9 @@ int bt_sbc_player(enum PLAYER_OPER_T on, enum APP_SYSFREQ_FREQ_T freq) {
}
#endif
#endif
freq = APP_SYSFREQ_52M;
if (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",
@ -3886,8 +3888,10 @@ 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)
if (current_a2dp_non_type == A2DP_NON_CODEC_TYPE_LHDC) {
else if (current_a2dp_non_type == A2DP_NON_CODEC_TYPE_LHDC) {
app_overlay_select(APP_OVERLAY_A2DP_LHDC);
}
#endif

View File

@ -1,5 +1,11 @@
#!/usr/bin/env sh
#!/usr/bin/env bash
num=$(find /dev -name 'ttyUSB*' | rev | cut -c 1)
echo "$num"
sudo minicom "port$num"
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