| | |
| | | <inputType id="assembler.input.1304626576" name="Assembler Source" superClass="assembler.input"/> |
| | | </tool> |
| | | <tool id="sharc.toolchain.compiler.913943905" name="CrossCore SHARC C/C++ Compiler" superClass="sharc.toolchain.compiler"> |
| | | <option id="compiler.option.optimization.556394403" name="Enable optimization (-O)" superClass="compiler.option.optimization" useByScannerDiscovery="false"/> |
| | | <option id="compiler.option.debugcode.900335004" name="Generate debug information (-g)" superClass="compiler.option.debugcode" useByScannerDiscovery="false"/> |
| | | <option id="compiler.option.optimization.556394403" name="Enable optimization (-O)" superClass="compiler.option.optimization" useByScannerDiscovery="false" value="false" valueType="boolean"/> |
| | | <option id="compiler.option.debugcode.900335004" name="Generate debug information (-g)" superClass="compiler.option.debugcode" useByScannerDiscovery="false" value="true" valueType="boolean"/> |
| | | <option id="compiler.option.proc.775463007" name="-proc" superClass="compiler.option.proc" useByScannerDiscovery="false" value=" ADSP-21569" valueType="string"/> |
| | | <option id="compiler.option.sirevision.375383135" name="-si-revision" superClass="compiler.option.sirevision" useByScannerDiscovery="false" value=" 0.0" valueType="string"/> |
| | | <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="compiler.option.preprocessdefs.200157960" name="Preprocessor definitions (-D):" superClass="compiler.option.preprocessdefs" useByScannerDiscovery="false" valueType="definedSymbols"> |
| | |
| | | </option> |
| | | <option id="compiler.option.compilerswitch.182237227" name="Compiler Switch" superClass="compiler.option.compilerswitch" useByScannerDiscovery="false" value="false" valueType="boolean"/> |
| | | <option id="compiler.option.cpp11.976576354" name="Compile C++ source files with C++11 feature extensions (-c++11)" superClass="compiler.option.cpp11" useByScannerDiscovery="false" value="true" valueType="boolean"/> |
| | | <option id="compiler.option.interprocdoptim.1504058608" name="Interprocedural optimization (-ipa)" superClass="compiler.option.interprocdoptim" useByScannerDiscovery="false" value="false" valueType="boolean"/> |
| | | <inputType id="compiler.inputType.1651873364" name="C/C++ Source" superClass="compiler.inputType"/> |
| | | </tool> |
| | | <tool id="sharc.toolchain.linker.1433934460" name="CrossCore SHARC Linker" superClass="sharc.toolchain.linker"> |
| | |
| | | <tool id="sharc.toolchain.loader.1387296196" name="CrossCore SHARC Loader" superClass="sharc.toolchain.loader"> |
| | | <option id="loader.option.proc.1054273039" name="-proc" superClass="loader.option.proc" useByScannerDiscovery="false" value=" ADSP-21569" valueType="string"/> |
| | | <option id="loader.option.sirevision.439317339" name="-si-revision" superClass="loader.option.sirevision" useByScannerDiscovery="false" value=" 0.0" valueType="string"/> |
| | | <option id="sharc.loader.option.kernelfile.696987039" name="Kernel file (-l)" superClass="sharc.loader.option.kernelfile" useByScannerDiscovery="false" value="C:\Analog Devices\CrossCore Embedded Studio 2.11.0\SHARC\ldr\null.dxe" valueType="string"/> |
| | | <option id="sharc.loader.option.enumerated.bootmode.568320891" superClass="sharc.loader.option.enumerated.bootmode" useByScannerDiscovery="false" value="sharc.loader.option.boot.enumerated.spislave" valueType="enumerated"/> |
| | | <option id="sharc.loader.option.enumerated.bootformat.1189547824" superClass="sharc.loader.option.enumerated.bootformat" useByScannerDiscovery="false" value="sharc.loader.option.format.enumerated.binary" valueType="enumerated"/> |
| | | <option id="sharc.loader.option.initfile.1249896984" superClass="sharc.loader.option.initfile" useByScannerDiscovery="false" value="C:\Analog Devices\CrossCore Embedded Studio 2.11.0\SHARC\ldr\ezkit21569_initcode.dxe" valueType="string"/> |
| | | <option id="sharc.loader.option.kernelfile.696987039" name="Kernel file (-l)" superClass="sharc.loader.option.kernelfile" useByScannerDiscovery="false" value="D:\Program Files\Analog Devices\CrossCore Embedded Studio 2.12.1\SHARC\ldr\null.dxe" valueType="string"/> |
| | | <option id="sharc.loader.option.enumerated.bootmode.568320891" name="Boot mode (-b)" superClass="sharc.loader.option.enumerated.bootmode" useByScannerDiscovery="false" value="sharc.loader.option.boot.enumerated.spislave" valueType="enumerated"/> |
| | | <option id="sharc.loader.option.enumerated.bootformat.1189547824" name="Boot format (-f)" superClass="sharc.loader.option.enumerated.bootformat" useByScannerDiscovery="false" value="sharc.loader.option.format.enumerated.binary" valueType="enumerated"/> |
| | | <option id="sharc.loader.option.initfile.1249896984" name="Initialization file (-init)" superClass="sharc.loader.option.initfile" useByScannerDiscovery="false" value="D:\Program Files\Analog Devices\CrossCore Embedded Studio 2.12.1\SHARC\ldr\ezkit21569_initcode.dxe" valueType="string"/> |
| | | </tool> |
| | | <tool id="sharc.toolchain.deviceprogrammer.185366862" name="CrossCore SHARC Device Programmer" superClass="sharc.toolchain.deviceprogrammer"> |
| | | <option id="deviceprogrammer.option.proc.1944618241" name="-proc" superClass="deviceprogrammer.option.proc" useByScannerDiscovery="false" value=" ADSP-21569" valueType="string"/> |
| | | <option id="deviceprogrammer.option.enumerated.fileformat.170825008" superClass="deviceprogrammer.option.enumerated.fileformat" useByScannerDiscovery="false" value="deviceprogrammer.option.format.enumerated.binary" valueType="enumerated"/> |
| | | <option id="deviceprogrammer.option.enumerated.fileformat.170825008" name="File format" superClass="deviceprogrammer.option.enumerated.fileformat" useByScannerDiscovery="false" value="deviceprogrammer.option.format.enumerated.binary" valueType="enumerated"/> |
| | | </tool> |
| | | </toolChain> |
| | | </folderInfo> |
| | |
| | | <tool id="sharc.toolchain.deviceprogrammer.630556623" name="CrossCore SHARC Device Programmer" superClass="sharc.toolchain.deviceprogrammer.185366862"/> |
| | | </toolChain> |
| | | </folderInfo> |
| | | <fileInfo id="sharc.toolchain.configuration.debug.986561216.776821550" name="tob.cpp" rcbsApplicability="disable" resourcePath="src/tob.cpp" toolsToInvoke="sharc.toolchain.compiler.913943905.1208184272"> |
| | | <tool id="sharc.toolchain.compiler.913943905.1208184272" name="CrossCore SHARC C/C++ Compiler" superClass="sharc.toolchain.compiler.913943905"> |
| | | <option id="compiler.option.debugcode.1852700867" name="Generate debug information (-g)" superClass="compiler.option.debugcode" useByScannerDiscovery="false" value="true" valueType="boolean"/> |
| | | <option id="compiler.option.optimization.1367621719" name="Enable optimization (-O)" superClass="compiler.option.optimization" useByScannerDiscovery="false" value="false" valueType="boolean"/> |
| | | <option id="compiler.option.interprocdoptim.1519443625" name="Interprocedural optimization (-ipa)" superClass="compiler.option.interprocdoptim" useByScannerDiscovery="false" value="true" valueType="boolean"/> |
| | | <inputType id="compiler.inputType.1256387287" name="C/C++ Source" superClass="compiler.inputType"/> |
| | | </tool> |
| | | </fileInfo> |
| | | <fileInfo id="sharc.toolchain.configuration.debug.986561216.961651879" name="f2f.c" rcbsApplicability="disable" resourcePath="src/f2f.c" toolsToInvoke="sharc.toolchain.compiler.913943905.255253029"> |
| | | <tool id="sharc.toolchain.compiler.913943905.255253029" name="CrossCore SHARC C/C++ Compiler" superClass="sharc.toolchain.compiler.913943905"> |
| | | <option id="compiler.option.debugcode.640011568" name="Generate debug information (-g)" superClass="compiler.option.debugcode" useByScannerDiscovery="false" value="false" valueType="boolean"/> |
| | | <option id="compiler.option.optimization.1494843332" name="Enable optimization (-O)" superClass="compiler.option.optimization" useByScannerDiscovery="false" value="true" valueType="boolean"/> |
| | | <option id="compiler.option.interprocdoptim.1022671789" name="Interprocedural optimization (-ipa)" superClass="compiler.option.interprocdoptim" useByScannerDiscovery="false" value="true" valueType="boolean"/> |
| | | <inputType id="compiler.inputType.142353510" name="C/C++ Source" superClass="compiler.inputType"/> |
| | | </tool> |
| | | </fileInfo> |
| | | <sourceEntries> |
| | | <entry excluding="system|src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> |
| | | <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/> |
| | |
| | | <tool id="sharc.toolchain.loader.1360261758" name="CrossCore SHARC Loader" superClass="sharc.toolchain.loader"> |
| | | <option id="loader.option.proc.1450984201" name="-proc" superClass="loader.option.proc" value=" ADSP-21569" valueType="string"/> |
| | | <option id="loader.option.sirevision.838668312" name="-si-revision" superClass="loader.option.sirevision" value=" 0.0" valueType="string"/> |
| | | <option id="sharc.loader.option.kernelfile.307294945" name="Kernel file (-l)" superClass="sharc.loader.option.kernelfile" value="C:\Analog Devices\CrossCore Embedded Studio 2.11.0\SHARC\ldr\_prom.dxe" valueType="string"/> |
| | | <option id="sharc.loader.option.kernelfile.307294945" name="Kernel file (-l)" superClass="sharc.loader.option.kernelfile" value="D:\Program Files\Analog Devices\CrossCore Embedded Studio 2.12.1\SHARC\ldr\_prom.dxe" valueType="string"/> |
| | | </tool> |
| | | <tool id="sharc.toolchain.deviceprogrammer.707828906" name="CrossCore SHARC Device Programmer" superClass="sharc.toolchain.deviceprogrammer"> |
| | | <option id="deviceprogrammer.option.proc.686495168" name="-proc" superClass="deviceprogrammer.option.proc" value=" ADSP-21569" valueType="string"/> |
| | |
| | | eclipse.preferences.version=1 |
| | | version=2.11.0.0 |
| | | version=2.12.1.0 |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | eclipse.preferences.version=1 |
| | | encoding//src/messageproc.cpp=UTF-8 |
| | | encoding//src/tg/tg_scene.cpp=UTF-8 |
| | |
| | | }ADI_DMC_CONFIG; |
| | | |
| | | int dmc_cfg0_init(void); |
| | | void adi_dmc_lane_reset(bool reset); |
| | | |
| | | #ifdef __cplusplus |
| | | } |
| | |
| | | *pREG_FIR0_CHNPTR = (uint32_t)(saddr(firHead.first->tcb+12)); |
| | | firHead.clock_start = clock(); |
| | | //Initializing the chain pointer register |
| | | *pREG_FIR0_CTL1 = BITM_FIR_CTL1_EN|BITM_FIR_CTL1_DMAEN|(firHead.num -1)<<BITP_FIR_CTL1_CH|BITM_FIR_CTL1_BURSTEN; |
| | | //*pREG_FIR0_CTL1 = BITM_FIR_CTL1_EN|BITM_FIR_CTL1_DMAEN|(firHead.num -1)<<BITP_FIR_CTL1_CH|BITM_FIR_CTL1_BURSTEN; |
| | | *pREG_FIR0_CTL1 = BITM_FIR_CTL1_EN|BITM_FIR_CTL1_DMAEN|((firHead.num -1)<<BITP_FIR_CTL1_CH); |
| | | |
| | | firHead.status = acc_processing; |
| | | } |
| | |
| | | #include "linkport.h" |
| | | |
| | | |
| | | unsigned int SAMPLE_RATE = 48000; |
| | | unsigned int SAMPLE_NUM = 64; |
| | | |
| | | |
| | | void spu_config(void) |
| | | { |
| | |
| | | if(sports[i].interrupt) { |
| | | dma_install_interrupt(sports[i].spid); |
| | | } |
| | | sport_config(get_sport_regs(sports[i].spid) , &sports[i]); |
| | | sport_config(get_sport_regs(sports[i].spid) , &sports[i], SAMPLE_NUM); |
| | | } |
| | | } |
| | | |
| | |
| | | * Author: graydon |
| | | */ |
| | | |
| | | #ifndef DRV_BOARD_H_ |
| | | #define DRV_BOARD_H_ |
| | | //#ifndef DRV_BOARD_H_ |
| | | //#define DRV_BOARD_H_ |
| | | #pragma once |
| | | |
| | | #ifdef __cplusplus |
| | | extern "C" { |
| | |
| | | |
| | | #include "typedefs.h" |
| | | #include "sru_dai.h" |
| | | |
| | | extern unsigned int SAMPLE_RATE; |
| | | extern unsigned int SAMPLE_NUM; |
| | | |
| | | /* |
| | | * 为äºå21489 ä¿æå
¼å®¹ï¼ åè®®å®ä¹å
¨é¨éç¨shortç±»å |
| | | * */ |
| | |
| | | #ifdef __cplusplus |
| | | } |
| | | #endif |
| | | #endif /* DRV_BOARD_H_ */ |
| | | //#endif /* DRV_BOARD_H_ */ |
| | |
| | | #include <stdint.h> |
| | | #include <stdlib.h> |
| | | #include <services/pwr/adi_pwr.h> |
| | | #include "DMCInit.h" |
| | | |
| | | /********************************************************************************************** |
| | | * CGU Configuration Number 0 |
| | |
| | | #include <stdint.h> |
| | | #include <stdio.h> |
| | | #include <services/int/adi_int.h> |
| | | #include <services/int/adi_sec.h> |
| | | #include <drivers/spi/adi_spi.h> |
| | | #include <signal.h> |
| | | #include "typedefs.h" |
| | | #include "spi.h" |
| | | #include "gpio.h" |
| | | #include "config.h" |
| | | #include <drivers/spi/adi_spi.h> |
| | | |
| | | |
| | | #define MASTER 0 |
| | | #define CPHA 1 |
| | |
| | | |
| | | // GPIO_SetOutPut(GPIOA, GPIO_Pin12|GPIO_Pin13, GPIO_HIGH); |
| | | // GPIO_SetOutPut(GPIOB, GPIO_Pin5, GPIO_HIGH); |
| | | GPIO_SetOutPut(GPIOA, GPIO_Pin13, GPIO_LOW); |
| | | GPIO_SetOutPut(GPIOB, GPIO_Pin5, GPIO_LOW); |
| | | |
| | | SPIRxCnt ++ ; |
| | | SPIRxDone = 1; |
| | |
| | | *pREG_DMA26_CFG = (MSIZE<<8) | (PSIZE<<4) | 4 ; |
| | | *pREG_DMA26_XCNT = SPI_BUFFER_SIZE; |
| | | *pREG_DMA26_XMOD = 1; |
| | | *pREG_DMA26_ADDRSTART= (uint32_t)SPI_Tx_BUFFER|MP_OFFSET; |
| | | *pREG_DMA26_ADDRSTART= (void *)((uint32_t)SPI_Tx_BUFFER|MP_OFFSET); |
| | | *pREG_DMA26_CFG |= 1 ; |
| | | |
| | | *pREG_SPI2_TXCTL |= (1<<0); |
| | |
| | | *pREG_DMA27_CFG = (1<<1)| (MSIZE<<8) | (PSIZE<<4) | (1<<20) | 4 ; |
| | | *pREG_DMA27_XCNT = SPI_BUFFER_SIZE; |
| | | *pREG_DMA27_XMOD = 1; |
| | | *pREG_DMA27_ADDRSTART= (uint32_t)SPI_Rx_BUFFER|MP_OFFSET; |
| | | *pREG_DMA27_ADDRSTART= (void *)((uint32_t)SPI_Rx_BUFFER|MP_OFFSET); |
| | | *pREG_DMA27_CFG |= 1 ; |
| | | |
| | | *pREG_SPI2_RXCTL |= (1<<0); |
| | |
| | | *pREG_DMA26_CFG = (MSIZE<<8) | (PSIZE<<4) | 4 ; |
| | | *pREG_DMA26_XCNT = SPI_BUFFER_SIZE; |
| | | *pREG_DMA26_XMOD = 1; |
| | | *pREG_DMA26_ADDRSTART= (uint32_t)SPI_Tx_BUFFER|MP_OFFSET; |
| | | *pREG_DMA26_ADDRSTART= (void *)((uint32_t)SPI_Tx_BUFFER|MP_OFFSET); |
| | | *pREG_DMA26_CFG |= 1 ; |
| | | |
| | | *pREG_DMA27_CFG = (1<<1)| (MSIZE<<8) | (PSIZE<<4) | (1<<20) | 4 ; |
| | | *pREG_DMA27_XCNT = SPI_BUFFER_SIZE; |
| | | *pREG_DMA27_XMOD = 1; |
| | | *pREG_DMA27_ADDRSTART= (uint32_t)SPI_Rx_BUFFER|MP_OFFSET; |
| | | *pREG_DMA27_ADDRSTART= (void *)((uint32_t)SPI_Rx_BUFFER|MP_OFFSET); |
| | | *pREG_DMA27_CFG |= 1 ; |
| | | |
| | | *pREG_SPI2_CTL= (MASTER<<1)|(0<<3)|(CPHA<<4)|(CPOL<<5)|(1<<6)|(1<<8)|(BITS<<9)|(1<<0); |
| | |
| | | void * buffer; |
| | | }; |
| | | |
| | | unsigned int SAMPLE_NUM = 32; |
| | | static AudioCodec mAudioCodec[16]; |
| | | static u32 mCodecNum = 0; |
| | | static struct DMA_Desc sp_desc[32];//0a_ping,0a_pong,0b_ping,0b_pong,... |
| | |
| | | return 0; |
| | | } |
| | | |
| | | void sport_config(volatile SportRegsDef* regs , struct SportDef * config) |
| | | void sport_config(volatile SportRegsDef* regs , struct SportDef * config, unsigned int sample_num) |
| | | { |
| | | u32 i; |
| | | |
| | | volatile DMARegsDef* dma = get_dma_regs(config->spid); |
| | | struct DMA_Desc* desca_0 = &sp_desc[config->spid*2 + 0]; |
| | | struct DMA_Desc* desca_1 = &sp_desc[config->spid*2 + 1]; |
| | | u32 dmaBufferLen = config->slots*SAMPLE_NUM; |
| | | u32 dmaBufferLen = config->slots * sample_num; |
| | | s32* dmaBuffer_ping, *dmaBuffer_pong; |
| | | |
| | | if(config->enable_sec) { |
| | |
| | | |
| | | void sport_init(void); |
| | | volatile SportRegsDef* get_sport_regs(uint32_t sportid); |
| | | void sport_config(volatile SportRegsDef* regs ,struct SportDef * config); |
| | | void sport_config(volatile SportRegsDef* regs ,struct SportDef * config, unsigned int sample_num); |
| | | void sport_enable(volatile SportRegsDef* regs, ubool enable_sec); |
| | | #ifdef __cplusplus |
| | | } |
| | |
| | | __MODULE_EXPORT IModule* SignalGeneraterCreate(u32 n, ubool linkEnable , u32 sampleRate, u32 sampleNum, u16 inputNum, u16 outputNum); |
| | | __MODULE_EXPORT IModule* ContinuousSPLCreate(u32 n, ubool linkEnable , u32 sampleRate, u32 sampleNum, u16 inputNum, u16 outputNum); |
| | | __MODULE_EXPORT IModule* DummyCreate(u32 n, ubool linkEnable , u32 sampleRate, u32 sampleNum, u16 inputNum, u16 outputNum); |
| | | __MODULE_EXPORT IModule* SignalSourceCreate(u32 n, ubool linkEnable , u32 sampleRate, u32 sampleNum, u16 inputNum, u16 outputNum); |
| | | __MODULE_EXPORT IModule* InputCreate(u32 n,ubool linkEnable , u32 sampleRate, u32 sampleNum, u16 inputNum, u16 outputNum); |
| | | __MODULE_EXPORT IModule* GainCreate(u32 n, ubool linkEnable , u32 sampleRate, u32 sampleNum, u16 inputNum, u16 outputNum); |
| | | __MODULE_EXPORT IModule* OutputCreate(u32 n, ubool linkEnable , u32 sampleRate, u32 sampleNum, u16 inputNum, u16 outputNum); |
| | |
| | | #ifndef CORE_CONFIG_H_ |
| | | #define CORE_CONFIG_H_ |
| | | //#ifndef CORE_CONFIG_H_ |
| | | //#define CORE_CONFIG_H_ |
| | | |
| | | //#pragma once |
| | | |
| | | #include "../drv/board.h" |
| | | |
| | | //å
¨å±å®å®ä¹. |
| | | #define MP_OFFSET 0x28000000 |
| | | #define SPI_BUFFER_SIZE (1024) |
| | | |
| | | #define SAMPLE_RATE 48000 |
| | | //#define SAMPLE_RATE 48000 |
| | | //process block sample size. |
| | | extern unsigned int SAMPLE_NUM; |
| | | //extern unsigned int SAMPLE_RATE; |
| | | //extern unsigned int SAMPLE_NUM; |
| | | |
| | | //f2f.c use physical input & output |
| | | #define PHY_INPUT_NUM 64 |
| | |
| | | |
| | | #define LEVEL_REPORT_TIME(x) \ |
| | | (x*SAMPLE_RATE/(1000*SAMPLE_NUM)) |
| | | #endif |
| | | |
| | | |
| | | //#endif |
| | | |
| | | |
| | |
| | | ModuleProcessLibInit(); |
| | | |
| | | if (modules.empty()) { |
| | | modules.push_back(ModuleEntry("Input",ModuleType::PROC_INPUT, InputCreate, ufalse)); |
| | | modules.push_back(ModuleEntry("Input", ModuleType::PROC_INPUT, SignalSourceCreate, ufalse)); //SignalSource |
| | | // modules.push_back(ModuleEntry("Input",ModuleType::PROC_INPUT, InputCreate, ufalse)); |
| | | modules.push_back(ModuleEntry("Output",ModuleType::PROC_OUTPUT, OutputCreate, ufalse)); |
| | | |
| | | modules.push_back(ModuleEntry("Meter",ModuleType::PROC_METER, MeterCreate, ufalse)); |
| | | modules.push_back(ModuleEntry("Meter",ModuleType::PROC_METER, MeterCreate, utrue)); |
| | | modules.push_back(ModuleEntry("Expander",ModuleType::PROC_EXPANDER, ExpanderCreate, utrue)); |
| | | modules.push_back(ModuleEntry("Compress",ModuleType::PROC_COMPRESS, CompressorCreate, utrue)); |
| | | modules.push_back(ModuleEntry("Limiter",ModuleType::PROC_LIMIT, LimiterCreate, utrue)); |
| | | modules.push_back(ModuleEntry("Mixer",ModuleType::PROC_MIXER, MixerCreate, ufalse)); |
| | | modules.push_back(ModuleEntry("Delay",ModuleType::PROC_DELAY, DelayCreate, utrue)); |
| | | modules.push_back(ModuleEntry("Gain",ModuleType::PROC_GAIN, GainCreate, ufalse)); |
| | | modules.push_back(ModuleEntry("Gain",ModuleType::PROC_GAIN, GainCreate, utrue)); |
| | | modules.push_back(ModuleEntry("GainSharingmixer",ModuleType::PROC_AUTOMIXER, GSAMCreate, ufalse)); |
| | | modules.push_back(ModuleEntry("GatingMixer",ModuleType::PROC_GATING_AUTOMIXER, GatingAMCreate, ufalse)); |
| | | modules.push_back(ModuleEntry("SPL",ModuleType::PROC_CONTINUNOUS_SPL, ContinuousSPLCreate, utrue)); |
| | |
| | | modules.push_back(ModuleEntry("Ducker",ModuleType::PROC_DUCKER, DuckerCreate, utrue)); |
| | | modules.push_back(ModuleEntry("AGC",ModuleType::PROC_AGC, AGCCreate, utrue)); |
| | | modules.push_back(ModuleEntry("SELECTOR",ModuleType::PROC_SELECTOR, MixerCreate, ufalse)); |
| | | modules.push_back(ModuleEntry("SignalGenerator",ModuleType::PROC_SIGNALGEN, SignalGeneraterCreate, ufalse)); |
| | | modules.push_back(ModuleEntry("SignalGenerator",ModuleType::PROC_SIGNALGEN, SignalGeneraterCreate, utrue)); |
| | | modules.push_back(ModuleEntry("GATING",ModuleType::PROC_GATING, NoiseGateCreate,utrue)); |
| | | modules.push_back(ModuleEntry("ROUTE",ModuleType::PROC_ROUTE, RouteCreate,ufalse)); |
| | | modules.push_back(ModuleEntry("EQ",ModuleType::PROC_EQ, EQsCreate, utrue)); |
| | | modules.push_back(ModuleEntry("GEQ",ModuleType::PROC_GEQ, GEQCreate, utrue)); |
| | | modules.push_back(ModuleEntry("Crossover",ModuleType::PROC_CROSSOVER, CrossOverCreate, ufalse)); |
| | | modules.push_back(ModuleEntry("Crossover",ModuleType::PROC_CROSSOVER, CrossOverCreate, utrue)); |
| | | modules.push_back(ModuleEntry("nhs",ModuleType::PROC_FEEDBACK, NHSCreate, utrue)); |
| | | modules.push_back(ModuleEntry("aec",ModuleType::PROC_AEC, SQECreate, utrue)); |
| | | modules.push_back(ModuleEntry("aec",ModuleType::PROC_AEC, SQECreate, ufalse)); |
| | | modules.push_back(ModuleEntry("ans",ModuleType::PROC_ANS, ANSCreate, utrue)); |
| | | modules.push_back(ModuleEntry("Sysctrl",ModuleType::PROC_SYSCTL, SysctlCreate, ufalse)); |
| | | modules.push_back(ModuleEntry("FIR",ModuleType::PROC_FIR, FIRCreate,utrue)); |
| | | //modules.push_back(ModuleEntry("AFC",ModuleType::PROC_AFC, AFCCreate, utrue)); |
| | | modules.push_back(ModuleEntry("Pitch",ModuleType::PROC_PITCH, PitchCreate, ufalse)); |
| | | modules.push_back(ModuleEntry("Pitch",ModuleType::PROC_PITCH, PitchCreate, utrue)); |
| | | modules.push_back(ModuleEntry("Reverb",ModuleType::PROC_REVERB, ReverbCreate, utrue)); |
| | | modules.push_back(ModuleEntry("Echo",ModuleType::PROC_ECHO, EchoCreate, utrue)); |
| | | modules.push_back(ModuleEntry("DummyInput",ModuleType::DUMMY_INPUT, DummyCreate, ufalse)); |
| | |
| | | PROC_METER, //çµå¹³è¡¨ |
| | | PROC_EQ, //EQ |
| | | PROC_EXPANDER, //æ©å±å¨ |
| | | PROC_COMPRESS, //åç¼©å¨ |
| | | PROC_COMPRESS, //åç¼©å¨ 5 |
| | | PROC_LIMIT, //éå¹
å¨ |
| | | PROC_MIXER, //æ··é³å¨ |
| | | PROC_DELAY, //å»¶æ¶å¨ |
| | | PROC_CROSSOVER, //åé¢å¨ |
| | | PROC_OUTPUT, //è¾åº |
| | | PROC_OUTPUT, //è¾åº 10 |
| | | PROC_GAIN, //å¢ç |
| | | PROC_FEEDBACK, //é·æ³¢åé¦æå¶ |
| | | PROC_AUTOMIXER, //å¢çå
±äº«èªå¨æ··é³ |
| | | PROC_AGC, //èªå¨å¢ç |
| | | PROC_AEC, //å声æ¶é¤ |
| | | PROC_AEC, //å声æ¶é¤ 15 |
| | | PROC_ANS, //åªå£°æå¶ |
| | | PROC_SYSCTL, //ç³»ç»æ§å¶ |
| | | PROC_SHELF, // é«ä½æ¶ |
| | | PROC_SELECTOR, //æ··é³å¨ |
| | | PROC_GATING_AUTOMIXER, //é¨éèªå¨æ··é³ |
| | | PROC_CONTINUNOUS_SPL, //è¿ç»åSPL |
| | | PROC_GATING_AUTOMIXER, //é¨éèªå¨æ··é³ 20 |
| | | PROC_CONTINUNOUS_SPL, //è¿ç»åSPL(åªå£°å¢çè¡¥å¿) |
| | | PROC_GATING, //åªå£°é¨ |
| | | PROC_DUCKER, //éªé¿å¨ |
| | | PROC_REVERB, //æ··å |
| | | PROC_ECHO, //å声 |
| | | PROC_ECHO, //å声 25 |
| | | PROC_GEQ, //å¾å½¢åè¡¡å¨ |
| | | PROC_FIR, //FIRæ»¤æ³¢å¨ |
| | | PROC_AFC, //èªéåºå馿å¶å¨ |
| | | |
| | | PROC_SIGNALGEN, //ä¿¡å·åçå¨ |
| | | PROC_PITCH, //åé³å¨ |
| | | PROC_PITCH, //åé³å¨ 30 |
| | | PROC_ROUTE, //è·¯ç±å¨ |
| | | |
| | | DUMMY_INPUT, |
| | |
| | | public: |
| | | //s8 name[16]; |
| | | u16 module_type; |
| | | ubool link_enable; |
| | | ubool link_enable; //åæ°å¤ééå
±äº«æ¯æï¼ |
| | | ubool pad =0; |
| | | |
| | | Create module_create; |
| | |
| | | #include <string.h> |
| | | #include <math.h> |
| | | #include "config.h" |
| | | #include "f2f.h" |
| | | #include "../drv/sport.h" |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | void in2out_bypass(ufloat* out[], ufloat* in[], int ch, int len) |
| | | { |
| | | int i, j; |
| | | for (i = 0; i < ch; i++) |
| | | for (j = 0; j < len; j++) { |
| | | out[i][j] = in[i][j]; |
| | | } |
| | | } |
| | | void sin_gen(ufloat* dat, int len) |
| | | { |
| | | static int sta = 0; |
| | | for (u32 i = 0; i < len; i++) { |
| | | dat[i] = 0.4f * sinf(2 * 3.1415926f * 675 * sta++ / SAMPLE_RATE); |
| | | } |
| | | if (sta == SAMPLE_RATE) |
| | | sta = 0; |
| | | } |
| | | uvoid UpdateOutput(u32 iid ,u32 blockIndex) |
| | | { |
| | | // in2out_bypass(mTxChannel[0], mRxChannel[0], 1, SAMPLE_NUM); |
| | | // static ufloat data[64] = {0}; |
| | | // static int odd = 0; |
| | | // if (0 == odd++ % 3) { |
| | | // sin_gen(data, SAMPLE_NUM); |
| | | // for (u32 i = 0; i < SAMPLE_NUM; i++) { |
| | | // for (u32 j = 0; j < 8; j++) { |
| | | // mTxChannel[0][j][i] = data[i]; |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | for(s32 type =0 ; type < COUNT ;type ++) { |
| | | u16 channel = 0; |
| | | u16 output_num = mOutputNum[type]; |
| | |
| | | |
| | | for(u32 i =0 ;i < gCodecNum[type] ;i++) { |
| | | const AudioCodec* codec = &codec_arr[i]; |
| | | |
| | | if(codec->rx == utrue) continue; |
| | | |
| | | ubool enable = (iid == codec->follow_intr_no); |
| | |
| | | |
| | | if(codec->enable_sec){ |
| | | for(u32 j = 0; channel < output_num && j < codec->channel_num*2 ;j ++,channel++) { |
| | | if(enable && pTxChannel[channel] != NULL) |
| | | fixData(dataPtr +OFFSET(j), pTxChannel[channel], codec->slot_num*2, SAMPLE_NUM); |
| | | if(enable && pTxChannel[channel] != NULL) { |
| | | s32 shift = OFFSET(j); |
| | | fixData(dataPtr + shift, pTxChannel[channel], codec->slot_num*2, SAMPLE_NUM); |
| | | } |
| | | } |
| | | } |
| | | else{ |
| | |
| | | |
| | | s8 ana_input_num ; |
| | | s8 ana_output_num ; |
| | | s8 usb_input_num; |
| | | s8 usb_output_num; |
| | | s8 dante_input_num ; |
| | | s8 dante_output_num ; |
| | | s8 local_input_num; |
| | | s8 local_output_num; |
| | | public: |
| | | virtual ~hw_adapter_t(){} |
| | | hw_adapter_t(s8 dual_dsp,s8 dsp_index,s8 ana_input_num,s8 ana_output_num,s8 dante_input_num,s8 dante_output_num) |
| | | hw_adapter_t(s8 dual_dsp, s8 dsp_index, s8 local_input_num, s8 local_output_num, s8 dante_input_num, s8 dante_output_num) |
| | | { |
| | | this->dual_dsp = dual_dsp; |
| | | this->dsp_index = dsp_index ; |
| | | this->ana_input_num = ana_input_num; |
| | | this->ana_output_num = ana_output_num; |
| | | this->local_input_num = local_input_num; |
| | | this->local_output_num = local_output_num; |
| | | this->dante_input_num = dante_input_num; |
| | | this->dante_output_num = dante_output_num; |
| | | this->usb_input_num = 2; |
| | | this->usb_output_num = 2; |
| | | this->ana_input_num = local_input_num - usb_input_num; |
| | | this->ana_output_num = local_output_num - usb_output_num; |
| | | } |
| | | uvoid get_channel_num(s8* ana_rx_num,s8* ana_tx_num,s8* dante_rx_num,s8* dante_tx_num) |
| | | uvoid get_channel_num(s8* loc_rx_num,s8* loc_tx_num,s8* dante_rx_num,s8* dante_tx_num,s8* usb_rx_num,s8* usb_tx_num) |
| | | { |
| | | *ana_rx_num = ana_input_num; |
| | | *ana_tx_num = ana_output_num; |
| | | *loc_rx_num = local_input_num; |
| | | *loc_tx_num = local_output_num; |
| | | *dante_rx_num = dante_input_num; |
| | | *dante_tx_num = dante_output_num; |
| | | *usb_rx_num = usb_input_num; |
| | | *usb_tx_num = usb_output_num; |
| | | } |
| | | |
| | | uvoid get_channel_num(u16* input_num ,u16* output_num) |
| | | { |
| | | *input_num = ana_input_num+dante_input_num; |
| | | *output_num = ana_output_num+dante_output_num; |
| | | *input_num = local_input_num+dante_input_num; |
| | | *output_num = local_output_num+dante_output_num; |
| | | } |
| | | |
| | | s32 get_dsp_index() {return dsp_index ;} |
| | |
| | | #include "queue.h" |
| | | #include "f2f.h" |
| | | #include "var_state.h" |
| | | #include "tob.h" |
| | | #include "tg/module_def.h" |
| | | #include "tg/tg_scene.h" |
| | | |
| | | //å
¨å±åé |
| | | #define MAX_INTR 100 |
| | |
| | | GPIO_SetOutPut(GPIOB, GPIO_Pin10, level); |
| | | } |
| | | |
| | | |
| | | /* |
| | | * 128 · |
| | | UpdateInput && UpdateOutput 7.37% |
| | |
| | | * */ |
| | | extern "C" uvoid AudioProcCallBack (u32 iid) |
| | | { |
| | | //ToB* tob = ToB::GetInstance(); |
| | | ToB* tob = ToB::GetInstance(); |
| | | ufloat clock_start,clock_stop; |
| | | VarState& var = VarState::GetInstance(); |
| | | |
| | | //if(tob == NULL) return ; |
| | | if(var.master_intr == iid){ |
| | | var.dsp_status = DSPStatus::dsp_running_ok; |
| | | } |
| | | if(tob == NULL) return ; |
| | | |
| | | if(var.TopoLoading){ |
| | | MuteOutput(); |
| | | } else if(var.master_intr == iid){ |
| | | } |
| | | else if(var.master_intr == iid){ |
| | | clock_start = clock(); |
| | | UpdateInput(iid, DMACount[iid]&0x1); |
| | | //tob->toProc(); |
| | | tob->toProc(); |
| | | |
| | | UpdateOutput(iid, DMACount[iid]&0x1); |
| | | //LP_transmit(); |
| | | ModulesAsynSetInterval(proc_secs); |
| | |
| | | UpdateInput(iid, DMACount[iid]&0x1); |
| | | UpdateOutput(iid, DMACount[iid]&0x1); |
| | | } |
| | | DMACount[iid]++; |
| | | |
| | | ++DMACount[iid]; |
| | | } |
| | | |
| | | int main(int argc, char *argv[]) |
| | |
| | | memset(DMACount, 0, sizeof(DMACount)); |
| | | |
| | | Message* spiMsg = new Message(8); |
| | | //ç¬¬ä¸æ¬¡å¯å¨ä¸æ¥ç¹å«æ¯ä»¿ççæ¶åéè¦arm'éæ°åéæ¶æ¯. |
| | | spiMsg->DspStatusPush(DSP_EMULATE_DEBUG, 0, 0); |
| | | spiMsg->ReportDspStatus(&msg); |
| | | |
| | | SPI2_Init(); |
| | | |
| | | fir_acc_init(); |
| | | |
| | | //éç¥armå¯å¨å®æ. |
| | | //dir: pin12, High level DSP can receive data, low level DSP has data to send . |
| | | //busy: pin13, low level DSP is in busy state and cannot receive and send data, high level is free. |
| | | //dir: pin12, High level DSP can receive data, low level DSP has data toz send . |
| | | //busy: pin13/PB5, low level DSP is in busy state and cannot receive and send data, high level is free. |
| | | GPIO_SetOutPut(GPIOA, GPIO_Pin12, GPIO_HIGH); |
| | | GPIO_SetOutPut(GPIOA, GPIO_Pin13, GPIO_HIGH); |
| | | GPIO_SetOutPut(GPIOB, GPIO_Pin5, GPIO_HIGH); |
| | | |
| | | //ç¬¬ä¸æ¬¡å¯å¨ä¸æ¥ç¹å«æ¯ä»¿ççæ¶åéè¦arm'éæ°åæ¡æ. |
| | | spiMsg->DspStatusPush(DSP_EMULATE_DEBUG, 0, 0); |
| | | spiMsg->ReportDspStatus(&msg); |
| | | |
| | | printf("free sram %d, L2 %d\n", sram_free_space(SRAM_DDR, mem_any), sram_free_space(SRAM_L2, mem_any)); |
| | | |
| | | while(1) { |
| | | asyn_proc_secs = ModulesAsynProcess(); |
| | |
| | | ledCount = DMACount[var.master_intr]; |
| | | |
| | | cpu = cpu_utility()*100; //all modules execute time.; |
| | | mem = (1- space_unused()/total_mem)*10000; |
| | | mem = (1.0f - (float)space_unused()/total_mem)*10000; |
| | | |
| | | spiMsg->DspStatusPush(DSP_MEM_UTILITY, &mem, 1); |
| | | spiMsg->DspStatusPush(DSP_CPU_UTILITY, &cpu, 1); |
| | | spiMsg->DspStatusPush(DSP_CLOCK_STATUS,&var.dsp_status ,1); |
| | | spiMsg->DspStatusPush(DSP_RUNNING_STATUS,&var.dsp_status ,1); |
| | | |
| | | spiMsg->ReportDspStatus(&msg); |
| | | } |
| | |
| | | |
| | | //clock state will change after running,it need check always. |
| | | //about 1s |
| | | if(++loop_cnt > 100000000){ |
| | | if(clock_check_count == DMACount[var.master_intr]) { |
| | | if(++loop_cnt > 5e+6){ |
| | | if (var.clock_ok && clock_check_count == DMACount[var.master_intr]) { |
| | | var.dsp_status = dsp_no_clock; |
| | | spiMsg->DspStatusPush(DSP_CLOCK_STATUS,&var.dsp_status ,1); |
| | | spiMsg->DspStatusPush(DSP_RUNNING_STATUS, &var.dsp_status ,1); |
| | | spiMsg->ReportDspStatus(&msg); |
| | | printf("clk0 ok\n"); |
| | | } |
| | | loop_cnt =0; |
| | | clock_check_count = DMACount[var.master_intr]; |
| | | // printf("clk1 ok\n"); |
| | | } |
| | | |
| | | |
| | | if(!var.clock_ok && var.dsp_status == DSPStatus::dsp_running_ok && var.HandShakeSuccesful) { |
| | | //notify arm to work normaly. |
| | | spiMsg->DspStatusPush(DSP_CLOCK_STATUS, 0, 0); |
| | | spiMsg->DspStatusPush(DSP_CLOCK_STATUS, &var.dsp_status, 1); |
| | | request_topo_count = DMACount[var.master_intr] ; |
| | | var.clock_ok = utrue; |
| | | spiMsg->ReportDspStatus(&msg); |
| | | printf("clk2 ok\n"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | /* |
| | | * messageproc.c |
| | | * |
| | | * Created on: 2021å¹´11æ1æ¥ |
| | | * Created on: 2021å¹´11æ1æ¥ |
| | | * Author: graydon |
| | | */ |
| | | #include <string.h> |
| | |
| | | #include "messageproc.h" |
| | | #include "../drv/spi.h" |
| | | #include "../drv/gpio.h" |
| | | #include "../drv/memory.h" |
| | | |
| | | #include "F2F.h" |
| | | #include "ModuleProAPI.h" |
| | | #include "tg/tg_adapter.h" |
| | |
| | | } |
| | | } |
| | | |
| | | uvoid Message::ReportLevel(MSG* pmsg) |
| | | { |
| | | int i; |
| | | int data_len; |
| | | |
| | | ToB* tob = ToB::GetInstance(); |
| | | u16 LevelCnt = tob->GetLevels(Levels); //918 levels |
| | | u32 msgLen = LevelCnt * sizeof(*Levels); |
| | | int Packegs = (msgLen+MSG_DATA_LEN-1)/MSG_DATA_LEN; |
| | | |
| | | pmsg->magic = 0x5aa5; |
| | | // pmsg->dataLen = LevelCnt; |
| | | pmsg->totalPkts = Packegs; |
| | | // pmsg->pktNo = 1; |
| | | pmsg->msgType = MSG_GET_LEVEL; |
| | | pmsg->msgID = LevelCnt; |
| | | |
| | | // Split packeg |
| | | for(i=0; i<Packegs; i++){ |
| | | if(i == Packegs-1){ |
| | | data_len = msgLen - i * MSG_DATA_LEN; |
| | | } |
| | | else{ |
| | | data_len = MSG_DATA_LEN; |
| | | } |
| | | |
| | | memcpy(pmsg->data, Levels + i * MSG_DATA_LEN / sizeof(*Levels), data_len); |
| | | pmsg->dataLen = data_len; |
| | | pmsg->pktNo = i; |
| | | |
| | | pmsg->Enc(MsgType::MSG_GET_LEVEL, 0, data_len); |
| | | txQueue->Push(*pmsg); |
| | | } |
| | | } |
| | | |
| | | s32 Message::ParamCtrl(MSG* pmsg) |
| | | { |
| | | #define PCTL_MAX_PKT 5 |
| | |
| | | |
| | | if(tob != NULL && pmsg->pktNo == pmsg->totalPkts - 1) { |
| | | VarState& var = VarState::GetInstance(); |
| | | u32 type = tob->GetModuleType(ptr->mid); |
| | | // u32 type = tob->GetModuleType(ptr->mid); |
| | | s32 data_num = (pmsg->totalPkts-1)*MSG_DATA_LEN+pmsg->dataLen; |
| | | |
| | | s16* data = (s16*)(ptr + 1); |
| | | |
| | | data_num = (data_num - sizeof(struct ParamCtrl))/sizeof(s16); |
| | | |
| | | ptr->mid = var.pscene->get_module_id(ptr->mid, type, ptr->cmd) ; |
| | | // ptr->mid = var.pscene->get_module_id(ptr->mid, type, ptr->cmd) ; |
| | | // printf("mID:%d pID:%d val[0]:%d val[1]:%d\n",ptr->mid, ptr->cmd, data[0], data[1]); |
| | | tob->toCtrl(ptr->mid, ptr->cmd, data, data_num); |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | s32 Message::PresetProcess(MSG* pmsg) |
| | | { |
| | |
| | | sram_free(SRAM_DDR, bin); |
| | | bin = NULL; |
| | | } |
| | | |
| | | if(pmsg->pktNo == 0 && bin == NULL) { |
| | | bin = (u8*)sram_malloc(SRAM_DDR, mem_any ,pmsg->totalPkts*MSG_DATA_LEN); |
| | | } |
| | | if(bin == NULL) return -1; |
| | | // printf("No:%d len %d\n", pmsg->pktNo,pmsg->dataLen); |
| | | var.TopoLoading = utrue; |
| | | memcpy(bin+pmsg->pktNo*MSG_DATA_LEN, pmsg->data , pmsg->dataLen); |
| | | |
| | | if(pmsg->pktNo == pmsg->totalPkts -1) { |
| | | u32 size = (pmsg->totalPkts -1)*MSG_DATA_LEN+pmsg->dataLen; |
| | | |
| | |
| | | var.TopoStatus = PRESET_STA::PRESET_ERR; |
| | | } |
| | | else if(tob){ |
| | | s8* content = (s8*)sram_malloc(SRAM_DDR, mem_any ,16*1024); |
| | | int preset_size = sizeof(tag_parameters); // 45128 + sizeof(tag_fir) * MAX_OUTPUT_NUM; // size + FIR |
| | | u8* content = (u8*)sram_malloc(SRAM_DDR, mem_any, preset_size); |
| | | s32 size ; |
| | | |
| | | tob->toClear(); |
| | | |
| | | var.pscene->update_module(); |
| | | size = var.pscene->convert_to_bin(content); |
| | | |
| | | tob->toClear(); |
| | | tob->toAnalysis(bin, size); |
| | | tob->toAnalysis(content, size); |
| | | |
| | | sram_free(SRAM_DDR, content); |
| | | var.TopoStatus = PRESET_STA::PRESET_DONE; |
| | | } |
| | | } |
| | | sram_free(SRAM_DDR, bin); bin = NULL; |
| | | var.TopoLoading =0 ; |
| | | var.TopoLoading = ufalse ; |
| | | } |
| | | |
| | | return 0; |
| | |
| | | |
| | | s32 Message::HandshakeMessageProcess(MSG* pmsg) |
| | | { |
| | | // s8 usb_rx_ch=2, usb_tx_ch=2; |
| | | VarState& var = VarState::GetInstance(); |
| | | |
| | | ptag_device_config device_config = (ptag_device_config)pmsg->data; |
| | | struct DSPConfig dspconfig ; |
| | | |
| | | if(var.HandShakeSuccesful == ufalse) { |
| | | //å¯ä»¥æ ¹æ®ptag_device_config.hardware_type卿éé
åå·. |
| | | //å¯ä»¥æ ¹æ®ptag_device_config.hardware_type卿éé
åå·. |
| | | if(var.pscene){ |
| | | delete var.pscene; |
| | | var.pscene = NULL; |
| | | } |
| | | |
| | | // param_init(device_config); |
| | | hw_adapter_t* _adapter = new tg_hw_adapter_t(device_config->dual_dsp,device_config->dsp_index |
| | | ,device_config->local_rx_num,device_config->local_tx_num |
| | | ,device_config->dante_rx_num,device_config->dante_tx_num); |
| | | var.pscene = new tgScene(_adapter); |
| | | var.pscene = new(SRAM_DDR) tgScene(_adapter); |
| | | |
| | | _adapter->config_board(&dspconfig); |
| | | new(SRAM_DDR) ToB(device_config->dual_dsp, device_config->dsp_index); |
| | | |
| | | SAMPLE_NUM = dspconfig.mSampleNum; |
| | | var.master_intr = dspconfig.mIntrNo; |
| | |
| | | //Config(conf); |
| | | RouteConfig(dspconfig.routes,dspconfig.mRouteNum); |
| | | SRCsConfig(0 , &dspconfig.srcs[0]); |
| | | SRCsConfig(1 , &dspconfig.srcs[4]); |
| | | SRCsConfig(1 , &dspconfig.srcs[1]); |
| | | PCGsConfig(dspconfig.pcgs); |
| | | SportsConfig(dspconfig.sports); |
| | | //LinportConfig(dspconfig.linkport); |
| | |
| | | } |
| | | |
| | | Send(MsgType::MSG_ACK_REQ, 0 , 0); |
| | | |
| | | printf("HandShake OK\n"); |
| | | return 0; |
| | | } |
| | | |
| | |
| | | ParamCtrl(pmsg); |
| | | break; |
| | | case MsgType::MSG_GET_LEVEL: |
| | | ReportLevel(pmsg); |
| | | break; |
| | | case MsgType::MSG_PARAM_CONFIG: |
| | | case MsgType::MSG_PARAM_COMPLETED: |
| | |
| | | uvoid Message::Proc() |
| | | { |
| | | u32 status = 0; |
| | | // static bool bSetOk = 0; |
| | | |
| | | // MSG* p = (MSG*)SPI_Rx_BUFFER; |
| | | // if (0 == bSetOk) { |
| | | // HandshakeMessageProcess(p); //virtual communication |
| | | // PresetProcess(p); |
| | | // bSetOk = 1; |
| | | // } |
| | | |
| | | if(SPIRxDone) { |
| | | RxMessageHandler((MSG*)SPI_Rx_BUFFER); |
| | |
| | | GPIO_SetOutPut(GPIOA, GPIO_Pin12, GPIO_HIGH); |
| | | } |
| | | SPI2_SetTransMode(SPIStatus::SPI_TRX); |
| | | GPIO_SetOutPut(GPIOA, GPIO_Pin13, GPIO_HIGH); |
| | | GPIO_SetOutPut(GPIOB, GPIO_Pin5, GPIO_HIGH); |
| | | } |
| | | } |
| | |
| | | #define MESSAGEPROC_H_ |
| | | |
| | | #include <stdint.h> |
| | | #include <heapnew> |
| | | #include "protocol.h" |
| | | #include "typedefs.h" |
| | | #include "queue.h" |
| | | #include "dsp_report.h" |
| | | #include "../drv/memory.h" |
| | | |
| | | class Message{ |
| | | private: |
| | | Queue<MSG>* txQueue; |
| | | |
| | | ReportStatus dsp_status_q; |
| | | s16* Levels; |
| | | |
| | | s32 PresetProcess(MSG* pmsg); |
| | | |
| | |
| | | s32 HandshakeMessageProcess(MSG* pmsg); |
| | | |
| | | s32 RxMessageHandler(MSG* pmsg); |
| | | |
| | | void param_init(ptag_device_config pDevCfg); |
| | | |
| | | public: |
| | | Message(u32 num) |
| | | { |
| | | txQueue = new Queue<MSG>(num); |
| | | Levels = new s16[1000]; |
| | | } |
| | | ~Message() |
| | | { |
| | |
| | | uvoid Proc(); |
| | | |
| | | uvoid ReportDspStatus(MSG* pmsg); |
| | | uvoid ReportLevel(MSG* pmsg); |
| | | }; |
| | | |
| | | #endif /* MESSAGEPROC_H_ */ |
| | |
| | | //é¢è®¾åæ°è§£æç¨ |
| | | typedef u32 (*ParamCtrl_fn)(IModule* m, void* handle, int &plen); |
| | | //åæ°æ§å¶ç¨ |
| | | typedef u32 (*Ctrl_fn)(IModule* m, u32 pID, s16* val_c); |
| | | typedef u32 (*Ctrl_fn)(IModule* m, u32 pID, s16* val_c, u32 num); |
| | | |
| | | class ParamEntry { |
| | | private: |
| | |
| | | Ctrl_fn ctrl; |
| | | |
| | | public: |
| | | ParamCtrl_fn GetParamEntry(){ |
| | | ParamCtrl_fn GetParamEntry() const { |
| | | return param; |
| | | } |
| | | |
| | | Ctrl_fn GetCtrlEntry(){ |
| | | Ctrl_fn GetCtrlEntry() const { |
| | | return ctrl; |
| | | } |
| | | ParamEntry() : param(nullptr), ctrl(nullptr) {} |
| | |
| | | }; |
| | | |
| | | class param_ctrl_t{ |
| | | protected: |
| | | std::map<u32, ParamEntry> mctrl_list; |
| | | |
| | | public: |
| | | // è¿åpairé¿å
é夿¥æ¾ |
| | | std::pair<ParamCtrl_fn, Ctrl_fn> GetEntries(u32 mtype) const |
| | | { |
| | | auto it = mctrl_list.find(mtype); |
| | | if(it != mctrl_list.end()) { |
| | | return {it->second.GetParamEntry(), it->second.GetCtrlEntry()}; |
| | | } |
| | | return {nullptr, nullptr}; |
| | | } |
| | | |
| | | ParamCtrl_fn GetParamEntry(u32 mtype) const |
| | | { |
| | | auto it = mctrl_list.find(mtype); |
| | | return (it != mctrl_list.end()) ? it->second.GetParamEntry() : nullptr; |
| | | } |
| | | |
| | | Ctrl_fn GetCtrlEntry(u32 mtype) const |
| | | { |
| | | auto it = mctrl_list.find(mtype); |
| | | return (it != mctrl_list.end()) ? it->second.GetCtrlEntry() : nullptr; |
| | | } |
| | | |
| | | // æ£æ¥æ¯å¦åå¨ |
| | | bool HasEntry(u32 mtype) const |
| | | { |
| | | return mctrl_list.find(mtype) != mctrl_list.end(); |
| | | } |
| | | }; |
| | | /*class param_ctrl_t{ |
| | | protected: |
| | | std::map<u32, ParamEntry> mctrl_list; |
| | | public: |
| | |
| | | else |
| | | return NULL; |
| | | } |
| | | }; |
| | | };*/ |
| | | |
| | | |
| | | |
| | |
| | | #ifndef PROTOCOL_H_ |
| | | #define PROTOCOL_H_ |
| | | |
| | | #include <string> |
| | | #include "config.h" |
| | | |
| | | #define MSG_DATA_LEN (SPI_BUFFER_SIZE-16) |
| | |
| | | typedef struct{ |
| | | short dual_dsp; |
| | | short dsp_index; |
| | | short local_rx_num; |
| | | short local_rx_num; // include analog + usb channel |
| | | short local_tx_num; |
| | | short dante_rx_num; |
| | | short dante_tx_num; |
| | |
| | | }PhyPort; |
| | | |
| | | struct FlowChartHead { |
| | | short crcLsb; |
| | | short crcMsb; |
| | | int crc; |
| | | unsigned short module_num; |
| | | unsigned char compress; |
| | | unsigned char version; |
| | |
| | | * Created on: 2025å¹´7æ21æ¥ |
| | | * Author: 86189 |
| | | */ |
| | | #include <stdio.h> |
| | | #include <cstdlib> |
| | | #include <cstring> |
| | | #include "config.h" |
| | |
| | | #include "protocol_internal.h" |
| | | #include "moduleexport.h" |
| | | #include "crc.h" |
| | | #include "../drv/memory.h" |
| | | |
| | | s32 Scene::str_delim(const s8* str, u8 logic_channel[]) |
| | | s32 Scene::str_delim(const s8* str, u16 logic_channel[]) |
| | | { |
| | | s8 pstr[32]; |
| | | s8 * ptr; |
| | |
| | | |
| | | ptr = strtok(NULL, "-"); |
| | | end = atoi(ptr); |
| | | if(start==end) return 0; |
| | | while (start<=end) |
| | | { |
| | | logic_channel[i++] = start++; |
| | |
| | | |
| | | |
| | | |
| | | s32 Scene::convert_to_bin(s8* bin) |
| | | s32 Scene::convert_to_bin(u8* bin) |
| | | { |
| | | s32 i ,j; |
| | | struct FlowChartHead* flowchart = (struct FlowChartHead*)bin; |
| | | u32 size = sizeof(struct FlowChartHead); |
| | | s32 ninports,noutports; |
| | | u8 rxBufID[64],txBufID[64]; |
| | | u16 rxBufID[64],txBufID[64]; |
| | | u32 dsp_index ; |
| | | |
| | | u16 dsp_input_num[2] ={0,0}; |
| | | u16 dsp_output_num[2] ={0,0}; |
| | | |
| | | s32 crc = 0xFFFFFFFF; |
| | | |
| | | if (!bin) return 0; |
| | | |
| | | for (i=0; i< proc_list.size(); i++) { |
| | | struct Module *m = (struct Module *)(bin + size); |
| | | struct proc_field * p = &proc_list[i]; |
| | | printf("proc list size %d\n", proc_list.size()); |
| | | |
| | | for (i=0; i< proc_list.size(); i++) { |
| | | Module *m = (struct Module *)(bin + size); |
| | | proc_field * p = &proc_list[i]; |
| | | |
| | | ninports = str_delim(p->inportstr, rxBufID) ; |
| | | noutports = str_delim(p->outportstr , txBufID) ; |
| | |
| | | if(p->proc_type == PROC_DUCKER || p->proc_type == PROC_CONTINUNOUS_SPL) { |
| | | //insert a mixer. |
| | | struct Module *mixer = (struct Module *)(bin + size); |
| | | u8 channelID[64]; |
| | | u16 channelID[64]; |
| | | |
| | | mixer->mDsp = 0; |
| | | mixer->mID = p->proc_id + 320; |
| | | mixer->mType = ModuleType::PROC_MIXER; |
| | | mixer->mTag = 0; |
| | | mixer->mPhyModule = 0; |
| | | mixer->mParamaddr = (s32)get_module_param_ptr(p->parameters,p->fixed); |
| | | mixer->mParamaddr = (s32)get_module_param_ptr(mixer->mType, p->parameters, p->fixed); |
| | | |
| | | size += sizeof(struct Module); |
| | | |
| | |
| | | mixer->mTxNum = 1; |
| | | memcpy(bin + size , &rxBufID[1], mixer->mTxNum*sizeof(u16)); size += mixer->mTxNum*sizeof(u16); |
| | | } |
| | | if(hw_adapter->get_system_is_dual_dsp()){ |
| | | dsp_index = p->dsp_index ; |
| | | } |
| | | else { |
| | | dsp_index = 0; |
| | | } |
| | | |
| | | |
| | | m = (struct Module *)(bin + size); |
| | | for(j = 0 ; j< ninports ;j ++) { |
| | | if(rxBufID[j] > dsp_input_num[p->dsp_index]) { |
| | | dsp_input_num[p->dsp_index] = rxBufID[j]; |
| | | if(rxBufID[j] > dsp_input_num[dsp_index]) { |
| | | dsp_input_num[dsp_index] = rxBufID[j]; |
| | | } |
| | | } |
| | | for(j = 0 ; j< noutports ;j ++) { |
| | | if(txBufID[j] > dsp_output_num[p->dsp_index]) { |
| | | dsp_output_num[p->dsp_index] = txBufID[j]; |
| | | if(txBufID[j] > dsp_output_num[dsp_index]) { |
| | | dsp_output_num[dsp_index] = txBufID[j]; |
| | | } |
| | | } |
| | | |
| | | m->mDsp = 0; |
| | | m->mDsp = dsp_index; |
| | | m->mID = p->proc_id; |
| | | m->mType = p->proc_type; |
| | | m->mTag = p->tag; |
| | | m->mPhyModule = p->physic_type; |
| | | m->mParamaddr = (s32)get_module_param_ptr(p->parameters,p->fixed); |
| | | m->mParamaddr = (s32)get_module_param_ptr(m->mType, p->parameters, p->fixed); |
| | | |
| | | size += sizeof(struct Module); |
| | | m->mRxNum = ninports; |
| | | memcpy(bin + size , rxBufID, m->mRxNum*sizeof(u16)); size += m->mRxNum*sizeof(u16); |
| | | m->mTxNum = noutports; |
| | | memcpy(bin + size , txBufID, m->mTxNum*sizeof(u16)); size += m->mTxNum*sizeof(u16); |
| | | |
| | | if(p->physic_type == ModuleInterfaceType::PHY_INPUT) { |
| | | PhyPort* phy_id = (PhyPort*)(bin + size); |
| | | for(j = 0 ; j< ninports ;j ++, phy_id++) { |
| | | phy_id->mIntType = 0; |
| | | phy_id->mPhyID = hw_adapter->get_physical_channel(1, rxBufID[j]-1); |
| | | // printf("PhyID:%d\n", phy_id->mPhyID); |
| | | } |
| | | size += ninports*sizeof(PhyPort); |
| | | } |
| | | else if(p->physic_type == ModuleInterfaceType::PHY_OUTPUT){ |
| | | PhyPort* phy_id = (PhyPort*)(bin + size); |
| | | for(j = 0 ; j< noutports ;j ++, phy_id++) { |
| | | phy_id->mIntType = 0; |
| | | phy_id->mPhyID = hw_adapter->get_physical_channel(0, txBufID[j]-1); |
| | | } |
| | | size += noutports*sizeof(PhyPort); |
| | | } |
| | | } |
| | | |
| | | ninports = dsp_input_num[0]>dsp_output_num[0]?dsp_input_num[0]:dsp_output_num[0]; |
| | | noutports = dsp_input_num[1]>dsp_output_num[1]?dsp_input_num[1]:dsp_output_num[1]; |
| | | |
| | | if(0) { |
| | | flowchart->dsp_buffer_num[0] = ninports; |
| | | flowchart->dsp_buffer_num[1] = noutports; |
| | | } |
| | | else { |
| | | flowchart->dsp_buffer_num[0] = ninports>noutports?ninports:noutports; |
| | | //dual_dsp for 2 DSP,else 1 DSP. |
| | | for (i =0 ;i < hw_adapter->get_system_is_dual_dsp() + 1 ;i ++) { |
| | | flowchart->dsp_buffer_num[i] = std::max(dsp_input_num[i], dsp_output_num[i]); |
| | | } |
| | | |
| | | flowchart->module_num = proc_list.size(); |
| | | flowchart->crcLsb = 0; |
| | | flowchart->crcMsb = 0; |
| | | flowchart->compress = 0; |
| | | flowchart->version = 1; |
| | | flowchart->crc = 0; |
| | | |
| | | crc = CRC::crc32((const u8*)bin, size); |
| | | |
| | | flowchart->crcLsb = crc & 0xffff; |
| | | flowchart->crcMsb = crc >> 16; |
| | | flowchart->crc = crc; |
| | | return size; |
| | | } |
| | | |
| | |
| | | } |
| | | //è§£æinportstråoutportstr, |
| | | //åç¬¦ä¸²è½¬æ¢æé»è¾ç«¯å£å·,è¿åè¾å
¥è¾åºç«¯å£æ°é. |
| | | s32 str_delim(const s8* str, u8 logic_channel[]) ; |
| | | s32 str_delim(const s8* str, u16 logic_channel[]) ; |
| | | |
| | | virtual uvoid* get_module_param_ptr(uvoid *param, s32 fixed) =0; |
| | | virtual uvoid* get_module_param_ptr(s32 mtype, uvoid *param, s32 fixed) =0; |
| | | //æ ¹æ®æ¨¡åç±»åæ´æ°æ¨¡åä¿¡æ¯. |
| | | virtual s32 update_module() =0; |
| | | //æåè¿å0ï¼å¤±è´¥è¿å-1(å
容é误ã大å°ä¸å¹é
ç). |
| | | virtual s32 set_parameters_content(uvoid* param, s32 size) =0; |
| | | |
| | | virtual u32 get_module_id(u32 mid, s32 mtype ,u32 pid) =0; |
| | | // virtual u32 get_module_id(u32 mid, s32 mtype ,u32 pid) =0; |
| | | |
| | | s32 convert_to_bin(s8* bin); |
| | | s32 convert_to_bin(u8* bin); |
| | | }; |
| | | |
| | | #endif |
| | |
| | | }tag_echo,*ptag_echo; |
| | | |
| | | typedef struct{ |
| | | short bypass; |
| | | short name[8]; |
| | | short taps; |
| | | int coeffs[MAX_FIR_TAPS]; |
| | | }tag_fir, *ptag_fir; |
| | | |
| | | typedef struct{ |
| | |
| | | typedef struct{ |
| | | short proc_type; |
| | | short pad; |
| | | short proc_ins[sizeof(tag_eq)]; |
| | | char proc_ins[sizeof(tag_eq)]; |
| | | }tag_module ,*ptag_module; |
| | | |
| | | typedef struct{ |
| | | short input_group[MAX_INPUT_NUM]; |
| | | short output_group[MAX_OUTPUT_NUM]; |
| | | short proc_type; |
| | | short pad; |
| | | char proc_ins[sizeof(tag_fir)]; |
| | | }tag_module_fir, *ptag_module_fir; |
| | | |
| | | typedef struct{ |
| | | int input_group[MAX_INPUT_NUM]; |
| | | int output_group[MAX_OUTPUT_NUM]; |
| | | }tag_group,*ptag_group ; |
| | | |
| | | |
| | | // ENUM |
| | | typedef enum{ |
| | | INPUT_GAIN = 0x1, |
| | | INPUT_MUTE, |
| | |
| | | |
| | | s32 tg_hw_adapter_t::get_physical_channel(s32 input , s32 logic_channel) |
| | | { |
| | | //s32 phy_channel[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,19}; |
| | | if(input) { |
| | | s32 input_num = ana_input_num + dante_input_num ; |
| | | if(logic_channel < ana_input_num) { |
| | | //analog |
| | | return logic_channel; |
| | | return logic_channel + 1; |
| | | } |
| | | else if(logic_channel < input_num) { |
| | | //dante |
| | | return 16+ (logic_channel-ana_input_num); |
| | | return 19 + (logic_channel - ana_input_num); |
| | | } |
| | | else { |
| | | //usb |
| | | return 48 + (logic_channel-input_num); |
| | | // return 17 + (logic_channel - input_num); |
| | | return (logic_channel > input_num) ? 17 : 18; |
| | | } |
| | | } |
| | | else { //output |
| | | s32 output_num = ana_output_num + dante_output_num ; |
| | | //analog |
| | | if(logic_channel < ana_output_num) { |
| | | return logic_channel + 1; |
| | | } |
| | | else if(logic_channel < output_num) { |
| | | //dante |
| | | return 19 + (logic_channel - ana_output_num); |
| | | } |
| | | else { |
| | | //output |
| | | //usb |
| | | // return 17 + (logic_channel - output_num); |
| | | return (logic_channel > output_num) ? 17 : 18; |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | //ç©çbufferå®ä¹é¡ºåºæ¯16é鿍¡æ+2ééUSB+32ééDante. |
| | |
| | | AddRoute(SourceSignal::SPT0_BD1_O, DestSignal::DAI0_PB12_I); |
| | | |
| | | //USB Slave. SCLK(DAI0_8),LRCLK(DAI0_9), RX(DAI0_7),TX(DAI0_10) |
| | | for(i =4 ;i < 5; i++) { |
| | | //sport2A<->input; sport2B<->output |
| | | for(i =4 ;i < 6; i++) { |
| | | conf->sports[i].spid = i; |
| | | conf->sports[i].clke = utrue; |
| | | conf->sports[i].enable = utrue; |
| | | conf->sports[i].enable_sec = ufalse; |
| | | conf->sports[i].lfs = ufalse; |
| | | conf->sports[i].mfd = 1; |
| | | conf->sports[i].opmode = 0 ; //tdm |
| | | conf->sports[i].lfs = ufalse; // The USB left and right channels can be swapped. |
| | | conf->sports[i].mfd = 0; |
| | | conf->sports[i].opmode = 1 ; //i2s |
| | | conf->sports[i].rx = ufalse; |
| | | conf->sports[i].slots = 8; |
| | | conf->sports[i].vld = 8; |
| | | conf->sports[i].slots = 2; |
| | | conf->sports[i].vld = 2; |
| | | conf->sports[i].follow_intr_no = intr_sport_no(4); |
| | | } |
| | | conf->sports[4].interrupt = utrue; |
| | |
| | | conf->pcgs[1].fs_div = mclk / conf->mSampleRate ; |
| | | conf->pcgs[1].sclk_div = mclk / (conf->mSampleRate * 2 * 32); |
| | | AddRoute(SourceSignal::DAI0_PB02_O, DestSignal::PCG_EXTB_I); |
| | | // route |
| | | AddRoute(SourceSignal::PCG_FSB_O, DestSignal::SPT2_AFS_I); |
| | | AddRoute(SourceSignal::PCG_FSB_O, DestSignal::SPT2_BFS_I); |
| | | AddRoute(SourceSignal::PCG_CLKB_O, DestSignal::SPT2_ACLK_I); |
| | | AddRoute(SourceSignal::PCG_CLKB_O, DestSignal::SPT2_BCLK_I); |
| | | |
| | | AddRoute(SourceSignal::LOGIC_HIGH, DestSignal::DAI0_PBEN09_I);//fs |
| | | AddRoute(SourceSignal::LOGIC_HIGH, DestSignal::DAI0_PBEN08_I);//sclk |
| | | AddRoute(SourceSignal::PCG_FSB_O, DestSignal::DAI0_PB09_I); |
| | | AddRoute(SourceSignal::PCG_CLKB_O, DestSignal::DAI0_PB08_I); |
| | | // AddRoute(SourceSignal::LOGIC_HIGH, DestSignal::DAI0_PBEN09_I);//fs |
| | | // AddRoute(SourceSignal::LOGIC_HIGH, DestSignal::DAI0_PBEN08_I);//sclk |
| | | // AddRoute(SourceSignal::PCG_FSB_O, DestSignal::DAI0_PB09_I); |
| | | // AddRoute(SourceSignal::PCG_CLKB_O, DestSignal::DAI0_PB08_I); |
| | | |
| | | AddRoute(SourceSignal::DAI0_PB08_O, DestSignal::SPT2_ACLK_I); |
| | | AddRoute(SourceSignal::DAI0_PB09_O, DestSignal::SPT2_AFS_I); |
| | | AddRoute(SourceSignal::DAI0_PB08_O, DestSignal::SPT2_BCLK_I); |
| | | AddRoute(SourceSignal::DAI0_PB09_O, DestSignal::SPT2_BFS_I); |
| | | // AddRoute(SourceSignal::DAI0_PB08_O, DestSignal::SPT2_ACLK_I); |
| | | // AddRoute(SourceSignal::DAI0_PB09_O, DestSignal::SPT2_AFS_I); |
| | | // AddRoute(SourceSignal::DAI0_PB08_O, DestSignal::SPT2_BCLK_I); |
| | | // AddRoute(SourceSignal::DAI0_PB09_O, DestSignal::SPT2_BFS_I); |
| | | |
| | | AddRoute(SourceSignal::DAI0_PB07_O, DestSignal::SPT2_AD0_I); |
| | | // AddRoute(SourceSignal::DAI0_PB07_O, DestSignal::SPT2_AD0_I); // usb output |
| | | // AddRoute(SourceSignal::LOGIC_HIGH, DestSignal::DAI0_PBEN10_I); |
| | | // AddRoute(SourceSignal::SPT2_BD0_O, DestSignal::DAI0_PB10_I); // usb input |
| | | |
| | | // usb asrc |
| | | conf->srcs[0].enable = utrue; |
| | | conf->srcs[0].format = 1; |
| | | conf->srcs[0].wordLen = 0; |
| | | conf->srcs[0].ratio = 1; // usb input |
| | | |
| | | conf->srcs[1].enable = utrue; |
| | | conf->srcs[1].format = 1; |
| | | conf->srcs[1].wordLen = 0; |
| | | conf->srcs[1].ratio = 0; // usb output |
| | | |
| | | // usb input / asrc input |
| | | AddRoute(SourceSignal::DAI0_PB09_O, DestSignal::SRC0_FS_IP_I); |
| | | AddRoute(SourceSignal::DAI0_PB08_O, DestSignal::SRC0_CLK_IP_I); |
| | | AddRoute(SourceSignal::DAI0_PB07_O, DestSignal::SRC0_DAT_IP_I); |
| | | // usb input / asrc output |
| | | AddRoute(SourceSignal::PCG_FSB_O, DestSignal::SRC0_FS_OP_I); |
| | | AddRoute(SourceSignal::PCG_CLKB_O, DestSignal::SRC0_CLK_OP_I); |
| | | AddRoute(SourceSignal::SRC0_DAT_OP_O, DestSignal::SPT2_AD0_I); |
| | | // usb output / asrc input |
| | | AddRoute(SourceSignal::PCG_FSB_O, DestSignal::SRC1_FS_IP_I); |
| | | AddRoute(SourceSignal::PCG_CLKB_O, DestSignal::SRC1_CLK_IP_I); |
| | | AddRoute(SourceSignal::SPT2_BD0_O, DestSignal::SRC1_DAT_IP_I); |
| | | // usb output / asrc output |
| | | AddRoute(SourceSignal::DAI0_PB09_O, DestSignal::SRC1_FS_OP_I); |
| | | AddRoute(SourceSignal::DAI0_PB08_O, DestSignal::SRC1_CLK_OP_I); |
| | | AddRoute(SourceSignal::LOGIC_HIGH, DestSignal::DAI0_PBEN10_I); |
| | | AddRoute(SourceSignal::SPT2_BD0_O, DestSignal::DAI0_PB10_I); |
| | | AddRoute(SourceSignal::SRC1_DAT_OP_O, DestSignal::DAI0_PB10_I); |
| | | |
| | | //Danteã |
| | | //Dante Slave |
| | | //MCLK(DAI1_2),LRCLK(DAI1_20),SCLK(DAI1_19) |
| | | //RX0(DAI1_12),RX1(DAI1_10),RX2(DAI1_8),RX3(DAI1_6) |
| | | //TX0(DAI1_11),TX1(DAI1_9),TX2(DAI1_7),TX3(DAI1_5) |
| | | //TX0(DAI1_12),TX1(DAI1_10),TX2(DAI1_8),TX3(DAI1_6) |
| | | //RX0(DAI1_11),RX1(DAI1_9),RX2(DAI1_7),RX3(DAI1_5) |
| | | //sport4a,4b<->RX;sport5a,5b<->TX |
| | | for(i = 8 ;i < 12 ;i ++) { |
| | | conf->sports[i].spid = i; |
| | | conf->sports[i].clke = utrue; |
| | | conf->sports[i].enable = utrue; |
| | | conf->sports[i].enable_sec = ufalse; |
| | | conf->sports[i].lfs = ufalse; |
| | | conf->sports[i].mfd = 1; |
| | | conf->sports[i].opmode = 0 ; //tdm |
| | | conf->sports[i].rx = ufalse; |
| | | conf->sports[i].slots = 8; |
| | | conf->sports[i].vld = 8; |
| | | conf->sports[i].follow_intr_no = intr_sport_no(8); |
| | | } |
| | | conf->sports[8].interrupt = utrue; |
| | | conf->sports[8].rx = conf->sports[9].rx = utrue; |
| | | |
| | | AddRoute(SourceSignal::DAI1_PB19_O, DestSignal::SPT4_ACLK_I); |
| | | AddRoute(SourceSignal::DAI1_PB19_O, DestSignal::SPT4_BCLK_I); |
| | | AddRoute(SourceSignal::DAI1_PB19_O, DestSignal::SPT5_ACLK_I); |
| | | AddRoute(SourceSignal::DAI1_PB19_O, DestSignal::SPT5_BCLK_I); |
| | | AddRoute(SourceSignal::DAI1_PB20_O, DestSignal::SPT4_AFS_I); |
| | | AddRoute(SourceSignal::DAI1_PB20_O, DestSignal::SPT4_BFS_I); |
| | | AddRoute(SourceSignal::DAI1_PB20_O, DestSignal::SPT5_AFS_I); |
| | | AddRoute(SourceSignal::DAI1_PB20_O, DestSignal::SPT5_BFS_I); |
| | | |
| | | AddRoute(SourceSignal::DAI1_PB11_O, DestSignal::SPT4_AD0_I); |
| | | AddRoute(SourceSignal::DAI1_PB09_O, DestSignal::SPT4_BD0_I); |
| | | // AddRoute(SourceSignal::DAI1_PB07_O, DestSignal::SPT4_AD0_I); |
| | | // AddRoute(SourceSignal::DAI1_PB05_O, DestSignal::SPT4_BD0_I); |
| | | |
| | | AddRoute(SourceSignal::LOGIC_HIGH, DestSignal::DAI1_PBEN12_I); |
| | | AddRoute(SourceSignal::SPT5_AD0_O, DestSignal::DAI1_PB12_I); |
| | | AddRoute(SourceSignal::LOGIC_HIGH, DestSignal::DAI1_PBEN10_I); |
| | | AddRoute(SourceSignal::SPT5_BD0_O, DestSignal::DAI1_PB10_I); |
| | | // AddRoute(SourceSignal::LOGIC_HIGH, DestSignal::DAI1_PBEN08_I); |
| | | // AddRoute(SourceSignal::SPT5_AD0_O, DestSignal::DAI1_PB08_I); |
| | | // AddRoute(SourceSignal::LOGIC_HIGH, DestSignal::DAI1_PBEN06_I); |
| | | // AddRoute(SourceSignal::SPT5_BD0_O, DestSignal::DAI1_PB06_I); |
| | | /* TDM8 |
| | | for(i = 8 ;i < 12 ;i ++) { |
| | | conf->sports[i].spid = i; |
| | | conf->sports[i].clke = utrue; |
| | |
| | | AddRoute(SourceSignal::DAI1_PB20_O, DestSignal::SPT5_AFS_I); |
| | | AddRoute(SourceSignal::DAI1_PB20_O, DestSignal::SPT5_BFS_I); |
| | | |
| | | AddRoute(SourceSignal::DAI1_PB12_O, DestSignal::SPT4_AD0_I); |
| | | AddRoute(SourceSignal::DAI1_PB10_O, DestSignal::SPT4_AD1_I); |
| | | AddRoute(SourceSignal::DAI1_PB08_O, DestSignal::SPT4_BD0_I); |
| | | AddRoute(SourceSignal::DAI1_PB06_O, DestSignal::SPT4_BD1_I); |
| | | AddRoute(SourceSignal::DAI1_PB11_O, DestSignal::SPT4_AD0_I); |
| | | AddRoute(SourceSignal::DAI1_PB09_O, DestSignal::SPT4_AD1_I); |
| | | AddRoute(SourceSignal::DAI1_PB07_O, DestSignal::SPT4_BD0_I); |
| | | AddRoute(SourceSignal::DAI1_PB05_O, DestSignal::SPT4_BD1_I); |
| | | |
| | | AddRoute(SourceSignal::LOGIC_HIGH, DestSignal::DAI1_PBEN11_I); |
| | | AddRoute(SourceSignal::SPT5_AD0_O, DestSignal::DAI1_PB11_I); |
| | | AddRoute(SourceSignal::LOGIC_HIGH, DestSignal::DAI1_PBEN09_I); |
| | | AddRoute(SourceSignal::SPT5_AD1_O, DestSignal::DAI1_PB09_I); |
| | | AddRoute(SourceSignal::LOGIC_HIGH, DestSignal::DAI1_PBEN07_I); |
| | | AddRoute(SourceSignal::SPT5_BD0_O, DestSignal::DAI1_PB07_I); |
| | | AddRoute(SourceSignal::LOGIC_HIGH, DestSignal::DAI1_PBEN05_I); |
| | | AddRoute(SourceSignal::SPT5_BD1_O, DestSignal::DAI1_PB05_I); |
| | | AddRoute(SourceSignal::LOGIC_HIGH, DestSignal::DAI1_PBEN12_I); |
| | | AddRoute(SourceSignal::SPT5_AD0_O, DestSignal::DAI1_PB12_I); |
| | | AddRoute(SourceSignal::LOGIC_HIGH, DestSignal::DAI1_PBEN10_I); |
| | | AddRoute(SourceSignal::SPT5_AD1_O, DestSignal::DAI1_PB10_I); |
| | | AddRoute(SourceSignal::LOGIC_HIGH, DestSignal::DAI1_PBEN08_I); |
| | | AddRoute(SourceSignal::SPT5_BD0_O, DestSignal::DAI1_PB08_I); |
| | | AddRoute(SourceSignal::LOGIC_HIGH, DestSignal::DAI1_PBEN06_I); |
| | | AddRoute(SourceSignal::SPT5_BD1_O, DestSignal::DAI1_PB06_I);*/ |
| | | } |
| | |
| | | } |
| | | |
| | | // |
| | | uvoid config_board(struct DSPConfig * conf); |
| | | uvoid config_board(struct DSPConfig * conf) override; |
| | | |
| | | s32 get_physical_channel(s32 input , s32 logic_channel); |
| | | s32 get_physical_channel(s32 input , s32 logic_channel) override; |
| | | }; |
| | | |
| | | #endif /* __TIANGONG_H__ */ |
| | |
| | | #include "config.h" |
| | | |
| | | //项ç®å®å¶åå®å®ä¹. |
| | | #define MAX_INPUT_NUM 32 |
| | | #define MAX_OUTPUT_NUM 32 |
| | | #define MAX_INPUT_NUM 34 // ana:16, dante:16, usb:2 |
| | | #define MAX_OUTPUT_NUM 34 |
| | | |
| | | #define FEEDBACK_FILTERS_NUM 16 //NHS滤波å¨ç»æ°ç® |
| | | |
| | | #define MAX_MIXER_INPUT 36 |
| | | #define MAX_MIXER_OUTPUT 33 |
| | | #define MAX_MIXER_INPUT 37 |
| | | #define MAX_MIXER_OUTPUT 34 |
| | | |
| | | #define MAX_EQ_SECTION 12 |
| | | #define AUTOMIXER_CHANNEL_NUM 32 |
| | | #define AUTOMIXER_CHANNEL_NUM 34 |
| | | #define MAX_DELAY_MSEC 1200 |
| | | |
| | | #define MAX_DELIM_LEN 32 |
| | | |
| | | #define MAX_FIR_TAPS 1024 |
| | | |
| | | #ifdef __ADSP21489__ |
| | | #define RESSIGNBIT(X) (((X)&0x8000)?(-((~(X))&0xffff)-1):(X)) //è¿å符å·ä½ |
| | | #elif defined(__ADSP21569__) |
| | |
| | | |
| | | u32 tg_param_convert::InputParamCtrl(IModule* m, void* handle, int &plen) |
| | | { |
| | | enum GainID { |
| | | enum Input_ID{ |
| | | GAIN = 0x1, |
| | | MUTE, |
| | | SENSI, |
| | | PHANTOM, |
| | | |
| | | PHASE = 9, |
| | | STEP,//-500~+500 |
| | | }; |
| | | TYPE, |
| | | FREQ, |
| | | LEVEL, |
| | | NAME, |
| | | PHASE, |
| | | STEP, |
| | | LINK, |
| | | CHANNEL_LEVEL, |
| | | |
| | | enum PitchID { |
| | | PITCH_BYPASS = 0x1,// |
| | | PITCH_SEMITONES,// |
| | | INPUT_MIN, |
| | | INPUT_MAX, |
| | | }; |
| | | |
| | | if(handle == NULL) return 1; |
| | |
| | | |
| | | val[1] = RESSIGNBIT(pInput->input[i].gain); m->Ctrl(GAIN, val, 2); |
| | | val[1] = RESSIGNBIT(pInput->input[i].mute); m->Ctrl(MUTE, val, 2); |
| | | val[1] = RESSIGNBIT(pInput->input[i].level); m->Ctrl(LEVEL, val, 2); |
| | | val[1] = RESSIGNBIT(pInput->input[i].sensitivity); m->Ctrl(SENSI, val, 2); |
| | | val[1] = RESSIGNBIT(pInput->input[i].phant); m->Ctrl(PHANTOM, val, 2); |
| | | val[1] = RESSIGNBIT(pInput->input[i].phase); m->Ctrl(PHASE, val, 2); |
| | | |
| | | val[1] = RESSIGNBIT(pInput->input[i].type); m->Ctrl(TYPE, val, 2); |
| | | val[1] = RESSIGNBIT(pInput->input[i].freq); m->Ctrl(FREQ, val, 2); |
| | | val[1] = RESSIGNBIT(pInput->input[i].level); m->Ctrl(LEVEL, val, 2); |
| | | } |
| | | |
| | | return 0; |
| | |
| | | for(i=0 ;i < pmixer->output_num ;i ++) { |
| | | for(j =0 ;j < pmixer->input_num ;j++) { |
| | | val[0] = j; val[1] = i ; val[2] = (pmixer->input_mask[i][j/15]>>(j&15))&0x1; m->Ctrl(MIXER_SWITCH, val, 3); |
| | | // printf("oich %d %d= %x %x %x\n", i,j, val[0],val[1],val[2]); |
| | | val[0] = j; val[1] = i ; val[2] = RESSIGNBIT(pmixer->input_gain[i][j]); m->Ctrl(MIXER_GAIN, val, 3); |
| | | } |
| | | } |
| | |
| | | |
| | | u32 tg_param_convert::FeedbackParamCtrl(IModule* m, void* handle, int &plen) |
| | | { |
| | | // enum NHSID{ |
| | | // FB_BYPASS = 0x1, |
| | | // FB_PANIC, |
| | | // FB_THRS, |
| | | // FB_FLT_DEPTH, |
| | | // FB_STEP, |
| | | // FB_FLT_Q, |
| | | // FB_RECYCLETIME, |
| | | // |
| | | // FB_FLT_FREQ, |
| | | // FB_FLT_GAIN, |
| | | // FB_FLT_TYPE, |
| | | // |
| | | // FB_CLEAR, // |
| | | // FB_CLEAR_DYNAMIC,// |
| | | // }; |
| | | |
| | | enum NHSID{ |
| | | FB_BYPASS= 0x1, |
| | | FB_FLT_FREQ, |
| | |
| | | |
| | | if(handle == NULL) return 1; |
| | | |
| | | short val[4]; |
| | | short val[4] = {0,0,0,0}; |
| | | ptag_aec paec = (ptag_aec)handle; |
| | | plen = sizeof(tag_aec); |
| | | |
| | | val[0] = paec->bypass; m->Ctrl(BYPASS, val, 1); |
| | | val[0] = paec->mode; m->Ctrl(NLPLEVEL, val, 1); |
| | | val[1] = paec->bypass; m->Ctrl(BYPASS, val, 2); |
| | | val[1] = paec->mode; m->Ctrl(NLPLEVEL, val, 2); |
| | | val[1] = 2; m->Ctrl(NSMODE, val, 2); |
| | | |
| | | return 0; |
| | | } |
| | |
| | | return 0; |
| | | } |
| | | |
| | | u32 tg_param_convert::FirParamCtrl(IModule* m, void* handle, int &plen) |
| | | { |
| | | enum FIRID { |
| | | FIR_BYPASS = 0x1, ////val[0]: 0-åæ¶bypass, 1- 使è½bypass |
| | | FIR_NAME, //æ ç¨ |
| | | FIR_TAPS, //æ ç¨ |
| | | FIR_COEFFS, //val: åå
ï¼æå¤§é¿åº¦1024 float. æ 转æ¢ç´æ¥æ·è´float. |
| | | }; |
| | | if(NULL == handle) return 1; |
| | | |
| | | ptag_fir pfir = (ptag_fir)handle; |
| | | |
| | | plen = sizeof(tag_fir); |
| | | short val[4] = {0}; |
| | | val[0] = pfir->bypass; |
| | | int taps = pfir->taps; |
| | | const short *pcoeffs = (const short *)pfir->coeffs; |
| | | |
| | | m->Ctrl(FIR_BYPASS, val, 1); |
| | | m->Ctrl(FIR_COEFFS, pcoeffs, taps * 2); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | u32 tg_param_convert::EmptyParamCtrl(IModule* m, void* handle, int &plen) |
| | | { |
| | | if(handle == NULL) return 1; |
| | |
| | | static u32 GeqParamCtrl(IModule* m, void* handle, int &plen); |
| | | static u32 ReverbParamCtrl(IModule* m, void* handle, int &plen); |
| | | static u32 EchoParamCtrl(IModule* m, void* handle, int &plen); |
| | | static u32 FirParamCtrl(IModule* m, void* handle, int &plen); |
| | | static u32 EmptyParamCtrl(IModule* m, void* handle, int &plen); |
| | | }; |
| | | |
| | |
| | | mctrl_list.insert(std::pair<u32, ParamEntry>((u32)PROC_AFC, ParamEntry(tg_param_convert::EmptyParamCtrl, tg_param_ctrl::General_Ctrl))); |
| | | mctrl_list.insert(std::pair<u32, ParamEntry>((u32)DUMMY_INPUT, ParamEntry(tg_param_convert::EmptyParamCtrl, tg_param_ctrl::General_Ctrl))); |
| | | mctrl_list.insert(std::pair<u32, ParamEntry>((u32)DUMMY_OUTPUT, ParamEntry(tg_param_convert::EmptyParamCtrl, tg_param_ctrl::General_Ctrl))); |
| | | mctrl_list.insert(std::pair<u32, ParamEntry>((u32)PROC_FIR, ParamEntry(tg_param_convert::FirParamCtrl, tg_param_ctrl::Fir_Ctrl))); |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | /* |
| | | * scene.c |
| | | * |
| | | * Created on: 2025å¹´7æ18æ¥ |
| | | * Created on: 2025å¹´7æ18æ¥ |
| | | * Author: 86189 |
| | | */ |
| | | #include <string.h> |
| | |
| | | |
| | | tgScene::tgScene(hw_adapter_t* adapter):Scene(adapter) |
| | | { |
| | | s8 inport_str[8],outport_str[8]; |
| | | s8 ana_input_num, ana_output_num,dante_input_num,dante_output_num ; |
| | | s8 inport_str[16],outport_str[16]; |
| | | s8 ana_input_num, ana_output_num, loc_input_num, loc_output_num, dante_input_num, dante_output_num ; |
| | | s8 usb_input_num, usb_output_num; |
| | | s16 input_num, output_num ; |
| | | s32 n; |
| | | s32 n, new_idx = 300; //ID of the USB channel starts from 300. |
| | | |
| | | s16 dual_dsp = adapter->get_system_is_dual_dsp(); |
| | | s16 dsp_index = adapter->get_dsp_index(); |
| | | |
| | | adapter->get_channel_num(&ana_input_num, &ana_output_num, &dante_input_num, &dante_output_num); |
| | | input_num = ana_input_num + dante_input_num; |
| | | output_num = dante_input_num + dante_output_num; |
| | | adapter->get_channel_num(&loc_input_num, &loc_output_num, &dante_input_num, &dante_output_num, &usb_input_num, &usb_output_num); |
| | | ana_input_num = loc_input_num - usb_input_num; |
| | | ana_output_num = loc_output_num - usb_output_num; |
| | | |
| | | sprintf(inport_str, "0-%d", input_num-1); |
| | | //ç©çè¾å
¥å
±16+16+2 |
| | | input_num = ana_input_num + dante_input_num + usb_input_num; //2 USB |
| | | output_num = ana_output_num + dante_output_num + usb_output_num; |
| | | |
| | | tgScene_param_default(¶meters); |
| | | |
| | | sprintf(inport_str, "1-%d", input_num); |
| | | __MADD(299,PROC_INPUT,inport_str,inport_str,0, 1 ,¶meters.input, 0, ModuleInterfaceType::PHY_INPUT); |
| | | |
| | | sprintf(inport_str, "1-%d", input_num); |
| | | __MADD(298,PROC_METER,inport_str,"",0,1 ,NULL,0, ModuleInterfaceType::SOFT_MODULE); //tag:0-peak,1-rms |
| | | |
| | | //The number of DSPs is 1, but the number of input and output channels is greater than 16. |
| | | //It only processes analog input and output. |
| | | //However, for the channels that do not need to be processed, the level offset needs to be calculated. |
| | | if(!dual_dsp && input_num >16) { |
| | | n = ana_input_num; |
| | | } |
| | | else { |
| | | n= input_num; |
| | | } |
| | | // if(!dual_dsp && input_num >16) { |
| | | // n = ana_input_num; |
| | | // } |
| | | // else { |
| | | // n= input_num; |
| | | // } |
| | | |
| | | //expander |
| | | for(s32 i =0 ;i < input_num ; i++) { |
| | | sprintf(inport_str, "%d|", i); |
| | | sprintf(inport_str, "%d|", i+1); |
| | | if(i < input_num - usb_input_num) |
| | | __MADD(1+i,PROC_EXPANDER, inport_str, inport_str, 0, 0, ¶meters.in1[i], 0, ModuleInterfaceType::SOFT_MODULE); |
| | | else |
| | | __MADD(new_idx++,PROC_EXPANDER, inport_str, inport_str, 0, 0, ¶meters.in1[i], 0, ModuleInterfaceType::SOFT_MODULE); |
| | | } |
| | | |
| | | //compresser |
| | | for(s32 i =0 ;i < input_num ; i++) { |
| | | sprintf(inport_str, "%d|", i); |
| | | sprintf(inport_str, "%d|", i+1); |
| | | if(i < input_num - usb_input_num) |
| | | __MADD(33+i,PROC_COMPRESS, inport_str, inport_str, 0, 0, ¶meters.in2[i], 0, ModuleInterfaceType::SOFT_MODULE); |
| | | else |
| | | __MADD(new_idx++,PROC_COMPRESS, inport_str, inport_str, 0, 0, ¶meters.in2[i], 0, ModuleInterfaceType::SOFT_MODULE); |
| | | } |
| | | |
| | | //agc |
| | | for(s32 i =0 ;i < input_num ; i++) { |
| | | sprintf(inport_str, "%d|", i); |
| | | sprintf(inport_str, "%d|", i+1); |
| | | if(i < input_num - usb_input_num) |
| | | __MADD(65+i,PROC_AGC, inport_str, inport_str, 0, 0, ¶meters.in3[i], 0, ModuleInterfaceType::SOFT_MODULE); |
| | | else |
| | | __MADD(new_idx++,PROC_AGC, inport_str, inport_str, 0, 0, ¶meters.in3[i], 0, ModuleInterfaceType::SOFT_MODULE); |
| | | } |
| | | |
| | | //eq |
| | | for(s32 i =0 ;i < input_num ; i++) { |
| | | sprintf(inport_str, "%d|", i); |
| | | sprintf(inport_str, "%d|", i+1); |
| | | if(i < input_num - usb_input_num) |
| | | __MADD(97+i,PROC_EQ, inport_str, inport_str, 0, 0, ¶meters.in4[i], 8, ModuleInterfaceType::SOFT_MODULE); |
| | | else |
| | | __MADD(new_idx++,PROC_EQ, inport_str, inport_str, 0, 0, ¶meters.in4[i], 8, ModuleInterfaceType::SOFT_MODULE); |
| | | } |
| | | |
| | | //nhs |
| | | for(s32 i =0 ;i < input_num ; i++) { |
| | | sprintf(inport_str, "%d|", i); |
| | | sprintf(inport_str, "%d|", i+1); |
| | | if(i < input_num - usb_input_num) |
| | | __MADD(129+i,PROC_FEEDBACK, inport_str, inport_str, 0, 0, ¶meters.in5[i], 8, ModuleInterfaceType::SOFT_MODULE); |
| | | else |
| | | __MADD(new_idx++,PROC_FEEDBACK, inport_str, inport_str, 0, 0, ¶meters.in5[i], 8, ModuleInterfaceType::SOFT_MODULE); |
| | | } |
| | | |
| | | //am |
| | | sprintf(inport_str, "0-%d", input_num-1); |
| | | sprintf(outport_str, "0-%d", input_num); |
| | | __MADD(161,PROC_AUTOMIXER,inport_str, outport_str,0, 0, ¶meters.automixer, 0, ModuleInterfaceType::SOFT_MODULE); //坿¿æ¢ |
| | | sprintf(inport_str, "1-%d", input_num); |
| | | sprintf(outport_str, "1-%d", input_num+1); |
| | | __MADD(161,PROC_AUTOMIXER,inport_str, outport_str, 0, 0, ¶meters.automixer, 0, ModuleInterfaceType::SOFT_MODULE); //¿ÃÃæ»» |
| | | |
| | | //aec selector |
| | | sprintf(inport_str, "0-%d", input_num+ 1);//+1 add usb |
| | | sprintf(inport_str, "1-%d", input_num+ 1); |
| | | sprintf(outport_str, "%d|%d|", input_num+ 2, input_num+ 3); |
| | | __MADD(162,PROC_SELECTOR, inport_str,outport_str, 0, 1, ¶meters.aec_selector, 0, ModuleInterfaceType::SOFT_MODULE); //add usb |
| | | |
| | |
| | | __MADD(163,PROC_AEC,inport_str, outport_str ,0, 1, ¶meters.aec, 256, ModuleInterfaceType::SOFT_MODULE); |
| | | |
| | | //ans selector |
| | | sprintf(inport_str, "0-%d", input_num+ 2); |
| | | sprintf(inport_str, "1-%d", input_num+ 2); |
| | | sprintf(outport_str, "%d|", input_num+ 3); |
| | | __MADD(164,PROC_SELECTOR,inport_str,outport_str, 1, 1 ,¶meters.ans_selector, 0, ModuleInterfaceType::SOFT_MODULE); |
| | | |
| | |
| | | __MADD(165,PROC_ANS,inport_str,outport_str, 1, 0 ,¶meters.afc_ns,0, ModuleInterfaceType::SOFT_MODULE); |
| | | |
| | | //mixer |
| | | sprintf(inport_str, "0-%d", input_num+ 3); |
| | | sprintf(outport_str, "0-%d", output_num); |
| | | __MADD(166,PROC_MIXER,"0-35","0-32",1, 1 ,¶meters.mixer, 0, ModuleInterfaceType::SOFT_MODULE); |
| | | sprintf(inport_str, "1-%d", input_num+ 3); |
| | | sprintf(outport_str, "%d-%d",input_num+4, input_num+output_num+4); |
| | | __MADD(166,PROC_MIXER,inport_str,outport_str,1, 1 ,¶meters.mixer, 0, ModuleInterfaceType::SOFT_MODULE); // .begin()+48 |
| | | |
| | | //crossover |
| | | for(s32 i =0 ;i < output_num ; i++) { |
| | | sprintf(outport_str, "%d|", i); |
| | | __MADD(167,PROC_CROSSOVER,outport_str, outport_str,1, 0, ¶meters.out1[i],2, ModuleInterfaceType::SOFT_MODULE); |
| | | sprintf(inport_str, "%d|", i+input_num+4); |
| | | sprintf(outport_str, "%d|", i+1); |
| | | if(i < output_num - usb_output_num) |
| | | __MADD(167+i,PROC_CROSSOVER,inport_str,outport_str,1, 0, ¶meters.out1[i],2, ModuleInterfaceType::SOFT_MODULE); |
| | | else |
| | | __MADD(new_idx++,PROC_CROSSOVER,inport_str,outport_str,1, 0, ¶meters.out1[i],2, ModuleInterfaceType::SOFT_MODULE); |
| | | } |
| | | |
| | | //eq |
| | | for(s32 i =0 ;i < output_num ; i++) { |
| | | sprintf(outport_str, "%d|", i); |
| | | __MADD(199,PROC_EQ,outport_str, outport_str,1, 0, ¶meters.out2[i], 8, ModuleInterfaceType::SOFT_MODULE); |
| | | sprintf(outport_str, "%d|", i+1); |
| | | if(i < output_num - usb_output_num) |
| | | __MADD(199+i,PROC_EQ,outport_str, outport_str,1, 0, ¶meters.out2[i], 8, ModuleInterfaceType::SOFT_MODULE); |
| | | else |
| | | __MADD(new_idx++,PROC_EQ,outport_str, outport_str,1, 0, ¶meters.out2[i], 8, ModuleInterfaceType::SOFT_MODULE); |
| | | } |
| | | |
| | | //delay |
| | | for(s32 i =0 ;i < output_num ; i++) { |
| | | sprintf(outport_str, "%d|", i); |
| | | __MADD(231,PROC_DELAY,outport_str, outport_str,1, 0, ¶meters.out3[i], 1200, ModuleInterfaceType::SOFT_MODULE); |
| | | sprintf(outport_str, "%d|", i+1); |
| | | if(i < output_num - usb_output_num) |
| | | __MADD(231+i,PROC_DELAY,outport_str, outport_str,1, 0, ¶meters.out3[i], 1200, ModuleInterfaceType::SOFT_MODULE); |
| | | else |
| | | __MADD(new_idx++,PROC_DELAY,outport_str, outport_str,1, 0, ¶meters.out3[i], 1200, ModuleInterfaceType::SOFT_MODULE); |
| | | } |
| | | |
| | | //limit |
| | | for(s32 i =0 ;i < output_num ; i++) { |
| | | sprintf(outport_str, "%d|", i); |
| | | __MADD(263,PROC_LIMIT,outport_str, outport_str,1, 0, ¶meters.out4[i],0, ModuleInterfaceType::SOFT_MODULE); |
| | | sprintf(outport_str, "%d|", i+1); |
| | | if(i < output_num - usb_output_num) |
| | | __MADD(263+i,PROC_LIMIT,outport_str, outport_str,1, 0, ¶meters.out4[i],0, ModuleInterfaceType::SOFT_MODULE); |
| | | else |
| | | __MADD(new_idx++,PROC_LIMIT,outport_str, outport_str,1, 0, ¶meters.out4[i],0, ModuleInterfaceType::SOFT_MODULE); |
| | | } |
| | | |
| | | //output |
| | | sprintf(outport_str, "0-%d", output_num-1); |
| | | sprintf(outport_str, "1-%d", output_num); |
| | | __MADD(295,PROC_OUTPUT,outport_str,outport_str,1, 1, ¶meters.output,0, ModuleInterfaceType::SOFT_MODULE); |
| | | //sysctrl |
| | | __MADD(296,PROC_SYSCTL,outport_str,outport_str,1, 1, ¶meters.sysctl,0, ModuleInterfaceType::PHY_OUTPUT); |
| | | //meter |
| | | __MADD(297,PROC_METER,outport_str,"",1, 1, NULL, 0, ModuleInterfaceType::SOFT_MODULE); |
| | | |
| | | |
| | | }; |
| | | |
| | | |
| | | void tgScene::module_def(s32 proc_type, void* param_ptr) |
| | | { |
| | | int j; |
| | | int allbypass = 1; |
| | | switch(proc_type) { |
| | | |
| | | case PROC_INPUT: |
| | | ptag_input pInput = (ptag_input)param_ptr; |
| | | pInput->input_num = MAX_INPUT_NUM; |
| | | for(j=0; j<pInput->input_num; j++){ |
| | | pInput->input[j].freq = 1000; |
| | | pInput->input[j].level = -4800; |
| | | pInput->input[j].phant = 0; |
| | | pInput->input[j].sensitivity = 0; |
| | | pInput->input[j].channelID = j; |
| | | pInput->input[j].gain =0; |
| | | pInput->input[j].mute = 0; |
| | | pInput->input[j].type=0; |
| | | pInput->input[j].phase =0 ; |
| | | pInput->input[j].mingain = -8000; |
| | | pInput->input[j].maxgain = 1200; |
| | | } |
| | | break; |
| | | |
| | | case PROC_METER: |
| | | ptag_Meter pMeter = (ptag_Meter)param_ptr; |
| | | pMeter->input_num = 8; |
| | | break; |
| | | |
| | | case PROC_SHELF: |
| | | ptag_shelf pshelf = (ptag_shelf)param_ptr; |
| | | pshelf->highshelf.bypass = allbypass; |
| | | pshelf->highshelf.freq = 500; |
| | | pshelf->highshelf.gain = -4500; |
| | | pshelf->highshelf.q = 71; |
| | | pshelf->lowshelf.bypass = 1; |
| | | pshelf->lowshelf.freq = 500; |
| | | pshelf->lowshelf.gain =-4500; |
| | | pshelf->lowshelf.q = 71; |
| | | break; |
| | | |
| | | case PROC_GEQ: |
| | | int j; |
| | | ptag_geq pGEQ = (ptag_geq)param_ptr; |
| | | pGEQ->bypass = allbypass; |
| | | pGEQ->q = 2; |
| | | pGEQ->nsections = 31; |
| | | for(j=0;j<31;j++){ |
| | | pGEQ->eq_attr[j].gain = 0; |
| | | } |
| | | break; |
| | | case PROC_EQ: |
| | | ptag_eq pEQ = (ptag_eq)param_ptr; |
| | | u16 freq[]={40,80,200,500,1000,2000,4000,8000,10000,12500,16000,20000}; |
| | | pEQ->bypass = allbypass; |
| | | pEQ->nsection = MAX_EQ_SECTION; |
| | | for(j=0;j<pEQ->nsection;j++){ |
| | | pEQ->eq_attr[j].bypass = allbypass; |
| | | pEQ->eq_attr[j].freq = freq[j]; |
| | | pEQ->eq_attr[j].gain = 0; |
| | | pEQ->eq_attr[j].q = 250; |
| | | //pEQ->eq_attr[j].type = |
| | | } |
| | | break; |
| | | |
| | | case PROC_EXPANDER: |
| | | ptag_expander pExpander = (ptag_expander)param_ptr; |
| | | pExpander->bypass = allbypass; |
| | | pExpander->threshold = -6000; |
| | | pExpander->ratio = 100; |
| | | pExpander->attack = 1; |
| | | pExpander->release = 1; |
| | | break; |
| | | |
| | | case PROC_COMPRESS: |
| | | ptag_compress pcompress = (ptag_compress)param_ptr; |
| | | pcompress->bypass = allbypass; |
| | | pcompress->threshold = -4800; |
| | | pcompress->ratio = 100; |
| | | pcompress->attack = 1; |
| | | pcompress->release = 1; |
| | | pcompress->gain = 0; |
| | | pcompress->soft = 0; |
| | | break; |
| | | |
| | | case PROC_LIMIT: |
| | | ptag_compress limiter = (ptag_compress)param_ptr; |
| | | limiter->bypass = allbypass; |
| | | limiter->threshold = 0; |
| | | limiter->ratio = 10000; |
| | | limiter->attack = 1; |
| | | limiter->release = 1; |
| | | limiter->gain = 0; |
| | | limiter->soft = 0; |
| | | break; |
| | | |
| | | case PROC_MIXER: |
| | | int m; |
| | | ptag_mixer pMixer = (ptag_mixer)param_ptr; |
| | | pMixer->input_num = MAX_MIXER_INPUT; |
| | | pMixer->output_num = MAX_MIXER_OUTPUT; |
| | | memset(pMixer->input_mask,0,sizeof(pMixer->input_mask)); |
| | | for (m=0;m<pMixer->output_num ;m ++){ |
| | | for(j=0;j<pMixer->input_num;j++){ |
| | | pMixer->input_gain[m][j]=0; |
| | | pMixer->delay[m][j] =0; |
| | | } |
| | | pMixer->input_mask[m][m/16]=1<<(m&15); |
| | | } |
| | | break; |
| | | |
| | | case PROC_DELAY: |
| | | ptag_delay pDelay = (ptag_delay)param_ptr; |
| | | pDelay->bypass = allbypass; |
| | | pDelay->ms = 1; |
| | | break; |
| | | |
| | | case PROC_CROSSOVER: |
| | | ptag_crossover pCross = (ptag_crossover)param_ptr; |
| | | pCross->highpass.bypass = allbypass; |
| | | pCross->highpass.freq = 500;//454; |
| | | pCross->highpass.taps = 18;//48; |
| | | pCross->highpass.type = 0; |
| | | pCross->highpass.gain =0 ; |
| | | pCross->lowpass.bypass = allbypass; |
| | | pCross->lowpass.freq = 500; |
| | | pCross->lowpass.taps = 18; |
| | | pCross->lowpass.type = 0; |
| | | pCross->lowpass.gain =0; |
| | | break; |
| | | |
| | | case PROC_OUTPUT: |
| | | ptag_output pOutput= (ptag_output)param_ptr; |
| | | pOutput->output_num = MAX_OUTPUT_NUM; |
| | | for(j=0;j<pOutput->output_num;j++){ |
| | | pOutput->output[j].gain = 0; |
| | | pOutput->output[j].mute = 0; |
| | | pOutput->output[j].channelID = j; |
| | | pOutput->output[j].phase = 0; |
| | | pOutput->output[j].mingain = -8000; |
| | | pOutput->output[j].maxgain = 1200; |
| | | } |
| | | break; |
| | | |
| | | case PROC_GAIN: |
| | | ptag_gain pgain = (ptag_gain)param_ptr; |
| | | pgain->gain = 0; |
| | | pgain->mute = 0; |
| | | break; |
| | | |
| | | case PROC_AUTOMIXER: |
| | | ptag_gainsharing_mixer pautomixer = (ptag_gainsharing_mixer)param_ptr; |
| | | pautomixer->bypass = allbypass; |
| | | pautomixer->master_mute =0; |
| | | pautomixer->master_gain =0; |
| | | pautomixer->response = 5; |
| | | pautomixer->slope = 200; |
| | | for(j=0;j<AUTOMIXER_CHANNEL_NUM;j++){ |
| | | pautomixer->channels[j].automatic = 0; |
| | | pautomixer->channels[j].mute = 0; |
| | | pautomixer->channels[j].gain = 0; |
| | | pautomixer->channels[j].priority = 5; |
| | | } |
| | | break; |
| | | |
| | | case PROC_FEEDBACK: |
| | | ptag_feedback pfb = (ptag_feedback)param_ptr; |
| | | pfb->bypass = allbypass; |
| | | pfb->panic_threshold = 0; |
| | | pfb->flt_depth = 1800; |
| | | break; |
| | | |
| | | case PROC_SYSCTL: |
| | | ptag_sysctl psysctl = (ptag_sysctl)param_ptr; |
| | | psysctl->gain = 0; |
| | | psysctl->mute = 0; |
| | | break; |
| | | |
| | | case PROC_AEC: |
| | | ptag_aec paec = (ptag_aec)param_ptr; |
| | | paec->bypass = allbypass; |
| | | paec->mode = 0; |
| | | break; |
| | | |
| | | case PROC_ANS: |
| | | ptag_ans pans = (ptag_ans)param_ptr; |
| | | pans->bypass = allbypass; |
| | | pans->mode = 0; |
| | | break; |
| | | |
| | | case PROC_SELECTOR: |
| | | ptag_selector pselector = (ptag_selector)param_ptr; |
| | | pselector->input_num = MAX_MIXER_INPUT; |
| | | pselector->output_num = MAX_MIXER_OUTPUT; |
| | | memset(pselector->input_mask,0,sizeof(pselector->input_mask)); |
| | | break; |
| | | |
| | | case PROC_AGC: |
| | | ptag_agc pAGC = (ptag_agc)param_ptr; |
| | | pAGC->bypass = allbypass; |
| | | pAGC->attacktime = 1; |
| | | pAGC->releasetime = 500; |
| | | pAGC->ratio = 100; |
| | | pAGC->tar_threshold = 0; |
| | | pAGC->threshold =-4800; |
| | | break; |
| | | |
| | | case PROC_GATING_AUTOMIXER: |
| | | ptag_gating_mixer pgautomixer = (ptag_gating_mixer)param_ptr; |
| | | pgautomixer->bypass = allbypass; |
| | | pgautomixer->master_mute =0; |
| | | pgautomixer->master_gain =0; |
| | | pgautomixer->holdtime = 500; |
| | | pgautomixer->offgain = -4000; |
| | | pgautomixer->sensitivity = 600; |
| | | pgautomixer->nom_atten = 300; |
| | | pgautomixer->nom_num = 4; |
| | | for(j=0;j<AUTOMIXER_CHANNEL_NUM;j++){ |
| | | pgautomixer->channels[j].automatic = 0; |
| | | pgautomixer->channels[j].mute = 0; |
| | | pgautomixer->channels[j].gain = 0; |
| | | pgautomixer->channels[j].priority = 5; |
| | | } |
| | | break; |
| | | |
| | | case PROC_CONTINUNOUS_SPL: |
| | | ptag_spl pspl = (ptag_spl)param_ptr; |
| | | pspl->maxgain = 2000; |
| | | pspl->mingain = -2000; |
| | | pspl->sense_ratio = 75; |
| | | pspl->speed = 5; |
| | | pspl->trim =0; |
| | | pspl->bypass = allbypass; |
| | | memset((void*)pspl->mask,0,sizeof(pspl->mask)); |
| | | break; |
| | | |
| | | case PROC_GATING: |
| | | ptag_gate pgate = (ptag_gate)param_ptr; |
| | | pgate->bypass = allbypass; |
| | | pgate->threshold = -3000; |
| | | pgate->depth = -6000; |
| | | pgate->attacktime = 2; |
| | | pgate->holdtime = 5; |
| | | pgate->releasetime = 1000; |
| | | break; |
| | | |
| | | case PROC_DUCKER: |
| | | ptag_ducker pducker = (ptag_ducker)param_ptr; |
| | | pducker->bypass = allbypass; |
| | | pducker->threshold = -4500; |
| | | pducker->depth = -2000; |
| | | pducker->attacktime = 20; |
| | | pducker->holdtime = 1000; |
| | | pducker->releasetime = 1000; |
| | | memset((void*)pducker->mask,0,sizeof(pducker->mask)); |
| | | break; |
| | | |
| | | case PROC_REVERB: |
| | | break; |
| | | |
| | | case PROC_ECHO: |
| | | break; |
| | | |
| | | case PROC_FIR: |
| | | ptag_fir pfir = (ptag_fir)param_ptr; |
| | | pfir->bypass = allbypass; |
| | | pfir->taps = 1024; |
| | | memset((void*)pfir->coeffs, 0, sizeof(pfir->coeffs)); |
| | | pfir->coeffs[0] = 1; |
| | | break; |
| | | |
| | | default: |
| | | break; |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | void tgScene::tgScene_param_default(ptag_parameters p) |
| | | { |
| | | int i,j,module_cnt=0; |
| | | |
| | | module_def(PROC_INPUT, &p->input); |
| | | |
| | | for (i=0; i<MAX_INPUT_NUM; i++) { |
| | | module_def(PROC_EXPANDER, &p->in1[i]); |
| | | module_def(PROC_COMPRESS, &p->in2[i]); |
| | | module_def(PROC_AGC, &p->in3[i]); |
| | | module_def(PROC_EQ, &p->in4[i]); |
| | | module_def(PROC_FEEDBACK, &p->in5[i]); |
| | | } |
| | | |
| | | module_def(PROC_AUTOMIXER, &p->automixer); |
| | | module_def(PROC_SELECTOR, &p->aec_selector); |
| | | module_def(PROC_AEC, &p->aec); |
| | | module_def(PROC_SELECTOR, &p->ans_selector); |
| | | module_def(PROC_ANS, &p->ans_selector); |
| | | module_def(PROC_MIXER, &p->mixer); |
| | | |
| | | for (i=0; i<MAX_OUTPUT_NUM; i++) { |
| | | module_def(PROC_CROSSOVER, &p->out1[i]); |
| | | module_def(PROC_EQ, &p->out2[i]); |
| | | module_def(PROC_DELAY, &p->out3[i]); |
| | | module_def(PROC_LIMIT, &p->out4[i]); |
| | | } |
| | | |
| | | module_def(PROC_OUTPUT, &p->output); |
| | | module_def(PROC_SYSCTL, &p->sysctl); |
| | | } |
| | | |
| | | |
| | | s32 tgScene::set_parameters_content(uvoid* param, s32 size) |
| | | { |
| | | tag_parameters* pp = (tag_parameters*)param; |
| | | if(pp->magic != 0xb34c && size != sizeof(tag_parameters)) { |
| | | //basic check. |
| | | int L[24] = {0}; |
| | | if(pp->magic != 0xbcba || size != sizeof(tag_parameters)) { |
| | | printf("preset param error!\n"); |
| | | /*printf("tag_head:%d,%d,%d,%d,%d\n", L[0]=sizeof(parameters.magic), L[1]=sizeof(parameters.nmds)+L[0], L[2]=sizeof(parameters.pad1)+L[1], L[3]=sizeof(parameters.pad2)+L[2], L[4]=sizeof(parameters.crc)+L[3]); |
| | | printf("tag_input:%d, %d\n", sizeof(tag_input), L[5]=sizeof(tag_input)+L[4]); |
| | | printf("tag_module_in:%d, %d\n", sizeof(tag_module), L[6]=sizeof(tag_module) * MAX_INPUT_NUM * 5 + L[5]); |
| | | |
| | | printf("tag_automixer:%d, %d\n", sizeof(tag_automixer), L[7]=sizeof(tag_automixer)+L[6]); |
| | | printf("tag_select1:%d, %d\n", sizeof(tag_selector), L[8]=sizeof(tag_selector)+L[7]); |
| | | printf("tag_aec:%d, %d\n", sizeof(tag_aec), L[9]=sizeof(tag_aec)+L[8]); |
| | | printf("tag_selector:%d, %d\n", sizeof(tag_selector), L[10]=sizeof(tag_selector) + L[9]); |
| | | printf("tag_3a:%d, %d, %d\n", sizeof(tag_3a), L[11]=sizeof(tag_3a)+L[10]); |
| | | printf("tag_mixer:%d, %d\n", sizeof(tag_mixer), L[12]=sizeof(tag_mixer)+L[11]); |
| | | |
| | | printf("tag_module_o1:%d, %d\n", sizeof(tag_module), L[13]=sizeof(tag_module) * MAX_INPUT_NUM + L[12]); |
| | | printf("tag_module_fir:%d\n", sizeof(tag_module_fir), L[14]=sizeof(tag_module_fir) * MAX_OUTPUT_NUM + L[13]); |
| | | printf("tag_module_out:%d\n", sizeof(tag_module), L[15]=sizeof(tag_module) * MAX_OUTPUT_NUM * 2 + L[14]); |
| | | printf("tag_output:%d, %d\n", sizeof(tag_output), L[16]=sizeof(tag_output)+L[15]); |
| | | printf("tag_sysctl:%d, %d\n", sizeof(tag_sysctl), L[17]=sizeof(tag_sysctl)+L[16]); |
| | | printf("tag_group:%d, %d\n", sizeof(tag_group), L[18]=sizeof(tag_group)+L[17]);*/ |
| | | |
| | | printf("Len parameters:%d, Len recv:%d\n", L[19]=sizeof(tag_parameters), size); |
| | | return -1; |
| | | } |
| | | memcpy(¶meters, param, sizeof(tag_parameters)); |
| | |
| | | s32 tgScene::update_dynmodule_tag(s32 proc_type,struct proc_field* proc) |
| | | { |
| | | switch(proc_type) { |
| | | case ModuleType::PROC_EQ:{ |
| | | case ModuleType::PROC_GEQ:{ |
| | | ptag_module pmodule = (ptag_module)proc->parameters; |
| | | ptag_geq geq = (ptag_geq)pmodule->proc_ins; |
| | | |
| | | proc->tag = geq->nsections; |
| | | } |
| | | break; |
| | | case ModuleType::PROC_GEQ:{ |
| | | case ModuleType::PROC_EQ:{ |
| | | ptag_module pmodule = (ptag_module)proc->parameters; |
| | | ptag_eq eq = (ptag_eq)pmodule->proc_ins; |
| | | |
| | |
| | | proc->tag =1200; |
| | | break; |
| | | case ModuleType::PROC_CROSSOVER: |
| | | proc->tag =2; |
| | | proc->tag =1; |
| | | break; |
| | | case ModuleType::PROC_FEEDBACK:{ |
| | | ptag_module pmodule = (ptag_module)proc->parameters; |
| | |
| | | |
| | | s32 tgScene::update_module() |
| | | { |
| | | u8 port_number[16]; |
| | | s8 ana_input_num, ana_output_num,dante_input_num,dante_output_num ; |
| | | s8 ana_input_num, ana_output_num,dante_input_num,dante_output_num, usb_input_num, usb_output_num ; |
| | | s16 input_num, output_num ; |
| | | s16 dual_dsp = hw_adapter->get_system_is_dual_dsp(); |
| | | s16 dsp_index = hw_adapter->get_dsp_index(); |
| | | |
| | | hw_adapter->get_channel_num(&ana_input_num, &ana_output_num, &dante_input_num, &dante_output_num); |
| | | hw_adapter->get_channel_num(&ana_input_num, &ana_output_num, &dante_input_num, &dante_output_num, &usb_input_num, &usb_output_num); |
| | | input_num = ana_input_num + dante_input_num; |
| | | output_num = dante_input_num + dante_output_num; |
| | | output_num = ana_output_num + dante_output_num; |
| | | |
| | | for(auto& iter: proc_list){ |
| | | //update dynamic module info. |
| | |
| | | if(pmodule->proc_type >= ModuleType::PROC_COUNT || pmodule->proc_type < ModuleType::PROC_NONE) { |
| | | pmodule->proc_type = ModuleType::PROC_NONE; |
| | | } |
| | | update_dynmodule_tag(pmodule->proc_type, &iter); |
| | | |
| | | // if(iter.dsp_index == 0) { |
| | | // s32 n = input_num; |
| | | // s32 ninports = str_delim((const s8*)iter.inportstr, port_number); |
| | | // |
| | | // //Consider PCM model&& PCM channel don't process. |
| | | // if(dual_dsp == 0 && input_num >16){ |
| | | // n = ana_input_num; |
| | | // } |
| | | // |
| | | // if(ninports == 1 && port_number[0] >= n){ |
| | | // iter.proc_type = ModuleType::PROC_NONE;//便äºè§£æåºæ¯è¿æ»¤ |
| | | // //even though module not to process, but the pc has level offset. |
| | | // if(port_number[0] >= input_num) { |
| | | // |
| | | // } |
| | | // } |
| | | // } |
| | | // else { |
| | | // s32 n = output_num; |
| | | // s32 ninports = str_delim(iter.inportstr, port_number); |
| | | // |
| | | // if(dual_dsp == 0 && output_num >16){ |
| | | // n = ana_output_num; |
| | | // } |
| | | // |
| | | // if(ninports==1 && port_number[0] >= n){ |
| | | // iter.proc_type = ModuleType::PROC_NONE; //便äºè§£æåºæ¯è¿æ»¤ |
| | | // //even though module not to process, but the pc has level offset. |
| | | // if(port_number[0] >= output_num) { |
| | | // |
| | | // } |
| | | // } |
| | | // } |
| | | update_dynmodule_tag(pmodule->proc_type, &iter); |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | uvoid* tgScene::get_module_param_ptr(uvoid *param, s32 fixed) |
| | | uvoid* tgScene::get_module_param_ptr(s32 mType, uvoid *param, s32 fixed) |
| | | { |
| | | uvoid *ptr = param; |
| | | |
| | | if(fixed == 0){ |
| | | if (PROC_FIR == mType) { |
| | | ptag_module_fir pmod = (ptag_module_fir)param; |
| | | ptr = (void*)pmod->proc_ins; |
| | | } |
| | | else { |
| | | ptag_module pmod = (ptag_module)param; |
| | | ptr = (void*)pmod->proc_ins; |
| | | } |
| | | } |
| | | return ptr; |
| | | } |
| | | |
| | | |
| | | u32 tgScene::get_module_id(u32 mid, s32 mtype , u32 pid) |
| | | { |
| | | if(mtype == PROC_INPUT && (pid == INPUT_TYPE || pid == INPUT_FREQ || pid == INPUT_LEVEL)){ |
| | | mid = 300; |
| | | } |
| | | else if(mtype == PROC_DUCKER && pid == DUCKER_MIX){ |
| | | mid = mid + 320; |
| | | } |
| | | |
| | | return mid; |
| | | } |
| | | //u32 tgScene::get_module_id(u32 mid, s32 mtype , u32 pid) |
| | | //{ |
| | | // if(mtype == PROC_INPUT && (pid == INPUT_TYPE || pid == INPUT_FREQ || pid == INPUT_LEVEL)){ |
| | | // mid = 300; |
| | | // } |
| | | // else if(mtype == PROC_DUCKER && pid == DUCKER_MIX){ |
| | | // mid = mid + 320; |
| | | // } |
| | | // |
| | | // return mid; |
| | | //} |
| | |
| | | |
| | | #include <vector> |
| | | #include "../scene.h" |
| | | #include "../protocol.h" |
| | | #include "module_def.h" |
| | | |
| | | #pragma pack (1) |
| | | typedef struct { |
| | | unsigned short magic; |
| | | unsigned short nmds; |
| | | |
| | | unsigned short pad1; |
| | | unsigned short pad2; |
| | | |
| | | unsigned short crc[2]; |
| | | |
| | | tag_input input; //1362 |
| | | |
| | | tag_input input;//514 |
| | | |
| | | tag_module in1[MAX_INPUT_NUM]; |
| | | tag_module in1[MAX_INPUT_NUM]; //4352 |
| | | tag_module in2[MAX_INPUT_NUM]; |
| | | tag_module in3[MAX_INPUT_NUM]; |
| | | tag_module in4[MAX_INPUT_NUM]; |
| | | tag_module in5[MAX_INPUT_NUM]; |
| | | |
| | | tag_automixer automixer;//138 |
| | | tag_selector aec_selector; //68 |
| | | tag_automixer automixer; //366 |
| | | tag_selector aec_selector; //208 |
| | | tag_aec aec; //4 |
| | | tag_selector ans_selector; //68 |
| | | tag_3a afc_ns;//4 |
| | | tag_mixer mixer; //728 -4 |
| | | tag_selector ans_selector; //208 |
| | | tag_3a afc_ns; //36 |
| | | tag_mixer mixer; //5242 |
| | | |
| | | tag_module out1[MAX_OUTPUT_NUM]; |
| | | tag_module out2[MAX_OUTPUT_NUM]; |
| | | tag_module out1[MAX_OUTPUT_NUM]; //4352 |
| | | // tag_module out2[MAX_OUTPUT_NUM]; |
| | | tag_module_fir out2[MAX_OUTPUT_NUM]; //140080 |
| | | tag_module out3[MAX_OUTPUT_NUM]; |
| | | tag_module out4[MAX_OUTPUT_NUM]; |
| | | tag_output output; |
| | | tag_sysctl sysctl; |
| | | tag_group group; |
| | | tag_output output; //1158 |
| | | tag_sysctl sysctl; //6 |
| | | tag_group group; //272 |
| | | } tag_parameters, *ptag_parameters; |
| | | |
| | | #pragma pack () |
| | | |
| | | class tgScene: public Scene |
| | | { |
| | |
| | | s32 update_dynmodule_tag(s32 proc_type,struct proc_field* proc); |
| | | public: |
| | | tgScene(hw_adapter_t* adapter); |
| | | void module_def(s32 proc_type, void* param_ptr); |
| | | void tgScene_param_default(ptag_parameters p); |
| | | |
| | | //æ ¹æ®æ¨¡åç±»åæ´æ°æ¨¡åä¿¡æ¯. |
| | | virtual s32 update_module() override; |
| | | |
| | | virtual s32 set_parameters_content(uvoid* param, s32 size) override; |
| | | |
| | | virtual uvoid* get_module_param_ptr(uvoid *param, s32 fixed) override; |
| | | virtual uvoid* get_module_param_ptr(s32 mType, uvoid *param, s32 fixed) override; |
| | | |
| | | virtual u32 get_module_id(u32 mid, s32 mtype ,u32 pid) override; |
| | | // virtual u32 get_module_id(u32 mid, s32 mtype ,u32 pid) override; |
| | | }; |
| | | |
| | | |
| | | //void param_init(ptag_device_config pDevCfg); |
| | | //void preset_init(tag_parameters *p); |
| | | |
| | | |
| | | #endif /* TG_SCENE_H_ */ |
| | |
| | | * Created on: 2025å¹´7æ24æ¥ |
| | | * Author: 86189 |
| | | */ |
| | | #include <stdio.h> |
| | | #include "IModule.h" |
| | | #include "module_def.h" |
| | | #include "tg_user_ctrl.h" |
| | | |
| | | |
| | | u32 tg_param_ctrl::Signalgen_Ctrl(IModule* m, u32 pID, s16* val_c) |
| | | u32 tg_param_ctrl::Signalgen_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num) |
| | | { |
| | | enum SGItemType{ |
| | | SG_MUTE = 0x1, |
| | |
| | | return 0; |
| | | } |
| | | |
| | | u32 tg_param_ctrl::Input_Ctrl(IModule* m, u32 pID, s16* val_c) |
| | | u32 tg_param_ctrl::Input_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num) |
| | | { |
| | | enum GainID { |
| | | enum Input_ID{ |
| | | GAIN = 0x1, |
| | | MUTE, |
| | | SENSI, |
| | | PHANTOM, |
| | | |
| | | PHASE = 9, |
| | | STEP,//-500~+500 |
| | | TYPE, |
| | | FREQ, |
| | | LEVEL, |
| | | NAME, |
| | | PHASE, |
| | | STEP, |
| | | LINK, |
| | | CHANNEL_LEVEL, |
| | | |
| | | INPUT_MIN, |
| | | INPUT_MAX, |
| | | }; |
| | | |
| | | |
| | | enum PitchID { |
| | | PITCH_BYPASS = 0x1,// |
| | | PITCH_SEMITONES,// |
| | | }; |
| | | |
| | | |
| | | short val[4]; |
| | | int channel = val_c[0]&(MAX_INPUT_NUM-1); |
| | | int channel = val_c[0];//&(MAX_INPUT_NUM-1); |
| | | |
| | | if(pID == INPUT_STEP) { |
| | | val[0] = channel; val[1] = RESSIGNBIT(val_c[1]); |
| | | m->Ctrl(STEP, val, 2); |
| | | } |
| | | else { |
| | | val[0] = channel; val[1] = RESSIGNBIT(val_c[1]); |
| | | m->Ctrl(pID, val, 2); |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | u32 tg_param_ctrl::Gain_Ctrl(IModule* m, u32 pID, s16* val_c) |
| | | u32 tg_param_ctrl::Gain_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num) |
| | | { |
| | | enum GainID { |
| | | GAIN = 0x1, |
| | |
| | | }; |
| | | |
| | | short val[4]; |
| | | int channel = val_c[0]&(MAX_INPUT_NUM-1); |
| | | int channel = val_c[0];//&(MAX_INPUT_NUM-1); |
| | | |
| | | if(pID == 0x20) { |
| | | val[0] = channel; val[1] = RESSIGNBIT(val_c[1]); |
| | |
| | | return 0; |
| | | } |
| | | |
| | | u32 tg_param_ctrl::Output_Ctrl(IModule* m, u32 pID, s16* val_c) |
| | | u32 tg_param_ctrl::Output_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num) |
| | | { |
| | | enum GainID { |
| | | GAIN = 0x1, |
| | |
| | | }; |
| | | |
| | | short val[4]; |
| | | int channel = val_c[0]&(MAX_OUTPUT_NUM-1); |
| | | int channel = val_c[0];//&(MAX_OUTPUT_NUM-1); |
| | | |
| | | short cmd[16] = {GAIN, MUTE, 0, PHASE, SENSI, STEP, 0, 0, 0, 0, 0, 0 ,0 ,0 ,0 ,0 }; |
| | | val[0] = channel; |
| | |
| | | return 0; |
| | | } |
| | | |
| | | u32 tg_param_ctrl::Mixer_Ctrl(IModule* m, u32 pID, s16* val_c) |
| | | u32 tg_param_ctrl::Mixer_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num) |
| | | { |
| | | short val[4]; |
| | | |
| | |
| | | return 0; |
| | | } |
| | | |
| | | u32 tg_param_ctrl::Crossover_Ctrl(IModule* m, u32 pID, s16* val_c) |
| | | u32 tg_param_ctrl::Crossover_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num) |
| | | { |
| | | enum CFilterID { |
| | | _BYPASS = 0x1, |
| | |
| | | return 0; |
| | | } |
| | | |
| | | u32 tg_param_ctrl::Feedback_Ctrl(IModule* m, u32 pID, s16* val_c) |
| | | u32 tg_param_ctrl::Feedback_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num) |
| | | { |
| | | // enum NHSID{ |
| | | // FB_BYPASS = 0x1, |
| | |
| | | return 0; |
| | | } |
| | | |
| | | u32 tg_param_ctrl::Automixer_Ctrl(IModule* m, u32 pID, s16* val_c) |
| | | u32 tg_param_ctrl::Automixer_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num) |
| | | { |
| | | enum GainSharingAMID { |
| | | AM_BYPASS =0x1, |
| | |
| | | return 0; |
| | | } |
| | | |
| | | u32 tg_param_ctrl::Aec_Ctrl(IModule* m, u32 pID, s16* val_c) |
| | | u32 tg_param_ctrl::Aec_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num) |
| | | { |
| | | enum AECID{ |
| | | BYPASS = 0X1, |
| | |
| | | AGC_GAIN, |
| | | }; |
| | | |
| | | short val[4] = {0,0,0,0}; |
| | | short cmd[3] = {0, BYPASS, NLPLEVEL}; |
| | | |
| | | short val[4]; |
| | | short cmd[12] = {0, BYPASS, NLPLEVEL, 0, 0,0}; |
| | | |
| | | val[0] = RESSIGNBIT(val_c[0]); |
| | | val[1] = RESSIGNBIT(val_c[1]); |
| | | m->Ctrl(cmd[pID], val, 1); |
| | | val[1] = RESSIGNBIT(val_c[0]); |
| | | m->Ctrl(cmd[pID], val, 2); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | u32 tg_param_ctrl::Sysctl_Ctrl(IModule* m, u32 pID, s16* val_c) |
| | | u32 tg_param_ctrl::Sysctl_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num) |
| | | { |
| | | enum SYSCTRLID{ |
| | | SYSCTL_MUTE = 0x1, //val[0]:0-unmute,1-mute |
| | |
| | | return 0; |
| | | } |
| | | |
| | | u32 tg_param_ctrl::Geq_Ctrl(IModule* m, u32 pID, s16* val_c) |
| | | u32 tg_param_ctrl::Geq_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num) |
| | | { |
| | | enum EQID{ |
| | | EQ_BYPASS_ALL = 0x1, |
| | |
| | | return 0; |
| | | } |
| | | |
| | | u32 tg_param_ctrl::Reverb_Ctrl(IModule* m, u32 pID, s16* val_c) |
| | | u32 tg_param_ctrl::Reverb_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num) |
| | | { |
| | | short val[4]; |
| | | |
| | |
| | | return 0; |
| | | } |
| | | |
| | | u32 tg_param_ctrl::Echo_Ctrl(IModule* m, u32 pID, s16* val_c) |
| | | u32 tg_param_ctrl::Echo_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num) |
| | | { |
| | | enum EchoID{ |
| | | ECHO_BYPASS = 1, |
| | |
| | | return 0; |
| | | } |
| | | |
| | | u32 tg_param_ctrl::General_Ctrl(IModule* m, u32 pID, s16* val_c) |
| | | u32 tg_param_ctrl::General_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num) |
| | | { |
| | | short val[4]; |
| | | |
| | |
| | | val[1] = RESSIGNBIT(val_c[1]); |
| | | |
| | | m->Ctrl(pID, val, 2); |
| | | // printf("pID:%d v[0]:%d v[1]:%d\n", pID, val[0], val[1]); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | u32 tg_param_ctrl::Fir_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num) |
| | | { |
| | | enum FIRID { |
| | | FIR_BYPASS = 0x1, ////val[0]: 0-åæ¶bypass, 1- 使è½bypass |
| | | FIR_NAME, //æ ç¨ |
| | | FIR_TAPS, //æ ç¨ |
| | | FIR_COEFFS, //val: åå
ï¼æå¤§é¿åº¦1024 float. æ 转æ¢ç´æ¥æ·è´float. |
| | | }; |
| | | s16 val[4]; |
| | | val[0] = RESSIGNBIT(val_c[0]); |
| | | |
| | | if(FIR_BYPASS == pID){ |
| | | m->Ctrl(pID, val, 1); // val[0] is bypass or nobypass |
| | | } |
| | | else if (FIR_COEFFS == pID){ |
| | | m->Ctrl(pID, val_c, num); |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | class tg_param_ctrl { |
| | | public: |
| | | static u32 Signalgen_Ctrl(IModule* m, u32 pID, s16* val_c); |
| | | static u32 Input_Ctrl(IModule* m, u32 pID, s16* val_c); |
| | | static u32 Gain_Ctrl(IModule* m, u32 pID, s16* val_c); |
| | | static u32 Output_Ctrl(IModule* m, u32 pID, s16* val_c); |
| | | static u32 Mixer_Ctrl(IModule* m, u32 pID, s16* val_c); |
| | | static u32 Crossover_Ctrl(IModule* m, u32 pID, s16* val_c); |
| | | static u32 Feedback_Ctrl(IModule* m, u32 pID, s16* val_c); |
| | | static u32 Automixer_Ctrl(IModule* m, u32 pID, s16* val_c); |
| | | static u32 Aec_Ctrl(IModule* m, u32 pID, s16* val_c); |
| | | static u32 Sysctl_Ctrl(IModule* m, u32 pID, s16* val_c); |
| | | static u32 Geq_Ctrl(IModule* m, u32 pID, s16* val_c); |
| | | static u32 Reverb_Ctrl(IModule* m, u32 pID, s16* val_c); |
| | | static u32 Echo_Ctrl(IModule* m, u32 pID, s16* val_c); |
| | | static u32 General_Ctrl(IModule* m, u32 pID, s16* val_c); |
| | | static u32 Signalgen_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num); |
| | | static u32 Input_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num); |
| | | static u32 Gain_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num); |
| | | static u32 Output_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num); |
| | | static u32 Mixer_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num); |
| | | static u32 Crossover_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num); |
| | | static u32 Feedback_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num); |
| | | static u32 Automixer_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num); |
| | | static u32 Aec_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num); |
| | | static u32 Sysctl_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num); |
| | | static u32 Geq_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num); |
| | | static u32 Reverb_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num); |
| | | static u32 Echo_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num); |
| | | static u32 General_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num); |
| | | static u32 Fir_Ctrl(IModule* m, u32 pID, s16* val_c, u32 num); |
| | | }; |
| | | |
| | | |
| | |
| | | */ |
| | | #include <stdlib.h> |
| | | #include <stdio.h> |
| | | #include <heapnew> |
| | | #include "tob.h" |
| | | #include "crc.h" |
| | | #include "config.h" |
| | |
| | | #include "IModule.h" |
| | | #include "f2f.h" |
| | | #include "../drv/memory.h" |
| | | #include "param_ctrl.h" |
| | | |
| | | |
| | | |
| | | //#define DEBUG |
| | | #ifdef DEBUG |
| | |
| | | #define dbg_printf |
| | | #endif |
| | | |
| | | static ToB* tob = NULL; |
| | | //static ToB* tob = NULL; |
| | | |
| | | ToB* ToB::GetInstance() |
| | | { |
| | | return tob; |
| | | } |
| | | //ToB* ToB::GetInstance() |
| | | //{ |
| | | // return tob; |
| | | //} |
| | | |
| | | ToB::ToB(ubool dualDsp, u32 dspIndex ) |
| | | : dual_dsp(dualDsp), dsp_index(dspIndex),mList(32) |
| | | : dual_dsp(dualDsp), dsp_index(dspIndex) |
| | | { |
| | | if(tob != NULL) { |
| | | delete tob; |
| | | } |
| | | tob = this; |
| | | frames = NULL; |
| | | // if(tob != NULL) { |
| | | // delete tob; |
| | | // } |
| | | // tob = this; |
| | | frames = nullptr; |
| | | processed = ufalse; |
| | | mModuleNum =0; |
| | | mLevelPacketNum =0; |
| | | mModuleIndex.resize(0); |
| | | paramset = new(SRAM_DDR) tg_param_ctrl_t(); |
| | | } |
| | | |
| | | ToB::~ToB() |
| | | { |
| | | toClear(); |
| | | tob = NULL; |
| | | // tob = NULL; |
| | | delete paramset; |
| | | } |
| | | |
| | | uvoid ToB::SetMute(ubool mute) |
| | |
| | | ErrStatus ToB::toClear() |
| | | { |
| | | processed = ufalse; |
| | | int i = 0; |
| | | |
| | | for (std::vector<IModule*>::iterator iter = mList.begin(); |
| | | iter != mList.end() ;iter++) { |
| | | delete *iter; |
| | | // for (std::vector<IModule*>::iterator iter = mList.begin(); iter != mList.end(); iter++, ++i) { |
| | | // delete *iter; |
| | | // *iter = nullptr; |
| | | // } |
| | | for (auto iter : mList) { |
| | | delete iter; |
| | | iter = nullptr; |
| | | } |
| | | |
| | | mList.clear(); |
| | | mModuleIndex.clear(); |
| | | |
| | | if(frames != NULL) { |
| | | delete frames; |
| | | frames = nullptr; |
| | | } |
| | | mModuleNum = 0; |
| | | |
| | |
| | | |
| | | u32 size = sizeof(FlowChartHead); |
| | | u32 nPhyInput =0 ,nPhyOutput=0; |
| | | |
| | | frames = new Frames(head->dsp_buffer_num[dsp_index]); |
| | | |
| | | do { |
| | |
| | | if (size != nbytes) { |
| | | dbg_printf("check flowchart some error!\n"); |
| | | } |
| | | dbg_printf("Phy InputNum %d, Output Num %d\n",nPhyInput,nPhyOutput); |
| | | // dbg_printf("Phy InputNum %d, Output Num %d\n",nPhyInput,nPhyOutput); |
| | | SetNumOfChannels(IntDataType::TDM , nPhyInput, nPhyOutput); |
| | | |
| | | return ErrStatus::SUCCESS; |
| | | } |
| | | #define DEBUG 0 |
| | | #if 1//DEBUG |
| | | const s8* type_string[ModuleType::PROC_COUNT] = { |
| | | "none" |
| | | ,"input" |
| | | ,"meter" |
| | | ,"peq" |
| | | ,"expander" |
| | | ,"compresser" |
| | | ,"limiter" |
| | | ,"mixer" |
| | | ,"delay" |
| | | ,"crossover" |
| | | ,"output" |
| | | ,"gain" |
| | | ,"nhs" |
| | | ,"gain sharing am" |
| | | ,"agc" |
| | | ,"aec" |
| | | ,"ans" |
| | | ,"sysctrl" |
| | | ,"shelf" |
| | | ,"selector" |
| | | ,"gating am" |
| | | ,"spl" |
| | | ,"gating" |
| | | ,"ducker" |
| | | ,"reverb" |
| | | ,"echo" |
| | | ,"geq" |
| | | ,"fir" |
| | | ,"afc" |
| | | ,"signal gen" |
| | | ,"pitch" |
| | | ,"route" |
| | | ,"dummuy input" |
| | | ,"dummy output" |
| | | }; |
| | | #endif |
| | | ErrStatus ToB::CreateModuleV1(const u8* bin, u32 nbytes) |
| | | { |
| | | FlowChartHead* head = (FlowChartHead*)bin; |
| | | u32 size = sizeof(FlowChartHead); |
| | | u16 nPhyInput[IntDataType::COUNT] = { 0,0,0 }, nPhyOutput[IntDataType::COUNT] = { 0,0,0 }; |
| | | |
| | | s32 len =0; |
| | | frames = new Frames(head->dsp_buffer_num[dsp_index]); |
| | | |
| | | do { |
| | |
| | | |
| | | if (pmod->mDsp != dsp_index) continue; |
| | | |
| | | #ifdef DEBUG |
| | | dbg_printf("Module ID %d type %d rxnum %d txnum %d. \n",pmod->mID ,pmod->mType, pmod->mRxNum,pmod->mTxNum); |
| | | #if DEBUG |
| | | //if (PROC_FIR == pmod->mType) |
| | | printf("Module ID %d type %d %s rxnum %d txnum %d tag %d. \n",pmod->mID ,pmod->mType, type_string[pmod->mType], pmod->mRxNum,pmod->mTxNum,pmod->mTag); |
| | | #endif |
| | | |
| | | IModule* m = CreateBaseModule(pmod->mType,pmod->mTag, mRxNum,mTxNum); |
| | | if(!m) { |
| | | dbg_printf("Module ID Create fail.\n", pmod->mID); |
| | | continue; |
| | | } |
| | | |
| | | m->SetModuleInfo(pmod->mID ,pmod->mType,pmod->mTag); |
| | | mList.push_back(m); |
| | | |
| | |
| | | } |
| | | mModuleIndex[pmod->mID] = ++mModuleNum ; |
| | | |
| | | // printf("Module id:%d, Tx buffer id:", pmod->mID); |
| | | for (size_t i = 0; i < mTxNum && !bOutput; i++){ |
| | | // printf("bid %d, ", mTxbufID[i]); |
| | | if (mTxbufID[i] > 0) { |
| | | Frame* pcm = frames->GetFrame(mTxbufID[i]-1 ); |
| | | m->SetOutputChannelDataPtr(i, pcm); |
| | |
| | | nPhyInput[mPhyID[i].mIntType] = mPhyID[i].mPhyID; |
| | | m->SetInputChannelDataPtr(i, pcm); |
| | | SetRxChannelPtr(static_cast<IntDataType>(mPhyID[i].mIntType), mPhyID[i].mPhyID-1, pcm->Data()); |
| | | // printf("phy_id %d\n", mPhyID[i].mPhyID); |
| | | } |
| | | } |
| | | else { |
| | | m->SetOutputChannelDataPtr(i, 0); |
| | | } |
| | | } |
| | | // printf(";Rx buffer id:"); |
| | | for (size_t i = 0; i < mRxNum && !bInput; i++) { |
| | | // printf("mID %d,bid %d\n", pmod->mID, mRxbufID[i]); |
| | | if (mRxbufID[i] > 0) { |
| | | Frame* pcm = frames->GetFrame(mRxbufID[i]-1 ); |
| | | m->SetInputChannelDataPtr(i, pcm); |
| | |
| | | if(nPhyOutput[mPhyID[i].mIntType] < mPhyID[i].mPhyID) |
| | | nPhyOutput[mPhyID[i].mIntType] = mPhyID[i].mPhyID; |
| | | |
| | | pcm = frames->AllocFrame(); |
| | | //pcm = frames->AllocFrame(); // It is not necessary to be compatible with the AXE1208 series here, because the TOP architecture is different. |
| | | m->SetOutputChannelDataPtr(i, pcm); |
| | | SetTxChannelPtr(static_cast<IntDataType>(mPhyID[i].mIntType), mPhyID[i].mPhyID-1, pcm->Data()); |
| | | // printf("mID %d,bid %d\n", pmod->mID, mPhyID[i].mPhyID-1); |
| | | // printf("phy_type %d, _id %d\n", mPhyID[i].mIntType, mPhyID[i].mPhyID); |
| | | } |
| | | } |
| | | else { |
| | | m->SetInputChannelDataPtr(i, 0); |
| | | } |
| | | } |
| | | // printf("\n"); |
| | | |
| | | m->Init(); |
| | | |
| | | // ä» paramset ä¸è·å对åºçåæ°æ§å¶å½æ°æé |
| | | ParamCtrl_fn paramEntry = paramset->GetParamEntry( m->GetModuleType()); |
| | | if(paramEntry == NULL) { |
| | | printf("paramEntry is NULL!\n"); |
| | | } |
| | | // è°ç¨åæ°æ§å¶å½æ° |
| | | u32 result = paramEntry(m, (uvoid*)pmod->mParamaddr, len); |
| | | |
| | | } while (size < nbytes); |
| | | |
| | | // int ddr = sram_free_space(SRAM_DDR,mem_any); |
| | | // int ccm = sram_free_space(SRAM_L2,mem_any); |
| | | // int l1 = sram_free_space(SRAM_L1,mem_heap); |
| | | // printf("mListAdd:0x%x, ddr %d ccm %d l1 %d.\n", &mList, ddr, ccm ,l1); |
| | | |
| | | //for (auto pl : mList) { |
| | | // delete pl; |
| | | // int l2mem = sram_free_space(SRAM_L2, mem_any); |
| | | // printf("L2mem %d\n", l2mem); |
| | | //} |
| | | |
| | | if (size != nbytes) { |
| | | dbg_printf("check flowchart some error!\n"); |
| | |
| | | SetNumOfChannels(static_cast<IntDataType>(i) , nPhyInput[i], nPhyOutput[i]); |
| | | } |
| | | |
| | | /*for (auto pt = mList.begin(); pt < mList.end(); pt++) { |
| | | IModule *p = *pt._Myptr; |
| | | static int i = 0; |
| | | printf("%d, id %d, type %d\n",i++, p->GetModuleID(), p->GetModuleType()); |
| | | }*/ |
| | | |
| | | return ErrStatus::SUCCESS; |
| | | } |
| | | ErrStatus ToB::toAnalysis(const u8* bin, u32 nbytes) |
| | |
| | | FlowChartHead* head = (FlowChartHead*)bin; |
| | | ErrStatus ret = ErrStatus::ERR_METHOD; |
| | | //check crc |
| | | u32 tmp_crc ,crc = head->crcLsb|(head->crcMsb<<16); |
| | | head->crcLsb = head->crcMsb = 0; |
| | | s32 tmp_crc; |
| | | s32 crc = head->crc; |
| | | head->crc = 0; |
| | | tmp_crc = CRC::crc32(bin, nbytes); |
| | | if (tmp_crc != crc) { |
| | | //dbg_printf("flowchar crc check fail.\n"); |
| | | printf("flowchar crc check fail.\n"); |
| | | return ErrStatus::ERR_PARAM; |
| | | } |
| | | |
| | | processed = ufalse; |
| | | |
| | | if(head->version == 0) { |
| | |
| | | else if(head->version == 1) { |
| | | ret = CreateModuleV1(bin, nbytes); |
| | | } |
| | | |
| | | processed = utrue; |
| | | return ret; |
| | | } |
| | | ErrStatus ToB::toProc() |
| | | { |
| | | if(processed) { |
| | | for (auto iter = mList.begin(); |
| | | iter != mList.end() ;iter++) { |
| | | for (auto iter = mList.begin(); iter < mList.end(); iter++) { |
| | | // if(((*iter)->GetModuleType() >= 6) && ((*iter)->GetModuleType() <= 6)) { |
| | | // printf("%d ", (*iter)->GetModuleID()); |
| | | (*iter)->Proc(); |
| | | // } |
| | | } |
| | | // printf("\n"); |
| | | } |
| | | else { |
| | | MuteOutput(); |
| | |
| | | return 0; |
| | | } |
| | | |
| | | /*ErrStatus ToB::toCtrl(u32 mID, u32 pID, const s16* val, u32 num) |
| | | { |
| | | if(mID >= mModuleIndex.size() || mModuleIndex[mID] == 0) { |
| | | printf("ToB::toCtrl mID Error!\n"); |
| | | return ErrStatus::ERR_PARAM; |
| | | } |
| | | |
| | | IModule* m = mList[mModuleIndex[mID]-1]; |
| | | if(!m) { |
| | | printf("ToB::toCtrl m Error!\n"); |
| | | return ErrStatus::ERR_PARAM; |
| | | } |
| | | |
| | | auto entries = paramset->GetEntries(m->GetModuleType()); |
| | | if(!entries.second) { |
| | | printf("ToB::toCtrl entries Error!\n"); |
| | | return ErrStatus::ERR_METHOD; |
| | | } |
| | | |
| | | entries.second(m, pID, const_cast<s16*>(val), num); |
| | | return ErrStatus::SUCCESS; |
| | | }*/ |
| | | ErrStatus ToB::toCtrl(u32 mID, u32 pID, const s16* val, u32 num) |
| | | { |
| | | if(mID >= mModuleIndex.size() || mModuleIndex[mID] == 0) { |
| | |
| | | |
| | | IModule* m = mList[mModuleIndex[mID]-1]; |
| | | if( m != NULL) { |
| | | m->Ctrl(pID, val, num); |
| | | // m->Ctrl(pID, val, num); |
| | | paramset->GetCtrlEntry(m->GetModuleType())(m, pID, (s16*)val, num); |
| | | } |
| | | |
| | | // printf("mID:%d pID:%d val[0]:%d val[1]:%d\n",mID, pID, val[0], val[1]); |
| | | return ErrStatus::SUCCESS; |
| | | } |
| | | |
| | |
| | | FlowChartHead* head = (FlowChartHead*)bin; |
| | | |
| | | //check crc |
| | | u32 tmp_crc ,crc = head->crcLsb|(head->crcMsb<<16); |
| | | head->crcLsb = head->crcMsb = 0; |
| | | u32 tmp_crc ,crc = head->crc; |
| | | head->crc =0; |
| | | tmp_crc = CRC::crc32(bin, nbytes); |
| | | if (tmp_crc != crc) { |
| | | //dbg_printf("flowchar crc check fail.\n"); |
| | | dbg_printf("flowchar crc check fail.\n"); |
| | | return ErrStatus::ERR_PARAM; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | if(size != nbytes) { |
| | | //dbg_printf("check preset has some error!\n"); |
| | | dbg_printf("check preset has some error!\n"); |
| | | } |
| | | |
| | | processed = utrue; |
| | | return ErrStatus::SUCCESS; |
| | | } |
| | | |
| | | u32 ToB::GetLevels(Message* handle , MSG* pmsg) |
| | | |
| | | u32 ToB::GetLevels(s16* buffer) |
| | | { |
| | | u32 n =0,len =0; |
| | | s8 buffer[MSG_DATA_LEN]; |
| | | u32 packetNo =0; |
| | | u32 n =0,size =0; |
| | | |
| | | if( !processed ) { |
| | | return 0; |
| | | } |
| | | // |
| | | // for (std::vector<IModule*>::iterator iter = mList.begin(); |
| | | // iter != mList.end() ; iter++) { |
| | | // IModule* m = *iter; |
| | | // |
| | | // u32 ID = m->GetModuleID(); |
| | | // |
| | | // struct Level* p = (struct Level*)buffer; |
| | | // |
| | | // n = sizeof(struct Level); |
| | | // p->mID = ID; |
| | | // |
| | | // /*graydon-230905: å¤é鿍¡åä¼åºç°çµå¹³æ°éè¶
åº1024ï¼æ¯å¦32éé32ç¹å馿å¶, |
| | | // * ps: 讨论å³å®å¤é鿍¡åå¨çé¢åæ°ééå¶ä¸è¿å¤å¤ééä¸ç¬¦ååºç¨éæ±. |
| | | // */ |
| | | // p->num = m->GetLevel((s16*)(buffer + n)); |
| | | // if(p->num == 0) continue; |
| | | // |
| | | // n += p->num*sizeof(s16); |
| | | // |
| | | // //è¿å»ççµå¹³æ°é+å½åççµå¹³æ°éæ¯å¦å¤§äºMSG_DATA_LEN |
| | | // if(len + n > MSG_DATA_LEN) { |
| | | // pmsg->pktNo = packetNo++; |
| | | // pmsg->totalPkts = mLevelPacketNum; |
| | | // pmsg->Enc(MsgType::MSG_LEVEL_GET_RES, 0, len); |
| | | // handle->Send(pmsg);//å
¥éå |
| | | // len = 0; |
| | | // } |
| | | // memcpy(pmsg->data+len, p , n); |
| | | // len += n; |
| | | // } |
| | | // |
| | | // if(len > 0) { |
| | | // pmsg->pktNo = packetNo++; |
| | | // pmsg->totalPkts = mLevelPacketNum; |
| | | // pmsg->Enc(MsgType::MSG_LEVEL_GET_RES, 0, len); |
| | | // handle->Send(pmsg); |
| | | // } |
| | | // |
| | | // if(packetNo > 0){ |
| | | // mLevelPacketNum = packetNo; |
| | | // } |
| | | // return n; |
| | | return 0; |
| | | for (std::vector<IModule*>::iterator iter = mList.begin(); |
| | | iter != mList.end() ; iter++) { |
| | | size = (*iter)->GetLevel(buffer + n ); |
| | | // printf("proc %s level num:%d\n",type_string[(*iter)->GetModuleType()],size); |
| | | n += size; |
| | | } |
| | | |
| | | |
| | | //cpu = time*SAMPLE_RATE/SAMPLE_NUM |
| | | //cpu *1000 -> s32 |
| | | //cpu * 100 -> percent. |
| | | u32 ToB::GetModuleCPU(Message* handle , MSG* pmsg) |
| | | { |
| | | // u32 n =0; |
| | | // const ufloat period_s = SAMPLE_NUM*1.f/SAMPLE_RATE; |
| | | // const u32 percent = 100000; |
| | | // ufloat module_cpu ; |
| | | // u32* data = (u32*)pmsg->data; |
| | | // |
| | | // if( !processed ) { |
| | | // return 0; |
| | | // } |
| | | // |
| | | // for (std::vector<IModule*>::iterator iter = mList.begin(); |
| | | // iter != mList.end() ; iter++) { |
| | | // IModule* m = *iter; |
| | | // ufloat time = m->GetRuntime(); |
| | | // ModuleType type = (ModuleType)m->GetModuleType(); |
| | | // u32 tag = m->GetModuleTag(); |
| | | // u16 rxNum = m->GetModuleInputNum(); |
| | | // u16 txNum = m->GetModuleOutputNum(); |
| | | // u32 ID = m->GetModuleID(); |
| | | // |
| | | // |
| | | // switch(type) { |
| | | // case ModuleType::Mixer: |
| | | // case ModuleType::SupperMatrix: |
| | | // time = time / rxNum ; |
| | | // module_cpu = time / period_s ; |
| | | // break; |
| | | // case ModuleType::GEQ: |
| | | // case ModuleType::EQ: |
| | | // case ModuleType::NHS: |
| | | // time = time / (tag * rxNum) ; |
| | | // module_cpu = time / period_s ; |
| | | // break; |
| | | // case ModuleType::SignalGenerator: |
| | | // case ModuleType::Ducker: |
| | | // case ModuleType::ContinuitySPL: |
| | | // time = time / txNum ; |
| | | // module_cpu = time / period_s ; |
| | | // break; |
| | | // case ModuleType::AEC: |
| | | // module_cpu = time / 0.01f ;//aec 10mså¤ç䏿¬¡. |
| | | // break; |
| | | // default: |
| | | // time = time / rxNum ; |
| | | // module_cpu = time / period_s ; |
| | | // break; |
| | | // } |
| | | // data[n++] = ID; |
| | | // data[n++] = (u32)(module_cpu* percent); |
| | | // |
| | | // if(n*sizeof(u32) >= MSG_DATA_LEN) { |
| | | // pmsg->Enc(MsgType::MSG_MODULE_CPU_RES, 0, MSG_DATA_LEN); |
| | | // handle->Send(pmsg); |
| | | // n = 0; |
| | | // } |
| | | // } |
| | | // |
| | | // if(n > 0) { |
| | | // pmsg->Enc(MsgType::MSG_MODULE_CPU_RES, 0, n*sizeof(u32)); |
| | | // handle->Send(pmsg); |
| | | // } |
| | | |
| | | return 0; |
| | | return n; |
| | | } |
| | | |
| | | |
| | |
| | | #include "ModuleExport.h" |
| | | #include "messageproc.h" |
| | | #include "protocol.h" |
| | | #include "tg/tg_param_ctrl.h" |
| | | |
| | | |
| | | class ToB { |
| | |
| | | std::vector<IModule*> mList;//模åå表 |
| | | std::vector<u16> mModuleIndex; |
| | | |
| | | param_ctrl_t* paramset; |
| | | Frames* frames; |
| | | u32 dsp_index; |
| | | ubool dual_dsp; |
| | | ubool processed; |
| | | u16 mModuleNum; |
| | | u16 mLevelPacketNum ; |
| | | IModule* CreateBaseModule( u32 moduleType, u16 tag, u16 rxNum, u16 txNum); |
| | | ErrStatus CreateModule(const u8* bin, u32 nbytes); |
| | | ErrStatus CreateModuleV1(const u8* bin, u32 nbytes); |
| | | public: |
| | | ToB(ubool dualDsp, u32 dspIndex); |
| | | ~ToB(); |
| | | static ToB* GetInstance(); |
| | | // static ToB* GetInstance(); |
| | | ToB(const ToB&) = delete; |
| | | ToB& operator=(const ToB&) = delete; |
| | | static ToB* GetInstance(ubool dualDsp = true, u32 dspIndex = 0) { |
| | | static ToB instance(dualDsp, dspIndex); |
| | | return &instance; |
| | | } |
| | | uvoid SetMute(ubool mute); |
| | | ErrStatus toClear(); |
| | | ErrStatus toProc(); |
| | |
| | | ErrStatus toCtrl(u32 mID, u32 pID, const s16* val, u32 num); |
| | | ErrStatus toCtrl(const u8* bin , u32 nbytes); |
| | | ErrStatus toAnalysis(const u8* bin, u32 nbytes); |
| | | u32 GetLevels(Message* handle , MSG* msg); |
| | | u32 GetModuleCPU(Message* handle , MSG* pmsg); |
| | | u32 GetLevels(s16* buffer); |
| | | u16 GetModuleNum() {return mModuleNum;} |
| | | u16 GetLevelPacketNum() {return mLevelPacketNum;} |
| | | |
| | | u32 GetDSPIndex(){return dsp_index ;} |
| | | u32 GetModuleType(u32 mID); |
| | | }; |
| | |
| | | /* |
| | | ** ADSP-21569 linker description file generated on Jul 17, 2025 at 13:46:52. |
| | | ** ADSP-21569 linker description file generated on Sep 05, 2025 at 15:48:19. |
| | | */ |
| | | /* |
| | | ** Copyright (C) 2000-2022 Analog Devices Inc., All Rights Reserved. |
| | | ** Copyright (C) 2000-2023 Analog Devices Inc., All Rights Reserved. |
| | | ** |
| | | ** This file is generated automatically based upon the options selected |
| | | ** in the System Configuration utility. Changes to the LDF configuration |
| | |
| | | ** placed within these sections are preserved when this file is re-generated. |
| | | ** |
| | | ** Product : CrossCore Embedded Studio |
| | | ** Tool Version : 6.2.3.3 |
| | | ** Tool Version : 6.2.5.2 |
| | | */ |
| | | |
| | | ARCHITECTURE(ADSP-21569) |
| | |
| | | // Stack and heap initial memory reserve. |
| | | dxe_block0_stack_and_heap_reserve NO_INIT BW |
| | | { |
| | | RESERVE(heaps_and_system_stack_in_L1, heaps_and_system_stack_in_L1_length = 32768, 8) |
| | | RESERVE(heaps_and_system_stack_in_L1, heaps_and_system_stack_in_L1_length = 189440, 8) |
| | | } > mem_block0_bw |
| | | |
| | | // Highest priority (prio0) data and code. |
| | |
| | | INPUT_SECTION_ALIGN(4) |
| | | RESERVE_EXPAND(heaps_and_system_stack_in_L1, heaps_and_system_stack_in_L1_length, 0, 8) |
| | | ldf_stack_space = heaps_and_system_stack_in_L1; |
| | | ldf_stack_end = (ldf_stack_space + (heaps_and_system_stack_in_L1_length - 8)); |
| | | ldf_stack_end = (ldf_stack_space + (((heaps_and_system_stack_in_L1_length * 57344) / 189440) - 8)); |
| | | ldf_stack_length = ldf_stack_end - ldf_stack_space; |
| | | L1mem_space = ldf_stack_end + 8; |
| | | L1mem_end = (L1mem_space + (((heaps_and_system_stack_in_L1_length * 132096) / 189440) - 8)); |
| | | L1mem_length = L1mem_end - L1mem_space; |
| | | } > mem_block0_bw |
| | | |
| | | dxe_l2_stack_and_heap_expand NO_INIT BW |
| | |
| | | /*$VDSG<insert-input-sections-at-the-start-of-dxe_sdram_stack_and_heap> */ |
| | | |
| | | RESERVE_EXPAND(heaps_and_system_stack_in_L3, heaps_and_system_stack_in_L3_length, 0, 8) |
| | | DDRHeap_space = heaps_and_system_stack_in_L3; |
| | | DDRHeap_space = heaps_and_system_stack_in_L3 + 8; |
| | | DDRHeap_end = (DDRHeap_space + (heaps_and_system_stack_in_L3_length - 8)); |
| | | DDRHeap_length = DDRHeap_end - DDRHeap_space; |
| | | } > SDRAM_STACK_HEAP_BLOCK |
| | |
| | | /* |
| | | ** ADSP-21569 app_IVT.s generated on Jul 17, 2025 at 13:46:52 |
| | | ** ADSP-21569 app_IVT.s generated on Sep 05, 2025 at 15:48:19 |
| | | */ |
| | | /* |
| | | ** Copyright (C) 2000-2022 Analog Devices Inc., All Rights Reserved. |
| | | ** Copyright (C) 2000-2023 Analog Devices Inc., All Rights Reserved. |
| | | ** |
| | | ** This file is generated automatically based upon the options selected |
| | | ** in the System Configuration utility. Changes to the Startup Code configuration |
| | |
| | | /* |
| | | ** ADSP-21569 user heap source file generated on Jul 17, 2025 at 13:46:52. |
| | | ** ADSP-21569 user heap source file generated on Sep 05, 2025 at 15:48:19. |
| | | */ |
| | | /* |
| | | ** Copyright (C) 2000-2022 Analog Devices Inc., All Rights Reserved. |
| | | ** Copyright (C) 2000-2023 Analog Devices Inc., All Rights Reserved. |
| | | ** |
| | | ** This file is generated automatically based upon the options selected |
| | | ** in the System Configuration utility. Changes to the Heap configuration |
| | |
| | | ** placed within these sections are preserved when this file is re-generated. |
| | | ** |
| | | ** Product : CrossCore Embedded Studio |
| | | ** Tool Version : 6.2.3.3 |
| | | ** Tool Version : 6.2.5.2 |
| | | */ |
| | | |
| | | #ifdef _MISRA_RULES |
| | |
| | | |
| | | extern "asm" unsigned long ldf_heap_space; |
| | | extern "asm" unsigned long ldf_heap_length; |
| | | extern "asm" int L1mem_space; |
| | | extern "asm" int L1mem_length; |
| | | extern "asm" int DDRHeap_space; |
| | | extern "asm" int DDRHeap_length; |
| | | |
| | | const __heap_desc_t heap_table[3] = |
| | | const __heap_desc_t heap_table[4] = |
| | | { |
| | | |
| | | { &ldf_heap_space, (unsigned long) &ldf_heap_length, 0 }, |
| | | { &DDRHeap_space, (unsigned long) &DDRHeap_length, 1 }, |
| | | { &L1mem_space, (unsigned long) &L1mem_length, 1 }, |
| | | { &DDRHeap_space, (unsigned long) &DDRHeap_length, 2 }, |
| | | |
| | | { (void *)0, (size_t)0, 0 } /* This terminates the table. */ |
| | | }; |
| | |
| | | /* |
| | | ** ADSP-21569 startup code generated on Jul 17, 2025 at 13:46:52. |
| | | ** ADSP-21569 startup code generated on Sep 05, 2025 at 15:48:19. |
| | | */ |
| | | /* |
| | | ** Copyright (C) 2000-2022 Analog Devices Inc., All Rights Reserved. |
| | | ** Copyright (C) 2000-2023 Analog Devices Inc., All Rights Reserved. |
| | | ** |
| | | ** This file is generated automatically based upon the options selected |
| | | ** in the System Configuration utility. Changes to the Startup Code configuration |
| | |
| | | ** placed within these sections are preserved when this file is re-generated. |
| | | ** |
| | | ** Product : CrossCore Embedded Studio |
| | | ** Tool Version : 6.2.3.3 |
| | | ** Tool Version : 6.2.5.2 |
| | | */ |
| | | |
| | | .FILE_ATTR libGroup="startup"; |