Add logging to anc init

This commit is contained in:
Ben V. Brown 2023-02-04 21:52:20 +11:00
parent 9f525debd0
commit b63b1b3a39
2 changed files with 32 additions and 22 deletions

View File

@ -47,8 +47,8 @@
#endif #endif
#include "co_math.h" #include "co_math.h"
//#define ANC_MODE_SWITCH_WITHOUT_FADE //Comment this line if you need fade // #define ANC_MODE_SWITCH_WITHOUT_FADE //Comment this line if you need fade
// function between anc mode // function between anc mode
#ifndef _ANC_FADE_STACK_SIZE #ifndef _ANC_FADE_STACK_SIZE
#define _ANC_FADE_STACK_SIZE (1 * 1024) #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]; capture_rate = anc_sample_rate[AUD_STREAM_CAPTURE];
pmu_anc_config(1); pmu_anc_config(1);
int result = 0;
#ifdef ANC_FF_ENABLED #ifdef ANC_FF_ENABLED
af_anc_open(ANC_FEEDFORWARD, playback_rate, capture_rate, handler); result = af_anc_open(ANC_FEEDFORWARD, playback_rate, capture_rate, handler);
anc_open(ANC_FEEDFORWARD); TRACE(2, "af_anc_open %s %d -> %d\n", __FUNCTION__, __LINE__, result);
anc_select_coef(anc_sample_rate[AUD_STREAM_PLAYBACK], anc_coef_idx, result = anc_open(ANC_FEEDFORWARD);
ANC_FEEDFORWARD, ANC_GAIN_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_FEEDFORWARD, ANC_GAIN_DELAY);
TRACE(2, "anc_select_coef %s %d -> %d\n", __FUNCTION__, __LINE__, result);
#endif #endif
#ifdef ANC_FB_ENABLED #ifdef ANC_FB_ENABLED
af_anc_open(ANC_FEEDBACK, playback_rate, capture_rate, handler); result = af_anc_open(ANC_FEEDBACK, playback_rate, capture_rate, handler);
anc_open(ANC_FEEDBACK); TRACE(2, "anc_open %s %d -> %d\n", __FUNCTION__, __LINE__, result);
anc_select_coef(anc_sample_rate[AUD_STREAM_PLAYBACK], anc_coef_idx, result = anc_open(ANC_FEEDBACK);
ANC_FEEDBACK, ANC_GAIN_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_FEEDBACK, ANC_GAIN_DELAY);
TRACE(2, "anc_select_coef %s %d -> %d\n", __FUNCTION__, __LINE__, result);
#endif #endif
#ifdef AUDIO_ANC_FB_MC_HW #ifdef AUDIO_ANC_FB_MC_HW
anc_open(ANC_MUSICCANCLE); result = anc_open(ANC_MUSICCANCLE);
anc_select_coef(anc_sample_rate[AUD_STREAM_PLAYBACK], anc_coef_idx, TRACE(2, "anc_open %s %d -> %d\n", __FUNCTION__, __LINE__, result);
ANC_MUSICCANCLE, ANC_GAIN_NO_DELAY); 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 #endif
#if defined(AUDIO_ANC_TT_HW) #if defined(AUDIO_ANC_TT_HW)
anc_open(ANC_TALKTHRU); anc_open(ANC_TALKTHRU);
anc_select_coef(anc_sample_rate[AUD_STREAM_PLAYBACK], anc_coef_idx, TRACE(2, "anc_open %s %d -> %d\n", __FUNCTION__, __LINE__, result);
ANC_TALKTHRU, ANC_GAIN_NO_DELAY); 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 #endif
#ifdef AUDIO_ANC_FB_MC_HW #ifdef AUDIO_ANC_FB_MC_HW

View File

@ -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) * 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_FF_MIC AUD_CHANNEL_MAP_CH0
#define ANC_FB_MIC AUD_CHANNEL_MAP_CH2 #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_VMIC_CFG AUD_VMIC_MAP_VMIC2
// audio codec // audio codec