里如怎麼決定 algorithm, 哪裡會去執行 fft, aoa , cfar 的 code..
trace overhead_mount_occupy 這個 example 中,object detection hardware 的 code,找到 DPC_ObjectDetection_execute 這個 function。
就是做 處理的地方,然後它被放在DPM_ProcChainCfg 這個 structure 里。
從這個 structure 來找...應該是 interface 吧...
sdk/packages/ti/control/dpm/dpm.h
typedef struct DPM_ProcChainCfg_t
{
DPM_ProcChainInitFxn initFxn;
DPM_ProcChainStartFxn startFxn;
DPM_ProcChainExecuteFxn executeFxn;
DPM_ProcChainIoctlFxn ioctlFxn;
DPM_ProcChainStopFxn stopFxn;
DPM_ProcChainDeinitFxn deinitFxn;
DPM_ProcChainInjectDataFxn injectDataFxn;
DPM_ProcChainChirpAvailableCallbackFxn chirpAvailableFxn;
DPM_ProcChainFrameStartCallbackFxn frameStartFxn;
}DPM_ProcChainCfg;
這個 interface 是給誰用的?從 member executeFxn 來找找看,他是被 DPM_execute( ) 呼叫:
int32_t DPM_execute (DPM_Handle handle, DPM_Buffer* ptrResult)
...
ptrDPM = (DPM_MCB*)handle;
...
retVal = ptrDPM->procChainCfg.executeFxn (ptrDPM->dpcHandle, ptrResult);
所以呼叫 DPM_execute 時,準備好的參數: handle. 就包含了將要 run 的 function (algorithm)拿 overhead_mount_occupancy 的 mss 來看。這個 structure 在哪裡宣告。
在 project source 的 src/common/dpc/objdetrangehwa/src/objdetrangehwa.c 中,先把這個 functiontable(interface): gDPC_ObjDetRangeHWACfg 的內容 implement好,把表填好
DPM_ProcChainCfg gDPC_ObjDetRangeHWACfg =
{
DPC_ObjectDetection_init, /* Initialization Function: */
DPC_ObjectDetection_start, /* Start Function: */
DPC_ObjectDetection_execute, /* Execute Function: */
DPC_ObjectDetection_ioctl, /* Configuration Function: */
DPC_ObjectDetection_stop, /* Stop Function: */
DPC_ObjectDetection_deinit, /* Deinitialization Function: */
NULL, /* Inject Data Function: */
NULL, /* Chirp Available Function: */
DPC_ObjectDetection_frameStart /* Frame Start Function: */
};
在 mss_main.c 的 initTask( ) 時,放在要給 DPM 的 parameter, handle structure 中,然後呼叫 DPM_init( ) 初始化,並且把這個 structure 放到 objDetDpmHandle 中:
dpmInitCfg.ptrProcChainCfg = &gDPC_ObjDetRangeHWACfg;
...
gMmwMssMCB.objDetDpmHandle = DPM_init (&dpmInitCfg, &errCode);
然後在後來 create 的 Task : mssDPMTask( ) 中,呼叫 DPM_execute 時,傳入這個structure 做 parameter.
static void mmwDemo_mssDPMTask(UArg arg0, UArg arg1)
{
...
while (1)
{
...
errCode = DPM_execute (gMmwMssMCB.objDetDpmHandle, &result);
沒有留言:
張貼留言