Browse Source

initial commit

master
Hannes 3 years ago
commit
c986807e75

+ 40
- 0
.gitignore View File

# 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

+ 2587
- 0
mss/mss_main.c
File diff suppressed because it is too large
View File


+ 1195
- 0
mss/pcount3D_cli.c
File diff suppressed because it is too large
View File


+ 90
- 0
mss/pcount3D_mss.cfg View File

/*
* 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 Memory = xdc.useModule('xdc.runtime.Memory');
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.arm.v7r.vim.Hwi');
var System = xdc.useModule('xdc.runtime.System');
var SysStd = xdc.useModule('xdc.runtime.SysStd');
var clock = xdc.useModule('ti.sysbios.knl.Clock');
var Pmu = xdc.useModule('ti.sysbios.family.arm.v7a.Pmu');
var Load = xdc.useModule('ti.sysbios.utils.Load');

System.SupportProxy = SysStd;

/* FIQ Stack Usage: */
Hwi.fiqStackSize = 2048;
Hwi.fiqStackSection = ".myFiqStack"
Program.sectMap[".myFiqStack"] = "DATA_RAM";

/* Default Heap Creation: Local L2 memory */
var heapMemParams = new HeapMem.Params();
heapMemParams.size = 130*1024;
heapMemParams.sectionName = "systemHeap";
Program.global.heap0 = HeapMem.create(heapMemParams);
Memory.defaultHeapInstance = Program.global.heap0;
System.extendedFormats = '%$L%$S%$F%f';

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

/* Reduce the size of BIOS */
BIOS.swiEnabled = false; /* We don't use SWIs */
BIOS.libType = BIOS.LibType_Custom;
Program.stack = 2048; /* for isr context */
Task.idleTaskStackSize = 800;
var Text = xdc.useModule('xdc.runtime.Text');
Text.isLoaded = false;

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

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

Program.sectMap[".vecs"] = "VECTORS";

/* Make sure libraries are built with 32-bit enum types to be compatible with DSP enum types*/
BIOS.includeXdcRuntime = true;
BIOS.libType = BIOS.LibType_Custom;
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;


+ 394
- 0
mss/pcount3D_mss.h View File

/**
* @file pcount3D_mss.h
*
* @brief
* This is the main header file for the 3D people counting demo
*
* \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 MMW_MSS_H
#define MMW_MSS_H

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

#include <ti/common/mmwave_error.h>
#include <ti/drivers/osal/DebugP.h>
#include <ti/drivers/soc/soc.h>
#include <ti/drivers/uart/UART.h>
#include <ti/drivers/gpio/gpio.h>
#include <ti/drivers/mailbox/mailbox.h>

#include <people_counting/68xx_3D_people_counting/src/common/mmwdemo_adcconfig.h>
//#include <ti/demo/utils/mmwdemo_monitor.h>

#include <common/src/dpc/objdetrangehwa/objdetrangehwa.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>


#ifdef __cplusplus
extern "C" {
#endif

/*! @brief For advanced frame config, below define means the configuration given is
* global at frame level and therefore it is broadcast to all sub-frames.
*/
#define PCOUNT3DDEMO_SUBFRAME_NUM_FRAME_LEVEL_CONFIG (-1)

/**
* @defgroup configStoreOffsets Offsets for storing CLI configuration
* @brief Offsets of config fields within the parent structures, note these offsets will be
* unique and hence can be used to differentiate the commands for processing purposes.
* @{
*/
#define PCOUNT3DDEMO_ADCBUFCFG_OFFSET (offsetof(Pcount3DDemo_SubFrameCfg, adcBufCfg))

#define PCOUNT3DDEMO_SUBFRAME_DSPDYNCFG_OFFSET (offsetof(Pcount3DDemo_SubFrameCfg, objDetDynCfg) + \
offsetof(Pcount3DDemo_DPC_ObjDet_DynCfg, dspDynCfg))

#define PCOUNT3DDEMO_SUBFRAME_R4FDYNCFG_OFFSET (offsetof(Pcount3DDemo_SubFrameCfg, objDetDynCfg) + \
offsetof(Pcount3DDemo_DPC_ObjDet_DynCfg, r4fDynCfg))

#define PCOUNT3DDEMO_CALIBDCRANGESIG_OFFSET (PCOUNT3DDEMO_SUBFRAME_R4FDYNCFG_OFFSET + \
offsetof(DPC_ObjectDetectionRangeHWA_DynCfg, calibDcRangeSigCfg))

#define PCOUNT3DDEMO_CAPONCHAINCFG_OFFSET (PCOUNT3DDEMO_SUBFRAME_DSPDYNCFG_OFFSET + \
offsetof(DPC_ObjectDetection_DynCfg, caponChainCfg))

#define PCOUNT3DDEMO_DYNRACFARCFG_OFFSET (PCOUNT3DDEMO_CAPONCHAINCFG_OFFSET + \
offsetof(caponChainCfg, dynamicCfarConfig))

#define PCOUNT3DDEMO_STATICRACFARCFG_OFFSET (PCOUNT3DDEMO_CAPONCHAINCFG_OFFSET + \
offsetof(caponChainCfg, staticCfarConfig))

#define PCOUNT3DDEMO_DOACAPONCFG_OFFSET (PCOUNT3DDEMO_CAPONCHAINCFG_OFFSET + \
offsetof(caponChainCfg, doaConfig))

#define PCOUNT3DDEMO_DOACAPONRACFG_OFFSET (PCOUNT3DDEMO_DOACAPONCFG_OFFSET + \
offsetof(doaConfig, rangeAngleCfg))

#define PCOUNT3DDEMO_DOA2DESTCFG_OFFSET (PCOUNT3DDEMO_DOACAPONCFG_OFFSET + \
offsetof(doaConfig, angle2DEst))

#define PCOUNT3DDEMO_DOAFOVCFG_OFFSET (PCOUNT3DDEMO_DOACAPONCFG_OFFSET + \
offsetof(doaConfig, fovCfg))

#define PCOUNT3DDEMO_STATICANGESTCFG_OFFSET (PCOUNT3DDEMO_DOACAPONCFG_OFFSET + \
offsetof(doaConfig, staticEstCfg))

#define PCOUNT3DDEMO_DOPCFARCFG_OFFSET (PCOUNT3DDEMO_DOACAPONCFG_OFFSET + \
offsetof(doaConfig, dopCfarCfg))



/** @}*/ /* configStoreOffsets */

