From 7534dda3b69026df6dc40b3d907b825a0078617b Mon Sep 17 00:00:00 2001
From: chenlh <2008get@163.com>
Date: 星期四, 21 八月 2025 20:14:01 +0800
Subject: [PATCH] Signed-off-by: chenlh <2008get@163.com>

---
 src/main.cpp |   37 ++++++++++++++++++++++++++-----------
 1 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/src/main.cpp b/src/main.cpp
index 3a527de..f4a6f5c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -26,6 +26,9 @@
 #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
@@ -47,6 +50,7 @@
 	GPIO_SetOutPut(GPIOB, GPIO_Pin10, level);
 }
 
+
 /*
  * 128 路
 UpdateInput && UpdateOutput 7.37%
@@ -54,22 +58,27 @@
  * */
 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);
-		fir_acc_startup();
+//		ModulesAsynSetInterval(proc_secs);
+//		fir_acc_startup();
 		clock_stop = clock();
 		proc_secs = ((ufloat) (clock_stop - clock_start))/ CLOCKS_PER_SEC;
 	}
@@ -77,6 +86,7 @@
 		UpdateInput(iid, DMACount[iid]&0x1);
 		UpdateOutput(iid, DMACount[iid]&0x1);
 	}
+
 	DMACount[iid]++;
 }
 
@@ -119,9 +129,12 @@
 
 	//通知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.
+	//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);
+
+	u32 ddrspace = sram_free_space(SRAM_DDR, mem_any);
+	printf("ddrspace:%d\n", ddrspace);
 
 	while(1) {
 		asyn_proc_secs = ModulesAsynProcess();
@@ -134,11 +147,11 @@
 			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);
 		}
@@ -160,11 +173,12 @@
 		if(++loop_cnt > 100000000){
 			if(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_CLOCK_STATUS, &var.dsp_status ,1);
 				spiMsg->ReportDspStatus(&msg);
 			}
 			loop_cnt =0;
 			clock_check_count = DMACount[var.master_intr];
+			printf("clk1 ok\n");
 		}
 
 
@@ -173,6 +187,7 @@
 			spiMsg->DspStatusPush(DSP_CLOCK_STATUS, 0, 0);
 			request_topo_count = DMACount[var.master_intr] ;
 			var.clock_ok = utrue;
+			printf("clk2 ok\n");
 		}
 	}
 

--
Gitblit v1.9.3