Browse Source

initial commit

master
Hannes 9 months ago
commit
df784d49bf

+ 40
- 0
.gitignore View File

@@ -0,0 +1,40 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# Folder
.settings/
Debug/
.xdchelp
.ccsproject
.cproject
.project

+ 100
- 0
dss/c674x_linker.cmd View File

@@ -0,0 +1,100 @@
/*
* Copyright (c) 2016, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#define L1P_CACHE_SIZE (4*1024)
#define L1D_CACHE_SIZE (16*1024)
#define MMWAVE_L3RAM_SIZE (MMWAVE_L3RAM_NUM_BANK*MMWAVE_SHMEM_BANK_SIZE - MMWAVE_MSSUSED_L3RAM_SIZE)

MEMORY
{
PAGE 0:

#if (L1P_CACHE_SIZE < 0x8000)
L1PSRAM: o = 0x00E00000, l = (0x00008000 - L1P_CACHE_SIZE)
#endif
#if (L1D_CACHE_SIZE < 0x8000)
L1DSRAM: o = 0x00F00000, l = (0x00008000 - L1D_CACHE_SIZE)
#endif
L2SRAM_UMAP1: o = 0x007E0000, l = 0x00020000
L2SRAM_UMAP0: o = 0x00800000, l = 0x00020000
L3SRAM: o = (0x20000000+MMWAVE_MSSUSED_L3RAM_SIZE), l = MMWAVE_L3RAM_SIZE
L3SRAMOVLY: o = 0x20000000, l = MMWAVE_MSSUSED_L3RAM_SIZE
HWA_RAM : o = 0x21030000, l = 0x00010000
HSRAM: o = 0x21080000, l = 0x8000

/* PAGEs 1 and onwards are for overlay purposes for memory optimization.
Some examples:
1. Overlay one-time only text with uninitialized data.
2. Overlay L1PSRAM data path processing fast code and use copy tables
to page in (before entering data path) and out of L1PSRAM (when entering
sleep/low power).
*/
PAGE 1:
L3SRAM: o = (0x20000000+MMWAVE_MSSUSED_L3RAM_SIZE), l = MMWAVE_L3RAM_SIZE
}

/* Set L1D, L1P and L2 Cache Sizes */
ti_sysbios_family_c64p_Cache_l1dSize = L1D_CACHE_SIZE;
ti_sysbios_family_c64p_Cache_l1pSize = L1P_CACHE_SIZE;
ti_sysbios_family_c64p_Cache_l2Size = 0;

SECTIONS
{
/* hard addresses forces vecs to be allocated there */
.vecs: {. = align(32); } > 0x007E0000

/* Allocate data preferentially in one UMAP and code (.text) in another,
this can improve performance due to simultaneous misses from L1P
and L1D caches to L2 SRAM, for more information see C674 Megamodule
User Guide section "Level 2 Memory Architecture".
The linker notation "X >> Y | Z" indicates section X is first allocated in Y
and allowed to overflow into Z and can be split from Y to Z.
The linker notation "X > Y | Z" indicates section X is first allocated in Y
and allowed to overflow into Z and cannot be split from Y to Z. Some sections
like bss are not allowed to be split so > notation is used for them */

.fardata: {} >> L2SRAM_UMAP0 | L2SRAM_UMAP1
.const: {} >> L2SRAM_UMAP0 | L2SRAM_UMAP1
.switch: {} >> L2SRAM_UMAP0 | L2SRAM_UMAP1
.cio: {} >> L2SRAM_UMAP0 | L2SRAM_UMAP1
.data: {} >> L2SRAM_UMAP0 | L2SRAM_UMAP1

.rodata: {} > L2SRAM_UMAP0 | L2SRAM_UMAP1
.bss: {} > L2SRAM_UMAP0 | L2SRAM_UMAP1
.neardata: {} > L2SRAM_UMAP0 | L2SRAM_UMAP1
.stack: {} > L2SRAM_UMAP0 | L2SRAM_UMAP1
.cinit: {} > L2SRAM_UMAP0 | L2SRAM_UMAP1
.far: {} > L2SRAM_UMAP0 | L2SRAM_UMAP1

.text: {} >> L2SRAM_UMAP1 | L2SRAM_UMAP0
}


+ 97
- 0
dss/copyTranspose.c View File

@@ -0,0 +1,97 @@
/*!
* \file copyTranspose.c
*
* \brief Copy with transpose function.
*
* Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/

#include <common/src/dpu/capon3d/include/copyTranspose.h>

#if 0
uint32_t copyTranspose(uint32_t * src, uint32_t * dest, uint32_t size, int32_t offset, uint32_t stride, uint32_t pairs)
{
int32_t i, j, k;
j = 0;
for(i = 0; i < (int32_t)size; i++)
{
for (k = 0; k < (int32_t)pairs; k++)
{
dest[j+k+i*offset] = src[pairs * i + k];
}
j += (int32_t)stride;
}
return(1);
}
#else

// for optimization purposes specific for 3D capon people counting, will ignore offset and pair parameter.
uint32_t copyTranspose(uint32_t * RESTRICT src, uint32_t * RESTRICT dest, uint32_t size, int32_t offset, uint32_t stride, uint32_t pairs)
{
int32_t i;
int32_t sizeOver4;
uint64_t * RESTRICT input, lltemp1;
uint32_t * RESTRICT output;
uint32_t * RESTRICT input1;

sizeOver4 = (int32_t) (size >> 2);
input = (uint64_t *) src;
output = dest;

for(i = 0; i < sizeOver4; i++)
{
lltemp1 = _amem8(input++);
* output = _loll(lltemp1);
output += stride;
* output = _hill(lltemp1);
output += stride;
lltemp1 = _amem8(input++);
* output = _loll(lltemp1);
output += stride;
* output = _hill(lltemp1);
output += stride;
}

input1 = (uint32_t *) src;
i = i * 4;
for(; i < (int32_t)size; i++)
{
* output = input1[i];
output += stride;
}

return(1);
}

#endif


+ 832
- 0
dss/dss_main.c View File

@@ -0,0 +1,832 @@
/**
* @file dss_main.c
*
* @brief
* This is the main file which implements the 3D people counting Demo on DSS.
*
* \par
* NOTE:
* (C) Copyright 2019 Texas Instruments, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/**************************************************************************
*************************** Include Files ********************************
**************************************************************************/

/* Standard Include Files. */
#include <stdint.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <math.h>

/* BIOS/XDC Include Files. */
#include <xdc/std.h>
#include <xdc/cfg/global.h>
#include <xdc/runtime/IHeap.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/Memory.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Event.h>
#include <ti/sysbios/knl/Semaphore.h>
#include <ti/sysbios/knl/Clock.h>
#include <ti/sysbios/heaps/HeapBuf.h>
#include <ti/sysbios/heaps/HeapMem.h>
#include <ti/sysbios/knl/Event.h>
#include <ti/sysbios/utils/Load.h>
#include <ti/sysbios/family/c64p/Hwi.h>

/* mmWave SDK Include Files: */
#include <ti/common/sys_common.h>
#include <ti/control/dpm/dpm.h>
#include <ti/drivers/soc/soc.h>
#include <ti/drivers/esm/esm.h>
#include <ti/drivers/crc/crc.h>
#include <ti/drivers/osal/DebugP.h>

/* Data path Include Files */
#include <common/src/dpc/capon3d/objectdetection.h>

/* Demo Include Files */
#include <people_counting/68xx_3D_people_counting/src/common/pcount3D_output.h>
#include "pcount3D_dss.h"
#include <people_counting/68xx_3D_people_counting/src/common/pcount3D_hwres.h>

/* Demo Profiling Include Files */
#include <ti/utils/cycleprofiler/cycle_profiler.h>

/**
* @brief Task Priority settings:
*/
#define MMWDEMO_DPC_OBJDET_DPM_TASK_PRIORITY 5

#define DEBUG(_x) //_x
//#define BUILDFORMETHOD2


#ifdef BUILDFORMETHOD2
#define L2HEAPSIZE (0x1B000) // for method 2 and full FoV support of ODS
#define L3HEAPSIZE (0x2D000) // for method 2 and full FoV support of ODS
#else
#define L2HEAPSIZE (0x19600) // for method 1 ISK and +/- 20 degree elev FOV of ODS
#define L3HEAPSIZE (0x21000) // for method 1 ISK and +/- 20 degree elev FOV of ODS
#endif

#define L2SCRATCHSIZE (0x900)
#define L1SCRATCHSIZE (0x1200)
#define L1HEAPSIZE (0x2E00)
#pragma DATA_SECTION(memHeapL2, ".dpc_l2Heap")
uint8_t memHeapL2[L2HEAPSIZE];
#pragma DATA_SECTION(memHeapL3, ".l3data")
uint8_t memHeapL3[L3HEAPSIZE];
#pragma DATA_SECTION(l2ScratchMem, ".dpc_l2Heap")
uint8_t l2ScratchMem[L2SCRATCHSIZE];
#pragma DATA_SECTION(l1ScratchMem, ".dpc_l1Heap")
uint8_t l1ScratchMem[L1SCRATCHSIZE];
#pragma DATA_SECTION(l1HeapMem, ".dpc_l1Heap")
uint8_t l1HeapMem[L1HEAPSIZE];