/**
* @brief
* 3D people counting Demo Sensor State
*
* @details
* The enumeration is used to define the sensor states used in 3D people counting Demo
*/
typedef enum Pcount3DDemo_SensorState_e
{
/*! @brief Inital state after sensor is initialized.
*/
Pcount3DDemo_SensorState_INIT = 0,

/*! @brief Indicates sensor is started */
Pcount3DDemo_SensorState_STARTED,

/*! @brief State after sensor has completely stopped */
Pcount3DDemo_SensorState_STOPPED
}Pcount3DDemo_SensorState;

/**
* @brief
* 3D people counting Demo statistics
*
* @details
* The structure is used to hold the statistics information for the
* 3D people counting Demo
*/
typedef struct Pcount3DDemo_MSS_Stats_t
{
/*! @brief Counter which tracks the number of frame trigger events from BSS */
uint64_t frameTriggerReady;
/*! @brief Counter which tracks the number of failed calibration reports
* The event is triggered by an asynchronous event from the BSS */
uint32_t failedTimingReports;

/*! @brief Counter which tracks the number of calibration reports received
* The event is triggered by an asynchronous event from the BSS */
uint32_t calibrationReports;

/*! @brief Counter which tracks the number of sensor stop events received
* The event is triggered by an asynchronous event from the BSS */
uint32_t sensorStopped;

/*! @brief Counter which tracks the number of dpm stop events received
* The event is triggered by DPM_Report_DPC_STOPPED from DPM */
uint32_t dpmStopEvents;

/*! @brief Counter which tracks the number of dpm start events received
* The event is triggered by DPM_Report_DPC_STARTED from DPM */
uint32_t dpmStartEvents;

}Pcount3DDemo_MSS_Stats;

/**
* @brief
* 3D people counting Demo Data Path Information.
*
* @details
* The structure is used to hold all the relevant information for
* the data path.
*/
typedef struct Pcount3DDemo_SubFrameCfg_t
{
/*! @brief ADC buffer configuration storage */
MmwDemo_ADCBufCfg adcBufCfg;

/*! @brief Flag indicating if @ref adcBufCfg is pending processing. */
uint8_t isAdcBufCfgPending : 1;

/*! @brief Dynamic configuration storage for object detection DPC */
Pcount3DDemo_DPC_ObjDet_DynCfg objDetDynCfg;

/*! @brief ADCBUF will generate chirp interrupt event every this many chirps - chirpthreshold */
uint8_t numChirpsPerChirpEvent;

/*! @brief Number of bytes per RX channel, it is aligned to 16 bytes as required by ADCBuf driver */
uint32_t adcBufChanDataSize;

/*! @brief Number of ADC samples */
uint16_t numAdcSamples;

/*! @brief Number of chirps per sub-frame */
uint16_t numChirpsPerSubFrame;
/*! @brief Number of virtual antennas */
uint8_t numVirtualAntennas;
} Pcount3DDemo_SubFrameCfg;

/*!
* @brief
* Structure holds message stats information from data path.
*
* @details
* The structure holds stats information. This is a payload of the TLV message item
* that holds stats information.
*/
typedef struct Pcount3DDemo_SubFrameStats_t
{
/*! @brief Frame processing stats */
Pcount3DDemo_output_message_stats outputStats;

/*! @brief Dynamic CLI configuration time in usec */
uint32_t pendingConfigProcTime;

/*! @brief SubFrame Preparation time on MSS in usec */
uint32_t subFramePreparationTime;
} Pcount3DDemo_SubFrameStats;

/**
* @brief Task handles storage structure
*/
typedef struct Pcount3DDemo_TaskHandles_t
{
/*! @brief MMWAVE Control Task Handle */
Task_Handle mmwaveCtrl;

/*! @brief ObjectDetection DPC related dpmTask */
Task_Handle objDetDpmTask;

/*! @brief Demo init task */
Task_Handle initTask;
} Pcount3DDemo_taskHandles;

typedef struct Pcount3DDemo_DataPathObj_t
{
/*! @brief Handle to hardware accelerator driver. */
HWA_Handle hwaHandle;

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

/*! @brief Radar cube memory information from range DPC */
DPC_ObjectDetectionRangeHWA_preStartCfg_radarCubeMem radarCubeMem;

/*! @brief Memory usage after the preStartCfg range DPC is applied */
DPC_ObjectDetectionRangeHWA_preStartCfg_memUsage memUsage;

/*! @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;

} Pcount3DDemo_DataPathObj;

/**
* @brief
* 3D people counting Demo MCB
*
* @details
* The structure is used to hold all the relevant information for the
* 3D people counting Demo
*/
typedef struct Pcount3DDemo_MSS_MCB_t
{
/*! @brief Configuration which is used to execute the demo */
Pcount3DDemo_Cfg cfg;

/*! * @brief Handle to the SOC Module */
SOC_Handle socHandle;

/*! @brief UART Logging Handle */
UART_Handle loggingUartHandle;

/*! @brief UART Command Rx/Tx Handle */
UART_Handle commandUartHandle;

/*! @brief This is the mmWave control handle which is used
* to configure the BSS. */
MMWave_Handle ctrlHandle;

/*! @brief ADCBuf driver handle */
ADCBuf_Handle adcBufHandle;

/*! @brief DSP chain DPM Handle */
DPM_Handle objDetDpmHandle;

/*! @brief Object Detection DPC common configuration */
Pcount3DDemo_DPC_ObjDet_CommonCfg objDetCommonCfg;

/*! @brief Data path object */
Pcount3DDemo_DataPathObj dataPathObj;

/*! @brief Tracker DPU Static Configuration */
DPC_ObjectDetection_TrackerConfig trackerCfg;

/*! @brief Object Detection DPC subFrame configuration */
Pcount3DDemo_SubFrameCfg subFrameCfg[RL_MAX_SUBFRAMES];

/*! @brief sub-frame stats */
Pcount3DDemo_SubFrameStats subFrameStats[RL_MAX_SUBFRAMES];

/*! @brief Demo Stats */
Pcount3DDemo_MSS_Stats stats;

Pcount3DDemo_output_message_UARTpointCloud pointCloudToUart;
DPIF_DetMatrix heatMapOutFromDSP;
DPIF_PointCloudSpherical *pointCloudFromDSP;
DPIF_PointCloudSideInfo *pointCloudSideInfoFromDSP;
DPC_ObjectDetection_Stats *frameStatsFromDSP;
uint32_t currSubFrameIdx;

trackerProc_TargetDescrHandle trackerOutput;
uint8_t numTargets;
uint16_t numIndices;
bool presenceDetEnabled;
uint32_t presenceInd;
uint16_t numDetectedPoints;
uint32_t trackerProcessingTimeInUsec;
uint32_t uartProcessingTimeInUsec;


/*! @brief Task handle storage */
Pcount3DDemo_taskHandles taskHandles;

/*! @brief RF frequency scale factor, = 2.7 for 60GHz device, = 3.6 for 76GHz device */
double rfFreqScaleFactor;

/*! @brief Semaphore handle to signal DPM started from DPM report function */
Semaphore_Handle DPMstartSemHandle;

/*! @brief Semaphore handle to signal DPM stopped from DPM report function. */
Semaphore_Handle DPMstopSemHandle;

/*! @brief Semaphore handle to signal DPM ioctl from DPM report function. */
Semaphore_Handle DPMioctlSemHandle;

/*! @brief Semaphore handle to run UART DMA task. */
Semaphore_Handle uartTxSemHandle;

/*! @brief Semaphore handle to trigger tracker DPU. */
Semaphore_Handle trackerDPUSemHandle;

/*! @brief Sensor state */
Pcount3DDemo_SensorState sensorState;

/*! @brief Tracks the number of sensor start */
uint32_t sensorStartCount;

/*! @brief Tracks the number of sensor sop */
uint32_t sensorStopCount;

} Pcount3DDemo_MSS_MCB;

/**************************************************************************
*************************** Extern Definitions ***************************
**************************************************************************/

/* Functions to handle the actions need to move the sensor state */
extern int32_t Pcount3DDemo_openSensor(bool isFirstTimeOpen);
extern int32_t Pcount3DDemo_configSensor(void);
extern int32_t Pcount3DDemo_startSensor(void);
extern void Pcount3DDemo_stopSensor(void);

/* functions to manage the dynamic configuration */
extern uint8_t Pcount3DDemo_isAllCfgInPendingState(void);
extern uint8_t Pcount3DDemo_isAllCfgInNonPendingState(void);
extern void Pcount3DDemo_resetStaticCfgPendingState(void);
extern void Pcount3DDemo_CfgUpdate(void *srcPtr, uint32_t offset, uint32_t size, int8_t subFrameNum);

extern void Pcount3DDemo_CLIInit (uint8_t taskPriority);

/* Debug Functions */
extern void _Pcount3DDemo_debugAssert(int32_t expression, const char *file, int32_t line);
#define Pcount3DDemo_debugAssert(expression) { \
_Pcount3DDemo_debugAssert(expression, \
__FILE__, __LINE__); \
DebugP_assert(expression); \
}

