Other Parts Discussed in Thread: MMWAVE-SDK, MMWAVEICBOOST, ,
I added all the hardcoded parameters in "ods_point_cloud_68xx_hwa_es1" to bypass CLI but one small issue is there sensor start with only demo visualizer only all other parameters are hardcoded (not depends on demo visualizer )
please tell me where i need to do modification which will help us to get LVDS data on power on only
i dont want to issue any command i written all the configuration inside CLI function i will share u file please correct me how i can get data on power on
/*
* @file mmw_cli.c
*
* @brief
* Mmw (Milli-meter wave) DEMO CLI Implementation
*
* \par
* NOTE:
* (C) Copyright 2018 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>
/* BIOS/XDC Include Files. */
#include <xdc/runtime/System.h>
/* mmWave SDK Include Files: */
#include <ti/common/sys_common.h>
#include <ti/common/mmwave_sdk_version.h>
#include <ti/drivers/uart/UART.h>
#include <ti/control/mmwavelink/mmwavelink.h>
#include <ti/utils/cli/cli.h>
#include <ti/utils/mathutils/mathutils.h>
/* Demo Include Files */
#include <mmw.h>
#include <mmw_config.h>
#include <utils/mmwdemo_adcconfig.h>
#include <utils/mmwdemo_rfparser.h>
#include <datapath/dpc/objectdetection/objdethwa/objectdetection.h>
#include <profile.h>
/**************************************************************************
*************************** Local Definitions ****************************
**************************************************************************/
/* CLI Extended Command Functions */
//static int32_t MmwDemo_Version (void);
//static int32_t MmwDemo_CLIFlushCfg (int32_t argc, char* argv[]);
//static int32_t MmwDemo_CLIDataOutputMode (int32_t argc, char* argv[]);
//static int32_t MmwDemo_CLIChannelCfg (int32_t argc, char* argv[]);
//static int32_t MmwDemo_CLIADCCfg (int32_t argc, char* argv[]);
//static int32_t MmwDemo_CLIProfileCfg (int32_t argc, char* argv[]);
//static int32_t MmwDemo_CLIChirpCfg (int32_t argc, char* argv[]);
//static int32_t MmwDemo_CLIFrameCfg (int32_t argc, char* argv[]);
//static int32_t MmwDemo_CLISubFrameCfg (int32_t argc, char* argv[]);
//static int32_t MmwDemo_CLILowPowerCfg (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLICfarCfg (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLIMultiObjBeamForming (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLICalibDcRangeSig (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLIClutterRemoval (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLISensorStart (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLISensorStop (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLIGuiMonSel (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLIADCBufCfg (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLICompRangeBiasAndRxChanPhaseCfg (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLIMeasureRangeBiasAndRxChanPhaseCfg (int32_t argc, char* argv[]);
//static int32_t MmwDemo_CLIBpmCfg(void);
static int32_t MmwDemo_CLICfarFovCfg (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLIAoAFovCfg (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLIExtendedMaxVelocity (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLIChirpQualityRxSatMonCfg (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLIChirpQualitySigImgMonCfg (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLIAnalogMonitorCfg (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLILvdsStreamCfg (int32_t argc, char* argv[]);
//static void mmwDemo_sensorConfig_task(void);
/**************************************************************************
*************************** Extern Definitions *******************************
**************************************************************************/
extern MmwDemo_MCB gMmwMCB;
/**************************************************************************
*************************** CLI Function Definitions **************************
**************************************************************************/
/**
* @b Description
* @n
* This is the CLI Handler for the flush configuration command
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* \ingroup CLI_UTIL_INTERNAL_FUNCTION
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
//static int32_t MmwDemo_CLIFlushCfg (int32_t argc, char* argv[])
//{
// /* Reset the global configuration: */
// memset ((void*)&gMmwMCB.cfg.ctrlCfg, 0, sizeof(MMWave_CtrlCfg));
//
// /* Reset the open configuration: */
// memset ((void*)&gMmwMCB.cfg.openCfg, 0, sizeof(MMWave_OpenCfg));
// return 0;
//}
/**
* @b Description
* @n
* This is the CLI Handler for the sensor start command
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
/**
* @b Description
* @n
* This is the CLI Handler for the DFE Data Output mode.
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* \ingroup CLI_UTIL_INTERNAL_FUNCTION
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
//static int32_t MmwDemo_CLIDataOutputMode (int32_t argc, char* argv[])
//{
// uint32_t cfgMode;
//
// /* Get the configuration mode: */
// cfgMode = DFE_DATA_OUTPUT_MODE_HCC; //atoi (argv[1]);
// switch (cfgMode)
// {
// case 1U:
// {
// gMmwMCB.cfg.ctrlCfg.dfeDataOutputMode = MMWave_DFEDataOutputMode_FRAME;
// break;
// }
// case 2U:
// {
// gMmwMCB.cfg.ctrlCfg.dfeDataOutputMode = MMWave_DFEDataOutputMode_CONTINUOUS;
// break;
// }
// case 3U:
// {
// gMmwMCB.cfg.ctrlCfg.dfeDataOutputMode = MMWave_DFEDataOutputMode_ADVANCED_FRAME;
// break;
// }
// default:
// {
// /* Error: Invalid argument. */
// CLI_write ("Error: Invalid mode.\n");
// return -1;
// }
// }
//
// return 0;
//}
//static int32_t MmwDemo_CLIChannelCfg (int32_t argc, char* argv[])
//{
// rlChanCfg_t chCfg;
//
//
// /* Initialize the channel configuration: */
// memset ((void *)&chCfg, 0, sizeof(rlChanCfg_t));
//
// /* Populate the channel configuration: */
// chCfg.rxChannelEn = CHANNEL_HCC_RX_CHANNEL_EN;//atoi (argv[1]);
// chCfg.txChannelEn = CHANNEL_HCC_TX_CHANNEL_EN;//atoi (argv[2]);
// chCfg.cascading = CHANNEL_HCC_CASCADING;//atoi (argv[3]);
//
// /* Save Configuration to use later */
// memcpy((void *)&gMmwMCB.cfg.openCfg.chCfg, (void *)&chCfg, sizeof(rlChanCfg_t));
// return 0;
//}
//static int32_t MmwDemo_CLIADCCfg (int32_t argc, char* argv[])
//{
// rlAdcOutCfg_t adcOutCfg;
// int32_t retVal = 0;
//
// /* Initialize the ADC Output configuration: */
// memset ((void *)&adcOutCfg, 0, sizeof(rlAdcOutCfg_t));
//
// /* Populate the ADC Output configuration: */
// adcOutCfg.fmt.b2AdcBits = ADC_HCC_NUM_ADC_BITS;//atoi (argv[1]);
// adcOutCfg.fmt.b2AdcOutFmt = ADC_HCC_OUTPUT_FMT;//atoi (argv[2]);
//
// /* Save Configuration to use later */
// memcpy((void *)&gMmwMCB.cfg.openCfg.adcOutCfg, (void *)&adcOutCfg, sizeof(rlAdcOutCfg_t));
// return retVal;
//}
//static int32_t MmwDemo_CLIProfileCfg (int32_t argc, char* argv[])
//{
// rlProfileCfg_t profileCfg;
// int32_t errCode;
// MMWave_ProfileHandle profileHandle;
//// MmwDemo_message message;
//
//
// /* Sanity Check: Profile configuration is valid only for the Frame or
// Advanced Frame Mode: */
// if ((gMmwMCB.cfg.ctrlCfg.dfeDataOutputMode != MMWave_DFEDataOutputMode_FRAME) &&
// (gMmwMCB.cfg.ctrlCfg.dfeDataOutputMode != MMWave_DFEDataOutputMode_ADVANCED_FRAME))
// {
// CLI_write ("Error: Configuration is valid only if the DFE Output Mode is Frame or Advanced Frame\n");
// return -1;
// }
//
// /* Initialize the profile configuration: */
// memset ((void *)&profileCfg, 0, sizeof(rlProfileCfg_t));
//
// /* Populate the profile configuration: */
// profileCfg.profileId = PROFILE_HCC_0_PROFILE_ID;
// profileCfg.startFreqConst = (uint32_t)(PROFILE_HCC_0_START_FREQ_GHZ * (1U << 26) / 3.6);
// profileCfg.idleTimeConst = (uint32_t)((float)PROFILE_HCC_0_IDLE_TIME_VAL * 1000 / 10);
// profileCfg.adcStartTimeConst = (uint32_t)((float)PROFILE_HCC_0_ADC_START_TIME_VAL * 1000 / 10);
// profileCfg.rampEndTime = (uint32_t)((float)PROFILE_HCC_0_RAMP_END_TIME_VAL * 1000 / 10);
// profileCfg.txOutPowerBackoffCode = PROFILE_HCC_0_TXOUT_POWER_BACKOFF;
// profileCfg.txPhaseShifter = PROFILE_HCC_0_TXPHASESHIFTER_VAL;
// profileCfg.freqSlopeConst = (int16_t)(PROFILE_HCC_0_FREQ_SLOPE_MHZ_PER_US * (1U << 26) / (3.6*1e3*900)); //2^26 * 1e6/((3.6*1e9)*900)
// profileCfg.txStartTime = (int32_t)((float)PROFILE_HCC_0_TX_START_TIME_VAL * 1000 / 10);
// profileCfg.numAdcSamples = PROFILE_HCC_0_ADC_SAMPLE_VAL;
// profileCfg.digOutSampleRate = PROFILE_HCC_0_DIGOUT_SAMPLERATE_VAL;
// profileCfg.hpfCornerFreq1 = PROFILE_HCC_0_HPFCORNER_FREQ1_VAL;
// profileCfg.hpfCornerFreq2 = PROFILE_HCC_0_HPFCORNER_FREQ2_VAL;
// profileCfg.rxGain = PROFILE_HCC_0_RX_GAIN_VAL;
//
//
// /* Initialize the profile handles */
//
// memset ((void *)&profileHandle, 0, sizeof(MMWave_ProfileHandle));
//
// /* Adding Profiles to Control Handle */
// profileHandle = MMWave_addProfile(gMmwMCB.ctrlHandle, &profileCfg, &errCode);
//
// return 0;
//}
//static int32_t MmwDemo_CLIChirpCfg (int32_t argc, char* argv[])
//{
//// MMWave_ChirpHandle chirpHandle;
//
//// uint8_t numProfiles=1;
// uint32_t errCode;
// uint8_t index;
// uint8_t numChirps=2;
//
// /* Get RF frequency scale factor */
// double gHCC_mmwave_freq_scale_factor;
// memset ((void *)&gHCC_mmwave_freq_scale_factor, 0, sizeof(double));
// gHCC_mmwave_freq_scale_factor = SOC_getDeviceRFFreqScaleFactor(gMmwMCB.socHandle, &errCode);
// /* Sanity Check: Chirp configuration is valid only for the Frame or
// Advanced Frame Mode: */
// if ((gMmwMCB.cfg.ctrlCfg.dfeDataOutputMode != MMWave_DFEDataOutputMode_FRAME) &&
// (gMmwMCB.cfg.ctrlCfg.dfeDataOutputMode != MMWave_DFEDataOutputMode_ADVANCED_FRAME))
// {
// CLI_write ("Error: Configuration is valid only if the DFE Output Mode is Chirp\n");
// return -1;
// }
//
// /* Initialize the chirp configurations */
// rlChirpCfg_t chirpCfg[numChirps];
// for (index = 0; index < numChirps; index++)
// memset ((void *)&chirpCfg[index], 0, sizeof(rlChirpCfg_t));
//
// /* Populate the chirps from hard-coded configs */
// chirpCfg[0].chirpStartIdx = CHIRP_HCC_0_START_INDEX;
// chirpCfg[0].chirpEndIdx = CHIRP_HCC_0_END_INDEX;
// chirpCfg[0].profileId = CHIRP_HCC_0_PROFILE_ID;
// chirpCfg[0].startFreqVar = (uint32_t)((float)CHIRP_HCC_0_START_FREQ_VAL * (1U << 26) / (gHCC_mmwave_freq_scale_factor * 1e9));
// chirpCfg[0].freqSlopeVar = (uint16_t)((float)CHIRP_HCC_0_FREQ_SLOPE_VAL * (1U << 26) / ((gHCC_mmwave_freq_scale_factor * 1e6) * 900.0));
// chirpCfg[0].idleTimeVar = (uint32_t)((float)CHIRP_HCC_0_IDLE_TIME_VAL * 1000.0 / 10.0);
// chirpCfg[0].adcStartTimeVar = (uint32_t)((float)CHIRP_HCC_0_ADC_START_TIME_VAL * 1000.0 / 10.0);
// chirpCfg[0].txEnable = CHIRP_HCC_0_TX_CHANNEL;
//
// chirpCfg[1].chirpStartIdx = CHIRP_HCC_1_START_INDEX;
// chirpCfg[1].chirpEndIdx = CHIRP_HCC_1_END_INDEX;
// chirpCfg[1].profileId = CHIRP_HCC_1_PROFILE_ID;
// chirpCfg[1].startFreqVar = (uint32_t)((float)CHIRP_HCC_1_START_FREQ_VAL * (1U << 26) / (gHCC_mmwave_freq_scale_factor * 1e9));
// chirpCfg[1].freqSlopeVar = (uint16_t)((float)CHIRP_HCC_1_FREQ_SLOPE_VAL * (1U << 26) / ((gHCC_mmwave_freq_scale_factor * 1e6) * 900.0));
// chirpCfg[1].idleTimeVar = (uint32_t)((float)CHIRP_HCC_1_IDLE_TIME_VAL * 1000.0 / 10.0);
// chirpCfg[1].adcStartTimeVar = (uint32_t)((float)CHIRP_HCC_1_ADC_START_TIME_VAL * 1000.0 / 10.0);
// chirpCfg[1].txEnable = CHIRP_HCC_1_TX_CHANNEL;
//
// chirpCfg[2].chirpStartIdx = CHIRP_HCC_2_START_INDEX;
// chirpCfg[2].chirpEndIdx = CHIRP_HCC_2_END_INDEX;
// chirpCfg[2].profileId = CHIRP_HCC_2_PROFILE_ID;
// chirpCfg[2].startFreqVar = (uint32_t)((float)CHIRP_HCC_2_START_FREQ_VAL * (1U << 26) / (gHCC_mmwave_freq_scale_factor * 1e9));
// chirpCfg[2].freqSlopeVar = (uint16_t)((float)CHIRP_HCC_2_FREQ_SLOPE_VAL * (1U << 26) / ((gHCC_mmwave_freq_scale_factor * 1e6) * 900.0));
// chirpCfg[2].idleTimeVar = (uint32_t)((float)CHIRP_HCC_2_IDLE_TIME_VAL * 1000.0 / 10.0);
// chirpCfg[2].adcStartTimeVar = (uint32_t)((float)CHIRP_HCC_2_ADC_START_TIME_VAL * 1000.0 / 10.0);
// chirpCfg[2].txEnable = CHIRP_HCC_2_TX_CHANNEL;
//
//
// /* Initialize the chirp handles */
// MMWave_ChirpHandle chirpHandle[numChirps];
// for (index = 0; index < numChirps; index++)
// memset ((void *)&chirpHandle[index], 0, sizeof(MMWave_ChirpHandle));
//
// return 0;
//}
//static int32_t MmwDemo_CLIFrameCfg (int32_t argc, char* argv[])
//{
// rlFrameCfg_t frameCfg;
//// int32_t errCode;
//
// /* Sanity Check: Frame configuration is valid only for the Frame or
// Advanced Frame Mode: */
// if (gMmwMCB.cfg.ctrlCfg.dfeDataOutputMode != MMWave_DFEDataOutputMode_FRAME)
// {
// CLI_write ("Error: Configuration is valid only if the DFE Output Mode is Chirp\n");
// return -1;
// }
//
// /* Initialize the frame configuration: */
// memset ((void *)&frameCfg, 0, sizeof(rlFrameCfg_t));
//
// /* Populate the frame configuration: */
// frameCfg.chirpStartIdx = FRAME_HCC_CHIRP_START_INDEX;//atoi (argv[1]);
// frameCfg.chirpEndIdx = FRAME_HCC_CHIRP_END_INDEX;//atoi (argv[2]);
// frameCfg.numLoops = FRAME_HCC_NUM_LOOPS;//atoi (argv[3]);
// frameCfg.numFrames = FRAME_HCC_NUM_FRAMES;//atoi (argv[4]);
// frameCfg.framePeriodicity = (uint32_t)((float)FRAME_HCC_FRAME_PERIODICITY * 1000000 / 5);
// frameCfg.triggerSelect = FRAME_HCC_TRIGGER_SELECT;//atoi (argv[6]);
// frameCfg.frameTriggerDelay = (uint32_t)((float)FRAME_HCC_FRAME_TRIG_DELAY * 1000000 / 5);
//
// /* Save Configuration to use later */
// memcpy((void *)&gMmwMCB.cfg.ctrlCfg.u.frameCfg.frameCfg, (void *)&frameCfg, sizeof(rlFrameCfg_t));
// return 0;
//}
//static int32_t MmwDemo_CLIAdvFrameCfg ()
//{
// rlAdvFrameCfg_t advFrameCfg;
//
// /* Sanity Check: Frame configuration is valid only for the Frame or
// Advanced Frame Mode: */
// if (gMmwMCB.cfg.ctrlCfg.dfeDataOutputMode != MMWave_DFEDataOutputMode_ADVANCED_FRAME)
// {
// CLI_write ("Error: Configuration is valid only if the DFE Output Mode is Advanced Frame\n");
// return -1;
// }
//
// /* Initialize the frame configuration: */
// memset ((void *)&advFrameCfg, 0, sizeof(rlAdvFrameCfg_t));
//
// /* Populate the frame configuration: */
// advFrameCfg.frameSeq.numOfSubFrames = ADVFRAME_HCC_NUM_SUBFRAMES;//atoi (argv[1]);
// advFrameCfg.frameSeq.forceProfile = ADVFRAME_HCC_FORCE_PROFILE;//atoi (argv[2]);
// advFrameCfg.frameSeq.numFrames = ADVFRAME_HCC_NUM_FRAMES;//atoi (argv[3]);
// advFrameCfg.frameSeq.triggerSelect = ADVFRAME_HCC_TRIGGER_SELECT;//atoi (argv[4]);
// advFrameCfg.frameSeq.frameTrigDelay = (uint32_t)((float)ADVFRAME_HCC_FRAME_TRIG_DELAY * 1000000 / 5);
//
// /* Save Configuration to use later */
// memcpy ((void *)&gMmwMCB.cfg.ctrlCfg.u.advancedFrameCfg.frameCfg,
// (void *)&advFrameCfg, sizeof(rlAdvFrameCfg_t));
// return 0;
//}
//static int32_t MmwDemo_CLISubFrameCfg (int32_t argc, char* argv[])
//{
// rlSubFrameCfg_t subFrameCfg;
// uint8_t subFrameNum;
//
//
// /* Sanity Check: Sub Frame configuration is valid only for the Advanced Frame Mode: */
// if (gMmwMCB.cfg.ctrlCfg.dfeDataOutputMode != MMWave_DFEDataOutputMode_ADVANCED_FRAME)
// {
// CLI_write ("Error: Configuration is valid only if the DFE Output Mode is Advanced Frame\n");
// return -1;
// }
//
// /* Initialize the frame configuration: */
// memset ((void *)&subFrameCfg, 0, sizeof(rlSubFrameCfg_t));
//
// /* Populate the frame configuration: */
// subFrameNum = (uint8_t)SUBFRAME_HCC_0_NUMBER;//atoi (argv[1]);
// if (subFrameNum > gMmwMCB.cfg.ctrlCfg.u.advancedFrameCfg.frameCfg.frameSeq.numOfSubFrames)
// {
// CLI_write ("Error: Invalid subframe number.\n");
// return -1;
// }
// subFrameCfg.forceProfileIdx = SUBFRAME_HCC_0_FORCE_PROFILE_INDEX;//atoi (argv[2]);
// subFrameCfg.chirpStartIdx = SUBFRAME_HCC_0_CHIRP_START_INDEX;//atoi (argv[3]);
// subFrameCfg.numOfChirps = SUBFRAME_HCC_0_NUM_CHIRPS;//atoi (argv[4]);
// subFrameCfg.numLoops = SUBFRAME_HCC_0_NUM_LOOPS;//atoi (argv[5]);
// subFrameCfg.burstPeriodicity = (uint32_t)((float)SUBFRAME_HCC_0_BURST_PERIODICITY * 1000000 / 5);
// subFrameCfg.chirpStartIdxOffset = SUBFRAME_HCC_0_CHIRP_START_OFFSET;//atoi (argv[7]);
// subFrameCfg.numOfBurst = SUBFRAME_HCC_0_NUM_BURST;//atoi (argv[8]);
// subFrameCfg.numOfBurstLoops = SUBFRAME_HCC_0_NUM_BURST_LOOPS;//atoi (argv[9]);
// subFrameCfg.subFramePeriodicity = (uint32_t)((float)SUBFRAME_HCC_0_SUBFRAME_PERIODICITY * 1000000 / 5);
//
// /* Save Configuration to use later */
// memcpy((void *)&gMmwMCB.cfg.ctrlCfg.u.advancedFrameCfg.frameCfg.frameSeq.subFrameCfg[subFrameNum],
// (void *)&subFrameCfg, sizeof(rlSubFrameCfg_t));
// return 0;
//
//}
//static int32_t MmwDemo_CLILowPowerCfg (int32_t argc, char* argv[])
//{
// rlLowPowerModeCfg_t lowPowerCfg;
//
// /* Initialize the channel configuration: */
// memset ((void *)&lowPowerCfg, 0, sizeof(rlLowPowerModeCfg_t));
//
// /* Populate the channel configuration: */
// lowPowerCfg.lpAdcMode = LP_HCC_LOW_POWER_MODE;//atoi (argv[2]);
//
// /* Save Configuration to use later */
// memcpy((void *)&gMmwMCB.cfg.openCfg.lowPowerMode, (void *)&lowPowerCfg, sizeof(rlLowPowerModeCfg_t));
// return 0;
//}
static int32_t MmwDemo_CLISensorStart (int32_t argc, char* argv[])
{
bool doReconfig = true;
int32_t retVal = 0;
/* Only following command syntax will be supported
sensorStart
sensorStart 0
*/
// if (argc == 2)
// {
// doReconfig = false; //(bool) atoi (argv[1]);
//
// if (doReconfig == true)
// {
// CLI_write ("Error: Reconfig is not supported, only argument of 0 is\n"
// "(do not reconfig, just re-start the sensor) valid\n");
// return -1;
// }
// }
// else
// {
/* In case there is no argument for sensorStart, always do reconfig */
doReconfig = true;
// }
/***********************************************************************************
* Do sensor state management to influence the sensor actions
***********************************************************************************/
/* Error checking initial state */
if (gMmwMCB.sensorState == MmwDemo_SensorState_INIT)
{
MMWave_CtrlCfg ctrlCfg;
/* need to get number of sub-frames so that next function to check
* pending state can work */
CLI_getMMWaveExtensionConfig (&ctrlCfg);
gMmwMCB.dataPathObj.objDetCommonCfg.preStartCommonCfg.numSubFrames =
MmwDemo_RFParser_getNumSubFrames(&ctrlCfg);
if (MmwDemo_isAllCfgInPendingState() == 0)
{
CLI_write ("Error: Full configuration must be provided before sensor can be started "
"the first time\n");
/* Although not strictly needed, bring back to the initial value since we
* are rejecting this first time configuration, prevents misleading debug. */
gMmwMCB.dataPathObj.objDetCommonCfg.preStartCommonCfg.numSubFrames = 0;
return -1;
}
}
if (gMmwMCB.sensorState == MmwDemo_SensorState_STARTED)
{
CLI_write ("Ignored: Sensor is already started\n");
return 0;
}
if (doReconfig == false)
{
/* User intends to issue sensor start without config, check if no
config was issued after stop and generate error if this is the case. */
if (! MmwDemo_isAllCfgInNonPendingState())
{
/* Message user differently if all config was issued or partial config was
issued. */
if (MmwDemo_isAllCfgInPendingState())
{
CLI_write ("Error: You have provided complete new configuration, "
"issue \"sensorStart\" (without argument) if you want it to "
"take effect\n");
}
else
{
CLI_write ("Error: You have provided partial configuration between stop and this "
"command and partial configuration cannot be undone."
"Issue the full configuration and do \"sensorStart\" \n");
}
return -1;
}
}
else
{
/* User intends to issue sensor start with full config, check if all config
was issued after stop and generate error if is the case. */
if (MmwDemo_isAllCfgInPendingState() == 0)
{
/* Message user differently if no config was issued or partial config was
issued. */
if (MmwDemo_isAllCfgInNonPendingState())
{
CLI_write ("Error: You have provided no configuration, "
"issue \"sensorStart 0\" OR provide "
"full configuration and issue \"sensorStart\"\n");
}
else
{
CLI_write ("Error: You have provided partial configuration between stop and this "
"command and partial configuration cannot be undone."
"Issue the full configuration and do \"sensorStart\" \n");
}
return -1;
}
}
/***********************************************************************************
* Retreive and check mmwave Open related config before calling openSensor
***********************************************************************************/
/* Fill demo's MCB mmWave openCfg structure from the CLI configs*/
if (gMmwMCB.sensorState == MmwDemo_SensorState_INIT)
{
/* Get the open configuration: */
CLI_getMMWaveExtensionOpenConfig (&gMmwMCB.cfg.openCfg);
}
else
{
/* openCfg related configurations like chCfg, lowPowerMode, adcCfg
* are only used on the first sensor start. If they are different
* on a subsequent sensor start, then generate a fatal error
* so the user does not think that the new (changed) configuration
* takes effect, the board needs to be reboot for the new
* configuration to be applied.
*/
MMWave_OpenCfg openCfg;
CLI_getMMWaveExtensionOpenConfig (&openCfg);
/* Compare openCfg->chCfg*/
if(memcmp((void *)&gMmwMCB.cfg.openCfg.chCfg, (void *)&openCfg.chCfg,
sizeof(rlChanCfg_t)) != 0)
{
MmwDemo_debugAssert(0);
}
/* Compare openCfg->lowPowerMode*/
if(memcmp((void *)&gMmwMCB.cfg.openCfg.lowPowerMode, (void *)&openCfg.lowPowerMode,
sizeof(rlLowPowerModeCfg_t)) != 0)
{
MmwDemo_debugAssert(0);
}
/* Compare openCfg->adcOutCfg*/
if(memcmp((void *)&gMmwMCB.cfg.openCfg.adcOutCfg, (void *)&openCfg.adcOutCfg,
sizeof(rlAdcOutCfg_t)) != 0)
{
MmwDemo_debugAssert(0);
}
}
retVal = MmwDemo_openSensor(gMmwMCB.sensorState == MmwDemo_SensorState_INIT);
if(retVal != 0)
{
return -1;
}
/***********************************************************************************
* Retrieve mmwave Control related config before calling startSensor
***********************************************************************************/
/* Get the mmWave ctrlCfg from the CLI mmWave Extension */
if (doReconfig) {
CLI_getMMWaveExtensionConfig (&gMmwMCB.cfg.ctrlCfg);
retVal = MmwDemo_configSensor();
if(retVal != 0)
{
return -1;
}
}
retVal = MmwDemo_startSensor();
if(retVal != 0)
{
return -1;
}
/***********************************************************************************
* Set the state
***********************************************************************************/
gMmwMCB.sensorState = MmwDemo_SensorState_STARTED;
return 0;
}
/**
* @b Description
* @n
* This is the CLI Handler for the sensor stop command
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t MmwDemo_CLISensorStop (int32_t argc, char* argv[])
{
if ((gMmwMCB.sensorState == MmwDemo_SensorState_STOPPED) ||
(gMmwMCB.sensorState == MmwDemo_SensorState_INIT))
{
CLI_write ("Ignored: Sensor is already stopped\n");
return 0;
}
MmwDemo_stopSensor();
MmwDemo_resetStaticCfgPendingState();
gMmwMCB.sensorState = MmwDemo_SensorState_STOPPED;
return 0;
}
/**
* @b Description
* @n
* This is the CLI Handler for gui monitoring configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t MmwDemo_CLIGuiMonSel (int32_t argc, char* argv[])
{
MmwDemo_GuiMonSel guiMonSel;
int8_t subFrameNum=GUI_HCC_0_SUBFRAME_IDX;
// if(MmwDemo_CLIGetSubframe(argc, argv, 8, &subFrameNum) < 0)
// {
// return -1;
// }
/* Initialize the guiMonSel configuration: */
memset ((void *)&guiMonSel, 0, sizeof(MmwDemo_GuiMonSel));
/* Populate configuration: */
guiMonSel.detectedObjects = GUI_HCC_0_DETECTED_OBJECTS; //atoi (argv[2]);
guiMonSel.logMagRange = GUI_HCC_0_LOG_MAGNITUDE_RANGE;//atoi (argv[3]);
guiMonSel.noiseProfile = GUI_HCC_0_NOISE_PROFILE; //atoi (argv[4]);
guiMonSel.rangeAzimuthHeatMap = GUI_HCC_0_RANGE_AZIMUTH_MAP; //atoi (argv[5]);
guiMonSel.rangeDopplerHeatMap = GUI_HCC_0_RANGE_DOPPLER_MAP; //atoi (argv[6]);
guiMonSel.statsInfo = GUI_HCC_0_STATS_INFO; //atoi (argv[7]);
MmwDemo_CfgUpdate((void *)&guiMonSel, MMWDEMO_GUIMONSEL_OFFSET,sizeof(MmwDemo_GuiMonSel),subFrameNum);
return 0;
}
/**
* @b Description
* @n
* This is the CLI Handler for CFAR configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t MmwDemo_CLICfarCfg (int32_t argc, char* argv[])
{
DPU_CFARCAProc_CfarCfg cfarCfg;
uint32_t procDirection;
int8_t subFrameNum=CFAR_HCC_0_SUBFRAME_IDX;
/* Initialize configuration: */
memset ((void *)&cfarCfg, 0, sizeof(cfarCfg));
/* Initialize Processing Direction */
memset ((void *)&procDirection, 0, sizeof(uint32_t));
/* Initialize Subframe Index */
memset((void *)&subFrameNum, 0, sizeof(int8_t));
/* Populate configuration: */
subFrameNum = CFAR_HCC_0_SUBFRAME_IDX;
procDirection = CFAR_HCC_0_PROC_DIRECTION;
cfarCfg.averageMode = CFAR_HCC_0_MODE;
cfarCfg.winLen = CFAR_HCC_0_NOISE_WIN;
cfarCfg.guardLen = CFAR_HCC_0_GUARD_LEN;
cfarCfg.noiseDivShift = CFAR_HCC_0_DIV_SHIFT;
cfarCfg.cyclicMode = CFAR_HCC_0_CYCLIC_MODE;
cfarCfg.thresholdScale = (uint16_t) (CFAR_HCC_0_THRESHOLD_SCALE * MMWDEMO_CFAR_THRESHOLD_ENCODING_FACTOR);
cfarCfg.peakGroupingEn = CFAR_HCC_0_PEAK_GROUPING;
/* Save Configuration to use later */
// for (i = 0; i < numProf; i++){
if (procDirection == 0){
MmwDemo_CfgUpdate((void *)&cfarCfg, MMWDEMO_CFARCFGRANGE_OFFSET, sizeof(cfarCfg), subFrameNum);
}
else{
MmwDemo_CfgUpdate((void *)&cfarCfg, MMWDEMO_CFARCFGDOPPLER_OFFSET, sizeof(cfarCfg), subFrameNum);
}
// }
subFrameNum = CFAR_HCC_1_SUBFRAME_IDX;
procDirection = CFAR_HCC_1_PROC_DIRECTION;
cfarCfg.averageMode = CFAR_HCC_1_MODE;
cfarCfg.winLen = CFAR_HCC_1_NOISE_WIN;
cfarCfg.guardLen = CFAR_HCC_1_GUARD_LEN;
cfarCfg.noiseDivShift = CFAR_HCC_1_DIV_SHIFT;
cfarCfg.cyclicMode = CFAR_HCC_1_CYCLIC_MODE;
cfarCfg.thresholdScale = (uint16_t) (CFAR_HCC_1_THRESHOLD_SCALE * MMWDEMO_CFAR_THRESHOLD_ENCODING_FACTOR);
cfarCfg.peakGroupingEn = CFAR_HCC_1_PEAK_GROUPING;
if (procDirection == 0){
MmwDemo_CfgUpdate((void *)&cfarCfg, MMWDEMO_CFARCFGRANGE_OFFSET, sizeof(cfarCfg), subFrameNum);
}
else{
MmwDemo_CfgUpdate((void *)&cfarCfg, MMWDEMO_CFARCFGDOPPLER_OFFSET, sizeof(cfarCfg), subFrameNum);
}
return 0;
}
/**
* @b Description
* @n
* This is the CLI Handler for CFAR FOV (Field Of View) configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t MmwDemo_CLICfarFovCfg (int32_t argc, char* argv[])
{
DPU_CFARCAProc_FovCfg fovCfg;
uint32_t procDirection;
int8_t subFrameNum=CFAR_FOV_HCC_0_SUBFRAME_IDX;
/* Initialize configuration: */
memset ((void *)&fovCfg, 0, sizeof(fovCfg));
/* Initialize Processing Direction */
memset ((void *)&procDirection, 0, sizeof(uint32_t));
/* Initialize Subframe Index */
memset((void *)&subFrameNum, 0, sizeof(int8_t));
/* Populate configuration: */
procDirection = (uint32_t)CFAR_FOV_HCC_0_PROC_DIRECTION;// atoi (argv[2]);
fovCfg.min = (float)CFAR_FOV_HCC_0_MINIMUM;// atof (argv[3]);
fovCfg.max = (float)CFAR_FOV_HCC_0_MAXIMUM;// atof (argv[4]);
/* Save Configuration to use later */
if (procDirection == 0)
{
MmwDemo_CfgUpdate((void *)&fovCfg, MMWDEMO_FOVRANGE_OFFSET,
sizeof(fovCfg), subFrameNum);
}
else
{
MmwDemo_CfgUpdate((void *)&fovCfg, MMWDEMO_FOVDOPPLER_OFFSET,sizeof(fovCfg), subFrameNum);
}
procDirection = CFAR_FOV_HCC_1_PROC_DIRECTION;
fovCfg.min = CFAR_FOV_HCC_1_MINIMUM;
fovCfg.max = CFAR_FOV_HCC_1_MAXIMUM;
/* Save Configuration to use later */
if (procDirection == 0)
{
MmwDemo_CfgUpdate((void *)&fovCfg, MMWDEMO_FOVRANGE_OFFSET,
sizeof(fovCfg), subFrameNum);
}
else
{
MmwDemo_CfgUpdate((void *)&fovCfg, MMWDEMO_FOVDOPPLER_OFFSET,sizeof(fovCfg), subFrameNum);
}
return 0;
}
/**
* @b Description
* @n
* This is the CLI Handler for AoA FOV (Field Of View) configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t MmwDemo_CLIAoAFovCfg (int32_t argc, char* argv[])
{
DPU_AoAProc_FovAoaCfg fovCfg;
int8_t subFrameNum=AOAFOV_HCC_SUBFRAME_IDX;
/* Initialize configuration: */
memset ((void *)&fovCfg, 0, sizeof(fovCfg));
/* Populate configuration: */
fovCfg.minAzimuthDeg = (float)AOAFOV_HCC_MIN_AZIMUTH_DEG; // atoi (argv[2]);
fovCfg.maxAzimuthDeg = (float)AOAFOV_HCC_MAX_AZIMUTH_DEG; // atoi (argv[3]);
fovCfg.minElevationDeg = (float)AOAFOV_HCC_MIN_ELEVATION_DEG; // atoi (argv[4]);
fovCfg.maxElevationDeg = (float)AOAFOV_HCC_MAX_ELEVATION_DEG; // atoi (argv[5]);
/* Save Configuration to use later */
MmwDemo_CfgUpdate((void *)&fovCfg, MMWDEMO_FOVAOA_OFFSET,sizeof(fovCfg), subFrameNum);
return 0;
}
/**
* @b Description
* @n
* This is the CLI Handler for extended maximum velocity configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t MmwDemo_CLIExtendedMaxVelocity (int32_t argc, char* argv[])
{
DPU_AoAProc_ExtendedMaxVelocityCfg cfg;
int8_t subFrameNum=EXTENDMAXVELOCITY_HCC_SUBFRAME_IDX;
/* Initialize configuration: */
memset ((void *)&cfg, 0, sizeof(cfg));
/* Populate configuration: */
cfg.enabled = (uint8_t)EXTENDMAXVELOCITY_HCC_ENABLED;// atoi (argv[2]);
/* Save Configuration to use later */
MmwDemo_CfgUpdate((void *)&cfg, MMWDEMO_EXTMAXVEL_OFFSET,sizeof(cfg), subFrameNum);
return 0;
}
/**
* @b Description
* @n
* This is the CLI Handler for multi object beam forming configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t MmwDemo_CLIMultiObjBeamForming (int32_t argc, char* argv[])
{
DPU_AoAProc_MultiObjBeamFormingCfg cfg;
int8_t subFrameNum=MULTI_OBJ_BEAM_HCC_0_SUBFRAME_IDX;
/* Initialize configuration: */
memset ((void *)&cfg, 0, sizeof(cfg));
/* Populate configuration: */
cfg.enabled = (uint8_t)MULTI_OBJ_BEAM_HCC_0_ENABLED; // atoi (argv[2]);
cfg.multiPeakThrsScal = (float)MULTI_OBJ_BEAM_HCC_0_THRESHOLD; // atof (argv[3]);
/* Save Configuration to use later */
MmwDemo_CfgUpdate((void *)&cfg, MMWDEMO_MULTIOBJBEAMFORMING_OFFSET,sizeof(cfg), subFrameNum);
return 0;
}
/**
* @b Description
* @n
* This is the CLI Handler for DC range calibration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t MmwDemo_CLICalibDcRangeSig (int32_t argc, char* argv[])
{
DPU_RangeProc_CalibDcRangeSigCfg cfg;
uint32_t log2NumAvgChirps;
int8_t subFrameNum=CALIB_DC_RANGE_HCC_0_SUBFRAME_IDX;
/* Initialize configuration for DC range signature calibration */
memset ((void *)&cfg, 0, sizeof(cfg));
/* Populate configuration: */
cfg.enabled = (uint16_t)CALIB_DC_RANGE_HCC_0_ENABLED; // atoi (argv[2]);
cfg.negativeBinIdx = (int16_t)CALIB_DC_RANGE_HCC_0_NEG_BIN_IDX; // atoi (argv[3]);
cfg.positiveBinIdx = (int16_t)CALIB_DC_RANGE_HCC_0_POS_BIN_IDX; // atoi (argv[4]);
cfg.numAvgChirps = (uint16_t)CALIB_DC_RANGE_HCC_0_NUM_AVG; // atoi (argv[5]);
if (cfg.negativeBinIdx > 0)
{
CLI_write ("Error: Invalid negative bin index\n");
return -1;
}
if ((cfg.positiveBinIdx - cfg.negativeBinIdx + 1) > DPU_RANGEPROC_SIGNATURE_COMP_MAX_BIN_SIZE)
{
CLI_write ("Error: Number of bins exceeds the limit\n");
return -1;
}
log2NumAvgChirps = (uint32_t) mathUtils_ceilLog2(cfg.numAvgChirps);
if (cfg.numAvgChirps != (1U << log2NumAvgChirps))
{
CLI_write ("Error: Number of averaged chirps is not power of two\n");
return -1;
}
/* Save Configuration to use later */
MmwDemo_CfgUpdate((void *)&cfg, MMWDEMO_CALIBDCRANGESIG_OFFSET,
sizeof(cfg), subFrameNum);
return 0;
}
/**
* @b Description
* @n
* Clutter removal Configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t MmwDemo_CLIClutterRemoval (int32_t argc, char* argv[])
{
DPC_ObjectDetection_StaticClutterRemovalCfg_Base cfg;
int8_t subFrameNum=CLUTTER_HCC_SUBFRAME_IDX;
/* Initialize configuration for clutter removal */
memset ((void *)&cfg, 0, sizeof(cfg));
/* Populate configuration: */
cfg.enabled = CLUTTER_HCC_ENABLED; //(uint16_t) atoi (argv[2]);
/* Save Configuration to use later */
MmwDemo_CfgUpdate((void *)&cfg, MMWDEMO_STATICCLUTTERREMOFVAL_OFFSET,
sizeof(cfg), subFrameNum);
return 0;
}
/**
* @b Description
* @n
* This is the CLI Handler for data logger set command
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t MmwDemo_CLIADCBufCfg (int32_t argc, char* argv[])
{
MmwDemo_ADCBufCfg adcBufCfg;
int8_t subFrameNum=ADCBUF_HCC_SUBFRAME_IDX;
if (gMmwMCB.sensorState == MmwDemo_SensorState_STARTED)
{
CLI_write ("Ignored: This command is not allowed after sensor has started\n");
return 0;
}
/* Initialize the ADC Output configuration: */
memset ((void *)&adcBufCfg, 0, sizeof(adcBufCfg));
/* Populate configuration: */
adcBufCfg.adcFmt = ADCBUF_HCC_OUTPUT_FMT;//(uint8_t) atoi (argv[2]);
adcBufCfg.iqSwapSel = ADCBUF_HCC_SAMPLE_SWAP;//(uint8_t) atoi (argv[3]);
adcBufCfg.chInterleave = ADCBUF_HCC_CHAN_INTERLEAVE;//(uint8_t) atoi (argv[4]);
adcBufCfg.chirpThreshold = ADCBUF_HCC_CHIRP_THRESHOLD;//(uint8_t) atoi (argv[5]);
/* This demo is using HWA for 1D processing which does not allow multi-chirp
* processing */
if (adcBufCfg.chirpThreshold != 1)
{
CLI_write("Error: chirpThreshold must be 1, multi-chirp is not allowed\n");
return -1;
}
/* Save Configuration to use later */
MmwDemo_CfgUpdate((void *)&adcBufCfg,
MMWDEMO_ADCBUFCFG_OFFSET,
sizeof(MmwDemo_ADCBufCfg), subFrameNum);
return 0;
}
/**
* @b Description
* @n
* This is the CLI Handler for compensation of range bias and channel phase offsets
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t MmwDemo_CLICompRangeBiasAndRxChanPhaseCfg (int32_t argc, char* argv[])
{
DPU_AoAProc_compRxChannelBiasCfg cfg;
int32_t Re, Im;
int32_t argInd;
int32_t i;
char *compRange[] = {"compRangeBiasAndRxChanPhase", "0.0", "-1", "0", "1", "0", "-1", "0", "1", "0", "-1", "0", "1", "0", "-1", "0", "1", "0", "-1", "0", "1", "0", "-1", "0", "1", "0"};
/* Initialize configuration: */
memset ((void *)&cfg, 0, sizeof(cfg));
/* Populate configuration: */
cfg.rangeBias = COMPRANGEBIASANDRXCHANPHASE;
argInd = 2;
for (i=0; i < SYS_COMMON_NUM_TX_ANTENNAS*SYS_COMMON_NUM_RX_CHANNEL; i++)
{
Re = (int32_t) (atof (compRange[argInd++]) * 32768.);
MATHUTILS_SATURATE16(Re);
cfg.rxChPhaseComp[i].real = (int16_t) Re;
Im = (int32_t) (atof (compRange[argInd++]) * 32768.);
MATHUTILS_SATURATE16(Im);
cfg.rxChPhaseComp[i].imag = (int16_t) Im;
}
/* Save Configuration to use later */
memcpy((void *) &gMmwMCB.dataPathObj.objDetCommonCfg.preStartCommonCfg.compRxChanCfg, &cfg, sizeof(cfg));
gMmwMCB.dataPathObj.objDetCommonCfg.isCompRxChannelBiasCfgPending = 1;
return 0;
}
/**
* @b Description
* @n
* This is the CLI Handler for measurement configuration of range bias
* and channel phase offsets
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t MmwDemo_CLIMeasureRangeBiasAndRxChanPhaseCfg (int32_t argc, char* argv[])
{
DPC_ObjectDetection_MeasureRxChannelBiasCfg cfg;
/* Initialize configuration: */
memset ((void *)&cfg, 0, sizeof(cfg));
/* Populate configuration: */
cfg.enabled = (uint8_t) MEASURERANGEBIAS_HCC_ENABLED;//atoi (argv[1]);
cfg.targetDistance = (float)MEASURERANGEBIAS_HCC_TARGET_DIST;// atof (argv[2]);
cfg.searchWinSize = (float)MEASURERANGEBIAS_HCC_SEARCH_WIN;// atof (argv[3]);
/* Save Configuration to use later */
memcpy((void *) &gMmwMCB.dataPathObj.objDetCommonCfg.preStartCommonCfg.measureRxChannelBiasCfg,
&cfg, sizeof(cfg));
gMmwMCB.dataPathObj.objDetCommonCfg.isMeasureRxChannelBiasCfgPending = 1;
return 0;
}
static int32_t MmwDemo_CLIChirpQualityRxSatMonCfg (int32_t argc, char* argv[])
{
rlRxSatMonConf_t cqSatMonCfg;
if (gMmwMCB.sensorState == MmwDemo_SensorState_STARTED)
{
CLI_write ("Ignored: This command is not allowed after sensor has started\n");
return 0;
}
/* Initialize configuration: */
memset ((void *)&cqSatMonCfg, 0, sizeof(rlRxSatMonConf_t));
/* Populate configuration: */
cqSatMonCfg.profileIndx = (uint8_t)CQRXSAT_HCC_0_PROFILE_ID;// atoi (argv[1]);
if(cqSatMonCfg.profileIndx < RL_MAX_PROFILES_CNT)
{
cqSatMonCfg.satMonSel = CQRXSAT_HCC_0_SAT_MON_SEL;//(uint8_t) atoi (argv[2]);
cqSatMonCfg.primarySliceDuration = CQRXSAT_HCC_0_PRI_SLICE_DURATION;//(uint16_t) atoi (argv[3]);
cqSatMonCfg.numSlices = CQRXSAT_HCC_0_NUM_SLICES;//(uint16_t) atoi (argv[4]);
cqSatMonCfg.rxChannelMask = CQRXSAT_HCC_0_RX_CHAN_MASK;//(uint8_t) atoi (argv[5]);
/* Save Configuration to use later */
gMmwMCB.cqSatMonCfg[cqSatMonCfg.profileIndx] = cqSatMonCfg;
return 0;
}
else
{
return -1;
}
}
/**
* @b Description
* @n
* This is the CLI Handler for configuring CQ Singal & Image band monitor
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t MmwDemo_CLIChirpQualitySigImgMonCfg (int32_t argc, char* argv[])
{
rlSigImgMonConf_t cqSigImgMonCfg;
if (gMmwMCB.sensorState == MmwDemo_SensorState_STARTED)
{
CLI_write ("Ignored: This command is not allowed after sensor has started\n");
return 0;
}
/* Initialize configuration: */
memset ((void *)&cqSigImgMonCfg, 0, sizeof(rlSigImgMonConf_t));
/* Populate configuration: */
cqSigImgMonCfg.profileIndx = (uint8_t)CQSIGIMG_HCC_0_PROFILE_ID;// atoi (argv[1]);
if(cqSigImgMonCfg.profileIndx < RL_MAX_PROFILES_CNT)
{
cqSigImgMonCfg.numSlices = (uint8_t)CQSIGIMG_HCC_0_NUM_SLICES;// atoi (argv[2]);
cqSigImgMonCfg.timeSliceNumSamples = (uint16_t)CQSIGIMG_HCC_0_NUM_SAMPLE_PER_SLICE;// atoi (argv[3]);
/* Save Configuration to use later */
gMmwMCB.cqSigImgMonCfg[cqSigImgMonCfg.profileIndx] = cqSigImgMonCfg;
return 0;
}
else
{
return -1;
}
}
/**
* @b Description
* @n
* This is the CLI Handler for enabling analog monitors
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t MmwDemo_CLIAnalogMonitorCfg (int32_t argc, char* argv[])
{
if (gMmwMCB.sensorState == MmwDemo_SensorState_STARTED)
{
CLI_write ("Ignored: This command is not allowed after sensor has started\n");
return 0;
}
/* Save Configuration to use later */
gMmwMCB.anaMonCfg.rxSatMonEn = ANALOGMONITOR_HCC_RX_SATURATION;//atoi (argv[1]);
gMmwMCB.anaMonCfg.sigImgMonEn = ANALOGMONITOR_HCC_SIG_IMG_BAND;//atoi (argv[2]);
if ((gMmwMCB.anaMonCfg.rxSatMonEn == 1) ||
(gMmwMCB.anaMonCfg.sigImgMonEn == 1))
{
CLI_write("Error: Analog Monitoring is not supported on this device\n");
return -1;
}
gMmwMCB.isAnaMonCfgPending = 1;
return 0;
}
/**
* @b Description
* @n
* This is the CLI Handler for the High Speed Interface
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t MmwDemo_CLILvdsStreamCfg (int32_t argc, char* argv[])
{
MmwDemo_LvdsStreamCfg cfg;
int8_t subFrameNum=LVDSSTREAM_HCC_SUBFRAME_IDX;
if (gMmwMCB.sensorState == MmwDemo_SensorState_STARTED)
{
CLI_write ("Ignored: This command is not allowed after sensor has started\n");
return 0;
}
/* Initialize configuration for DC range signature calibration */
memset ((void *)&cfg, 0, sizeof(MmwDemo_LvdsStreamCfg));
/* Populate configuration: */
cfg.isHeaderEnabled = LVDSSTREAM_HCC_ENABLE_HEADER; //(bool) atoi(argv[2]);
cfg.dataFmt = LVDSSTREAM_HCC_DATA_FMT; //(uint8_t) atoi(argv[3]);
cfg.isSwEnabled = LVDSSTREAM_HCC_ENABLE_SW; //(bool) atoi(argv[4]);
if (cfg.dataFmt == MMW_DEMO_LVDS_STREAM_CFG_DATAFMT_CP_ADC_CQ)
{
CLI_write("Error: CP_ADC_CQ data format not supported\n");
return -1;
}
/* If both h/w and s/w are enabled, HSI header must be enabled, because
* we don't allow mixed h/w session without HSI header
* simultaneously with s/w session with HSI header (s/w session always
* streams HSI header) */
if ((cfg.isSwEnabled == true) && (cfg.dataFmt != MMW_DEMO_LVDS_STREAM_CFG_DATAFMT_DISABLED))
{
if (cfg.isHeaderEnabled == false)
{
CLI_write("Error: header must be enabled when both h/w and s/w streaming are enabled\n");
return -1;
}
}
/* Save Configuration to use later */
MmwDemo_CfgUpdate((void *)&cfg,MMWDEMO_LVDSSTREAMCFG_OFFSET,sizeof(MmwDemo_LvdsStreamCfg),subFrameNum);
return 0;
}
/**
* @b Description
* @n
* This is the CLI Handler for the version command
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* \ingroup CLI_UTIL_INTERNAL_FUNCTION
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
//static int32_t CLI_MMWaveVersion ()
//{
// extern rlVersion_t gDevVersion;
//
// /* print the platform */
//#ifdef SOC_XWR14XX
// CLI_write ("Platform : xWR14xx\n");
//#else
// CLI_write ("Platform : xWR16xx\n");
//#endif
//
// /* Display the version information on the CLI Console: */
// CLI_write ("mmWave SDK Version: %02d.%02d.%02d.%02d\n",
// MMWAVE_SDK_VERSION_MAJOR,
// MMWAVE_SDK_VERSION_MINOR,
// MMWAVE_SDK_VERSION_BUGFIX,
// MMWAVE_SDK_VERSION_BUILD);
// /* Display the version information */
// CLI_write ("RF H/W Version : %02d.%02d\n",
// gDevVersion.rf.hwMajor, gDevVersion.rf.hwMinor);
// CLI_write ("RF F/W Version : %02d.%02d.%02d.%02d.%02d.%02d.%02d\n",
// gDevVersion.rf.fwMajor, gDevVersion.rf.fwMinor, gDevVersion.rf.fwBuild, gDevVersion.rf.fwDebug,
// gDevVersion.rf.fwYear, gDevVersion.rf.fwMonth, gDevVersion.rf.fwDay);
// CLI_write ("mmWaveLink Version: %02d.%02d.%02d.%02d\n",
// gDevVersion.mmWaveLink.major, gDevVersion.mmWaveLink.minor,
// gDevVersion.mmWaveLink.build, gDevVersion.mmWaveLink.debug);
//
// /* Version string has been formatted successfully. */
// return 0;
//}
//-----------------------------------------------------------------------------------
/**
* @b Description
* @n
* Sensor Configuration Task which initializes the
* hard-coded chirp configurations for the sensor.
*
* @retval
* Not Applicable.
*/
//void mmwDemo_sensorConfig_task()
//{
// int32_t errCode;
// uint8_t index, numAdvSubframes;
//
// memset ((void *)&errCode, 0, sizeof(int32_t));
// memset ((void *)&index, 0, sizeof(uint8_t));
// memset ((void *)&numAdvSubframes, 0, sizeof(uint8_t));
//
// /* Get RF frequency scale factor */
// double gHCC_mmwave_freq_scale_factor;
// memset ((void *)&gHCC_mmwave_freq_scale_factor, 0, sizeof(double));
// gHCC_mmwave_freq_scale_factor = SOC_getDeviceRFFreqScaleFactor(gMmwMCB.socHandle, &errCode);
//
// /*****************************************************************************
// * Configuration :: Open Sensor
// *****************************************************************************/
// MmwDemo_CLISensorStop();
//
// /*****************************************************************************
// * Configuration :: Initializing Data Path Configurations hard coded
// *****************************************************************************/
// /* Call HCC helper functions to configure data path */
//
//// MmwDemo_Version ();
// MmwDemo_FlushCfg ();
// MmwDemo_ChannelCfg ();
// MmwDemo_LowPowerCfg ();
// MmwDemo_ADCCfg ();
//
// /* Call MMW Demo helper function to open sensor */
// if (MmwDemo_openSensor(true) < 0)
// printf("MmDemo_openSensor command returned an error.\n");
// else
// printf("Sensor was successfully opened.\n");
// /* Call MMW Demo helper function to configure sensor */
// printf("Sending configSensor command to EVM.\n");
// if (MmwDemo_configSensor() < 0)
// printf("MmwDemo_configSensor command returned an error.\n");
// else
// printf("Sensor was successfully configured.\n");
// MmwDemo_CLICfarCfg();
// MmwDemo_CLIMultiObjBeamForming();
// MmwDemo_CLIClutterRemoval();
// MmwDemo_CLICalibDcRangeSig();
// MmwDemo_CLIExtendedMaxVelocity();
// MmwDemo_CLILvdsStreamCfg();
// MmwDemo_CLICompRangeBiasAndRxChanPhaseCfg();
// MmwDemo_CLIMeasureRangeBiasAndRxChanPhaseCfg();
// MmwDemo_CLIChirpQualityRxSatMonCfg();
// MmwDemo_CLIChirpQualitySigImgMonCfg();
// MmwDemo_CLIAnalogMonitorCfg();
// MmwDemo_CLIAoAFovCfg();
// MmwDemo_CLICfarFovCfg();
// MmwDemo_CLISensorStart();
// MmwDemo_ProfileCfg ();
// MmwDemo_ChirpCfg ();
// MmwDemo_FrameCfg ();
// MmwDemo_DataOutputMode ();
// MmwDemo_CLIGuiMonSel();
// MmwDemo_CLIADCBufCfg();
//
// /* Configure Pre-Start Common Config */
//// gMmwMCB.objDetCommonCfg.preStartCommonCfg.numSubFrames = MmwDemo_RFParser_getNumSubFrames(&gMmwMCB.cfg.ctrlCfg);
// gMmwMCB.dataPathObj.objDetCommonCfg.preStartCommonCfg.numSubFrames = MmwDemo_RFParser_getNumSubFrames(&gMmwMCB.cfg.ctrlCfg);
// /*****************************************************************************
// * Deployment :: Configuring and Starting Sensor
// *****************************************************************************/
// /* Call MMW Demo helper function to configure sensor */
// printf("Sending configSensor command to EVM.\n");
// if (MmwDemo_configSensor() < 0)
// printf("MmwDemo_configSensor command returned an error.\n");
// else
// printf("Sensor was successfully configured.\n");
// /* Call MMW Demo helper function to start sensor */
// if (MmwDemo_startSensor() < 0)
// printf("MmDemo_startSensor command returned an error.\n");
// else
// printf("Hard Coded Configuration successfully sent to EVM.\n");
//
// return;
//}
//-----------------------------------------------------------------------------------
/**
* @b Description
* @n
* This is the CLI Execution Task
*
* @retval
* Not Applicable.
*/
void MmwDemo_CLIInit (uint8_t taskPriority)
{
CLI_Cfg cliCfg;
char demoBanner[256];
uint32_t cnt;
char demoPlatform[16];
/* Create Demo Banner to be printed out by CLI */
sprintf(&demoBanner[0],
"******************************************\n" \
"xWR64xx MMW Demo %02d.%02d.%02d.%02d\n" \
"******************************************\n",
MMWAVE_SDK_VERSION_MAJOR,
MMWAVE_SDK_VERSION_MINOR,
MMWAVE_SDK_VERSION_BUGFIX,
MMWAVE_SDK_VERSION_BUILD
);
/* Create Demo Platform string. This is needed so that this demo
corectly reports the 64xx platform.*/
#if defined(USE_2D_AOA_DPU)
sprintf(&demoPlatform[0], "xWR68xx_AOP");
#else
sprintf(&demoPlatform[0], "xWR64xx");
#endif
/* Initialize the CLI configuration: */
memset ((void *)&cliCfg, 0, sizeof(CLI_Cfg));
/* Populate the CLI configuration: */
cliCfg.cliPrompt = "mmwDemo:/>";
cliCfg.cliBanner = demoBanner;
cliCfg.cliUartHandle = gMmwMCB.commandUartHandle;
cliCfg.taskPriority = taskPriority;
cliCfg.socHandle = gMmwMCB.socHandle;
cliCfg.mmWaveHandle = gMmwMCB.ctrlHandle;
cliCfg.enableMMWaveExtension = 1U;
cliCfg.usePolledMode = true;
cliCfg.overridePlatform = true;
cliCfg.overridePlatformString = demoPlatform;
cnt=0;
cliCfg.tableEntry[cnt].cmd = "sensorStart";
cliCfg.tableEntry[cnt].helpString = "[doReconfig(optional, default:enabled)]";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLISensorStart;
cnt++;
cliCfg.tableEntry[cnt].cmd = "sensorStop";
cliCfg.tableEntry[cnt].helpString = "No arguments";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLISensorStop;
cnt++;
cliCfg.tableEntry[cnt].cmd = "guiMonitor";
cliCfg.tableEntry[cnt].helpString = "<subFrameIdx> <detectedObjects> <logMagRange> <noiseProfile> <rangeAzimuthHeatMap> <rangeDopplerHeatMap> <statsInfo>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLIGuiMonSel;
cnt++;
cliCfg.tableEntry[cnt].cmd = "cfarCfg";
cliCfg.tableEntry[cnt].helpString = "<subFrameIdx> <procDirection> <averageMode> <winLen> <guardLen> <noiseDiv> <cyclicMode> <thresholdScale> <peakGroupingEn>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLICfarCfg;
cnt++;
cliCfg.tableEntry[cnt].cmd = "multiObjBeamForming";
cliCfg.tableEntry[cnt].helpString = "<subFrameIdx> <enabled> <threshold>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLIMultiObjBeamForming;
cnt++;
cliCfg.tableEntry[cnt].cmd = "calibDcRangeSig";
cliCfg.tableEntry[cnt].helpString = "<subFrameIdx> <enabled> <negativeBinIdx> <positiveBinIdx> <numAvgFrames>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLICalibDcRangeSig;
cnt++;
cliCfg.tableEntry[cnt].cmd = "clutterRemoval";
cliCfg.tableEntry[cnt].helpString = "<subFrameIdx> <enabled>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLIClutterRemoval;
cnt++;
cliCfg.tableEntry[cnt].cmd = "adcbufCfg";
cliCfg.tableEntry[cnt].helpString = "<subFrameIdx> <adcOutputFmt> <SampleSwap> <ChanInterleave> <ChirpThreshold>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLIADCBufCfg;
cnt++;
cliCfg.tableEntry[cnt].cmd = "compRangeBiasAndRxChanPhase";
cliCfg.tableEntry[cnt].helpString = "<rangeBias> <Re00> <Im00> <Re01> <Im01> <Re02> <Im02> <Re03> <Im03> <Re10> <Im10> <Re11> <Im11> <Re12> <Im12> <Re13> <Im13> ";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLICompRangeBiasAndRxChanPhaseCfg;
cnt++;
cliCfg.tableEntry[cnt].cmd = "measureRangeBiasAndRxChanPhase";
cliCfg.tableEntry[cnt].helpString = "<enabled> <targetDistance> <searchWin>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLIMeasureRangeBiasAndRxChanPhaseCfg;
cnt++;
cliCfg.tableEntry[cnt].cmd = "aoaFovCfg";
cliCfg.tableEntry[cnt].helpString = "<subFrameIdx> <minAzimuthDeg> <maxAzimuthDeg> <minElevationDeg> <maxElevationDeg>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLIAoAFovCfg;
cnt++;
cliCfg.tableEntry[cnt].cmd = "cfarFovCfg";
cliCfg.tableEntry[cnt].helpString = "<subFrameIdx> <procDirection> <min (meters or m/s)> <max (meters or m/s)>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLICfarFovCfg;
cnt++;
cliCfg.tableEntry[cnt].cmd = "extendedMaxVelocity";
cliCfg.tableEntry[cnt].helpString = "<subFrameIdx> <enabled>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLIExtendedMaxVelocity;
cnt++;
cliCfg.tableEntry[cnt].cmd = "CQRxSatMonitor";
cliCfg.tableEntry[cnt].helpString = "<profile> <satMonSel> <priSliceDuration> <numSlices> <rxChanMask>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLIChirpQualityRxSatMonCfg;
cnt++;
cliCfg.tableEntry[cnt].cmd = "CQSigImgMonitor";
cliCfg.tableEntry[cnt].helpString = "<profile> <numSlices> <numSamplePerSlice>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLIChirpQualitySigImgMonCfg;
cnt++;
cliCfg.tableEntry[cnt].cmd = "analogMonitor";
cliCfg.tableEntry[cnt].helpString = "<rxSaturation> <sigImgBand>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLIAnalogMonitorCfg;
cnt++;
cliCfg.tableEntry[cnt].cmd = "lvdsStreamCfg";
cliCfg.tableEntry[cnt].helpString = "<subFrameIdx> <enableHeader> <dataFmt> <enableSW>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLILvdsStreamCfg;
cnt++;
/* Open the CLI: */
if (CLI_open (&cliCfg) < 0)
{
System_printf ("Error: Unable to open the CLI\n");
return;
}
System_printf ("Debug: CLI is operational\n");
return;
}