#define DPC_OBJDET_DSP_INSTANCEID (0xDEEDDEED)

/**************************************************************************
*************************** Global Definitions ***************************
**************************************************************************/

/**
* @brief
* Global Variable for tracking information required by the mmw Demo
*/
Pcount3DDemo_DSS_MCB gPcount3DDssMCB;

/**
* @brief
* Global Variable for DPM result buffer
*/
DPM_Buffer resultBuffer;


/**************************************************************************
******************* Millimeter Wave Demo Functions Prototype *******************
**************************************************************************/
static void Pcount3DDemo_dssInitTask(UArg arg0, UArg arg1);
static void Pcount3DDemo_DPC_RadarProc_reportFxn
(
DPM_Report reportType,
uint32_t instanceId,
int32_t errCode,
uint32_t arg0,
uint32_t arg1
);
static void Pcount3DDemo_DPC_processFrameBeginCallBackFxn(uint8_t subFrameIndx);
static void Pcount3DDemo_DPC_processInterFrameBeginCallBackFxn(uint8_t subFrameIndx);
static void Pcount3DDemo_DPC_RadarProc_dpmTask(UArg arg0, UArg arg1);
static void Pcount3DDemo_sensorStopEpilog(void);


/* copy table related */
extern far COPY_TABLE _pcount3DDemo_fastCode_L1PSRAM_copy_table;
extern far COPY_TABLE _pcount3DDemo_configCode_HSRAM_copy_table;

static void MmwDemo_copyTable(EDMA_Handle handle, COPY_TABLE *tp);
static void MmwDemo_edmaBlockCopy(EDMA_Handle handle, uint32_t loadAddr, uint32_t runAddr, uint16_t size);


/**
* @b Description
* @n
* Performs linker generated copy table copy using EDMA. Currently this is
* used to page in fast code from L3 to L1PSRAM.
* @param[in] handle EDMA handle
* @param[in] tp Pointer to copy table
*
* @retval
* Not Applicable.
*/
static void MmwDemo_copyTable(EDMA_Handle handle, COPY_TABLE *tp)
{
uint16_t i;
COPY_RECORD crp;
uint32_t loadAddr;
uint32_t runAddr;

for (i = 0; i < tp->num_recs; i++)
{
crp = tp->recs[i];
loadAddr = (uint32_t)crp.load_addr;
runAddr = (uint32_t)crp.run_addr;

/* currently we use only one count of EDMA which is 16-bit so we cannot
handle tables bigger than 64 KB */
DebugP_assert(crp.size <= 65536U);

if (crp.size)
{
MmwDemo_edmaBlockCopy(handle, loadAddr, runAddr, crp.size);
}
}
}

/**
* @b Description
* @n
* Performs simple block copy using EDMA. Used for the purpose of copying
* linker table for L3 to L1PSRAM copy. memcpy cannot be used because there is
* no data bus access to L1PSRAM.
*
* @param[in] handle EDMA handle
* @param[in] loadAddr load address
* @param[in] runAddr run address
* @param[in] size size in bytes
*
* @retval
* Not Applicable.
*/
static void MmwDemo_edmaBlockCopy(EDMA_Handle handle, uint32_t loadAddr, uint32_t runAddr, uint16_t size)
{
EDMA_channelConfig_t config;
volatile bool isTransferDone;

config.channelId = EDMA_TPCC0_REQ_FREE_0;
config.channelType = (uint8_t)EDMA3_CHANNEL_TYPE_DMA;
config.paramId = (uint16_t)EDMA_TPCC0_REQ_FREE_0;
config.eventQueueId = 0;

config.paramSetConfig.sourceAddress = (uint32_t) SOC_translateAddress((uint32_t)loadAddr,
SOC_TranslateAddr_Dir_TO_EDMA, NULL);
config.paramSetConfig.destinationAddress = (uint32_t) SOC_translateAddress((uint32_t)runAddr,
SOC_TranslateAddr_Dir_TO_EDMA, NULL);

config.paramSetConfig.aCount = size;
config.paramSetConfig.bCount = 1U;
config.paramSetConfig.cCount = 1U;
config.paramSetConfig.bCountReload = 0U;

config.paramSetConfig.sourceBindex = 0U;
config.paramSetConfig.destinationBindex = 0U;

config.paramSetConfig.sourceCindex = 0U;
config.paramSetConfig.destinationCindex = 0U;

config.paramSetConfig.linkAddress = EDMA_NULL_LINK_ADDRESS;
config.paramSetConfig.transferType = (uint8_t)EDMA3_SYNC_A;
config.paramSetConfig.transferCompletionCode = (uint8_t) EDMA_TPCC0_REQ_FREE_0;
config.paramSetConfig.sourceAddressingMode = (uint8_t) EDMA3_ADDRESSING_MODE_LINEAR;
config.paramSetConfig.destinationAddressingMode = (uint8_t) EDMA3_ADDRESSING_MODE_LINEAR;

/* don't care because of linear addressing modes above */
config.paramSetConfig.fifoWidth = (uint8_t) EDMA3_FIFO_WIDTH_8BIT;

config.paramSetConfig.isStaticSet = false;
config.paramSetConfig.isEarlyCompletion = false;
config.paramSetConfig.isFinalTransferInterruptEnabled = true;
config.paramSetConfig.isIntermediateTransferInterruptEnabled = false;
config.paramSetConfig.isFinalChainingEnabled = false;
config.paramSetConfig.isIntermediateChainingEnabled = false;
config.transferCompletionCallbackFxn = NULL;
config.transferCompletionCallbackFxnArg = NULL;

if (EDMA_configChannel(handle, &config, false) != EDMA_NO_ERROR)
{
DebugP_assert(0);
}

if (EDMA_startDmaTransfer(handle, config.channelId) != EDMA_NO_ERROR)
{
DebugP_assert(0);
}

/* wait until transfer done */
do {
if (EDMA_isTransferComplete(handle,
config.paramSetConfig.transferCompletionCode,
(bool *)&isTransferDone) != EDMA_NO_ERROR)
{
DebugP_assert(0);
}
} while (isTransferDone == false);

/* make sure to disable channel so it is usable later */
EDMA_disableChannel(handle, config.channelId, config.channelType);
}


/**
* @b Description
* @n
* EDMA driver init
*
* @param[in] obj Pointer to data path object
*
* @retval
* Not Applicable.
*/
void MmwDemo_edmaInit(Pcount3DDemo_DataPathObj *obj, uint8_t instance)
{
int32_t errorCode;

errorCode = EDMA_init(instance);
if (errorCode != EDMA_NO_ERROR)
{
//System_printf ("Debug: EDMA instance %d initialization returned error %d\n", errorCode);
Pcount3DDemo_debugAssert (0);
return;
}

memset(&obj->EDMA_errorInfo, 0, sizeof(obj->EDMA_errorInfo));
memset(&obj->EDMA_transferControllerErrorInfo, 0, sizeof(obj->EDMA_transferControllerErrorInfo));
}

/**
* @b Description
* @n
* Call back function for EDMA CC (Channel controller) error as per EDMA API.
* Declare fatal error if happens, the output errorInfo can be examined if code
* gets trapped here.
*/
void MmwDemo_EDMA_errorCallbackFxn(EDMA_Handle handle, EDMA_errorInfo_t *errorInfo)
{
gPcount3DDssMCB.dataPathObj.EDMA_errorInfo = *errorInfo;
Pcount3DDemo_debugAssert(0);
}

/**
* @b Description
* @n
* Call back function for EDMA transfer controller error as per EDMA API.
* Declare fatal error if happens, the output errorInfo can be examined if code
* gets trapped here.
*/
void MmwDemo_EDMA_transferControllerErrorCallbackFxn(EDMA_Handle handle,
EDMA_transferControllerErrorInfo_t *errorInfo)
{
gPcount3DDssMCB.dataPathObj.EDMA_transferControllerErrorInfo = *errorInfo;
Pcount3DDemo_debugAssert(0);
}