#ifdef __cplusplus
}
#endif

#endif /* MMW_MSS_H */


+ 16
- 0
mss/pcount3D_mss_linker.cmd View File

/*----------------------------------------------------------------------------*/
/* Linker Settings */
--retain="*(.intvecs)"

/*----------------------------------------------------------------------------*/
/* Section Configuration */
SECTIONS
{
systemHeap : {} > DATA_RAM
.hwaBufs: load = HWA_RAM, type = NOINIT
.dpcLocalRam: {} > DATA_RAM
.l3ram: {} >> L3_RAM
.demoSharedMem: { } >> HS_RAM
}
/*----------------------------------------------------------------------------*/


+ 43
- 0
mss/r4f_linker.cmd View File

/*----------------------------------------------------------------------------*/
/* r4f_linker.cmd */
/* */
/* (c) Texas Instruments 2016, All rights reserved. */
/* */

/* USER CODE BEGIN (0) */
/* USER CODE END */


/*----------------------------------------------------------------------------*/
/* Linker Settings */
--retain="*(.intvecs)"

/*----------------------------------------------------------------------------*/
/* Memory Map */
#define MMWAVE_L3RAM_SIZE (MMWAVE_L3RAM_NUM_BANK*MMWAVE_SHMEM_BANK_SIZE - MMWAVE_MSSUSED_L3RAM_SIZE)
MEMORY{
PAGE 0:
VECTORS (X) : origin=0x00000000 length=0x00000100
PROG_RAM (RX) : origin=0x00000100 length=0x0007FF00+(MMWAVE_SHMEM_TCMA_NUM_BANK*MMWAVE_SHMEM_BANK_SIZE)
DATA_RAM (RW) : origin=0x08000000 length=0x00030000+(MMWAVE_SHMEM_TCMB_NUM_BANK*MMWAVE_SHMEM_BANK_SIZE)
L3_RAM (RW) : origin=0x51000000 length=0x00000000+(MMWAVE_MSSUSED_L3RAM_SIZE)
HWA_RAM (RW) : origin=0x52030000 length=0x00010000
HS_RAM (RW) : origin=0x52080000 length=0x8000
PAGE 1:
L3_RAM (RW) : origin=0x51000000 length=0x00000000+(MMWAVE_MSSUSED_L3RAM_SIZE)
}

/*----------------------------------------------------------------------------*/
/* Section Configuration */
SECTIONS{
.intvecs : {} > VECTORS
.text : {} > PROG_RAM
.const : {} > PROG_RAM
.cinit : {} > PROG_RAM
.pinit : {} > PROG_RAM
.bss : {} > DATA_RAM
.data : {} > DATA_RAM
.stack : {} > DATA_RAM
}
/*----------------------------------------------------------------------------*/


+ 1
- 0
mss/src/.exclude View File

This file exists to prevent Eclipse/CDT from adding the C sources contained in this directory (or below) to any enclosing project.

+ 62
- 0
mss/src/makefile.libs View File

#
# This file was generated based on the configuration script:
# C:\Users\Daunair\workspace_v10\3D_people_count_68xx_mss\mss\pcount3D_mss.cfg
#
# This makefile may be included in other makefiles that need to build
# the libraries containing the compiled source files generated as
# part of the configuration step.

#
# ======== GEN_SRC_DIR =========
# The path to the sources generated during configuration
#
# This path must be either absolute or relative to the build directory.
#
# The absolute path to the generated source directory (at the time the
# sources were generated) is:
# C:\Users\Daunair\workspace_v10\3D_people_count_68xx_mss\mss\src
#
GEN_SRC_DIR ?= ../mss/src

ifeq (,$(wildcard $(GEN_SRC_DIR)))
$(error "ERROR: GEN_SRC_DIR must be set to the directory containing the generated sources")
endif

#
# ======== .force ========
# The .force goal is used to force the build of any goal that names it as
# a prerequisite
#
.PHONY: .force
#
# ======== library macros ========
#
sysbios_SRC = $(GEN_SRC_DIR)/sysbios
sysbios_LIB = $(GEN_SRC_DIR)/sysbios/sysbios.aer4ft

#
# ======== dependencies ========
#
all: $(sysbios_LIB)
clean: .sysbios_clean


# ======== convenient build goals ========
.PHONY: sysbios
sysbios: $(GEN_SRC_DIR)/sysbios/sysbios.aer4ft

# CDT managed make executables depend on $(OBJS)
OBJS += $(sysbios_LIB)

