From 0a82336258b74d1cae3360e614b7b782a1cf768b Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Sat, 4 Feb 2023 21:52:20 +1100 Subject: [PATCH] Add logging to anc init --- apps/anc/src/app_anc.c | 42 +++++++++++++++++++------------ config/open_source/tgt_hardware.h | 12 ++++----- 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/apps/anc/src/app_anc.c b/apps/anc/src/app_anc.c index 465272b..ab4b076 100644 --- a/apps/anc/src/app_anc.c +++ b/apps/anc/src/app_anc.c @@ -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 diff --git a/config/open_source/tgt_hardware.h b/config/open_source/tgt_hardware.h index 9de67ca..11f9478 100644 --- a/config/open_source/tgt_hardware.h +++ b/config/open_source/tgt_hardware.h @@ -106,14 +106,14 @@ extern const struct HAL_KEY_GPIOKEY_CFG_T cfg_hw_gpio_key_cfg[CFG_HW_GPIOKEY_NUM * * Note that AUD_CHANNEL_MAP is offset by 1 (0 start) */ - -#define ANC_FF_MIC_CH_L AUD_CHANNEL_MAP_CH0 -#define ANC_FF_MIC_CH_R 0 -#define ANC_FB_MIC_CH_L AUD_CHANNEL_MAP_CH2 -#define ANC_FB_MIC_CH_R 0 - #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