/**
* @b Description
* @n
* Open EDMA driver instance
*
* @param[in] obj Pointer to data path object
* @param[in] instance EDMA instance
*
* @retval
* Not Applicable.
*/
static void MmwDemo_edmaOpen(Pcount3DDemo_DataPathObj *obj, uint8_t instance)
{
int32_t errCode;
EDMA_instanceInfo_t edmaInstanceInfo;
EDMA_errorConfig_t errorConfig;

obj->edmaHandle = EDMA_open(
instance,
&errCode,
&edmaInstanceInfo);
if (obj->edmaHandle == NULL)
{
Pcount3DDemo_debugAssert (0);
return;
}

errorConfig.isConfigAllEventQueues = true;
errorConfig.isConfigAllTransferControllers = true;
errorConfig.isEventQueueThresholdingEnabled = true;
errorConfig.eventQueueThreshold = EDMA_EVENT_QUEUE_THRESHOLD_MAX;
errorConfig.isEnableAllTransferControllerErrors = true;
errorConfig.callbackFxn = MmwDemo_EDMA_errorCallbackFxn;
errorConfig.transferControllerCallbackFxn = MmwDemo_EDMA_transferControllerErrorCallbackFxn;
if ((errCode = EDMA_configErrorMonitoring(obj->edmaHandle, &errorConfig)) != EDMA_NO_ERROR)
{
//System_printf("Error: EDMA_configErrorMonitoring() failed with errorCode = %d\n", errCode);
Pcount3DDemo_debugAssert (0);
return;
}
}

/**
* @b Description
* @n
* Close EDMA driver instance
*
* @param[in] obj Pointer to data path object
*
* @retval
* Not Applicable.
*/
void MmwDemo_edmaClose(Pcount3DDemo_DataPathObj *obj)
{
EDMA_close(obj->edmaHandle);
}


/**
* @b Description
* @n
* Epilog processing after sensor has stopped
*
* @retval None
*/
static void Pcount3DDemo_sensorStopEpilog(void)
{
Hwi_StackInfo stackInfo;
Task_Stat stat;
bool hwiStackOverflow;

DEBUG(System_printf("Data Path Stopped (last frame processing done)\n");)

/* Print DSS task statistics */
DEBUG(System_printf("DSS Task Stack Usage (Note: Task Stack Usage) ==========\n");)

Task_stat(gPcount3DDssMCB.initTaskHandle, &stat);
DEBUG(System_printf("%20s %12d %12d %12d\n", "initTask",
stat.stackSize,
stat.used,
stat.stackSize - stat.used);)

Task_stat(gPcount3DDssMCB.radarProcDpmTaskHandle, &stat);
DEBUG(System_printf("%20s %12s %12s %12s\n", "Task Name", "Size", "Used", "Free");)
DEBUG(System_printf("%20s %12d %12d %12d\n", "ObjDet DPM",
stat.stackSize,
stat.used,
stat.stackSize - stat.used);)

DEBUG(System_printf("HWI Stack (same as System Stack) Usage ============\n");)
hwiStackOverflow = Hwi_getStackInfo(&stackInfo, TRUE);
if (hwiStackOverflow == TRUE)
{
DEBUG(System_printf("DSS HWI Stack overflowed\n");)
Pcount3DDemo_debugAssert(0);
}
else
{
DEBUG(System_printf("%20s %12s %12s %12s\n", " ", "Size", "Used", "Free");)
DEBUG(System_printf("%20s %12d %12d %12d\n", " ",
stackInfo.hwiStackSize,
stackInfo.hwiStackPeak,
stackInfo.hwiStackSize - stackInfo.hwiStackPeak);)
}
}

/**
* @b Description
* @n
* DPM Registered Report Handler. The DPM Module uses this registered function to notify
* the application about DPM reports.
*
* @param[in] reportType
* Report Type
* @param[in] instanceId
* Instance Identifier which generated the report
* @param[in] errCode
* Error code if any.
* @param[in] arg0
* Argument 0 interpreted with the report type
* @param[in] arg1
* Argument 1 interpreted with the report type
*
* @retval
* Not Applicable.
*/
static void Pcount3DDemo_DPC_RadarProc_reportFxn
(
DPM_Report reportType,
uint32_t instanceId,
int32_t errCode,
uint32_t arg0,
uint32_t arg1
)
{

/* Only errors are logged on the console: */
if (errCode != 0)
{
/* Error: Detected log on the console and die all errors are FATAL currently. */
DEBUG(System_printf ("Error: DPM Report %d received with error:%d arg0:0x%x arg1:0x%x\n",
reportType, errCode, arg0, arg1);)
DebugP_assert (0);
}

/* Processing further is based on the reports received: This is the control of the profile
* state machine: */
switch (reportType)
{
case DPM_Report_IOCTL:
{
/*****************************************************************
* DPC has been configured without an error:
* - This is an indication that the profile configuration commands
* went through without any issues.
*****************************************************************/
DebugP_log1("DSSApp: DPM Report IOCTL, command = %d\n", arg0);
break;
}
case DPM_Report_DPC_STARTED:
{
/*****************************************************************
* DPC has been started without an error:
* - notify sensor management task that DPC is started.
*****************************************************************/
DebugP_log0("DSSApp: DPM Report start\n");
gPcount3DDssMCB.dpmStartEvents++;
break;
}
case DPM_Report_NOTIFY_DPC_RESULT:
{
/*****************************************************************
* DPC Results have been passed:
* - This implies that we have valid profile results which have
* been received from the profile.
*****************************************************************/

break;
}
case DPM_Report_NOTIFY_DPC_RESULT_ACKED:
{
/*****************************************************************
* DPC Results have been acked:
* - This implies that MSS received the results.
*****************************************************************/

break;
}
case DPM_Report_DPC_ASSERT:
{
DPM_DPCAssert* ptrAssert;

/*****************************************************************
* DPC Fault has been detected:
* - This implies that the DPC has crashed.
* - The argument0 points to the DPC assertion information
*****************************************************************/
ptrAssert = (DPM_DPCAssert*)arg0;
System_printf ("DSS Exception: %s, line %d.\n", ptrAssert->fileName,
ptrAssert->lineNum);
break;
}
case DPM_Report_DPC_STOPPED:
{
/*****************************************************************
* DPC has been stopped without an error:
* - This implies that the DPC can either be reconfigured or
* restarted.
*****************************************************************/
DebugP_log0("DSSApp: DPM Report stop\n");
gPcount3DDssMCB.dpmStopEvents++;
if (gPcount3DDssMCB.dpmStopEvents % 2 == 1) {
Pcount3DDemo_sensorStopEpilog();
}
break;
}
case DPM_Report_DPC_INFO:
{
/* Currently chain does not use this feature. */
break;
}
default:
{
DebugP_assert (0);
break;
}
}
return;
}

/**
* @b Description
* @n
* Call back function that was registered during config time and is going
* to be called in DPC processing at the beginning of frame/sub-frame processing.
* Note: In this demo objdetdsp DPC only have inter-frame processing, hence this
* callback function won't be called.
*
* @param[in] subFrameIndx Sub-frame index of the sub-frame during which processing
* this function was called.
*
* @retval None
*/
static void Pcount3DDemo_DPC_processFrameBeginCallBackFxn(uint8_t subFrameIndx)
{
/* Empty function */
}

/**
* @b Description
* @n
* Call back function that was registered during config time and is going
* to be called in DPC processing at the beginning of inter-frame/inter-sub-frame processing,
* we use this to issue BIOS calls for computing CPU load during active frame (chirping)
*
* @param[in] subFrameIndx Sub-frame index of the sub-frame during which processing
* this function was called.
*
* @retval None
*/
static void Pcount3DDemo_DPC_processInterFrameBeginCallBackFxn(uint8_t subFrameIndx)
{
Load_update();
gPcount3DDssMCB.dataPathObj.subFrameStats[subFrameIndx].interFrameCPULoad = Load_getCPULoad();
}


/**
* @b Description
* @n
* DPM Execution Task. DPM execute results are processed here:
* a) Update states based on timestamp from DPC.
* b) Copy results to shared memory to be shared with MSS.
* c) Send Results to MSS by calling DPM_sendResult()
*
* @retval
* Not Applicable.
*/
static void Pcount3DDemo_DPC_RadarProc_dpmTask(UArg arg0, UArg arg1)
{
int32_t retVal;
//DPC_ObjectDetection_ExecuteResult *result;
volatile uint32_t startTime;

while (1)
{
/* Execute the DPM module: */
//DebugP_log0("DSS main: Pcount3DDemo_DPC_RadarProc_dpmTask\n");
retVal = DPM_execute (gPcount3DDssMCB.dataPathObj.radarProcDpmHandle, &resultBuffer);
if (retVal < 0) {
DEBUG(System_printf ("Error: DPM execution failed [Error code %d]\n", retVal);)
Pcount3DDemo_debugAssert (0);
}
else
{
if ((resultBuffer.size[0] == sizeof(DPC_ObjectDetection_ExecuteResult)))
{

retVal = DPM_sendResult (gPcount3DDssMCB.dataPathObj.radarProcDpmHandle, true, &resultBuffer);
if (retVal < 0)
{
DEBUG(System_printf ("Error: Failed to send results [Error: %d] to remote\n", retVal);)
}

}
}
//writeback all the data shared with R4 in L3, and prepare cache for next frames radar cube from R4.
cache_wbInvAllL2Wait();
}
}