#
# ======== rules ========
#
$(sysbios_LIB): .force
@echo making $@ ...
@$(MAKE) -C $(sysbios_SRC)

.sysbios_clean:
@echo cleaning $(sysbios_SRC) ...
-@$(MAKE) --no-print-directory -C $(sysbios_SRC) clean


+ 82
- 0
mss/src/sysbios/makefile View File

# This is a generated file.
#
# Do not edit this file. Any modifications to this file
# will be overwritten whenever makefiles are re-generated.
#
# template: ti.sysbios/makefile.xdt
# target: ti.targets.arm.elf.R4Ft

vpath % C:/ti/bios_6_73_01_01/packages/ti/sysbios/
vpath %.c C:/ti/xdctools_3_50_08_24_core/packages/

XOPTS = -I"C:/ti/xdctools_3_50_08_24_core/packages/" -Dxdc_target_types__=C:/ti/bios_6_73_01_01/packages/ti/targets/arm/elf/std.h -Dxdc_target_name__=R4Ft

BIOS_DEFS = -Dti_sysbios_BIOS_swiEnabled__D=FALSE -Dti_sysbios_BIOS_taskEnabled__D=TRUE -Dti_sysbios_BIOS_clockEnabled__D=TRUE -Dti_sysbios_BIOS_runtimeCreatesEnabled__D=TRUE -Dti_sysbios_knl_Task_moduleStateCheckFlag__D=FALSE -Dti_sysbios_knl_Task_objectCheckFlag__D=FALSE -Dti_sysbios_hal_Hwi_DISABLE_ALL_HOOKS -Dti_sysbios_knl_Swi_DISABLE_ALL_HOOKS -Dti_sysbios_BIOS_smpEnabled__D=FALSE -Dti_sysbios_BIOS_mpeEnabled__D=FALSE -Dti_sysbios_Build_useHwiMacros -Dti_sysbios_knl_Swi_numPriorities__D=16 -Dti_sysbios_knl_Task_deleteTerminatedTasks__D=FALSE -Dti_sysbios_knl_Task_numPriorities__D=16 -Dti_sysbios_knl_Task_checkStackFlag__D=TRUE -Dti_sysbios_knl_Task_initStackFlag__D=TRUE -Dti_sysbios_knl_Clock_TICK_SOURCE=ti_sysbios_knl_Clock_TickSource_TIMER -Dti_sysbios_knl_Clock_TICK_MODE=ti_sysbios_knl_Clock_TickMode_PERIODIC -Dti_sysbios_hal_Core_delegate_getId=ti_sysbios_family_arm_v7r_tms570_Core_getId__E -Dti_sysbios_hal_Core_delegate_interruptCore=ti_sysbios_family_arm_v7r_tms570_Core_interruptCore__E -Dti_sysbios_hal_Core_delegate_lock=ti_sysbios_family_arm_v7r_tms570_Core_lock__E -Dti_sysbios_hal_Core_delegate_unlock=ti_sysbios_family_arm_v7r_tms570_Core_unlock__E -Dti_sysbios_hal_Core_numCores__D=1 -Dti_sysbios_family_arm_v7r_tms570_Core_numCores__D=1 -Dti_sysbios_utils_Load_taskEnabled__D=TRUE -Dti_sysbios_utils_Load_swiEnabled__D=FALSE -Dti_sysbios_utils_Load_hwiEnabled__D=FALSE -Dti_sysbios_family_arm_v7r_vim_Hwi_dispatcherSwiSupport__D=FALSE -Dti_sysbios_family_arm_v7r_vim_Hwi_dispatcherTaskSupport__D=TRUE -Dti_sysbios_family_arm_v7r_vim_Hwi_dispatcherAutoNestingSupport__D=TRUE -Dti_sysbios_family_arm_v7r_vim_Hwi_dispatcherIrpTrackingSupport__D=TRUE -Dti_sysbios_knl_Semaphore_supportsEvents__D=FALSE -Dti_sysbios_knl_Semaphore_supportsPriority__D=TRUE

CCOPTS = --code_state=16 --float_support=vfpv3d16 --endian=little -mv7R4 --abi=eabi -q -ms --opt_for_speed=2 --program_level_compile -o3 -g --enum_type=int -Dti_sysbios_family_arm_exc_Exception_enableDecode__D=TRUE -Dti_sysbios_knl_Clock_stopCheckNext__D=FALSE -Dti_sysbios_family_arm_v7r_vim_Hwi_lockstepDevice__D=TRUE -Dti_sysbios_family_arm_v7r_vim_Hwi_errataInitEsm__D=TRUE -Dti_sysbios_family_arm_v7r_vim_Hwi_resetVIM__D=TRUE -Dti_sysbios_hal_Core_numCores__D=1 -Dti_sysbios_knl_Task_ENABLE_SWITCH_HOOKS -Dti_sysbios_knl_Task_minimizeLatency__D=FALSE

BIOS_INC = -I"C:/ti/bios_6_73_01_01/packages/"
ANNEX_INCS =
INCS = $(BIOS_INC) $(ANNEX_INCS) -I"C:/ti/bios_6_73_01_01/packages/" -I"C:/ti/xdctools_3_50_08_24_core/packages/" -I"../" -I"/packages//" -IC:/ti/ti-cgt-arm_16.9.6.LTS/include

CC = C:/ti/ti-cgt-arm_16.9.6.LTS/bin/armcl -c $(CCOPTS)
ASM = C:/ti/ti-cgt-arm_16.9.6.LTS/bin/armcl -c $(CCOPTS)
AR = C:/ti/ti-cgt-arm_16.9.6.LTS/bin/armar rq

DEL = C:/ti/xdctools_3_50_08_24_core/packages/../bin/rm -f
CP = C:/ti/xdctools_3_50_08_24_core/packages/../bin/cp -f

define RM
$(if $(wildcard $1),$(DEL) $1,:)
endef

define ASSEMBLE
@echo asmer4ft $< ...
@$(ASM) $(BIOS_DEFS) $(XOPTS) $(INCS) $<
endef

all: sysbios.aer4ft

arm_IntrinsicsSupport_asm.obj: family/arm/IntrinsicsSupport_asm.asm makefile
@-$(call RM, $@)
$(ASSEMBLE) --output_file=arm_IntrinsicsSupport_asm.obj

arm_TaskSupport_asm.obj: family/arm/TaskSupport_asm.asm makefile
@-$(call RM, $@)
$(ASSEMBLE) --output_file=arm_TaskSupport_asm.obj

vim_Hwi_asm.obj: family/arm/v7r/vim/Hwi_asm.sv7R makefile
@-$(call RM, $@)
$(ASSEMBLE) --output_file=vim_Hwi_asm.obj

