From 1ac4814fdf5e256f0320285bcc444483c0f54d03 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Tue, 4 Jul 2023 23:00:09 +1000 Subject: [PATCH] Port some rough anc numbers from firmware dump --- config/open_source/tgt_hardware.c | 423 +++++++++++++++++------------- 1 file changed, 247 insertions(+), 176 deletions(-) diff --git a/config/open_source/tgt_hardware.c b/config/open_source/tgt_hardware.c index 34b4620..20668f7 100644 --- a/config/open_source/tgt_hardware.c +++ b/config/open_source/tgt_hardware.c @@ -226,8 +226,8 @@ HAL_IOMUX_PIN_PULLUP_ENABLE }; */ -#define IIR_COUNTER_FF_L (6) -#define IIR_COUNTER_FF_R (6) +#define IIR_COUNTER_FF_L (8) +#define IIR_COUNTER_FF_R (8) #define IIR_COUNTER_FB_L (5) #define IIR_COUNTER_FB_R (5) @@ -712,243 +712,314 @@ 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 = (2) * 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 = (2) * 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 = (2) * 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 = (2) * 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 = (2) * 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 = (2) * 4, - }, + .dac_gain_offset = 0, + .adc_gain_offset = (2) * 4, + }, #endif };