/**
* @b Description
* @n
* System Initialization Task which initializes the various
* components in the system.
*
* @retval
* Not Applicable.
*/
static void Pcount3DDemo_dssInitTask(UArg arg0, UArg arg1)
{
int32_t errCode;
Task_Params taskParams;
DPM_InitCfg dpmInitCfg;
DPC_ObjectDetection_InitParams objDetInitParams;

/*****************************************************************************
* Driver Init:
*****************************************************************************/

/*****************************************************************************
* Driver Open/Configuraiton:
*****************************************************************************/
/* Initialize EDMA */
MmwDemo_edmaInit(&gPcount3DDssMCB.dataPathObj, DPC_OBJDET_DSP_EDMA_INSTANCE);

/* Use instance 1 on DSS */
MmwDemo_edmaOpen(&gPcount3DDssMCB.dataPathObj, DPC_OBJDET_DSP_EDMA_INSTANCE);

/* Copy code from L3 to L1PSRAM, this code related to data path processing */
MmwDemo_copyTable(gPcount3DDssMCB.dataPathObj.edmaHandle, &_pcount3DDemo_fastCode_L1PSRAM_copy_table);
MmwDemo_copyTable(gPcount3DDssMCB.dataPathObj.edmaHandle, &_pcount3DDemo_configCode_HSRAM_copy_table);

/* Initialize the Mailbox */
Mailbox_init(MAILBOX_TYPE_DSS);


/*****************************************************************************
* Initialization of the DPM Module:
*****************************************************************************/
DebugP_log0("DSS main: Pcount3DDemo_dssInitTask\n");

memset ((void *)&objDetInitParams, 0, sizeof(DPC_ObjectDetection_InitParams));
/*Set up init params for memory osal*/
objDetInitParams.L3HeapCfg.addr = (void *) &memHeapL3[0];
objDetInitParams.L3HeapCfg.size = L3HEAPSIZE;
objDetInitParams.L3ScratchCfg.addr = (void *) NULL;
objDetInitParams.L3ScratchCfg.size = 0;
objDetInitParams.CoreL2HeapCfg.addr = (void *) &memHeapL2[0];
objDetInitParams.CoreL2HeapCfg.size = L2HEAPSIZE;
objDetInitParams.CoreL2ScratchCfg.addr = (void *) &l2ScratchMem[0];
objDetInitParams.CoreL2ScratchCfg.size = L2SCRATCHSIZE;
objDetInitParams.CoreL1HeapCfg.addr = (void *) &l1HeapMem[0];
objDetInitParams.CoreL1HeapCfg.size = L1HEAPSIZE;
objDetInitParams.CoreL1ScratchCfg.addr = (void *) &l1ScratchMem[0];
objDetInitParams.CoreL1ScratchCfg.size = L1SCRATCHSIZE;

/* DPC Call-back config */
objDetInitParams.processCallBackCfg.processFrameBeginCallBackFxn =
Pcount3DDemo_DPC_processFrameBeginCallBackFxn;
objDetInitParams.processCallBackCfg.processInterFrameBeginCallBackFxn =
Pcount3DDemo_DPC_processInterFrameBeginCallBackFxn;

memset ((void *)&dpmInitCfg, 0, sizeof(DPM_InitCfg));

/* Setup the configuration: */
dpmInitCfg.socHandle = gPcount3DDssMCB.socHandle;
dpmInitCfg.ptrProcChainCfg = &gDPC_ObjectDetectionCfg;
dpmInitCfg.instanceId = DPC_OBJDET_DSP_INSTANCEID;
dpmInitCfg.domain = DPM_Domain_DISTRIBUTED;
dpmInitCfg.reportFxn = Pcount3DDemo_DPC_RadarProc_reportFxn;
dpmInitCfg.arg = &objDetInitParams;
dpmInitCfg.argSize = sizeof(DPC_ObjectDetection_InitParams);

/* Initialize the DPM Module: */
gPcount3DDssMCB.dataPathObj.radarProcDpmHandle = DPM_init (&dpmInitCfg, &errCode);
if (gPcount3DDssMCB.dataPathObj.radarProcDpmHandle == NULL)
{
DEBUG(System_printf ("Error: Unable to initialize the DPM Module [Error: %d]\n", errCode);)
Pcount3DDemo_debugAssert (0);
return;
}

/* Synchronization: This will synchronize the execution of the control module
* between the domains. This is a prerequiste and always needs to be invoked. */
while (1)
{
int32_t syncStatus;

/* Get the synchronization status: */
syncStatus = DPM_synch (gPcount3DDssMCB.dataPathObj.radarProcDpmHandle, &errCode);
if (syncStatus < 0)
{
/* Error: Unable to synchronize the framework */
DEBUG(System_printf ("Error: DPM Synchronization failed [Error code %d]\n", errCode);)
Pcount3DDemo_debugAssert (0);
return;
}
if (syncStatus == 1)
{
/* Synchronization acheived: */
break;
}
/* Sleep and poll again: */
Task_sleep(1);
}
System_printf ("Debug: DPM Module Sync is done\n");

/* Launch the DPM Task */
Task_Params_init(&taskParams);
taskParams.priority = MMWDEMO_DPC_OBJDET_DPM_TASK_PRIORITY;
taskParams.stackSize = 3*1024;
gPcount3DDssMCB.radarProcDpmTaskHandle = Task_create(Pcount3DDemo_DPC_RadarProc_dpmTask, &taskParams, NULL);

return;
}

/**
* @b Description
* @n
* Function to sleep the DSP using IDLE instruction.
* When DSP has no work left to do,
* the BIOS will be in Idle thread and will call this function.
*
* @retval
* Not Applicable.
*/
void Pcount3DDemo_sleep(void)
{
/* issue WFI (Wait For Interrupt) instruction */
asm(" IDLE ");
}

/**
* @b Description
* @n
* Entry point into the Millimeter Wave Demo
*
* @retval
* Not Applicable.
*/
int main (void)
{
Task_Params taskParams;
int32_t errCode;
SOC_Handle socHandle;
SOC_Cfg socCfg;

// set cache state for l3 and hsram
cache_setMar((unsigned int *)0x20000000, 0xC0000, Cache_PC | Cache_PFX);
//cache_setMar((unsigned int *)0x21080000, 0x8000, Cache_PC | Cache_PFX);


/* Initialize and populate the demo MCB */
memset ((void*)&gPcount3DDssMCB, 0, sizeof(Pcount3DDemo_DSS_MCB));

/* Initialize the SOC confiugration: */
memset ((void *)&socCfg, 0, sizeof(SOC_Cfg));

/* Populate the SOC configuration: */
socCfg.clockCfg = SOC_SysClock_BYPASS_INIT;

/* Initialize the SOC Module: This is done as soon as the application is started
* to ensure that the MPU is correctly configured. */
socHandle = SOC_init (&socCfg, &errCode);
if (socHandle == NULL)
{
DEBUG(System_printf ("Error: SOC Module Initialization failed [Error code %d]\n", errCode);)
Pcount3DDemo_debugAssert (0);
return -1;
}

gPcount3DDssMCB.socHandle = socHandle;

/* Initialize the Task Parameters. */
Task_Params_init(&taskParams);
taskParams.stackSize = 1536;
gPcount3DDssMCB.initTaskHandle = Task_create(Pcount3DDemo_dssInitTask, &taskParams, NULL);

/* Start BIOS */
BIOS_start();
return 0;
}

+ 910
- 0
dss/objectdetection.c View File

@@ -0,0 +1,910 @@
/*
* @file objectdetection.c
*
* @brief
* Object Detection DPC implementation using DSP.
*
* \par
* NOTE:
* (C) Copyright 2019 Texas Instruments, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/**************************************************************************
*************************** Include Files ********************************
**************************************************************************/
#include <stdint.h>
#include <string.h>
#include <stdio.h>

/* mmWave SDK Include Files: */
#include <ti/drivers/soc/soc.h>
#include <ti/common/sys_common.h>
#include <ti/drivers/osal/DebugP.h>
#include <ti/drivers/osal/MemoryP.h>
#include <ti/utils/mathutils/mathutils.h>
#include <ti/utils/cycleprofiler/cycle_profiler.h>
#include <ti/control/dpm/dpm.h>
#include <xdc/runtime/System.h>

/* C674x mathlib */
/* Suppress the mathlib.h warnings
* #48-D: incompatible redefinition of macro "TRUE"
* #48-D: incompatible redefinition of macro "FALSE"
*/
//#pragma diag_push
//#pragma diag_suppress 48
//#include <ti/mathlib/mathlib.h>
//#pragma diag_pop

/*! This is supplied at command line when application builds this file. This file
* is owned by the application and contains all resource partitioning, an
* application may include more than one DPC and also use resources outside of DPCs.
* The resource definitions used by this object detection DPC are prefixed by DPC_OBJDET_ */
#include APP_RESOURCE_FILE

#include <ti/control/mmwavelink/mmwavelink.h>

/* Obj Det instance etc */
#include <common/src/dpc/capon3d/include/objectdetectioninternal.h>
#include <common/src/dpc/capon3d/objectdetection.h>