vim_Hwi_asm_switch.obj: family/arm/v7r/vim/Hwi_asm_switch.sv7R makefile
@-$(call RM, $@)
$(ASSEMBLE) --output_file=vim_Hwi_asm_switch.obj

exc_Exception_asm.obj: family/arm/exc/Exception_asm.asm makefile
@-$(call RM, $@)
$(ASSEMBLE) --output_file=exc_Exception_asm.obj

tms570_Core_asm.obj: family/arm/v7r/tms570/Core_asm.sv7R makefile
@-$(call RM, $@)
$(ASSEMBLE) --output_file=tms570_Core_asm.obj

a15_TimestampProvider_asm.obj: family/arm/a15/TimestampProvider_asm.asm makefile
@-$(call RM, $@)
$(ASSEMBLE) --output_file=a15_TimestampProvider_asm.obj


BIOS.obj: BIOS.c family/arm/IntrinsicsSupport.c family/arm/TaskSupport.c knl/Clock.c knl/Idle.c knl/Intrinsics.c knl/Event.c knl/Queue.c knl/Semaphore.c knl/Task.c heaps/HeapBuf.c heaps/HeapMem.c family/arm/v7r/vim/Hwi.c family/arm/exc/Exception.c hal/Cache.c hal/CacheNull.c hal/Core.c hal/Hwi.c hal/Hwi_stack.c hal/Hwi_startup.c family/arm/v7a/Pmu.c utils/Load.c utils/Load_CPU.c gates/GateHwi.c gates/GateMutex.c family/arm/v7r/tms570/Core.c timers/rti/Timer.c family/arm/a15/TimestampProvider.c xdc/runtime/xdc_noinit.c xdc/runtime/Assert.c xdc/runtime/Core-mem.c xdc/runtime/Core-smem.c xdc/runtime/Core-label.c xdc/runtime/Core-params.c xdc/runtime/Diags.c xdc/runtime/Error.c xdc/runtime/Gate.c xdc/runtime/Log.c xdc/runtime/LoggerBuf.c xdc/runtime/Memory.c xdc/runtime/Registry.c xdc/runtime/Startup.c xdc/runtime/System.c xdc/runtime/SysStd.c xdc/runtime/Text.c xdc/runtime/Timestamp.c xdc/runtime/TimestampNull.c makefile
@-$(call RM, $@)
@echo cler4ft $< ...
@$(CC) $(BIOS_DEFS) $(XOPTS) $(INCS) $(subst makefile,,$^)

sysbios.aer4ft: BIOS.obj arm_IntrinsicsSupport_asm.obj arm_TaskSupport_asm.obj vim_Hwi_asm.obj vim_Hwi_asm_switch.obj exc_Exception_asm.obj tms570_Core_asm.obj a15_TimestampProvider_asm.obj
@-$(call RM, $@)
@echo arer4ft $^ ...
@$(AR) $@ $^


clean:
@$(DEL) ..\makefile.libs
@-$(call RM, *)

BIN
mss/src/sysbios/sysbios.aer4ft View File


+ 99
- 0
mss/tracker_output.h View File

/**
* @file mmw_output.h
*
* @brief
* This is the interface/message header file for the Millimeter Wave Demo
*
* \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 TRACKER_OUTPUT_H
#define TRACKER_OUTPUT_H

#ifdef __cplusplus
extern "C" {
#endif

/** @brief Output packet length is a multiple of this value, must be power of 2*/
#define TRACKERDEMO_OUTPUT_MSG_SEGMENT_LEN 32
/*!
* @brief
* Message header for reporting detection information from data path.
*
* @details
* The structure defines the message header.
*/
typedef struct TrackerDemo_output_message_header_t
{
/*! @brief Output buffer magic word (sync word). It is initialized to {0x0102,0x0304,0x0506,0x0708} */
uint16_t magicWord[4];

/*! @brief SW Version: : MajorNum * 2^24 + MinorNum * 2^16 + BugfixNum * 2^8 + BuildNum */
uint32_t version;

/*! @brief HW platform type */
uint32_t platform;

/*! @brief Time in CPU cycles when the message was created, R4F CPU cycles */
uint32_t timeStamp;

/*! @brief Total packet length including header in Bytes */
uint32_t totalPacketLen;
/*! @brief Frame number */
uint32_t frameNumber;

/*! @brief For Advanced Frame config, this is the sub-frame number in the range
* 0 to (number of subframes - 1). For frame config (not advanced), this is always
* set to 0. */
uint32_t subFrameNumber;

/*! @brief Detection Layer Margins */
uint32_t chirpProcessingMargin;
uint32_t frameProcessingMargin;
/*! @brief Localization Layer Timing */
uint32_t trackingProcessingTime;
uint32_t uartSendingTime;

/*! @brief Number of TLVs in this message*/
uint16_t numTLVs;
/*! @brief Header checksum */
uint16_t checksum;

} TrackerDemo_output_message_header;

#ifdef __cplusplus
}
#endif

#endif /* MMW_OUTPUT_H */

+ 580
- 0
mss/tracker_utils.c View File

/**
* @file task_mbox.c
*
* @brief
* MSS main implementation of the millimeter wave Demo
*
* 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 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/runtime/System.h>

/* mmWave SDK Include Files: */
#include <ti/common/sys_common.h>
#include <ti/drivers/uart/UART.h>
#include <ti/utils/cli/cli.h>
#include <ti/alg/gtrack/gtrack.h>
#include <ti/drivers/osal/MemoryP.h>
#include "float.h"

/* Demo Include Files */
#include <people_counting/68xx_3D_people_counting/src/mss/pcount3D_mss.h>


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

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

typedef enum {
TRACKING_DEFAULT_PARAM_SET = 0,
TRACKING_TRAFFIC_MONITORING_PARAM_SET,
TRACKING_PEOPLE_COUNTING_PARAM_SET,
TRACKING_OUTDOOR_PARAM_SET,
TRACKING_CEILING_MOUNT_PARAM_SET
} TRACKING_ADVANCED_PARAM_SET;

