| | |
| | | __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); |
| | |
| | | ModuleProcessLibInit(); |
| | | |
| | | if (modules.empty()) { |
| | | modules.push_back(ModuleEntry("Input",ModuleType::PROC_INPUT, InputCreate, ufalse)); |
| | | modules.push_back(ModuleEntry("SignalSource", ModuleType::PROC_INPUT, SignalSourceCreate, ufalse)); |
| | | // 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)); |
| | |
| | | |
| | | s8 ana_input_num ; |
| | | s8 ana_output_num ; |
| | | s8 usb_input_num; |
| | | s8 usb_output_num; |
| | | s8 dante_input_num ; |
| | | s8 dante_output_num ; |
| | | public: |
| | |
| | | this->ana_output_num = ana_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; |
| | | } |
| | | uvoid get_channel_num(s8* ana_rx_num,s8* ana_tx_num,s8* dante_rx_num,s8* dante_tx_num) |
| | | { |
| | |
| | | fir_acc_init(); |
| | | |
| | | //通知arm启动完成. |
| | | //dir: pin12, High level DSP can receive data, low level DSP has data to send . |
| | | //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(GPIOB, GPIO_Pin5, GPIO_HIGH); |
| | | |
| | | u32 ddrspace = sram_free_space(SRAM_DDR, mem_any); |
| | | printf("ddrspace:%d\n", ddrspace); |
| | | // u32 ddrspace = sram_free_space(SRAM_DDR, mem_any); |
| | | // printf("ddrspace:%d\n", ddrspace); |
| | | |
| | | while(1) { |
| | | asyn_proc_secs = ModulesAsynProcess(); |
| | |
| | | } |
| | | loop_cnt =0; |
| | | clock_check_count = DMACount[var.master_intr]; |
| | | printf("clk1 ok\n"); |
| | | // printf("clk1 ok\n"); |
| | | } |
| | | |
| | | |
| | |
| | | spiMsg->DspStatusPush(DSP_CLOCK_STATUS, 0, 0); |
| | | request_topo_count = DMACount[var.master_intr] ; |
| | | var.clock_ok = utrue; |
| | | printf("clk2 ok\n"); |
| | | // printf("clk2 ok\n"); |
| | | } |
| | | } |
| | | |
| | |
| | | int data_len; |
| | | |
| | | ToB* tob = ToB::GetInstance(); |
| | | u16 LevelCnt = tob->GetLevels(Levels); |
| | | u16 LevelCnt = tob->GetLevels(Levels); //864 levels |
| | | u32 msgLen = LevelCnt * sizeof(*Levels); |
| | | |
| | | int Packegs = (LevelCnt+MSG_DATA_LEN-1)/MSG_DATA_LEN; |
| | | 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++){ |
| | |
| | | data_len = MSG_DATA_LEN; |
| | | } |
| | | |
| | | memcpy(pmsg->data, Levels + i * MSG_DATA_LEN, data_len); |
| | | pmsg->dataLen = LevelCnt; |
| | | 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, msgLen); |
| | | pmsg->Enc(MsgType::MSG_GET_LEVEL, 0, data_len); |
| | | txQueue->Push(*pmsg); |
| | | } |
| | | } |
| | |
| | | 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) ; |
| | | tob->toCtrl(ptr->mid, ptr->cmd, data, data_num); |
| | | } |
| | | |
| | |
| | | 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); |
| | | // printf("No:%d len %d\n", pmsg->pktNo,pmsg->dataLen); |
| | | var.TopoLoading = utrue; |
| | | memcpy(bin+pmsg->pktNo*MSG_DATA_LEN, pmsg->data , pmsg->dataLen); |
| | | |
| | |
| | | ParamCtrl(pmsg); |
| | | break; |
| | | case MsgType::MSG_GET_LEVEL: |
| | | //ReportLevel(pmsg); |
| | | ReportLevel(pmsg); |
| | | break; |
| | | case MsgType::MSG_PARAM_CONFIG: |
| | | case MsgType::MSG_PARAM_COMPLETED: |
| | |
| | | Message(u32 num) |
| | | { |
| | | txQueue = new Queue<MSG>(num); |
| | | Levels = new(SRAM_DDR) s16[300]; |
| | | Levels = new s16[868]; |
| | | } |
| | | ~Message() |
| | | { |
| | |
| | | if(mctrl_list.count(mtype)) |
| | | return mctrl_list[mtype].GetCtrlEntry(); |
| | | else |
| | | return NULL; |
| | | return NULL; |
| | | } |
| | | }; |
| | | |
| | |
| | | u32 size = sizeof(struct FlowChartHead); |
| | | s32 ninports,noutports; |
| | | u16 rxBufID[64],txBufID[64]; |
| | | u32 dsp_index ; |
| | | |
| | | u16 dsp_input_num[2] ={0,0}; |
| | | u16 dsp_output_num[2] ={0,0}; |
| | |
| | | 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 = hw_adapter->get_system_is_dual_dsp()?p->dsp_index:0; |
| | | m->mDsp = dsp_index; |
| | | m->mID = p->proc_id; |
| | | m->mType = p->proc_type; |
| | | m->mTag = p->tag; |
| | |
| | | { |
| | | //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 ; |
| | | // s32 input_num = ana_input_num + dante_input_num ; |
| | | s32 local_ch = ana_input_num + usb_input_num; // C H G 18 |
| | | if(logic_channel < ana_input_num) { |
| | | //analog |
| | | return logic_channel + 1; |
| | | } |
| | | else if(logic_channel < input_num) { |
| | | //dante |
| | | return 19 + (logic_channel-ana_input_num); |
| | | else if(logic_channel < local_ch) { |
| | | //usb |
| | | return 17 + (logic_channel + 2 - local_ch); |
| | | } |
| | | else { |
| | | //usb |
| | | return 17 + (logic_channel-input_num); |
| | | //dante |
| | | return 19 + (logic_channel - local_ch); |
| | | } |
| | | } |
| | | else { |
| | | s32 output_num = ana_output_num + dante_output_num ; |
| | | //output |
| | | else { //output |
| | | // s32 output_num = ana_output_num + dante_output_num ; |
| | | s32 local_ch = ana_output_num + usb_output_num; // C H G 18 |
| | | //analog |
| | | if(logic_channel < ana_output_num) { |
| | | return logic_channel +1; |
| | | } |
| | | else if(logic_channel < output_num) { |
| | | return 19 + (logic_channel-ana_output_num); |
| | | else if(logic_channel < local_ch) { |
| | | //usb |
| | | return 17 + (logic_channel + 2 - local_ch); |
| | | } |
| | | else { |
| | | return 17 + (logic_channel-output_num); |
| | | //dante |
| | | return 19 + (logic_channel - local_ch); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | tgScene::tgScene(hw_adapter_t* adapter):Scene(adapter) |
| | | { |
| | | s8 inport_str[8],outport_str[8]; |
| | | s8 inport_str[10],outport_str[10]; |
| | | s8 ana_input_num, ana_output_num,dante_input_num,dante_output_num ; |
| | | s16 input_num, output_num ; |
| | | s32 n; |
| | |
| | | |
| | | //mixer |
| | | sprintf(inport_str, "1-%d", input_num+ 4); |
| | | sprintf(outport_str, "1-%d", output_num+1); |
| | | sprintf(outport_str, "%d-%d",input_num+5, input_num+output_num+6); |
| | | __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+1); |
| | | __MADD(167+i,PROC_CROSSOVER,outport_str, outport_str,1, 0, ¶meters.out1[i],2, ModuleInterfaceType::SOFT_MODULE); |
| | | sprintf(inport_str, "%d|", i+input_num+5); |
| | | __MADD(167+i,PROC_CROSSOVER,inport_str,inport_str,1, 0, ¶meters.out1[i],2, ModuleInterfaceType::SOFT_MODULE); |
| | | } |
| | | |
| | | //eq |
| | | for(s32 i =0 ;i < output_num ; i++) { |
| | | sprintf(outport_str, "%d|", i+1); |
| | | __MADD(199+i,PROC_EQ,outport_str, outport_str,1, 0, ¶meters.out2[i], 8, ModuleInterfaceType::SOFT_MODULE); |
| | | sprintf(inport_str, "%d|", i+input_num+5); |
| | | __MADD(199+i,PROC_EQ,inport_str, inport_str,1, 0, ¶meters.out2[i], 8, ModuleInterfaceType::SOFT_MODULE); |
| | | } |
| | | |
| | | //delay |
| | | for(s32 i =0 ;i < output_num ; i++) { |
| | | sprintf(outport_str, "%d|", i+1); |
| | | __MADD(231+i,PROC_DELAY,outport_str, outport_str,1, 0, ¶meters.out3[i], 1200, ModuleInterfaceType::SOFT_MODULE); |
| | | sprintf(inport_str, "%d|", i+input_num+5); |
| | | __MADD(231+i,PROC_DELAY,inport_str, inport_str,1, 0, ¶meters.out3[i], 1200, ModuleInterfaceType::SOFT_MODULE); |
| | | } |
| | | |
| | | //limit |
| | | for(s32 i =0 ;i < output_num ; i++) { |
| | | sprintf(inport_str, "%d|", i+input_num+5); |
| | | sprintf(outport_str, "%d|", i+1); |
| | | __MADD(263+i,PROC_LIMIT,outport_str, outport_str,1, 0, ¶meters.out4[i],0, ModuleInterfaceType::SOFT_MODULE); |
| | | __MADD(263+i,PROC_LIMIT,inport_str, outport_str,1, 0, ¶meters.out4[i],0, ModuleInterfaceType::SOFT_MODULE); |
| | | } |
| | | |
| | | //output |
| | |
| | | __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); |
| | | |
| | | printf("lst size=%d\n", proc_list.size()); |
| | | }; |
| | | |
| | | |
| | |
| | | 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; |
| | |
| | | #include "../drv/memory.h" |
| | | |
| | | |
| | | |
| | | //#define DEBUG |
| | | #ifdef DEBUG |
| | | #define dbg_printf printf |
| | |
| | | |
| | | 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; |
| | | } |
| | | |
| | | #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]); // C H G |
| | | frames = new Frames(head->dsp_buffer_num[dsp_index]); |
| | | |
| | | do { |
| | | const Module* pmod = (Module*)(bin+ size); size += sizeof(Module); |
| | |
| | | if (pmod->mDsp != dsp_index) continue; |
| | | |
| | | #ifdef DEBUG |
| | | printf("Module ID %d type %d rxnum %d txnum %d tag %d. \n",pmod->mID ,pmod->mType, pmod->mRxNum,pmod->mTxNum,pmod->mTag); |
| | | 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); |
| | | |
| | | 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); |
| | | // 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("ddr %d ccm %d l1 %d.\n",ddr, ccm ,l1); |
| | | |
| | | m->SetModuleInfo(pmod->mID ,pmod->mType, pmod->mTag); |
| | | mList.push_back(m); |
| | | |
| | | if(pmod->mID >= mModuleIndex.size()) { |
| | | mModuleIndex.resize(pmod->mID + 1, 0); |
| | | } |
| | | mModuleIndex[pmod->mID] = ++mModuleNum ; |
| | | 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]); |
| | | printf("bid %d, ", mTxbufID[i]); |
| | | if (mTxbufID[i] > 0) { |
| | | Frame* pcm = frames->GetFrame(mTxbufID[i]-1 ); |
| | | Frame* pcm = frames->GetFrame(mTxbufID[i]-1); |
| | | m->SetOutputChannelDataPtr(i, pcm); |
| | | |
| | | if (bInput && mPhyID[i].mIntType < IntDataType::COUNT) { |
| | |
| | | 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", mPhyID[i].mPhyID); |
| | | printf("phy_id %d\n", mPhyID[i].mPhyID); |
| | | } |
| | | } |
| | | else { |
| | |
| | | // printf("\n"); |
| | | |
| | | m->Init(); |
| | | //paramset->GetParamEntry(m->GetModuleType())(m, (uvoid*)pmod->mParamaddr, len); |
| | | // paramset->GetParamEntry(m->GetModuleType())(m, (uvoid*)pmod->mParamaddr, len); |
| | | // 获取模块类型 |
| | | u32 moduleType = m->GetModuleType(); |
| | | // 从 paramset 中获取对应的参数控制函数指针 |
| | | ParamCtrl_fn paramEntry = paramset->GetParamEntry(moduleType); |
| | | // 获取模块参数地址 |
| | | void* paramAddr = (uvoid*)pmod->mParamaddr; |
| | | // 调用参数控制函数 |
| | | u32 result = paramEntry(m, paramAddr, len); |
| | | |
| | | } while (size < nbytes); |
| | | |
| | | if (size != nbytes) { |
| | |
| | | { |
| | | if(processed) { |
| | | for (auto iter = mList.begin(); iter < mList.end(); iter++) { |
| | | // if ((*iter)->GetModuleID() == 166) |
| | | // continue; |
| | | |
| | | if((*iter)->GetModuleType() <= 5) { |
| | | printf("%d ", (*iter)->GetModuleID()); |
| | | // if(((*iter)->GetModuleType() >= 9) && ((*iter)->GetModuleType() <= 9)) { |
| | | // printf("%d ", (*iter)->GetModuleID()); |
| | | (*iter)->Proc(); |
| | | } |
| | | // } |
| | | } |
| | | // printf("\n"); |
| | | } |
| | |
| | | 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; |
| | | } |
| | | |
| | | return n; |
| | | } |
| | | |