//#define DBG_DPC_OBJDET

#ifdef DBG_DPC_OBJDET
ObjDetObj *gObjDetObj;
#endif

/**************************************************************************
************************** Local Definitions **********************************
**************************************************************************/

/**
@}
*/
/*! Maximum Number of objects that can be detected in a frame */
#define DPC_OBJDET_MAX_NUM_OBJECTS DOA_OUTPUT_MAXPOINTS

/**************************************************************************
************************** Local Functions Prototype **************************
**************************************************************************/

static DPM_DPCHandle DPC_ObjectDetection_init
(
DPM_Handle dpmHandle,
DPM_InitCfg* ptrInitCfg,
int32_t* errCode
);

static int32_t DPC_ObjectDetection_execute
(
DPM_DPCHandle handle,
DPM_Buffer* ptrResult
);

static int32_t DPC_ObjectDetection_ioctl
(
DPM_DPCHandle handle,
uint32_t cmd,
void* arg,
uint32_t argLen
);

static int32_t DPC_ObjectDetection_start (DPM_DPCHandle handle);
static int32_t DPC_ObjectDetection_stop (DPM_DPCHandle handle);
static int32_t DPC_ObjectDetection_deinit (DPM_DPCHandle handle);
static void DPC_ObjectDetection_frameStart (DPM_DPCHandle handle);
int32_t DPC_ObjectDetection_dataInjection(DPM_DPCHandle handle, DPM_Buffer* ptrBuffer);

/**************************************************************************
************************** Local Functions *******************************
**************************************************************************/

/**
* @b Description
* @n
* Sends Assert
*
* @retval
* Not Applicable.
*/
void _DPC_Objdet_Assert(DPM_Handle handle, int32_t expression,
const char *file, int32_t line)
{
DPM_DPCAssert fault;

if (!expression)
{
fault.lineNum = (uint32_t)line;
fault.arg0 = 0U;
fault.arg1 = 0U;
strncpy (fault.fileName, file, (DPM_MAX_FILE_NAME_LEN-1));

/* Report the fault to the DPM entities */
DPM_ioctl (handle,
DPM_CMD_DPC_ASSERT,
(void*)&fault,
sizeof(DPM_DPCAssert));
}
}


/**
* @b Description
* @n
* DPC data injection function registered with DPM. This is invoked on reception
* of the data injection from DPM.
*
* @param[in] handle DPM's DPC handle
* @param[in] ptrBuffer Buffer for data injected
*
* \ingroup DPC_OBJDET__INTERNAL_FUNCTION
*
* @retval
* Not applicable
*/
int32_t DPC_ObjectDetection_dataInjection(DPM_DPCHandle handle, DPM_Buffer* ptrBuffer)
{
ObjDetObj *objDetObj = (ObjDetObj *) handle;

/* Notify the DPM Module that the DPC is ready for execution */

//DebugP_log1("ObjDet DPC: DPC_ObjectDetection_dataInjection, handle = 0x%x\n", (uint32_t)handle);
DebugP_assert (DPM_notifyExecute (objDetObj->dpmHandle, handle, true) == 0);

return 0;
}

/**
* @b Description
* @n
* Sub-frame reconfiguration, used when switching sub-frames. Invokes the
* DPU configuration using the configuration that was stored during the
* pre-start configuration so reconstruction time is saved because this will
* happen in real-time.
* @param[in] objDetObj Pointer to DPC object
* @param[in] subFrameIndx Sub-frame index.
*
* @retval
* Success - 0
* @retval
* Error - <0
*
* \ingroup DPC_OBJDET__INTERNAL_FUNCTION
*/
static int32_t DPC_ObjDetDSP_reconfigSubFrame(ObjDetObj *objDetObj, uint8_t subFrameIndx)
{
int32_t retVal = 0;
//SubFrameObj *subFrmObj;

//subFrmObj = &objDetObj->subFrameObj[subFrameIndx];

//retVal = DPU_CFARCAProcDSP_config(subFrmObj->dpuCFARCAObj, &subFrmObj->dpuCfg.cfarCfg);
if (retVal != 0)
{
goto exit;
}

exit:
return(retVal);
}

/**
* @b Description
* @n
* Function to initialize all DPUs used in the DPC chain
*
* @param[in] objDetObj Pointer to sub-frame object
* @param[in] numSubFrames Number of sub-frames
*
* \ingroup DPC_OBJDET__INTERNAL_FUNCTION
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static inline int32_t DPC_ObjDetDSP_initDPU
(
ObjDetObj *objDetObj,
uint8_t numSubFrames
)
{
int32_t retVal = 0;

return(retVal);
}

/**
* @b Description
* @n
* Function to de-initialize all DPUs used in the DPC chain
*
* @param[in] objDetObj Pointer to sub-frame object
* @param[in] numSubFrames Number of sub-frames
*
* \ingroup DPC_OBJDET__INTERNAL_FUNCTION
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static inline int32_t DPC_ObjDetDSP_deinitDPU
(
ObjDetObj *objDetObj,
uint8_t numSubFrames
)
{
int32_t retVal = 0;

radarOsal_memDeInit();

return(retVal);
}

/**
* @b Description
* @n
* Performs processing related to pre-start configuration, which is per sub-frame,
* by configuring each of the DPUs involved in the processing chain.
* Memory management notes:
* 1. Core Local Memory that needs to be preserved across sub-frames (such as range DPU's calib DC buffer)
* will be allocated using MemoryP_alloc.
* 2. Core Local Memory that needs to be preserved within a sub-frame across DPU calls
* (the DPIF * type memory) or for intermediate private scratch memory for
* DPU (i.e no preservation is required from process call to process call of the DPUs
* within the sub-frame) will be allocated from the Core Local RAM configuration supplied in
* @ref DPC_ObjectDetection_InitParams given to @ref DPC_ObjectDetection_init API
* 3. L3 memory will only be allocated from the L3 RAM configuration supplied in
* @ref DPC_ObjectDetection_InitParams given to @ref DPC_ObjectDetection_init API
* No L3 buffers are presently required that need to be preserved across sub-frames
* (type described in #1 above), neither are L3 scratch buffers required for
* intermediate processing within DPU process call.
*
* @param[in] subFrameObj Pointer to sub-frame object
* @param[in] commonCfg Pointer to pre-start common configuration
* @param[in] preStartCfg Pointer to pre-start configuration of the sub-frame
* @param[in] edmaHandle Pointer to array of EDMA handles for the device, this
* can be distributed among the DPUs, the actual EDMA handle used
* in DPC is determined by definition in application resource file
* @param[in] L3ramObj Pointer to L3 RAM memory pool object
* @param[in] CoreL2RamObj Pointer to Core Local L2 memory pool object
* @param[in] CoreL1RamObj Pointer to Core Local L1 memory pool object
* @param[out] L3RamUsage Net L3 RAM memory usage in bytes as a result of allocation
* by the DPUs.
* @param[out] CoreL2RamUsage Net Local L2 RAM memory usage in bytes
* @param[out] CoreL1RamUsage Net Core L1 RAM memory usage in bytes
*
* @retval
* Success - 0
* @retval
* Error - <0
*
* \ingroup DPC_OBJDET__INTERNAL_FUNCTION
*/
static int32_t DPC_ObjDetDSP_preStartConfig
(
SubFrameObj *subFrameObj,
DPC_ObjectDetection_PreStartCfg *preStartCfg
)
{
int32_t retVal = 0;
DPC_ObjectDetection_DynCfg *dynCfg;
DPIF_RadarCube radarCube;
DPU_ProcessErrorCodes procErrorCode;

dynCfg = &preStartCfg->dynCfg;

/* Save configs to object. We need to pass this stored config (instead of
the input arguments to this function which will be in stack) to
the DPU config functions inside of this function because the DPUs
have pointers to dynamic configurations which are later going to be
reused during re-configuration (intra sub-frame or inter sub-frame)
*/
subFrameObj->dynCfg = * dynCfg;

/* L3 allocations */
/* L3 - radar cube */
radarCube.dataSize = dynCfg->caponChainCfg.numRangeBins * dynCfg->caponChainCfg.numChirpPerFrame *
dynCfg->caponChainCfg.numAntenna * sizeof(cplx16_t);
DebugP_log1("ObjDet DPC: DPC_ObjDetDSP_preStartConfig, radarCubeFormat = %d\n", dynCfg->radarCubeFormat);
if(preStartCfg->shareMemCfg.shareMemEnable == true)
{
if((preStartCfg->shareMemCfg.radarCubeMem.addr != NULL) &&
(preStartCfg->shareMemCfg.radarCubeMem.size == radarCube.dataSize))
{
/* Use assigned radar cube address */
radarCube.data = preStartCfg->shareMemCfg.radarCubeMem.addr;
}
else
{
retVal = DPC_OBJECTDETECTION_EINVAL__COMMAND;
goto exit;
}
#ifdef RADARDEMO_AOARADARCUDE_RNGCHIRPANT
if (subFrameObj->dynCfg.radarCubeFormat != DPIF_RADARCUBE_FORMAT_2)
{
retVal = DPC_OBJECTDETECTION_EINVAL_CUBE;
goto exit;
}
#endif
}
else
{
retVal = DPC_OBJECTDETECTION_EINVAL_CUBE;
goto exit;
}

/* Only supported radar Cube format in this DPC */
radarCube.datafmt = DPIF_RADARCUBE_FORMAT_3;
subFrameObj->dataIn = radarCube.data;
subFrameObj->dpuCaponObj = DPU_radarProcess_init(&subFrameObj->dynCfg.caponChainCfg, &procErrorCode);
if (procErrorCode > PROCESS_OK)
{
retVal = DPC_OBJECTDETECTION_EINTERNAL;
DebugP_log1("DPC config error %d\n", procErrorCode);
goto exit;
}

//printf("DPC configuration done!\n");
DebugP_log0("DPC config done\n");
/* Report RAM usage */
radarOsal_printHeapStats();

exit:
return retVal;
}