typedef enum {
TRACKING_PARAM_SET_TM = 0,
TRACKING_PARAM_SET_PC,
TRACKING_PARAM_SET_OUTDOOR,
TRACKING_PARAM_SET_CEILING_MOUNT
} TRACKING_ADVANCED_PARAM_SET_TABLE;
#if 0
/* Scenery parameters includes up to two boundary boxes and up to two static boxes */
/* Each box is in format {x1,x2, y1,y2, z1,z2}. In 2D cases, the z parameters are ignored */
GTRACK_sceneryParams appSceneryParamTable[4] = {
/* TM: 1 boundary box: {-1,12, 15,75, 0,0}, and 1 static box {0,14, 19,50, 0,0} */
1,{{-1.f,12.f, 15.f,75.f, 0.f,0.f},{0.f,0.f,0.f,0.f,0.f,0.f}},1,{{0.f,11.f, 19.f,50.f, 0.f,0.f},{0.f,0.f,0.f,0.f,0.f}},
/* PEOPLE COUNTING: 1 boundary box: {-4,4, 0.5,7.5, 0,0}, and 1 static box {-3,3, 2,6, 0,0} */
1,{{-4.f,4.f, 0.5f,7.5f, 0.f,0.f},{0.f,0.f,0.f,0.f,0.f,0.f}}, 1,{{-3.f,3.f,2.f,6.f,0.f,0.f},{0.f,0.f,0.f,0.f,0.f,0.f}},
/* OUTDOOR: 1 boundary box: {-39,19, 2,50, 0,0}, and 1 static box {-30,16, 4,44, 0,0} */
1,{{-29.f,39.f, 2.f,59.f, -1.f,3.f},{0.f,0.f,0.f,0.f,0.f,0.f}}, 1,{{-20.f,20.f, 12.f,40.f, 0.f, 2.f},{0.f,0.f,0.f,0.f,0.f,0.f}},
/* CEILING MOUNT: 1 boundary box: {-4,4, 0.5,7.5, -1,3}, and 1 static box {-3,3, 2,6, -0.5,2.5} */
1,{{-4.f,4.f, 0.5f,7.5f, -1.f,3.0f},{0.f,0.f,0.f,0.f,0.f,0.f}}, 1,{{-3.f,3.f,2.f,6.f,-0.5,2.5f},{0.f,0.f,0.f,0.f,0.f,0.f}}
};

/* Gating Volume 2 "liters", Limits are set to 2m in depth and width, no limit in height and doppler */
GTRACK_gatingParams appGatingParamTable[4] = {
/* TM: Gating volume = 16, Limits are set to 12m in depth, 8m in width, ignore the height, no limit in doppler */
{4.f, {12.f, 6.f, 4.f, 12.f}},
/* PEOPLE COUNTING: Gating gain = 3, Limits are 2m in depth, 2m in width, ignore the height, 12m/s in doppler */
{3.f, {2.f, 2.f, 2.f, 12.f}},
/* OUTDOOR: Gating gain = 4, Limits are set to 6m in depth, 6m in width, ignore the height, 10m/s limit in doppler */
{4.f, {6.f, 6.f, 4.f, 10.f}},
/* CEILING MOUNT: Gating volume = 2, Limits are 2m in depth, 2m in width, 2m the height, no limit in doppler */
{2.f, {2.f, 2.f, 2.f, 10.f}}
};
GTRACK_stateParams appStateParamTable[4] = {
{3U, 3U, 5U, 100U, 5U}, /* TM: det2act, det2free, act2free, stat2free, exit2free */
{10U, 5U, 50U, 100U, 5U}, /* PC: det2act, det2free, act2free, stat2free, exit2free */
{4U, 10U, 60U, 600U, 20U}, /* OUTDOOR: det2act, det2free, act2free, stat2free, exit2free */
{10U, 5U, 10U, 100U, 5U} /* CEILING MOUNT: det2act, det2free, act2free, stat2free, exit2free */
};
GTRACK_allocationParams appAllocationParamTable[4] = {
{100.f, 100.f, 1.f, 3U, 4.f, 2.f}, /* TM: 100 (100) SNRs, 1m/s minimal velocity, 3 points with 4m in distance, 2m/c in velocity separation */
{60.f, 200.f, 0.1f, 5U, 1.5f, 2.f}, /* PC: 150 (250 obscured), 0.1 m/s minimal velocity, 5 points, with 1m in distance, 2m/c in velocity in separation */
{40.f, 200.f, 0.5f, 3U, 2.f, 2.f}, /* OUTDOOR: 50 (200 obscured), 0.5 m/s minimal velocity, 5 points, with 1m in distance, 2m/c in velocity in separation */
{60.f, 200.f, 0.1f, 5U, 1.5f, 2.f} /* CEILING MOUNT: 150 (200 obscured), 0.5 m/s minimal velocity, 5 points, with 1m in distance, 2m/c in velocity in separation */
};
/* This parameter is ignored in 2D/3D tracker versions */
GTRACK_varParams appVariationParamTable[4] = {
{0.f, 0.f, 0.f},
{0.f, 0.f, 0.f},
{0.f, 0.f, 0.f},
{0.f, 0.f, 0.f}
};

float maxAccelerationParams[3] = {1, 1, 1};
#endif
/**
* @brief
* Global Variable for tracking information required by the mmw Demo
*/
extern Pcount3DDemo_MSS_MCB gMmwMssMCB;

unsigned int gGtrackMemoryUsed = 0;

/* @TODO: These functions need to be abstracted to the DPC */
void *gtrack_alloc(unsigned int numElements, unsigned int sizeInBytes)
{
gGtrackMemoryUsed += numElements*sizeInBytes;
return MemoryP_ctrlAlloc(numElements*sizeInBytes, 0);
}
void gtrack_free(void *pFree, unsigned int sizeInBytes)
{
gGtrackMemoryUsed -= sizeInBytes;
MemoryP_ctrlFree(pFree,sizeInBytes);
}
void gtrack_log(GTRACK_VERBOSE_TYPE level, const char *format, ...)
{
#if 0
va_list args;
va_start(args, format);
vprintf(format, args);
va_end(args);
#endif
}

/**
* @b Description
* @n
* This is the CLI Handler for tracking configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
int32_t MmwDemo_CLITrackingCfg (int32_t argc, char* argv[])
{
GTRACK_moduleConfig config;


TRACKING_ADVANCED_PARAM_SET trackingParamSet;

//Memory_Stats startMemoryStats;
//Memory_Stats endMemoryStats;

if (argc >= 1) {
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.trackerEnabled = (uint16_t) atoi (argv[1]);
}

if(gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.trackerEnabled != 1) {
return 0;
}

/* Sanity Check: Minimum argument check */
if (argc != 8)
{
CLI_write ("Error: Invalid usage of the CLI command\n");
return -1;
}
#if 0
System_printf("Debug: Heap before creating a tracker\n");
MmwDemo_printHeapStats();
#endif
/* Initialize CLI configuration: */
memset ((void *)&config, 0, sizeof(GTRACK_moduleConfig));

