update modes
This commit is contained in:
@@ -50,21 +50,13 @@ XUD_Result_t HidInterfaceClassRequests(
|
|||||||
#endif
|
#endif
|
||||||
#if DEBUG_MEMORY_LOG_ENABLED
|
#if DEBUG_MEMORY_LOG_ENABLED
|
||||||
unsigned log_switch;
|
unsigned log_switch;
|
||||||
|
buffer[0] = 0x1;
|
||||||
|
|
||||||
GET_SHARED_GLOBAL(log_switch, g_log_switch);
|
GET_SHARED_GLOBAL(log_switch, g_log_switch);
|
||||||
if (log_switch) {
|
if (log_switch) {
|
||||||
ret_len = 65;
|
ret_len = 65;
|
||||||
UserReadHIDLog(&buffer[1]);
|
UserReadHIDLog(&buffer[1]);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if 0
|
|
||||||
debug_printf("%d:\n", ret_len);
|
|
||||||
for(int i=0; i < ret_len; i++)
|
|
||||||
{
|
|
||||||
printhex((buffer, unsigned char[])[i]);
|
|
||||||
printstr("-");
|
|
||||||
}
|
|
||||||
printstrln("\n");
|
|
||||||
#endif
|
#endif
|
||||||
return XUD_DoGetRequest(c_ep0_out, c_ep0_in, (buffer, unsigned char []), ret_len, sp.wLength);
|
return XUD_DoGetRequest(c_ep0_out, c_ep0_in, (buffer, unsigned char []), ret_len, sp.wLength);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -97,8 +97,8 @@ set(APP_COMPILER_FLAGS_factory ${SW_FACT_AUDIO_FLAGS} -DI2S_CHANS_DA
|
|||||||
-DSTREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS=32
|
-DSTREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS=32
|
||||||
-DOUTPUT_FORMAT_COUNT=1
|
-DOUTPUT_FORMAT_COUNT=1
|
||||||
-DXUA_SPDIF_TX_EN=0
|
-DXUA_SPDIF_TX_EN=0
|
||||||
-DMAX_FREQ=\(768000\)
|
-DMAX_FREQ=\(48000\)
|
||||||
-DMIN_FREQ=\(44100\)
|
-DMIN_FREQ=\(48000\)
|
||||||
-DDEFAULT_FREQ=\(48000\)
|
-DDEFAULT_FREQ=\(48000\)
|
||||||
-DUART_DEBUG=0
|
-DUART_DEBUG=0
|
||||||
-DHID_CONTROLS=1
|
-DHID_CONTROLS=1
|
||||||
@@ -125,9 +125,9 @@ set(APP_COMPILER_FLAGS_fps_uac1 ${SW_USB_AUDIO_FLAGS} -DXUA_SPDIF_RX
|
|||||||
#-fxscope
|
#-fxscope
|
||||||
#-DXSCOPE
|
#-DXSCOPE
|
||||||
-DXUA_DFU_EN=0
|
-DXUA_DFU_EN=0
|
||||||
-DSTREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS=24
|
-DSTREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS=32
|
||||||
-DOUTPUT_FORMAT_COUNT=1
|
-DOUTPUT_FORMAT_COUNT=1
|
||||||
-DSTREAM_FORMAT_INPUT_1_RESOLUTION_BITS=24
|
-DSTREAM_FORMAT_INPUT_1_RESOLUTION_BITS=32
|
||||||
-DINPUT_FORMAT_COUNT=1
|
-DINPUT_FORMAT_COUNT=1
|
||||||
-DMCLK_441=\(1024*44100\)
|
-DMCLK_441=\(1024*44100\)
|
||||||
-DMCLK_48=\(1024*48000\)
|
-DMCLK_48=\(1024*48000\)
|
||||||
@@ -148,81 +148,81 @@ set(APP_COMPILER_FLAGS_fps_uac1 ${SW_USB_AUDIO_FLAGS} -DXUA_SPDIF_RX
|
|||||||
-DI2S_CHANS_ADC=2)
|
-DI2S_CHANS_ADC=2)
|
||||||
|
|
||||||
|
|
||||||
set(APP_COMPILER_FLAGS_fps_uac2 ${SW_USB_AUDIO_FLAGS} -DXUA_SPDIF_RX_EN=0
|
#set(APP_COMPILER_FLAGS_fps_uac2 ${SW_USB_AUDIO_FLAGS} -DXUA_SPDIF_RX_EN=0
|
||||||
-DXUA_SPDIF_TX_EN=0
|
# -DXUA_SPDIF_TX_EN=0
|
||||||
-DI2S_CHANS_DAC=2
|
# -DI2S_CHANS_DAC=2
|
||||||
-DSPDIF_RX_I2S_OUT=0
|
# -DSPDIF_RX_I2S_OUT=0
|
||||||
#-DAUDIO_CLASS=1
|
# #-DAUDIO_CLASS=1
|
||||||
-DXUA_USB_EN=1
|
# -DXUA_USB_EN=1
|
||||||
-DNUM_USB_CHAN_IN=2
|
# -DNUM_USB_CHAN_IN=2
|
||||||
-DWINDOWS_OS_DESCRIPTOR_SUPPORT
|
# -DWINDOWS_OS_DESCRIPTOR_SUPPORT
|
||||||
-DNUM_USB_CHAN_IN_FS=2
|
# -DNUM_USB_CHAN_IN_FS=2
|
||||||
-DNUM_USB_CHAN_OUT=2
|
# -DNUM_USB_CHAN_OUT=2
|
||||||
-DNUM_USB_CHAN_OUT_FS=2
|
# -DNUM_USB_CHAN_OUT_FS=2
|
||||||
-DXUA_USE_SW_PLL=0
|
# -DXUA_USE_SW_PLL=0
|
||||||
-DOUT_VOLUME_IN_MIXER=0
|
# -DOUT_VOLUME_IN_MIXER=0
|
||||||
-DFPS_UAC2=1
|
# -DFPS_UAC2=1
|
||||||
#-fxscope
|
# #-fxscope
|
||||||
#-DXSCOPE
|
# #-DXSCOPE
|
||||||
-DXUA_DFU_EN=1
|
# -DXUA_DFU_EN=1
|
||||||
-DSTREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS=32
|
# -DSTREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS=32
|
||||||
-DOUTPUT_FORMAT_COUNT=1
|
# -DOUTPUT_FORMAT_COUNT=1
|
||||||
-DSTREAM_FORMAT_INPUT_1_RESOLUTION_BITS=32
|
# -DSTREAM_FORMAT_INPUT_1_RESOLUTION_BITS=32
|
||||||
-DINPUT_FORMAT_COUNT=1
|
# -DINPUT_FORMAT_COUNT=1
|
||||||
-DMCLK_441=\(1024*44100\)
|
# -DMCLK_441=\(1024*44100\)
|
||||||
-DMCLK_48=\(1024*48000\)
|
# -DMCLK_48=\(1024*48000\)
|
||||||
-DMAX_FREQ=\(48000\)
|
# -DMAX_FREQ=\(48000\)
|
||||||
-DMIN_FREQ=\(48000\)
|
# -DMIN_FREQ=\(48000\)
|
||||||
-DDEFAULT_FREQ=\(48000\)
|
# -DDEFAULT_FREQ=\(48000\)
|
||||||
-lxmos_fps
|
# -lxmos_fps
|
||||||
#-DHID_CONTROLS_UAC1=1
|
# #-DHID_CONTROLS_UAC1=1
|
||||||
-DEQ_EN=1
|
# -DEQ_EN=1
|
||||||
-DXMOS_FPS_EN=1
|
# -DXMOS_FPS_EN=1
|
||||||
-DUAC1=1
|
# -DUAC1=1
|
||||||
-DHID_CONTROLS=1
|
# -DHID_CONTROLS=1
|
||||||
-DDNR_50MS=1
|
# -DDNR_50MS=1
|
||||||
-ldnr_50ms
|
# -ldnr_50ms
|
||||||
#-DDEBUG_MEMORY_LOG_ENABLED=1
|
# #-DDEBUG_MEMORY_LOG_ENABLED=1
|
||||||
-DNO_LOG_TIMESTAPS=0
|
# -DNO_LOG_TIMESTAPS=0
|
||||||
-DI2S_CHANS_ADC=2)
|
# -DI2S_CHANS_ADC=2)
|
||||||
|
#
|
||||||
set(APP_COMPILER_FLAGS_br_uac2 ${SW_USB_AUDIO_FLAGS}
|
#set(APP_COMPILER_FLAGS_br_uac2 ${SW_USB_AUDIO_FLAGS}
|
||||||
-DXUA_SPDIF_RX_EN=0
|
# -DXUA_SPDIF_RX_EN=0
|
||||||
-DXUA_SPDIF_TX_EN=0
|
# -DXUA_SPDIF_TX_EN=0
|
||||||
-DI2S_CHANS_DAC=2
|
# -DI2S_CHANS_DAC=2
|
||||||
-DSPDIF_RX_I2S_OUT=0
|
# -DSPDIF_RX_I2S_OUT=0
|
||||||
#-DAUDIO_CLASS=1
|
# #-DAUDIO_CLASS=1
|
||||||
-DXUA_USB_EN=1
|
# -DXUA_USB_EN=1
|
||||||
-DNUM_USB_CHAN_IN=2
|
# -DNUM_USB_CHAN_IN=2
|
||||||
-DNUM_USB_CHAN_OUT=8
|
# -DNUM_USB_CHAN_OUT=8
|
||||||
-DNUM_USB_CHAN_OUT_FS=2
|
# -DNUM_USB_CHAN_OUT_FS=2
|
||||||
-DXUA_USE_SW_PLL=0
|
# -DXUA_USE_SW_PLL=0
|
||||||
-DOUT_VOLUME_IN_MIXER=0
|
# -DOUT_VOLUME_IN_MIXER=0
|
||||||
-DBR_UAC2=1
|
# -DBR_UAC2=1
|
||||||
#-fxscope
|
# #-fxscope
|
||||||
#-DXSCOPE
|
# #-DXSCOPE
|
||||||
-DXUA_DFU_EN=1
|
# -DXUA_DFU_EN=1
|
||||||
-DSTREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS=32
|
# -DSTREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS=32
|
||||||
-DOUTPUT_FORMAT_COUNT=1
|
# -DOUTPUT_FORMAT_COUNT=1
|
||||||
-DSTREAM_FORMAT_INPUT_1_RESOLUTION_BITS=32
|
# -DSTREAM_FORMAT_INPUT_1_RESOLUTION_BITS=32
|
||||||
-DINPUT_FORMAT_COUNT=1
|
# -DINPUT_FORMAT_COUNT=1
|
||||||
-DMCLK_441=\(1024*44100\)
|
# -DMCLK_441=\(1024*44100\)
|
||||||
-DMCLK_48=\(1024*48000\)
|
# -DMCLK_48=\(1024*48000\)
|
||||||
-DMAX_FREQ=\(48000\)
|
# -DMAX_FREQ=\(48000\)
|
||||||
-DMIN_FREQ=\(48000\)
|
# -DMIN_FREQ=\(48000\)
|
||||||
-DDEFAULT_FREQ=\(48000\)
|
# -DDEFAULT_FREQ=\(48000\)
|
||||||
-DUAC1=1
|
# -DUAC1=1
|
||||||
-DTHREE_AUDIO=1
|
# -DTHREE_AUDIO=1
|
||||||
#-lxmos_fps
|
# #-lxmos_fps
|
||||||
-DHID_CONTROLS=1
|
# -DHID_CONTROLS=1
|
||||||
-DBR_ALGO=1
|
# -DBR_ALGO=1
|
||||||
-lbr
|
# -lbr
|
||||||
-DEQ_EN=1
|
# -DEQ_EN=1
|
||||||
-DDNR_50MS=1
|
# -DDNR_50MS=1
|
||||||
-ldnr_50ms
|
# -ldnr_50ms
|
||||||
#-DDEBUG_MEMORY_LOG_ENABLED=1
|
# #-DDEBUG_MEMORY_LOG_ENABLED=1
|
||||||
-DNO_LOG_TIMESTAPS=0
|
# -DNO_LOG_TIMESTAPS=0
|
||||||
-DI2S_CHANS_ADC=2)
|
# -DI2S_CHANS_ADC=2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
xflash bin/factory/phaten_module_factory.xe --loader loader.o --upgrade 2 bin/fps_uac1/phaten_module_fps_uac1.xe --upgrade 1 bin/fps_uac2/phaten_module_fps_uac2.xe --upgrade 6 ../app_usb_aud_fosi_c1_lp/bin/bypass_uac2/phaten_module_bypass_uac2.xe -o %1
|
xflash bin/factory/phaten_module_factory.xe --loader loader.o --upgrade 6 bin/fps_uac1/phaten_module_fps_uac1.xe --upgrade 2 ../app_usb_aud_fosi_c1_lp/bin/bypass_uac1/phaten_module_bypass_uac1.xe -o %1
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
xflash --factory-version 15.3 --target-file src/core/xu316_qf60.xn --upgrade 2 bin/fps_uac1/phaten_module_fps_uac1.xe --upgrade 1 bin/fps_uac2/phaten_module_fps_uac2.xe --upgrade 6 ../app_usb_aud_fosi_c1_lp/bin/bypass_uac2/phaten_module_bypass_uac2.xe -o %1
|
xflash --factory-version 15.3 --target-file src/core/xu316_qf60.xn --upgrade 6 bin/fps_uac1/phaten_module_fps_uac1.xe --upgrade 2 ../app_usb_aud_fosi_c1_lp/bin/bypass_uac1/phaten_module_bypass_uac1.xe -o %1
|
||||||
|
|||||||
@@ -34,11 +34,11 @@ extern "C" {
|
|||||||
#define DISABLE_REBOOT 1
|
#define DISABLE_REBOOT 1
|
||||||
|
|
||||||
#define MODE_FPS_UAC2 COAX_IN_FLAG // 1 FPS
|
#define MODE_FPS_UAC2 COAX_IN_FLAG // 1 FPS
|
||||||
#define MODE_FPS_UAC1 USB_IN_FLAG // 2 UAC1
|
#define MODE_BYPASS_UAC1 USB_IN_FLAG // 2 BYPASS
|
||||||
#define MODE_BR_UAC2 OPT_IN_FLAG // 3 BR
|
#define MODE_BR_UAC2 OPT_IN_FLAG // 3 BR
|
||||||
#define MODE_V71_UAC2 UAC1_IN_FLAG // 4 V71
|
#define MODE_V71_UAC2 UAC1_IN_FLAG // 4 V71
|
||||||
#define MODE_V71_UAC1 BT_IN_FLAG // 5 UAC1
|
#define MODE_V71_UAC1 BT_IN_FLAG // 5 UAC1
|
||||||
#define MODE_BYPASS_UAC2 I2S_IN_FLAG // 6 BYPASS
|
#define MODE_FPS_UAC1 I2S_IN_FLAG // 6 UAC1
|
||||||
|
|
||||||
extern unsigned g_host_os; // 1 -> Windows, 2 -> Others
|
extern unsigned g_host_os; // 1 -> Windows, 2 -> Others
|
||||||
audio_sampling g_new_playback_format, g_playback_format;
|
audio_sampling g_new_playback_format, g_playback_format;
|
||||||
@@ -184,8 +184,8 @@ void switch_mode_by_c1_mode(unsigned c1_mode, unsigned force_reboot)
|
|||||||
switch (c1_mode)
|
switch (c1_mode)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
#if !BYPASS_UAC2
|
#if !BYPASS_UAC1
|
||||||
SetRoleSwitchFlag(MODE_BYPASS_UAC2);
|
SetRoleSwitchFlag(MODE_BYPASS_UAC1);
|
||||||
reboot_need = 1;
|
reboot_need = 1;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
@@ -218,8 +218,8 @@ void switch_mode_by_c1_mode(unsigned c1_mode, unsigned force_reboot)
|
|||||||
switch (c1_mode)
|
switch (c1_mode)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
SetRoleSwitchFlag(MODE_FPS_UAC1);
|
SetRoleSwitchFlag(MODE_BYPASS_UAC1);
|
||||||
reboot_need = 0;
|
reboot_need = 1;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
SetRoleSwitchFlag(MODE_V71_UAC1);
|
SetRoleSwitchFlag(MODE_V71_UAC1);
|
||||||
@@ -242,6 +242,8 @@ void switch_mode_by_c1_mode(unsigned c1_mode, unsigned force_reboot)
|
|||||||
if (reboot_need || force_reboot)
|
if (reboot_need || force_reboot)
|
||||||
{
|
{
|
||||||
delay_milliseconds(20);
|
delay_milliseconds(20);
|
||||||
|
debug_printf("switch_mode_by_c1_mode: reboot_need = %d, force_reboot = %d\n", reboot_need, force_reboot);
|
||||||
|
debug_printf("switch_mode_by_c1_mode: c1_mode = %d\n", c1_mode);
|
||||||
device_reboot();
|
device_reboot();
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
@@ -568,7 +570,7 @@ void AudioHwRemote2(streaming chanend c, client interface i2c_master_if i2c, cli
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined(WIN_OS_DETECTION)
|
#if 0// defined(WIN_OS_DETECTION)
|
||||||
for(int i = 0; i < 500; i++)
|
for(int i = 0; i < 500; i++)
|
||||||
{
|
{
|
||||||
GET_SHARED_GLOBAL(host_os, g_host_os);
|
GET_SHARED_GLOBAL(host_os, g_host_os);
|
||||||
@@ -588,6 +590,7 @@ void AudioHwRemote2(streaming chanend c, client interface i2c_master_if i2c, cli
|
|||||||
switch_mode_by_c1_mode(c1_mode, 0);
|
switch_mode_by_c1_mode(c1_mode, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
switch_mode_by_c1_mode(c1_mode, 0);
|
||||||
|
|
||||||
|
|
||||||
// 改动原因:开机从 LittleFS 恢复 DAC 音量寄存器码;无效或未写过时用最大音量 C1_DAC_VOL_MAX,避免误用默认值或垃圾数据。
|
// 改动原因:开机从 LittleFS 恢复 DAC 音量寄存器码;无效或未写过时用最大音量 C1_DAC_VOL_MAX,避免误用默认值或垃圾数据。
|
||||||
|
|||||||
@@ -479,7 +479,7 @@ static inline int32_t apply_gain(int32_t sample, int32_t gain_db) {
|
|||||||
* 改动原因:所有采样率共用44100Hz数组,参数相同,只需要设置sample_rate标记
|
* 改动原因:所有采样率共用44100Hz数组,参数相同,只需要设置sample_rate标记
|
||||||
* 系数会根据采样率动态计算,不需要复制参数
|
* 系数会根据采样率动态计算,不需要复制参数
|
||||||
*/
|
*/
|
||||||
#if !UAC1
|
#if 1// !UAC1
|
||||||
static int copy_params_from_44100(uint32_t sample_rate, uint8_t mode) {
|
static int copy_params_from_44100(uint32_t sample_rate, uint8_t mode) {
|
||||||
if (mode >= NUM_EQ_MODES) {
|
if (mode >= NUM_EQ_MODES) {
|
||||||
debug_printf("Error: Invalid mode %d in copy_params_from_44100\n", mode);
|
debug_printf("Error: Invalid mode %d in copy_params_from_44100\n", mode);
|
||||||
@@ -698,7 +698,7 @@ unsigned int is_eq_disabled(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void clear_eq_status(unsigned sample_freq, unsigned ch_no) {
|
void clear_eq_status(unsigned sample_freq, unsigned ch_no) {
|
||||||
#if !UAC1
|
#if 1// !UAC1
|
||||||
int n;
|
int n;
|
||||||
debug_printf("clear_eq_status %d %d\n", sample_freq, ch_no);
|
debug_printf("clear_eq_status %d %d\n", sample_freq, ch_no);
|
||||||
if(is_eq_disabled())
|
if(is_eq_disabled())
|
||||||
@@ -720,7 +720,7 @@ void clear_eq_status(unsigned sample_freq, unsigned ch_no) {
|
|||||||
// 复位EQ参数函数
|
// 复位EQ参数函数
|
||||||
uint8_t reset_eq_params(uint8_t mode) {
|
uint8_t reset_eq_params(uint8_t mode) {
|
||||||
debug_printf("Resetting EQ params for mode %d\n", mode);
|
debug_printf("Resetting EQ params for mode %d\n", mode);
|
||||||
#if !UAC1
|
#if 1 //!UAC1
|
||||||
// 检查模式号有效性
|
// 检查模式号有效性
|
||||||
if (mode != 0xFF && mode >= NUM_EQ_MODES) {
|
if (mode != 0xFF && mode >= NUM_EQ_MODES) {
|
||||||
debug_printf("Error: Invalid mode %d\n", mode);
|
debug_printf("Error: Invalid mode %d\n", mode);
|
||||||
@@ -882,7 +882,7 @@ void debug_print_eq_mode(eq_mode_data_t *eq_data) {
|
|||||||
int32_t handler_eq_filter(unsigned sample_freq, uint32_t ch, int32_t new_sample) {
|
int32_t handler_eq_filter(unsigned sample_freq, uint32_t ch, int32_t new_sample) {
|
||||||
int32_t temp_sample = new_sample;
|
int32_t temp_sample = new_sample;
|
||||||
|
|
||||||
#if !UAC1
|
#if 1// !UAC1
|
||||||
|
|
||||||
if(is_eq_disabled())
|
if(is_eq_disabled())
|
||||||
{
|
{
|
||||||
@@ -1109,7 +1109,7 @@ unsigned char process_send_params(uint8_t data[], uint16_t len) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !UAC1
|
#if 1// !UAC1
|
||||||
// Process read request (0x8E) - GET_EQ_PARAMS
|
// Process read request (0x8E) - GET_EQ_PARAMS
|
||||||
if (data[1] == 0x8E) {
|
if (data[1] == 0x8E) {
|
||||||
debug_printf("Received read request (GET_EQ_PARAMS)\n");
|
debug_printf("Received read request (GET_EQ_PARAMS)\n");
|
||||||
@@ -1685,7 +1685,7 @@ unsigned char process_send_params(uint8_t data[], uint16_t len) {
|
|||||||
|
|
||||||
if (data[1] == 0x8d)
|
if (data[1] == 0x8d)
|
||||||
{
|
{
|
||||||
#if !UAC1
|
#if 1// !UAC1
|
||||||
debug_printf("Received set EQ filter parameters command (SET_EQ_PARAMS)\n");
|
debug_printf("Received set EQ filter parameters command (SET_EQ_PARAMS)\n");
|
||||||
|
|
||||||
// Get mode value (跳过report_id字节)
|
// Get mode value (跳过report_id字节)
|
||||||
@@ -2010,7 +2010,7 @@ uint8_t process_uart_set_eq_mode(uint8_t mode)
|
|||||||
*/
|
*/
|
||||||
uint8_t process_uart_get_eq_mode(uint8_t *response, uint8_t response_size)
|
uint8_t process_uart_get_eq_mode(uint8_t *response, uint8_t response_size)
|
||||||
{
|
{
|
||||||
#if !UAC1
|
#if 1 //!UAC1
|
||||||
if (response_size < 22) {
|
if (response_size < 22) {
|
||||||
debug_printf("Response buffer too small\n");
|
debug_printf("Response buffer too small\n");
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2067,7 +2067,7 @@ uint8_t process_uart_get_eq_mode(uint8_t *response, uint8_t response_size)
|
|||||||
*/
|
*/
|
||||||
uint8_t process_uart_set_mode_gain_and_name(uint8_t *data)
|
uint8_t process_uart_set_mode_gain_and_name(uint8_t *data)
|
||||||
{
|
{
|
||||||
#if !UAC1
|
#if 1// !UAC1
|
||||||
uint8_t mode = data[5]; // 串口数据位置
|
uint8_t mode = data[5]; // 串口数据位置
|
||||||
int32_t gain = (data[9] << 24) | (data[8] << 16) | (data[7] << 8) | data[6]; // 小端序
|
int32_t gain = (data[9] << 24) | (data[8] << 16) | (data[7] << 8) | data[6]; // 小端序
|
||||||
char mode_name[16] = {0};
|
char mode_name[16] = {0};
|
||||||
@@ -2169,7 +2169,7 @@ uint8_t process_uart_set_mode_gain_and_name(uint8_t *data)
|
|||||||
uint8_t process_uart_set_eq_params(uint8_t *data)
|
uint8_t process_uart_set_eq_params(uint8_t *data)
|
||||||
{
|
{
|
||||||
uint8_t result = 0x00;
|
uint8_t result = 0x00;
|
||||||
#if !UAC1
|
#if 1// !UAC1
|
||||||
uint8_t mode = data[5]; // 模式值
|
uint8_t mode = data[5]; // 模式值
|
||||||
uint8_t band_index = data[6]; // 滤波器索引
|
uint8_t band_index = data[6]; // 滤波器索引
|
||||||
uint8_t filter_type = data[7]; // 滤波器类型
|
uint8_t filter_type = data[7]; // 滤波器类型
|
||||||
@@ -2240,7 +2240,7 @@ uint8_t process_uart_set_eq_params(uint8_t *data)
|
|||||||
*/
|
*/
|
||||||
uint8_t process_uart_get_eq_params(uint8_t *data, uint8_t *response, uint8_t response_size)
|
uint8_t process_uart_get_eq_params(uint8_t *data, uint8_t *response, uint8_t response_size)
|
||||||
{
|
{
|
||||||
#if !UAC1
|
#if 1// !UAC1
|
||||||
if (response_size < 27) {
|
if (response_size < 27) {
|
||||||
debug_printf("Response buffer too small\n");
|
debug_printf("Response buffer too small\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -97,8 +97,8 @@ set(APP_COMPILER_FLAGS_factory ${SW_FACT_AUDIO_FLAGS} -DI2S_CHANS_DA
|
|||||||
-DSTREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS=32
|
-DSTREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS=32
|
||||||
-DOUTPUT_FORMAT_COUNT=1
|
-DOUTPUT_FORMAT_COUNT=1
|
||||||
-DXUA_SPDIF_TX_EN=0
|
-DXUA_SPDIF_TX_EN=0
|
||||||
-DMAX_FREQ=\(768000\)
|
-DMAX_FREQ=\(48000\)
|
||||||
-DMIN_FREQ=\(44100\)
|
-DMIN_FREQ=\(48000\)
|
||||||
-DDEFAULT_FREQ=\(48000\)
|
-DDEFAULT_FREQ=\(48000\)
|
||||||
-DUART_DEBUG=0
|
-DUART_DEBUG=0
|
||||||
-DHID_CONTROLS=1
|
-DHID_CONTROLS=1
|
||||||
@@ -108,11 +108,11 @@ set(APP_COMPILER_FLAGS_factory ${SW_FACT_AUDIO_FLAGS} -DI2S_CHANS_DA
|
|||||||
-DNUM_USB_CHAN_OUT=2
|
-DNUM_USB_CHAN_OUT=2
|
||||||
-DI2S_CHANS_ADC=0)
|
-DI2S_CHANS_ADC=0)
|
||||||
|
|
||||||
set(APP_COMPILER_FLAGS_bypass_uac2 ${SW_USB_AUDIO_FLAGS} -DXUA_SPDIF_RX_EN=0
|
set(APP_COMPILER_FLAGS_bypass_uac1 ${SW_USB_AUDIO_FLAGS} -DXUA_SPDIF_RX_EN=0
|
||||||
-DXUA_SPDIF_TX_EN=0
|
-DXUA_SPDIF_TX_EN=0
|
||||||
-DI2S_CHANS_DAC=2
|
-DI2S_CHANS_DAC=2
|
||||||
-DSPDIF_RX_I2S_OUT=0
|
-DSPDIF_RX_I2S_OUT=0
|
||||||
#-DAUDIO_CLASS=1
|
-DAUDIO_CLASS=1
|
||||||
-DXUA_USB_EN=1
|
-DXUA_USB_EN=1
|
||||||
-DNUM_USB_CHAN_IN=2
|
-DNUM_USB_CHAN_IN=2
|
||||||
-DWINDOWS_OS_DESCRIPTOR_SUPPORT
|
-DWINDOWS_OS_DESCRIPTOR_SUPPORT
|
||||||
@@ -121,34 +121,73 @@ set(APP_COMPILER_FLAGS_bypass_uac2 ${SW_USB_AUDIO_FLAGS} -DXUA_SPDIF_RX
|
|||||||
-DNUM_USB_CHAN_OUT_FS=2
|
-DNUM_USB_CHAN_OUT_FS=2
|
||||||
-DXUA_USE_SW_PLL=0
|
-DXUA_USE_SW_PLL=0
|
||||||
-DOUT_VOLUME_IN_MIXER=0
|
-DOUT_VOLUME_IN_MIXER=0
|
||||||
-DBYPASS_UAC2=1
|
-DBYPASS_UAC1=1
|
||||||
#-fxscope
|
#-fxscope
|
||||||
#-DXSCOPE
|
#-DXSCOPE
|
||||||
-DXUA_DFU_EN=1
|
-DXUA_DFU_EN=1
|
||||||
-DSTREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS=32
|
-DSTREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS=24
|
||||||
-DOUTPUT_FORMAT_COUNT=1
|
-DOUTPUT_FORMAT_COUNT=1
|
||||||
-DSTREAM_FORMAT_INPUT_1_RESOLUTION_BITS=32
|
-DSTREAM_FORMAT_INPUT_1_RESOLUTION_BITS=24
|
||||||
-DINPUT_FORMAT_COUNT=1
|
-DINPUT_FORMAT_COUNT=1
|
||||||
-DMCLK_441=\(1024*44100\)
|
-DMCLK_441=\(1024*44100\)
|
||||||
-DMCLK_48=\(1024*48000\)
|
-DMCLK_48=\(1024*48000\)
|
||||||
-DMAX_FREQ=\(48000\)
|
-DMAX_FREQ=\(48000\)
|
||||||
-DMIN_FREQ=\(48000\)
|
-DMIN_FREQ=\(48000\)
|
||||||
-DDEFAULT_FREQ=\(48000\)
|
-DDEFAULT_FREQ=\(48000\)
|
||||||
#-lxmos_fps
|
-DHID_CONTROLS_UAC1=1
|
||||||
#-DHID_CONTROLS_UAC1=1
|
#-DEQ_EN=1
|
||||||
-DEQ_EN=0
|
|
||||||
-DXMOS_FPS_EN=0
|
-DXMOS_FPS_EN=0
|
||||||
-DUAC1=1
|
-DUAC1=1
|
||||||
-DHID_CONTROLS=1
|
-DHID_CONTROLS=1
|
||||||
-DDNR_50MS=1
|
#-DDNR_50MS=1
|
||||||
-DLOW_POWER_EN=1
|
#-DLOW_POWER_EN=1
|
||||||
-DCHAN_BUFF_CTRL=1
|
#-DCHAN_BUFF_CTRL=1
|
||||||
-DXUD_PRIORITY_HIGH=1
|
#-DXUD_PRIORITY_HIGH=1
|
||||||
-ldnr_50ms
|
#-ldnr_50ms
|
||||||
#-DDEBUG_MEMORY_LOG_ENABLED=1
|
-DDEBUG_MEMORY_LOG_ENABLED=1
|
||||||
-DNO_LOG_TIMESTAPS=0
|
-DNO_LOG_TIMESTAPS=0
|
||||||
-DI2S_CHANS_ADC=2)
|
-DI2S_CHANS_ADC=2)
|
||||||
|
|
||||||
|
#set(APP_COMPILER_FLAGS_bypass_uac2 ${SW_USB_AUDIO_FLAGS} -DXUA_SPDIF_RX_EN=0
|
||||||
|
# -DXUA_SPDIF_TX_EN=0
|
||||||
|
# -DI2S_CHANS_DAC=2
|
||||||
|
# -DSPDIF_RX_I2S_OUT=0
|
||||||
|
# -DXUA_USB_EN=1
|
||||||
|
# -DNUM_USB_CHAN_IN=2
|
||||||
|
# -DWINDOWS_OS_DESCRIPTOR_SUPPORT
|
||||||
|
# -DNUM_USB_CHAN_IN_FS=2
|
||||||
|
# -DNUM_USB_CHAN_OUT=2
|
||||||
|
# -DNUM_USB_CHAN_OUT_FS=2
|
||||||
|
# -DXUA_USE_SW_PLL=0
|
||||||
|
# -DOUT_VOLUME_IN_MIXER=0
|
||||||
|
# -DBYPASS_UAC2=1
|
||||||
|
# #-fxscope
|
||||||
|
# #-DXSCOPE
|
||||||
|
# -DXUA_DFU_EN=1
|
||||||
|
# -DSTREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS=32
|
||||||
|
# -DOUTPUT_FORMAT_COUNT=1
|
||||||
|
# -DSTREAM_FORMAT_INPUT_1_RESOLUTION_BITS=32
|
||||||
|
# -DINPUT_FORMAT_COUNT=1
|
||||||
|
# -DMCLK_441=\(1024*44100\)
|
||||||
|
# -DMCLK_48=\(1024*48000\)
|
||||||
|
# -DMAX_FREQ=\(48000\)
|
||||||
|
# -DMIN_FREQ=\(48000\)
|
||||||
|
# -DDEFAULT_FREQ=\(48000\)
|
||||||
|
# #-lxmos_fps
|
||||||
|
# #-DHID_CONTROLS_UAC1=1
|
||||||
|
# -DEQ_EN=0
|
||||||
|
# -DXMOS_FPS_EN=0
|
||||||
|
# -DUAC1=1
|
||||||
|
# -DHID_CONTROLS=1
|
||||||
|
# -DDNR_50MS=1
|
||||||
|
# -DLOW_POWER_EN=1
|
||||||
|
# -DCHAN_BUFF_CTRL=1
|
||||||
|
# -DXUD_PRIORITY_HIGH=1
|
||||||
|
# -ldnr_50ms
|
||||||
|
# #-DDEBUG_MEMORY_LOG_ENABLED=1
|
||||||
|
# -DNO_LOG_TIMESTAPS=0
|
||||||
|
# -DI2S_CHANS_ADC=2)
|
||||||
|
|
||||||
set(APP_INCLUDES src src/core src/extensions ../shared/)
|
set(APP_INCLUDES src src/core src/extensions ../shared/)
|
||||||
set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
|
set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
|
||||||
link_directories("${CMAKE_CURRENT_LIST_DIR}/src/extensions/dnr/")
|
link_directories("${CMAKE_CURRENT_LIST_DIR}/src/extensions/dnr/")
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
xflash bin/factory/phaten_module_factory.xe --loader loader.o --upgrade 2 bin/fps_uac1/phaten_module_fps_uac1.xe --upgrade 1 bin/fps_uac2/phaten_module_fps_uac2.xe --upgrade 6 ../app_usb_aud_fosi_c1_lp/bin/bypass_uac2/phaten_module_bypass_uac2.xe -o %1
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
xflash --factory-version 15.3 --target-file src/core/xu316_qf60.xn --upgrade 2 bin/fps_uac1/phaten_module_fps_uac1.xe --upgrade 1 bin/fps_uac2/phaten_module_fps_uac2.xe --upgrade 6 ../app_usb_aud_fosi_c1_lp/bin/bypass_uac2/phaten_module_bypass_uac2.xe -o %1
|
|
||||||
@@ -34,11 +34,11 @@ extern "C" {
|
|||||||
#define DISABLE_REBOOT 1
|
#define DISABLE_REBOOT 1
|
||||||
|
|
||||||
#define MODE_FPS_UAC2 COAX_IN_FLAG // 1 FPS
|
#define MODE_FPS_UAC2 COAX_IN_FLAG // 1 FPS
|
||||||
#define MODE_FPS_UAC1 USB_IN_FLAG // 2 UAC1
|
#define MODE_BYPASS_UAC1 USB_IN_FLAG // 2 BYPASS
|
||||||
#define MODE_BR_UAC2 OPT_IN_FLAG // 3 BR
|
#define MODE_BR_UAC2 OPT_IN_FLAG // 3 BR
|
||||||
#define MODE_V71_UAC2 UAC1_IN_FLAG // 4 V71
|
#define MODE_V71_UAC2 UAC1_IN_FLAG // 4 V71
|
||||||
#define MODE_V71_UAC1 BT_IN_FLAG // 5 UAC1
|
#define MODE_V71_UAC1 BT_IN_FLAG // 5 UAC1
|
||||||
#define MODE_BYPASS_UAC2 I2S_IN_FLAG // 6 BYPASS
|
#define MODE_FPS_UAC1 I2S_IN_FLAG // 6 UAC1
|
||||||
|
|
||||||
extern unsigned g_host_os; // 1 -> Windows, 2 -> Others
|
extern unsigned g_host_os; // 1 -> Windows, 2 -> Others
|
||||||
audio_sampling g_new_playback_format, g_playback_format;
|
audio_sampling g_new_playback_format, g_playback_format;
|
||||||
@@ -184,8 +184,8 @@ void switch_mode_by_c1_mode(unsigned c1_mode, unsigned force_reboot)
|
|||||||
switch (c1_mode)
|
switch (c1_mode)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
#if !BYPASS_UAC2
|
#if !BYPASS_UAC1
|
||||||
SetRoleSwitchFlag(MODE_BYPASS_UAC2);
|
SetRoleSwitchFlag(MODE_BYPASS_UAC1);
|
||||||
reboot_need = 1;
|
reboot_need = 1;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
@@ -218,8 +218,8 @@ void switch_mode_by_c1_mode(unsigned c1_mode, unsigned force_reboot)
|
|||||||
switch (c1_mode)
|
switch (c1_mode)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
SetRoleSwitchFlag(MODE_FPS_UAC1);
|
SetRoleSwitchFlag(MODE_BYPASS_UAC1);
|
||||||
reboot_need = 0;
|
reboot_need = 1;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
SetRoleSwitchFlag(MODE_V71_UAC1);
|
SetRoleSwitchFlag(MODE_V71_UAC1);
|
||||||
@@ -242,8 +242,10 @@ void switch_mode_by_c1_mode(unsigned c1_mode, unsigned force_reboot)
|
|||||||
if (reboot_need || force_reboot)
|
if (reboot_need || force_reboot)
|
||||||
{
|
{
|
||||||
delay_milliseconds(20);
|
delay_milliseconds(20);
|
||||||
device_reboot();
|
debug_printf("switch_mode_by_c1_mode: reboot_need = %d, force_reboot = %d\n", reboot_need, force_reboot);
|
||||||
while (1);
|
debug_printf("switch_mode_by_c1_mode: c1_mode = %d\n", c1_mode);
|
||||||
|
// device_reboot();
|
||||||
|
// while (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,7 +491,7 @@ void save_value(unsigned char * unsafe path, unsigned char value);
|
|||||||
unsigned char load_value(unsigned char * unsafe path);
|
unsigned char load_value(unsigned char * unsafe path);
|
||||||
#define C1_MODE_INFO_PATH "c1_mode"
|
#define C1_MODE_INFO_PATH "c1_mode"
|
||||||
/* 改动原因:c_dfu 仅接收 FIRMWARE_UPGRADE_START,在此线程执行 handle_firmware_upgrade_start */
|
/* 改动原因:c_dfu 仅接收 FIRMWARE_UPGRADE_START,在此线程执行 handle_firmware_upgrade_start */
|
||||||
void AudioHwRemote2(streaming chanend c, client interface i2c_master_if i2c, client interface c1_led_ctrl_if i_c1_led_ctrl, chanend c_erase, streaming chanend c_dfu)
|
void AudioHwRemote2(streaming chanend c, client interface i2c_master_if i2c, client interface c1_led_ctrl_if i_c1_led_ctrl, streaming chanend c_dfu)
|
||||||
{
|
{
|
||||||
unsigned cmd;
|
unsigned cmd;
|
||||||
int value;
|
int value;
|
||||||
@@ -557,6 +559,9 @@ void AudioHwRemote2(streaming chanend c, client interface i2c_master_if i2c, cli
|
|||||||
firmware_upgrade_init();
|
firmware_upgrade_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
debug_printf("AudioHwRemote2: c1_mode = %d\n", c1_mode);
|
||||||
|
|
||||||
// 改动原因:上电归一 c1_mode(含停用档 2/3→4),与按键循环 1/4/5 一致并写回 Flash。
|
// 改动原因:上电归一 c1_mode(含停用档 2/3→4),与按键循环 1/4/5 一致并写回 Flash。
|
||||||
{
|
{
|
||||||
unsigned c1_mode_corrected = c1_mode_sanitize(c1_mode);
|
unsigned c1_mode_corrected = c1_mode_sanitize(c1_mode);
|
||||||
@@ -568,7 +573,7 @@ void AudioHwRemote2(streaming chanend c, client interface i2c_master_if i2c, cli
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined(WIN_OS_DETECTION)
|
#if 0 // defined(WIN_OS_DETECTION)
|
||||||
for(int i = 0; i < 500; i++)
|
for(int i = 0; i < 500; i++)
|
||||||
{
|
{
|
||||||
GET_SHARED_GLOBAL(host_os, g_host_os);
|
GET_SHARED_GLOBAL(host_os, g_host_os);
|
||||||
@@ -588,6 +593,7 @@ void AudioHwRemote2(streaming chanend c, client interface i2c_master_if i2c, cli
|
|||||||
switch_mode_by_c1_mode(c1_mode, 0);
|
switch_mode_by_c1_mode(c1_mode, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
switch_mode_by_c1_mode(c1_mode, 0);
|
||||||
|
|
||||||
|
|
||||||
// 改动原因:开机从 LittleFS 恢复 DAC 音量寄存器码;无效或未写过时用最大音量 C1_DAC_VOL_MAX,避免误用默认值或垃圾数据。
|
// 改动原因:开机从 LittleFS 恢复 DAC 音量寄存器码;无效或未写过时用最大音量 C1_DAC_VOL_MAX,避免误用默认值或垃圾数据。
|
||||||
@@ -1553,14 +1559,14 @@ void flag_handler()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AudioHwRemote(streaming chanend c, client interface c1_led_ctrl_if i_c1_led_ctrl, chanend c_erase, streaming chanend c_dfu)
|
void AudioHwRemote(streaming chanend c, client interface c1_led_ctrl_if i_c1_led_ctrl, streaming chanend c_dfu)
|
||||||
{
|
{
|
||||||
i2c_master_if i2c[1];
|
i2c_master_if i2c[1];
|
||||||
|
|
||||||
par
|
par
|
||||||
{
|
{
|
||||||
i2c_master(i2c, 1, p_scl, p_sda, 100);
|
i2c_master(i2c, 1, p_scl, p_sda, 100);
|
||||||
AudioHwRemote2(c, i2c[0], i_c1_led_ctrl, c_erase, c_dfu);
|
AudioHwRemote2(c, i2c[0], i_c1_led_ctrl, c_dfu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,10 @@
|
|||||||
#include "aizip_dnr.h"
|
#include "aizip_dnr.h"
|
||||||
#include "debug_print.h"
|
#include "debug_print.h"
|
||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
|
#include "swlock.h"
|
||||||
|
|
||||||
|
// Global flash lock defined in lfs_services.c — protects all flash hardware access
|
||||||
|
extern swlock_t flash_lock;
|
||||||
|
|
||||||
//for AGC
|
//for AGC
|
||||||
//static agc_stage_ctx_t DWORD_ALIGNED agc_stage_state = {};
|
//static agc_stage_ctx_t DWORD_ALIGNED agc_stage_state = {};
|
||||||
@@ -80,7 +84,9 @@ void Aizip_DNR_init(void)
|
|||||||
delay_microseconds(10000);
|
delay_microseconds(10000);
|
||||||
// setFlashPortPins(XS1_PORT_1B,XS1_PORT_1C,XS1_PORT_4B, XS1_CLKBLK_3);
|
// setFlashPortPins(XS1_PORT_1B,XS1_PORT_1C,XS1_PORT_4B, XS1_CLKBLK_3);
|
||||||
|
|
||||||
|
swlock_acquire(&flash_lock);
|
||||||
int sta = AI_DNR_init(&pram);
|
int sta = AI_DNR_init(&pram);
|
||||||
|
swlock_release(&flash_lock);
|
||||||
dnr_init_flag = 1;
|
dnr_init_flag = 1;
|
||||||
debug_printf("AI_DNR_init status %d\n", sta);
|
debug_printf("AI_DNR_init status %d\n", sta);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ unsigned g_log_switch = 0;
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#if !UAC1
|
#if 1// !UAC1
|
||||||
#include "eq_params_44100.h"
|
#include "eq_params_44100.h"
|
||||||
|
|
||||||
// 改动原因:进一步优化EQ参数存储策略,所有采样率共用44100Hz数组
|
// 改动原因:进一步优化EQ参数存储策略,所有采样率共用44100Hz数组
|
||||||
@@ -479,7 +479,7 @@ static inline int32_t apply_gain(int32_t sample, int32_t gain_db) {
|
|||||||
* 改动原因:所有采样率共用44100Hz数组,参数相同,只需要设置sample_rate标记
|
* 改动原因:所有采样率共用44100Hz数组,参数相同,只需要设置sample_rate标记
|
||||||
* 系数会根据采样率动态计算,不需要复制参数
|
* 系数会根据采样率动态计算,不需要复制参数
|
||||||
*/
|
*/
|
||||||
#if !UAC1
|
#if 1// !UAC1
|
||||||
static int copy_params_from_44100(uint32_t sample_rate, uint8_t mode) {
|
static int copy_params_from_44100(uint32_t sample_rate, uint8_t mode) {
|
||||||
if (mode >= NUM_EQ_MODES) {
|
if (mode >= NUM_EQ_MODES) {
|
||||||
debug_printf("Error: Invalid mode %d in copy_params_from_44100\n", mode);
|
debug_printf("Error: Invalid mode %d in copy_params_from_44100\n", mode);
|
||||||
@@ -698,7 +698,7 @@ unsigned int is_eq_disabled(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void clear_eq_status(unsigned sample_freq, unsigned ch_no) {
|
void clear_eq_status(unsigned sample_freq, unsigned ch_no) {
|
||||||
#if !UAC1
|
#if 1// !UAC1
|
||||||
int n;
|
int n;
|
||||||
debug_printf("clear_eq_status %d %d\n", sample_freq, ch_no);
|
debug_printf("clear_eq_status %d %d\n", sample_freq, ch_no);
|
||||||
if(is_eq_disabled())
|
if(is_eq_disabled())
|
||||||
@@ -720,7 +720,7 @@ void clear_eq_status(unsigned sample_freq, unsigned ch_no) {
|
|||||||
// 复位EQ参数函数
|
// 复位EQ参数函数
|
||||||
uint8_t reset_eq_params(uint8_t mode) {
|
uint8_t reset_eq_params(uint8_t mode) {
|
||||||
debug_printf("Resetting EQ params for mode %d\n", mode);
|
debug_printf("Resetting EQ params for mode %d\n", mode);
|
||||||
#if !UAC1
|
#if 1 //!UAC1
|
||||||
// 检查模式号有效性
|
// 检查模式号有效性
|
||||||
if (mode != 0xFF && mode >= NUM_EQ_MODES) {
|
if (mode != 0xFF && mode >= NUM_EQ_MODES) {
|
||||||
debug_printf("Error: Invalid mode %d\n", mode);
|
debug_printf("Error: Invalid mode %d\n", mode);
|
||||||
@@ -882,7 +882,7 @@ void debug_print_eq_mode(eq_mode_data_t *eq_data) {
|
|||||||
int32_t handler_eq_filter(unsigned sample_freq, uint32_t ch, int32_t new_sample) {
|
int32_t handler_eq_filter(unsigned sample_freq, uint32_t ch, int32_t new_sample) {
|
||||||
int32_t temp_sample = new_sample;
|
int32_t temp_sample = new_sample;
|
||||||
|
|
||||||
#if !UAC1
|
#if 1// !UAC1
|
||||||
|
|
||||||
if(is_eq_disabled())
|
if(is_eq_disabled())
|
||||||
{
|
{
|
||||||
@@ -1109,7 +1109,7 @@ unsigned char process_send_params(uint8_t data[], uint16_t len) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !UAC1
|
#if 1// !UAC1
|
||||||
// Process read request (0x8E) - GET_EQ_PARAMS
|
// Process read request (0x8E) - GET_EQ_PARAMS
|
||||||
if (data[1] == 0x8E) {
|
if (data[1] == 0x8E) {
|
||||||
debug_printf("Received read request (GET_EQ_PARAMS)\n");
|
debug_printf("Received read request (GET_EQ_PARAMS)\n");
|
||||||
@@ -1685,7 +1685,7 @@ unsigned char process_send_params(uint8_t data[], uint16_t len) {
|
|||||||
|
|
||||||
if (data[1] == 0x8d)
|
if (data[1] == 0x8d)
|
||||||
{
|
{
|
||||||
#if !UAC1
|
#if 1// !UAC1
|
||||||
debug_printf("Received set EQ filter parameters command (SET_EQ_PARAMS)\n");
|
debug_printf("Received set EQ filter parameters command (SET_EQ_PARAMS)\n");
|
||||||
|
|
||||||
// Get mode value (跳过report_id字节)
|
// Get mode value (跳过report_id字节)
|
||||||
@@ -2010,7 +2010,7 @@ uint8_t process_uart_set_eq_mode(uint8_t mode)
|
|||||||
*/
|
*/
|
||||||
uint8_t process_uart_get_eq_mode(uint8_t *response, uint8_t response_size)
|
uint8_t process_uart_get_eq_mode(uint8_t *response, uint8_t response_size)
|
||||||
{
|
{
|
||||||
#if !UAC1
|
#if 1 //!UAC1
|
||||||
if (response_size < 22) {
|
if (response_size < 22) {
|
||||||
debug_printf("Response buffer too small\n");
|
debug_printf("Response buffer too small\n");
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2067,7 +2067,7 @@ uint8_t process_uart_get_eq_mode(uint8_t *response, uint8_t response_size)
|
|||||||
*/
|
*/
|
||||||
uint8_t process_uart_set_mode_gain_and_name(uint8_t *data)
|
uint8_t process_uart_set_mode_gain_and_name(uint8_t *data)
|
||||||
{
|
{
|
||||||
#if !UAC1
|
#if 1// !UAC1
|
||||||
uint8_t mode = data[5]; // 串口数据位置
|
uint8_t mode = data[5]; // 串口数据位置
|
||||||
int32_t gain = (data[9] << 24) | (data[8] << 16) | (data[7] << 8) | data[6]; // 小端序
|
int32_t gain = (data[9] << 24) | (data[8] << 16) | (data[7] << 8) | data[6]; // 小端序
|
||||||
char mode_name[16] = {0};
|
char mode_name[16] = {0};
|
||||||
@@ -2169,7 +2169,7 @@ uint8_t process_uart_set_mode_gain_and_name(uint8_t *data)
|
|||||||
uint8_t process_uart_set_eq_params(uint8_t *data)
|
uint8_t process_uart_set_eq_params(uint8_t *data)
|
||||||
{
|
{
|
||||||
uint8_t result = 0x00;
|
uint8_t result = 0x00;
|
||||||
#if !UAC1
|
#if 1// !UAC1
|
||||||
uint8_t mode = data[5]; // 模式值
|
uint8_t mode = data[5]; // 模式值
|
||||||
uint8_t band_index = data[6]; // 滤波器索引
|
uint8_t band_index = data[6]; // 滤波器索引
|
||||||
uint8_t filter_type = data[7]; // 滤波器类型
|
uint8_t filter_type = data[7]; // 滤波器类型
|
||||||
@@ -2240,7 +2240,7 @@ uint8_t process_uart_set_eq_params(uint8_t *data)
|
|||||||
*/
|
*/
|
||||||
uint8_t process_uart_get_eq_params(uint8_t *data, uint8_t *response, uint8_t response_size)
|
uint8_t process_uart_get_eq_params(uint8_t *data, uint8_t *response, uint8_t response_size)
|
||||||
{
|
{
|
||||||
#if !UAC1
|
#if 1// !UAC1
|
||||||
if (response_size < 27) {
|
if (response_size < 27) {
|
||||||
debug_printf("Response buffer too small\n");
|
debug_printf("Response buffer too small\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -73,37 +73,6 @@ extern unsigned g_adc_loop;
|
|||||||
|
|
||||||
void unmute_dac(void);
|
void unmute_dac(void);
|
||||||
|
|
||||||
inline unsigned is_silence(const unsigned samps[], int len)
|
|
||||||
{
|
|
||||||
// -30dB阈值:20*log10(threshold/max_value) = -30
|
|
||||||
// threshold = max_value * 10^(-30/20) = max_value * 0.0316
|
|
||||||
// 对于32位有符号整数,max_value = 2^31-1 ≈ 0x7FFFFFFF
|
|
||||||
// threshold ≈ 0x7FFFFFFF * 0.0316 ≈ 0x04000000
|
|
||||||
const unsigned int SILENCE_THRESHOLD = 0x10945; // -90db 0x20c49b; // 0x30000; // 0x0246b4e3; -35 // 0x04000000; // 约-30dB
|
|
||||||
|
|
||||||
for (int i = 0; i < len; ++i) {
|
|
||||||
// 正确的绝对值计算:使用条件运算符
|
|
||||||
unsigned int abs_val;
|
|
||||||
if (samps[i] & 0x80000000) {
|
|
||||||
// 负数:取反加1
|
|
||||||
abs_val = ~samps[i] + 1;
|
|
||||||
} else {
|
|
||||||
// 正数:直接使用
|
|
||||||
abs_val = samps[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查是否超过静音阈值
|
|
||||||
if (abs_val > SILENCE_THRESHOLD) {
|
|
||||||
//static int count = 0;
|
|
||||||
//count++;
|
|
||||||
// if (count % 1000000 == 0)
|
|
||||||
// debug_printf("abs_val %08x, %08x\n", abs_val, samps[i]);
|
|
||||||
return 0; // 不是静音
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1; // 是静音
|
|
||||||
}
|
|
||||||
|
|
||||||
void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[])
|
void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[])
|
||||||
{
|
{
|
||||||
unsigned dnr_enable = 0;
|
unsigned dnr_enable = 0;
|
||||||
|
|||||||
@@ -17,11 +17,7 @@ interface c1_led_ctrl_if {
|
|||||||
void switch_handler(void);
|
void switch_handler(void);
|
||||||
void flag_handler();
|
void flag_handler();
|
||||||
/* 改动原因:固件升级 START 在 AudioHwRemote2 处理,需传入 c_dfu;其余升级命令在 process_send_params 直接处理 */
|
/* 改动原因:固件升级 START 在 AudioHwRemote2 处理,需传入 c_dfu;其余升级命令在 process_send_params 直接处理 */
|
||||||
void AudioHwRemote(streaming chanend c, client interface c1_led_ctrl_if i_c1_led_ctrl, chanend c_erase, streaming chanend c_dfu);
|
void AudioHwRemote(streaming chanend c, client interface c1_led_ctrl_if i_c1_led_ctrl, streaming chanend c_dfu);
|
||||||
void uart_handler(streaming chanend c_tx, streaming chanend c_rx);
|
|
||||||
void uart_tx_handler(streaming chanend c_tx);
|
|
||||||
void uart_rx_handler(streaming chanend c_rx);
|
|
||||||
void i2s_driver(chanend c);
|
|
||||||
extern unsafe chanend uc_i2s;
|
extern unsafe chanend uc_i2s;
|
||||||
extern unsafe chanend uc_br_data;
|
extern unsafe chanend uc_br_data;
|
||||||
extern unsafe chanend uc_eq_data;
|
extern unsafe chanend uc_eq_data;
|
||||||
@@ -38,11 +34,9 @@ extern unsafe streaming chanend uc_dfu;
|
|||||||
extern void fps1_dsp_proc_task(void);
|
extern void fps1_dsp_proc_task(void);
|
||||||
extern void fps2_dsp_proc_task(void);
|
extern void fps2_dsp_proc_task(void);
|
||||||
|
|
||||||
#define USER_MAIN_DECLARATIONS streaming chan c_rx; streaming chan c_tx; \
|
#define USER_MAIN_DECLARATIONS chan c_data_transport, cc_br_eof, c_eq_data, c_validate; \
|
||||||
chan c_i2s; chan c_data_transport, cc_br_eof, c_eq_data, c_validate; \
|
|
||||||
streaming chan c_audiohw; streaming chan c_dfu; interface c1_led_ctrl_if i_c1_led_ctrl; \
|
streaming chan c_audiohw; streaming chan c_dfu; interface c1_led_ctrl_if i_c1_led_ctrl; \
|
||||||
chan c_usb_to_io; chan c_io_to_usb; chan c_io_to_dspL; chan c_dspL_to_io; chan c_io_to_dspR; chan c_dspR_to_io; \
|
chan c_usb_to_io; chan c_io_to_usb; chan c_io_to_dspL; chan c_dspL_to_io; chan c_io_to_dspR; chan c_dspR_to_io; \
|
||||||
chan c_erase;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -50,11 +44,10 @@ extern void fps2_dsp_proc_task(void);
|
|||||||
unsafe { \
|
unsafe { \
|
||||||
uc_audiohw = (chanend) c_audiohw;\
|
uc_audiohw = (chanend) c_audiohw;\
|
||||||
uc_dfu = (chanend) c_dfu;\
|
uc_dfu = (chanend) c_dfu;\
|
||||||
dsp_core0();\
|
|
||||||
} \
|
} \
|
||||||
}\
|
}\
|
||||||
on tile[0]: {\
|
on tile[0]: {\
|
||||||
AudioHwRemote(c_audiohw, i_c1_led_ctrl, c_erase, c_dfu);\
|
AudioHwRemote(c_audiohw, i_c1_led_ctrl, c_dfu);\
|
||||||
}\
|
}\
|
||||||
on tile[1]: app_control_slave(i_c1_led_ctrl, c_eq_data); \
|
on tile[1]: app_control_slave(i_c1_led_ctrl, c_eq_data); \
|
||||||
\
|
\
|
||||||
|
|||||||
Reference in New Issue
Block a user