/**
* @b Description
* @n
* DPC frame start function registered with DPM. This is invoked on reception
* of the frame start ISR from the RF front-end. This API is also invoked
* when application issues @ref DPC_OBJDET_IOCTL__TRIGGER_FRAME to simulate
* a frame trigger (e.g for unit testing purpose).
*
* @param[in] handle DPM's DPC handle
*
* \ingroup DPC_OBJDET__INTERNAL_FUNCTION
*
* @retval
* Not applicable
*/
static void DPC_ObjectDetection_frameStart (DPM_DPCHandle handle)
{
ObjDetObj *objDetObj = (ObjDetObj *) handle;

objDetObj->stats->frameStartTimeStamp = Cycleprofiler_getTimeStamp();

//DebugP_log2("ObjDet DPC: Frame Start, frameIndx = %d, subFrameIndx = %d\n",
// objDetObj->stats.frameStartIntCounter, objDetObj->subFrameIndx);

/* Check if previous frame (sub-frame) processing has completed */
DPC_Objdet_Assert(objDetObj->dpmHandle, (objDetObj->interSubFrameProcToken == 0));
objDetObj->interSubFrameProcToken++;

/* Increment interrupt counter for debugging purpose */
if (objDetObj->subFrameIndx == 0)
{
objDetObj->stats->frameStartIntCounter++;
}

return;
}

/**
* @b Description
* @n
* DPC's (DPM registered) start function which is invoked by the
* application using DPM_start API.
*
* @param[in] handle DPM's DPC handle
*
* \ingroup DPC_OBJDET__INTERNAL_FUNCTION
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t DPC_ObjectDetection_start (DPM_DPCHandle handle)
{
ObjDetObj *objDetObj;
int32_t retVal = 0;

objDetObj = (ObjDetObj *) handle;
DebugP_assert (objDetObj != NULL);

objDetObj->stats->frameStartIntCounter = 0;

/* Start marks consumption of all pre-start configs, reset the flag to check
* if pre-starts were issued only after common config was issued for the next
* time full configuration happens between stop and start */
objDetObj->isCommonCfgReceived = false;

/* App must issue export of last frame after stop which will switch to sub-frame 0,
* so start should always see sub-frame indx of 0, check */
DebugP_assert(objDetObj->subFrameIndx == 0);

if(objDetObj->numSubframes > 1U)
{
/* Pre-start cfgs for sub-frames may have come in any order, so need
* to ensure we reconfig for the current (0) sub-frame before starting */
DPC_ObjDetDSP_reconfigSubFrame(objDetObj, objDetObj->subFrameIndx);
}
DebugP_log0("ObjDet DPC: Start done\n");
return(retVal);
}

/**
* @b Description
* @n
* DPC's (DPM registered) stop function which is invoked by the
* application using DPM_stop API.
*
* @param[in] handle DPM's DPC handle
*
* \ingroup DPC_OBJDET__INTERNAL_FUNCTION
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t DPC_ObjectDetection_stop (DPM_DPCHandle handle)
{
ObjDetObj *objDetObj;

objDetObj = (ObjDetObj *) handle;
DebugP_assert (objDetObj != NULL);

/* We can be here only after complete frame processing is done, which means
* processing token must be 0 and subFrameIndx also 0 */
DebugP_assert((objDetObj->interSubFrameProcToken == 0) && (objDetObj->subFrameIndx == 0));

DebugP_log0("ObjDet DPC: Stop done\n");
return(0);
}

/**
* @b Description
* @n
* DPC's (DPM registered) execute function which is invoked by the application
* in the DPM's execute context when the DPC issues DPM_notifyExecute API from
* its registered @ref DPC_ObjectDetection_frameStart API that is invoked every
* frame interrupt.
*
* @param[in] handle DPM's DPC handle
* @param[out] ptrResult Pointer to the result
*
* \ingroup DPC_OBJDET__INTERNAL_FUNCTION
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
int32_t DPC_ObjectDetection_execute
(
DPM_DPCHandle handle,
DPM_Buffer* ptrResult
)
{
ObjDetObj *objDetObj;
SubFrameObj *subFrmObj;
DPC_ObjectDetection_ProcessCallBackCfg *processCallBack;
int32_t procErrorCode;

radarProcessOutput *result;
int32_t retVal = 0;
volatile uint32_t startTime;
int32_t i;

objDetObj = (ObjDetObj *) handle;
DebugP_assert (objDetObj != NULL);
DebugP_assert (ptrResult != NULL);

DebugP_log1("ObjDet DPC: Processing sub-frame %d\n", objDetObj->subFrameIndx);

processCallBack = &objDetObj->processCallBackCfg;

objDetObj->executeResult->subFrameIdx = objDetObj->subFrameIndx;
result = &objDetObj->executeResult->objOut;

subFrmObj = &objDetObj->subFrameObj[objDetObj->subFrameIndx];

if (processCallBack->processInterFrameBeginCallBackFxn != NULL)
{
(*processCallBack->processInterFrameBeginCallBackFxn)(objDetObj->subFrameIndx);
}

//DebugP_log0("ObjDet DPC: Range Proc Output Ready\n");

startTime = Cycleprofiler_getTimeStamp();
DPU_radarProcess_process(subFrmObj->dpuCaponObj, subFrmObj->dataIn, result, &procErrorCode);
if (procErrorCode > PROCESS_OK)
{
retVal = -1;
goto exit;
}

DebugP_log0("ObjDet DPC: Frame Proc Done\n");

objDetObj->stats->interFrameEndTimeStamp = Cycleprofiler_getTimeStamp();
memcpy(&(objDetObj->stats->subFrbenchmarkDetails), result->benchmarkOut, sizeof(radarProcessBenchmarkElem));
objDetObj->stats->interFrameExecTimeInUsec = (uint32_t)((float)(objDetObj->stats->interFrameEndTimeStamp - objDetObj->stats->frameStartTimeStamp) * _rcpsp((float)DSP_CLOCK_MHZ));
objDetObj->stats->activeFrameProcTimeInUsec = (uint32_t)((float)(objDetObj->stats->interFrameEndTimeStamp - startTime) * _rcpsp((float)DSP_CLOCK_MHZ));


/* populate DPM_resultBuf - first pointer and size are for results of the processing */
ptrResult->ptrBuffer[0] = (uint8_t *)objDetObj->executeResult;
ptrResult->size[0] = sizeof(DPC_ObjectDetection_ExecuteResult);

ptrResult->ptrBuffer[1] = (uint8_t *)objDetObj->stats;
ptrResult->size[1] = sizeof(DPC_ObjectDetection_Stats);



/* clear rest of the result */
for (i = 2; i < DPM_MAX_BUFFER; i++)
{
ptrResult->ptrBuffer[i] = NULL;
ptrResult->size[i] = 0;
}

exit:

return retVal;
}


/**
* @b Description
* @n
* DPC IOCTL commands configuration API which will be invoked by the
* application using DPM_ioctl API
*
* @param[in] handle DPM's DPC handle
* @param[in] cmd Capture DPC specific commands
* @param[in] arg Command specific arguments
* @param[in] argLen Length of the arguments which is also command specific
*
* \ingroup DPC_OBJDET__INTERNAL_FUNCTION
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t DPC_ObjectDetection_ioctl
(
DPM_DPCHandle handle,
uint32_t cmd,
void* arg,
uint32_t argLen
)
{
ObjDetObj *objDetObj;
SubFrameObj *subFrmObj;
int32_t retVal = 0;

/* Get the DSS MCB: */
objDetObj = (ObjDetObj *) handle;
DebugP_assert(objDetObj != NULL);