trackingParamSet = (TRACKING_ADVANCED_PARAM_SET) atoi (argv[2]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.trackingParamSet = trackingParamSet;

switch(trackingParamSet)
{
case TRACKING_DEFAULT_PARAM_SET:
// Do not configure advanced parameters, use library default parameters
config.advParams = 0;
break;

case TRACKING_TRAFFIC_MONITORING_PARAM_SET:
/* Initialize CLI configuration: */
config.initialRadialVelocity = -8.0f; // for TM, detected targets are approaching
config.maxAcceleration[0] = 2.0f; // for TM, maximum acceleration in lateral direction is set to 2m/s2
config.maxAcceleration[1] = 20.0f; // for TM, maximum acceleration is longitudinal direction set to 20m/s2
config.maxAcceleration[2] = 0.f; // ignored
break;

case TRACKING_PEOPLE_COUNTING_PARAM_SET:
/* Initialize CLI configuration: */
config.initialRadialVelocity = 0; //For PC, detected target velocity is unknown
config.maxAcceleration[0] = 0.1f;
config.maxAcceleration[1] = 0.1f;
config.maxAcceleration[2] = 0.1f;
break;

case TRACKING_OUTDOOR_PARAM_SET:
/* Initialize CLI configuration: */
config.initialRadialVelocity = 0; // for OUTDOOR, detected targets velocity is unknown
config.maxAcceleration[0] = 1.0f;
config.maxAcceleration[1] = 1.0f;
config.maxAcceleration[2] = 1.0f;
break;

case TRACKING_CEILING_MOUNT_PARAM_SET:
/* Initialize CLI configuration: */
config.initialRadialVelocity = 0;
config.maxAcceleration[0] = 0.1f;
config.maxAcceleration[1] = 0.1f;
config.maxAcceleration[2] = 0.1f;
break;


default:
CLI_write ("Error: Invalid usage of the CLI command\n");
return -1;
}
#ifdef GTRACK_3D
config.stateVectorType = GTRACK_STATE_VECTORS_3DA; // Track three dimensions with acceleration
#else
config.stateVectorType = GTRACK_STATE_VECTORS_2DA; // Track two dimensions with acceleration
#endif
config.verbose = GTRACK_VERBOSE_NONE;
config.maxNumPoints = (uint16_t) atoi(argv[3]);
config.maxNumTracks = (uint16_t) atoi(argv[4]);
config.maxRadialVelocity = (float) atoi(argv[5]) *0.1f;
#ifndef GTRACK_3D
config.radialVelocityResolution = (float) atoi(argv[6]) *0.001f;
#endif
config.deltaT = (float) atoi(argv[7]) *0.001f;

/* Save Configuration to use later */
memcpy((void *)&gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.gtrackModuleConfig, (void *)&config, sizeof(GTRACK_moduleConfig));

return 0;
}

int32_t MmwDemo_CLIStaticBoundaryBoxCfg (int32_t argc, char* argv[])
{
/* Sanity Check: Minimum argument check */
#ifdef GTRACK_3D
if (argc != 7)
#else
if (argc != 5)
#endif
{
CLI_write ("Error: Invalid usage of the CLI command\n");
return -1;
}

/* Initialize the ADC Output configuration: */
//memset ((void *)&sceneryParams, 0, sizeof(GTRACK_sceneryParams));
/* Populate configuration: */
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.numStaticBoxes = 1;
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.staticBox[0].x1 = (float) atof (argv[1]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.staticBox[0].x2 = (float) atof (argv[2]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.staticBox[0].y1 = (float) atof (argv[3]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.staticBox[0].y2 = (float) atof (argv[4]);
#ifdef GTRACK_3D
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.staticBox[0].z1 = (float) atof (argv[5]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.staticBox[0].z2 = (float) atof (argv[6]);
#endif

return 0;
}

int32_t MmwDemo_CLIBoundaryBoxCfg (int32_t argc, char* argv[])
{
/* Sanity Check: Minimum argument check */
#ifdef GTRACK_3D
if (argc != 7 && argc != 13)
#else
if (argc != 5)
#endif
{
CLI_write ("Error: Invalid usage of the CLI command\n");
return -1;
}

/* Initialize the ADC Output configuration: */
//memset ((void *)&sceneryParams, 0, sizeof(GTRACK_sceneryParams));
/* Populate configuration: */
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.numBoundaryBoxes = 1;
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.boundaryBox[0].x1 = (float) atof (argv[1]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.boundaryBox[0].x2 = (float) atof (argv[2]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.boundaryBox[0].y1 = (float) atof (argv[3]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.boundaryBox[0].y2 = (float) atof (argv[4]);
#ifdef GTRACK_3D
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.boundaryBox[0].z1 = (float) atof (argv[5]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.boundaryBox[0].z2 = (float) atof (argv[6]);
#endif
if (argc == 13) { //second boundary box
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.numBoundaryBoxes = 2;
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.boundaryBox[1].x1 = (float) atof (argv[7]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.boundaryBox[1].x2 = (float) atof (argv[8]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.boundaryBox[1].y1 = (float) atof (argv[9]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.boundaryBox[1].y2 = (float) atof (argv[10]);
#ifdef GTRACK_3D
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.boundaryBox[1].z1 = (float) atof (argv[11]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.boundaryBox[1].z2 = (float) atof (argv[12]);
#endif
}
return 0;
}

int32_t MmwDemo_CLISensorPositionCfg(int32_t argc, char* argv[])
{
if (argc != 4)
{
CLI_write("Error: Invalid usage of the CLI Command\n");
return -1;
}

/* Assume sensor position as the origin in the xy plane so x=0, y=0*/
/*populate sensor position configuration*/
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.sensorPosition.x = 0;
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.sensorPosition.y = 0;
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.sensorPosition.z = (float) atof (argv[1]);
/*populate sensor orientation configuration*/
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.sensorOrientation.azimTilt = (float) atof (argv[2]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.sensorOrientation.elevTilt = (float) atof (argv[3]);
/*demo parameters*/
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sensorAzimuthTilt = atoi(argv[2])*3.14f/180;
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sensorElevationTilt = atoi(argv[3])*3.14f/180;
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sensorHeight = (float)atof(argv[1]);

return 0;
}
/**
* @b Description
* @n
* This is the CLI Handler for GatingParam configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
int32_t MmwDemo_CLIGatingParamCfg (int32_t argc, char* argv[])
{
/* Sanity Check: Minimum argument check */
#ifdef GTRACK_3D
if (argc != 6)
#else
if (argc != 5)
#endif
{
CLI_write ("Error: Invalid usage of the CLI command\n");
return -1;
}
/* Initialize the ADC Output configuration: */
//memset ((void *)&gatingParams, 0, sizeof(GTRACK_gatingParams));
/* Populate configuration: */
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.gatingParams.gain = (float) atof (argv[1]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.gatingParams.limits.width = (float) atof (argv[2]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.gatingParams.limits.depth = (float) atof (argv[3]);
#ifdef GTRACK_3D
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.gatingParams.limits.height = (float) atof (argv[4]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.gatingParams.limits.vel = (float) atof (argv[5]);
#else
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.gatingParams.limits.vel = (float) atof (argv[4]);
#endif

return 0;
}


/**
* @b Description
* @n
* This is the CLI Handler for StateParam configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
int32_t MmwDemo_CLIStateParamCfg (int32_t argc, char* argv[])
{
/* Sanity Check: Minimum argument check */
if (argc != 7)
{
CLI_write ("Error: Invalid usage of the CLI command\n");
return -1;
}

/* Initialize the ADC Output configuration: */
//memset ((void *)&stateParams, 0, sizeof(GTRACK_stateParams));
/* Populate configuration: */
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.stateParams.det2actThre = (uint16_t) atoi (argv[1]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.stateParams.det2freeThre= (uint16_t) atoi (argv[2]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.stateParams.active2freeThre= (uint16_t) atoi (argv[3]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.stateParams.static2freeThre= (uint16_t) atoi (argv[4]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.stateParams.exit2freeThre= (uint16_t) atoi (argv[5]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.stateParams.sleep2freeThre = (uint16_t) atoi (argv[6]);

return 0;
}

/**
* @b Description
* @n
* This is the CLI Handler for AllocationParam configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
int32_t MmwDemo_CLIAllocationParamCfg (int32_t argc, char* argv[])
{
/* Sanity Check: Minimum argument check */
#ifdef GTRACK_3D
if (argc != 7)
#else
if (argc != 6)
#endif
{
CLI_write ("Error: Invalid usage of the CLI command\n");
return -1;
}

/* Initialize the ADC Output configuration: */
//memset ((void *)&allocationParams, 0, sizeof(GTRACK_allocationParams));

/* Populate configuration: */
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.allocationParams.snrThre = (float) atof (argv[1]);
#ifdef GTRACK_3D
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.allocationParams.snrThreObscured = (float) atof (argv[2]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.allocationParams.velocityThre = (float) atof (argv[3]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.allocationParams.pointsThre = (uint16_t) atoi (argv[4]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.allocationParams.maxDistanceThre = (float) atof (argv[5]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.allocationParams.maxVelThre = (float) atof (argv[6]);
#else
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.allocationParams.velocityThre = (float) atof (argv[2]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.allocationParams.pointsThre = (uint16_t) atoi (argv[3]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.allocationParams.maxDistanceThre = (float) atof (argv[4]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.allocationParams.maxVelThre = (float) atof (argv[5]);
#endif

return 0;
}

int32_t MmwDemoCLIMaxAccelerationParamCfg(int32_t argc, char* argv[])
{
#ifdef GTRACK_3D
if (argc != 4)
#else
if (argc != 3)
#endif
{
CLI_write ("Error: Invalid usage of the CLI command\n");
return -1;
}
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.accelerationParams[0] = (float) atof (argv[1]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.accelerationParams[1] = (float) atof (argv[2]);
#ifdef GTRACK_3D
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.accelerationParams[2] = (float) atof (argv[3]);
#endif
return 0;

}

/**
* @b Description
* @n
* This is the CLI Handler for PresenceParams configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
int32_t MmwDemo_CLIPresenceParamCfg (int32_t argc, char* argv[])
{
/* Sanity Check: Minimum argument check */
if (argc != 7)
{
CLI_write ("Error: Invalid usage of the CLI command\n");
return -1;
}

/* Hardcode presence detection thresholds */
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.presenceParams.pointsThre= 3;//(uint16_t) atoi (argv[1]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.presenceParams.velocityThre= 0.5;//(uint16_t) atoi (argv[2]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.presenceParams.on2offThre= 10;//(uint16_t) atoi (argv[3]);
/* Only one presence detection boundary box supported for now */
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.presenceParams.numOccupancyBoxes= 1;

/* Set presence detection enabled flag */
if( ( gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.sceneryParams.numBoundaryBoxes > 0)
&& ( gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.presenceParams.pointsThre > 0))
{
gMmwMssMCB.presenceDetEnabled = true;
}
/* Boundary Box configuration */
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.presenceParams.occupancyBox[0].x1= (float) atof (argv[1]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.presenceParams.occupancyBox[0].x2= (float) atof (argv[2]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.presenceParams.occupancyBox[0].y1= (float) atof (argv[3]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.presenceParams.occupancyBox[0].y2= (float) atof (argv[4]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.presenceParams.occupancyBox[0].z1= (float) atof (argv[5]);
gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.presenceParams.occupancyBox[0].z2= (float) atof (argv[6]);

return 0;
}


+ 212
- 0
mss/tracker_utils.h View File

/**
* @file task_mbox.c
*
* @brief
* MSS main implementation of the millimeter wave Demo
*
* 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 Files ********************************
**************************************************************************/

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

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

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

void *gtrack_alloc(unsigned int numElements, unsigned int sizeInBytes);
void gtrack_free(void *pFree, unsigned int sizeInBytes);

/**
* @b Description
* @n
* This is the CLI Handler for tracking configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/

int32_t MmwDemo_CLITrackingCfg (int32_t argc, char* argv[]);
/**
* @b Description
* @n
* This is the CLI Handler for static boundary box configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
int32_t MmwDemo_CLIStaticBoundaryBoxCfg (int32_t argc, char* argv[]);

/**
* @b Description
* @n
* This is the CLI Handler for boundary box configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
int32_t MmwDemo_CLIBoundaryBoxCfg (int32_t argc, char* argv[]);

/**
* @b Description
* @n
* This is the CLI Handler for sensor position and orientation configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
int32_t MmwDemo_CLISensorPositionCfg (int32_t argc, char* argv[]);

/**
* @b Description
* @n
* This is the CLI Handler for GatingParam configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
int32_t MmwDemo_CLIGatingParamCfg (int32_t argc, char* argv[]);

/**
* @b Description
* @n
* This is the CLI Handler for StateParam configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
int32_t MmwDemo_CLIStateParamCfg (int32_t argc, char* argv[]);

/**
* @b Description
* @n
* This is the CLI Handler for AllocationParam configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
int32_t MmwDemo_CLIAllocationParamCfg (int32_t argc, char* argv[]);

/**
* @b Description
* @n
* This is the CLI Handler for tracker Acceleration configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
int32_t MmwDemoCLIMaxAccelerationParamCfg(int32_t argc, char* argv[]);

/**
* @b Description
* @n
* This is the CLI Handler for PresenceParam configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
int32_t MmwDemo_CLIPresenceParamCfg (int32_t argc, char* argv[]);

+ 1209
- 0
objdetrangehwa.c
File diff suppressed because it is too large
View File


Loading…
Cancel
Save