/* Process the commands. Process non sub-frame specific ones first
* so the sub-frame specific ones can share some code. */
if((cmd < DPC_OBJDET_IOCTL__STATIC_PRE_START_CFG) || (cmd > DPC_OBJDET_IOCTL__MAX))
{
retVal = DPM_EINVCMD;
}
else if (cmd == DPC_OBJDET_IOCTL__TRIGGER_FRAME)
{
DPC_ObjectDetection_frameStart(handle);
}
else if (cmd == DPC_OBJDET_IOCTL__STATIC_PRE_START_COMMON_CFG)
{
objDetObj->numSubframes = *(uint8_t *)arg;
objDetObj->isCommonCfgReceived = true;
//DebugP_log1("ObjDet DPC: Pre-start Config IOCTL processed common config (numSubframes = %d)\n", objDetObj->numSubframes);
}
else if (cmd == DPC_OBJDET_IOCTL__DYNAMIC_EXECUTE_RESULT_EXPORTED)
{
DPC_ObjectDetection_ExecuteResultExportedInfo *inp;

DebugP_assert(argLen == sizeof(DPC_ObjectDetection_ExecuteResultExportedInfo));

inp = (DPC_ObjectDetection_ExecuteResultExportedInfo *)arg;

/* input sub-frame index must match current sub-frame index */
DebugP_assert(inp->subFrameIdx == objDetObj->subFrameIndx);

/* Reconfigure all DPUs resources for next sub-frame as EDMA and scrach buffer
* resources overlap across sub-frames */
if (objDetObj->numSubframes > 1)
{
/* Next sub-frame */
objDetObj->subFrameIndx++;
if (objDetObj->subFrameIndx == objDetObj->numSubframes)
{
objDetObj->subFrameIndx = 0;
}

DPC_ObjDetDSP_reconfigSubFrame(objDetObj, objDetObj->subFrameIndx);
}
DebugP_log0("ObjDet DPC: received ack from MSS for output data\n");

/* mark end of processing of the frame/sub-frame by the DPC and the app */
objDetObj->interSubFrameProcToken--;
}
else
{
uint8_t subFrameNum;

/* First argument is sub-frame number */
DebugP_assert(arg != NULL);
subFrameNum = *(uint8_t *)arg;
subFrmObj = &objDetObj->subFrameObj[subFrameNum];

switch (cmd)
{
/* Related to pre-start configuration */
case DPC_OBJDET_IOCTL__STATIC_PRE_START_CFG:
{
DPC_ObjectDetection_PreStartCfg *cfg;

/* Pre-start common config must be received before pre-start configs
* are received. */
if (objDetObj->isCommonCfgReceived == false)
{
//DebugP_log0("ObjDet DPC IOCTL: false isCommonCfgReceived\n");
retVal = DPC_OBJECTDETECTION_PRE_START_CONFIG_BEFORE_PRE_START_COMMON_CONFIG;
goto exit;
}

DebugP_assert(argLen == sizeof(DPC_ObjectDetection_PreStartCfg));

cfg = (DPC_ObjectDetection_PreStartCfg*)arg;


//DebugP_log4("ObjDet DPC IOCTL: function called with cfg = 0x%x, subFrmObj = 0x%x, cmd = %d, subFrameNum = %d\n", (uint32_t )arg, (uint32_t )subFrmObj, cmd, *(uint8_t *)arg);
retVal = DPC_ObjDetDSP_preStartConfig(subFrmObj,
cfg);
if (retVal != 0)
{
goto exit;
}


DebugP_log1("ObjDet DPC: Pre-start Config IOCTL processed (subFrameIndx = %d)\n", subFrameNum);
break;
}

default:
{
/* Error: This is an unsupported command */
retVal = DPM_EINVCMD;
break;
}
}
}

exit:
return retVal;
}

/**
* @b Description
* @n
* DPC's (DPM registered) initialization function which is invoked by the
* application using DPM_init API. Among other things, this API allocates DPC instance
* and DPU instances (by calling DPU's init APIs) from the MemoryP osal
* heap. If this API returns an error of any type, the heap is not guaranteed
* to be in the same state as before calling the API (i.e any allocations
* from the heap while executing the API are not guaranteed to be deallocated
* in case of error), so any error from this API should be considered fatal and
* if the error is of _ENOMEM type, the application will
* have to be built again with a bigger heap size to address the problem.
*
* @param[in] dpmHandle DPM's DPC handle
* @param[in] ptrInitCfg Handle to the framework semaphore
* @param[out] errCode Error code populated on error
*
* \ingroup DPC_OBJDET__INTERNAL_FUNCTION
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static DPM_DPCHandle DPC_ObjectDetection_init
(
DPM_Handle dpmHandle,
DPM_InitCfg* ptrInitCfg,
int32_t* errCode
)
{
ObjDetObj *objDetObj = NULL;
DPC_ObjectDetection_InitParams *dpcInitParams;
radarOsal_heapConfig heapconfig[3];

*errCode = 0;

//DebugP_log0("DPC: DPC_ObjectDetection_init\n");
if ((ptrInitCfg == NULL) || (ptrInitCfg->arg == NULL))
{
*errCode = DPC_OBJECTDETECTION_EINVAL;
goto exit;
}

if (ptrInitCfg->argSize != sizeof(DPC_ObjectDetection_InitParams))
{
*errCode = DPC_OBJECTDETECTION_EINVAL__INIT_CFG_ARGSIZE;
goto exit;
}

dpcInitParams = (DPC_ObjectDetection_InitParams *) ptrInitCfg->arg;
/*Set up heap and mem osal*/
{
memset(heapconfig, 0, sizeof(heapconfig));
heapconfig[RADARMEMOSAL_HEAPTYPE_DDR_CACHED].heapType = RADARMEMOSAL_HEAPTYPE_DDR_CACHED;
heapconfig[RADARMEMOSAL_HEAPTYPE_DDR_CACHED].heapAddr = (int8_t *) dpcInitParams->L3HeapCfg.addr;
heapconfig[RADARMEMOSAL_HEAPTYPE_DDR_CACHED].heapSize = dpcInitParams->L3HeapCfg.size;
heapconfig[RADARMEMOSAL_HEAPTYPE_DDR_CACHED].scratchAddr= (int8_t *) dpcInitParams->L3ScratchCfg.addr;
heapconfig[RADARMEMOSAL_HEAPTYPE_DDR_CACHED].scratchSize= dpcInitParams->L3ScratchCfg.size;

heapconfig[RADARMEMOSAL_HEAPTYPE_LL2].heapType = RADARMEMOSAL_HEAPTYPE_LL2;
heapconfig[RADARMEMOSAL_HEAPTYPE_LL2].heapAddr = (int8_t *) dpcInitParams->CoreL2HeapCfg.addr;
heapconfig[RADARMEMOSAL_HEAPTYPE_LL2].heapSize = dpcInitParams->CoreL2HeapCfg.size;
heapconfig[RADARMEMOSAL_HEAPTYPE_LL2].scratchAddr = (int8_t *) dpcInitParams->CoreL2ScratchCfg.addr;
heapconfig[RADARMEMOSAL_HEAPTYPE_LL2].scratchSize = dpcInitParams->CoreL2ScratchCfg.size;

heapconfig[RADARMEMOSAL_HEAPTYPE_LL1].heapType = RADARMEMOSAL_HEAPTYPE_LL1;
heapconfig[RADARMEMOSAL_HEAPTYPE_LL1].heapAddr = (int8_t *) dpcInitParams->CoreL1HeapCfg.addr;
heapconfig[RADARMEMOSAL_HEAPTYPE_LL1].heapSize = dpcInitParams->CoreL1HeapCfg.size;
heapconfig[RADARMEMOSAL_HEAPTYPE_LL1].scratchAddr = (int8_t *) dpcInitParams->CoreL1ScratchCfg.addr;
heapconfig[RADARMEMOSAL_HEAPTYPE_LL1].scratchSize = dpcInitParams->CoreL1ScratchCfg.size;
if(radarOsal_memInit(&heapconfig[0], 3) == RADARMEMOSAL_FAIL)
{
*errCode = DPC_OBJECTDETECTION_MEMINITERR;
goto exit;
}
}
objDetObj = MemoryP_ctrlAlloc(sizeof(ObjDetObj), 0);

#ifdef DBG_DPC_OBJDET
gObjDetObj = objDetObj;
#endif

System_printf("ObjDet DPC: objDetObj address = (ObjDetObj *) 0x%x\n", (uint32_t) objDetObj);

if(objDetObj == NULL)
{
*errCode = DPC_OBJECTDETECTION_ENOMEM;
goto exit;
}

/* Initialize memory */
memset((void *)objDetObj, 0, sizeof(ObjDetObj));

/* Copy over the DPM configuration: */
memcpy ((void*)&objDetObj->dpmInitCfg, (void*)ptrInitCfg, sizeof(DPM_InitCfg));

objDetObj->dpmHandle = dpmHandle;
objDetObj->socHandle = ptrInitCfg->socHandle;

objDetObj->processCallBackCfg = dpcInitParams->processCallBackCfg;

objDetObj->executeResult = (DPC_ObjectDetection_ExecuteResult *)radarOsal_memAlloc(RADARMEMOSAL_HEAPTYPE_DDR_CACHED, 0, sizeof(DPC_ObjectDetection_ExecuteResult), 1);
objDetObj->stats = (DPC_ObjectDetection_Stats *)radarOsal_memAlloc(RADARMEMOSAL_HEAPTYPE_DDR_CACHED, 0, sizeof(DPC_ObjectDetection_Stats), 1);

*errCode = DPC_ObjDetDSP_initDPU(objDetObj, RL_MAX_SUBFRAMES);
//printf ("DPC init done!\n");

exit:
if(*errCode != 0)
{
if(objDetObj != NULL)
{
MemoryP_ctrlFree(objDetObj, sizeof(ObjDetObj));
objDetObj = NULL;
}
}

return ((DPM_DPCHandle)objDetObj);
}

/**
* @b Description
* @n
* DPC's (DPM registered) de-initialization function which is invoked by the
* application using DPM_deinit API.
*
* @param[in] handle DPM's DPC handle
*
* \ingroup DPC_OBJDET__INTERNAL_FUNCTION
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t DPC_ObjectDetection_deinit (DPM_DPCHandle handle)
{
ObjDetObj *objDetObj = (ObjDetObj *) handle;
int32_t retVal = 0;

if (handle == NULL)
{
retVal = DPC_OBJECTDETECTION_EINVAL;
goto exit;
}

retVal = DPC_ObjDetDSP_deinitDPU(objDetObj, RL_MAX_SUBFRAMES);

MemoryP_ctrlFree(handle, sizeof(ObjDetObj));

exit:
return (retVal);
}

/**************************************************************************
************************* Global Declarations ****************************
**************************************************************************/

/** @addtogroup DPC_OBJDET__GLOBAL
@{ */

/**
* @brief Global used to register Object Detection DPC in DPM
*/
DPM_ProcChainCfg gDPC_ObjectDetectionCfg =
{
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: */
DPC_ObjectDetection_dataInjection, /* Inject Data Function: */
NULL, /* Chirp Available Function: */
DPC_ObjectDetection_frameStart /* Frame Start Function: */
};

/* @} */


+ 109
- 0
dss/pcount3D_dss.cfg View File

@@ -0,0 +1,109 @@
/*
* Copyright 2011 by Texas Instruments Incorporated.
*
* All rights reserved. Property of Texas Instruments Incorporated.
* Restricted rights to use, duplicate or disclose this code are
* granted through contract.
*
*/
environment['xdc.cfg.check.fatal'] = 'false';

/********************************************************************
************************** BIOS Modules ****************************
********************************************************************/
var Defaults = xdc.useModule('xdc.runtime.Defaults');
var Error = xdc.useModule('xdc.runtime.Error');
var System = xdc.useModule('xdc.runtime.System');
var Text = xdc.useModule('xdc.runtime.Text');
var Memory = xdc.useModule('xdc.runtime.Memory');
var SysStd = xdc.useModule('xdc.runtime.SysStd');

var BIOS = xdc.useModule('ti.sysbios.BIOS');
var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
var Task = xdc.useModule('ti.sysbios.knl.Task');
var Idle = xdc.useModule('ti.sysbios.knl.Idle');
var SEM = xdc.useModule('ti.sysbios.knl.Semaphore');
var Event = xdc.useModule('ti.sysbios.knl.Event');
var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
var EventCombiner = xdc.useModule('ti.sysbios.family.c64p.EventCombiner');
var Load = xdc.useModule('ti.sysbios.utils.Load');

System.SupportProxy = SysStd;

/* Default Heap Creation: Local L2 memory */
var heapMemParams = new HeapMem.Params();
heapMemParams.size = 11*1024;
heapMemParams.sectionName = "systemHeap";
Program.global.heap0 = HeapMem.create(heapMemParams);
Memory.defaultHeapInstance = Program.global.heap0;
/*
* Enable Event Groups here and registering of ISR for specific GEM INTC is done
* using EventCombiner_dispatchPlug() and Hwi_eventMap() APIs
*/
EventCombiner.eventGroupHwiNum[0] = 7;
EventCombiner.eventGroupHwiNum[1] = 8;
EventCombiner.eventGroupHwiNum[2] = 9;
EventCombiner.eventGroupHwiNum[3] = 10;

/* Enable BIOS Task Scheduler */
BIOS.taskEnabled = true;

/* System stack size (used by ISRs and Swis) */
Program.stack = 0x800;

Task.idleTaskStackSize = 800;

/* do not call update for load - Application will call it at inter-frame boundary */
Load.updateInIdle = false;

/* Install idle function to sleep. Note above
Load.updateInIdle is false which allows to sleep in idle.
Also, no other book-keeping etc functions should be installed in the idle thread */
Idle.addFunc('&Pcount3DDemo_sleep');

/*
* Build a custom BIOS library. The custom library will be smaller than the
* pre-built "instrumented" (default) and "non-instrumented" libraries.
*
* The BIOS.logsEnabled parameter specifies whether the Logging is enabled
* within BIOS for this custom build. These logs are used by the RTA and
* UIA analysis tools.
*
* The BIOS.assertsEnabled parameter specifies whether BIOS code will
* include Assert() checks. Setting this parameter to 'false' will generate
* smaller and faster code, but having asserts enabled is recommended for
* early development as the Assert() checks will catch lots of programming
* errors (invalid parameters, etc.)
*/
BIOS.libType = BIOS.LibType_Custom;
BIOS.logsEnabled = false;
BIOS.assertsEnabled = true;

/* Make sure libraries are built with 32-bit enum types to be compatible with DSP enum types*/
BIOS.includeXdcRuntime = true;
BIOS.customCCOpts += " --enum_type=int ";

/********************************************************************
* Enabling DebugP Log Support
********************************************************************/
var Log = xdc.useModule('xdc.runtime.Log');
var Main = xdc.useModule('xdc.runtime.Main');
var Diags = xdc.useModule('xdc.runtime.Diags');
var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');

/* Configure the Logger Buffer: */
var loggerBufParams = new LoggerBuf.Params();
loggerBufParams.bufType = LoggerBuf.BufType_CIRCULAR;
loggerBufParams.exitFlush = false;
loggerBufParams.instance.name = "_logInfo";
loggerBufParams.numEntries = 200;

/* Create the Logger and attach this to the application */
MyAppLogger = LoggerBuf.create(loggerBufParams);
Main.common$.logger = MyAppLogger;
Main.common$.diags_USER1 = Diags.RUNTIME_ON;
//Task.common$.diags_USER1 = Diags.RUNTIME_ON;
Task.common$.diags_USER1 = Diags.ALWAYS_ON;
Task.common$.diags_USER2 = Diags.ALWAYS_ON;


+ 134
- 0
dss/pcount3D_dss.h View File

@@ -0,0 +1,134 @@
/**
* @file pcount3D_dss.h
*
* @brief
* This is the main header file for the 3D people counting Demo on DSS.
*
* \par
* NOTE:
* (C) Copyright 2016 Texas Instruments, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef PCOUNT3D_DSS_H
#define PCOUNT3D_DSS_H

#include <ti/drivers/edma/edma.h>
#include <cpy_tbl.h>

#include <ti/sysbios/knl/Task.h>

#include <ti/common/mmwave_error.h>
#include <ti/drivers/soc/soc.h>
#include <ti/drivers/soc/soc.h>
#include <ti/drivers/mailbox/mailbox.h>
#include <ti/drivers/hwa/hwa.h>
#include <ti/drivers/osal/DebugP.h>

#include <people_counting/68xx_3D_people_counting/src/common/pcount3D_output.h>
#include <people_counting/68xx_3D_people_counting/src/common/pcount3D_config.h>
#include <common/src/dpu/capon3d/radarProcess.h>
#include <common/src/dpu/capon3d/modules/utilities/cycle_measure.h>

/* This is used to resolve RL_MAX_SUBFRAMES, TODO: wired */
#include <ti/control/mmwavelink/mmwavelink.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct Pcount3DDemo_DataPathObj_t
{
/*! @brief dpm Handle */
DPM_Handle radarProcDpmHandle;

/*! @brief Handle of the EDMA driver. */
EDMA_Handle edmaHandle;

/*! @brief EDMA error Information when there are errors like missing events */
EDMA_errorInfo_t EDMA_errorInfo;

/*! @brief EDMA transfer controller error information. */
EDMA_transferControllerErrorInfo_t EDMA_transferControllerErrorInfo;

/*! @brief Processing Stats */
Pcount3DDemo_output_message_stats subFrameStats[RL_MAX_SUBFRAMES];
} Pcount3DDemo_DataPathObj;

/**
* @brief
* Millimeter Wave Demo MCB
*
* @details
* The structure is used to hold all the relevant information for the
* Millimeter Wave demo
*/
typedef struct Pcount3DDemo_DSS_MCB_t
{
/*! * @brief Handle to the SOC Module */
SOC_Handle socHandle;