This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AWR1642BOOST: AWR1642Boost EVM

Part Number: AWR1642BOOST
Other Parts Discussed in Thread: SYSBIOS

I am currently trying to bypass the CLI while using the SRR. For this I am tying to introduce the "static int32_t CLI_ByPassApi(CLI_Cfg* ptrCLICfg)" instance to the code from the 'Object detection CAN'  - CLi.c

and i facing the errors mentioned below

>> Compilation failure
subdir_rules.mk:9: recipe for target 'mss_srr_cli.obj' failed
makefile:163: recipe for target 'all' failed
"../mss_srr_cli.c", line 472: warning #78-D: this declaration has no storage class or type specifier
"../mss_srr_cli.c", line 472: error #148: declaration is incompatible with "Srr_MSS_MCB gSrrMSSMCB" (declared at line 281 of "..\mss_srr.h")
"../mss_srr_cli.c", line 472: error #66: expected a ";"
"../mss_srr_cli.c", line 512: warning #12-D: parsing restarts here after previous syntax error
"../mss_srr_cli.c", line 513: error #171: expected a declaration
"../mss_srr_cli.c", line 546: warning #12-D: parsing restarts here after previous syntax error
"../mss_srr_cli.c", line 547: error #171: expected a declaration
"../mss_srr_cli.c", line 551: warning #12-D: parsing restarts here after previous syntax error
"../mss_srr_cli.c", line 554: error #171: expected a declaration
"../mss_srr_cli.c", line 594: warning #12-D: parsing restarts here after previous syntax error
"../mss_srr_cli.c", line 595: error #171: expected a declaration
"../mss_srr_cli.c", line 707: warning #12-D: parsing restarts here after previous syntax error
"../mss_srr_cli.c", line 118: warning #179-D: function "CLI_ByPassApi" was declared but never referenced

I have mentioned code below

/**************************************************************************
*************************** 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>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Event.h>
#include <ti/sysbios/knl/Semaphore.h>
#include <ti/sysbios/knl/Clock.h>
#include <ti/sysbios/heaps/HeapBuf.h>
#include <ti/sysbios/heaps/HeapMem.h>
#include <ti/sysbios/knl/Event.h>

/* mmWave SDK Include Files: */
#include <ti/common/sys_common.h>
#include <ti/drivers/uart/UART.h>
#include <ti/drivers/osal/DebugP.h>
#include <ti/control/mmwavelink/mmwavelink.h>
#include <ti/utils/cli/cli.h>
#include <ti/drivers/i2c/I2C.h>

/* Application Include Files: */
#include "mss_srr.h"
#include "../common/srr_config_consts.h"

/**********Define Cli_Bypass instance*****************/
CLI_Cfg cliCfg ;
#define CLI_BYPASS 1
#define MAX_RADAR_CMD
uint8_t* radarCmdString[MAX_RADAR_CMD] =
{
{"sensorStop \n\r"},
{"flushCfg \n\r"},
{"dfeDataOutputMode 1 \n\r"},
{"channelCfg 15 3 0 \n\r"},
{"adcCfg 2 1 \n\r"},
{"adcbufCfg -1 0 0 1 0 \n\r"},
{"profileCfg 0 77 7 7 58 0 0 68 1 256 5500 0 0 30 \n\r"},
{"chirpCfg 0 0 0 0 0 0 0 1 \n\r"},
{"chirpCfg 1 1 0 0 0 0 0 2 \n\r"},
{"bpmCfg -1 0 0 1 \n\r"},
{"frameCfg 0 1 32 0 100 1 0 \n\r"},
{"lowPower 0 1 \n\r"},
{"guiMonitor -1 1 1 1 0 0 1 \n\r"},
{"cfarCfg -1 0 2 8 4 4 0 5120 \n\r"},
{"cfarCfg -1 1 0 8 4 4 0 5120 \n\r"},
{"peakGrouping -1 1 0 0 1 224 \n\r"},
{"multiObjBeamForming -1 1 0.5 \n\r"},
{"calibDcRangeSig -1 0 -5 8 256 \n\r"},
{"extendedMaxVelocity -1 0 \n\r"},
{"clutterRemoval -1 0 \n\r"},
{"compRangeBiasAndRxChanPhase 0.0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 \n\r"},
{"measureRangeBiasAndRxChanPhase 0 1.5 0.2 \n\r"},
{"nearFieldCfg -1 0 0 0 \n\r"},
{"CQRxSatMonitor 0 3 4 127 0 \n\r"},
{"CQSigImgMonitor 0 63 8 \n\r"},
{"analogMonitor 1 1 \n\r"},
{"lvdsStreamCfg -1 0 0 0 \n\r"},
{"sensorStart \n\r"}
};

/**************************************************************************
*************************** Local Functions ******************************
**************************************************************************/
static int32_t SRR_MSS_CLISensorStart (int32_t argc, char* argv[]);
static int32_t SRR_MSS_CLISensorStop (int32_t argc, char* argv[]);
static int32_t SRR_MSS_CLIBasicCfg (int32_t argc, char* argv[]);
static int32_t SRR_MSS_CLIAdvancedFrameCfg (int32_t argc, char* argv[]);
void SRR_MSS_CLIInit (void);
static int32_t CLI_ByPassApi(CLI_Cfg* ptrCLICfg);
/**************************************************************************
****************************** CLI Functions *****************************
**************************************************************************/

/**
* @b Description
* @n
* This is the CLI Handler for starting the sensor
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t SRR_MSS_CLISensorStart (int32_t argc, char* argv[])
{
MMWave_CalibrationCfg calibrationCfg;
int32_t errCode;

if (gSrrMSSMCB.runningStatus == true)
{
/* Already running. */
return 0;
}
/* The sensor can only be started; if the link has been configured */
if (gSrrMSSMCB.cfgStatus == true)
{
/* Initialize the calibration configuration: */
memset ((void *)&calibrationCfg, 0, sizeof(MMWave_CalibrationCfg));

/* Populate the calibration configuration: */
calibrationCfg.dfeDataOutputMode =
MMWave_DFEDataOutputMode_ADVANCED_FRAME;
calibrationCfg.u.chirpCalibrationCfg.enableCalibration = true;
calibrationCfg.u.chirpCalibrationCfg.enablePeriodicity = true;
calibrationCfg.u.chirpCalibrationCfg.periodicTimeInFrames = 10U;

System_printf ("Debug: Sensor will start momentarily. \n");

/* Start the mmWave: */
if (MMWave_start (gSrrMSSMCB.ctrlHandle, &calibrationCfg, &errCode) < 0)
{
/* Error: Unable to start the mmWave control module */
System_printf ("Error: mmWave start failed [Error code %d]\n", errCode);
return -1;
}

gSrrMSSMCB.runningStatus = true;
return 0;
}
else
{
/* Invalid CLI use case; doing a sensor start without executing the basic or advanced configuration
* command. Inform the user and return an error code. */
System_printf ("Error: Please ensure that the XXXCfg CLI command is invoked before starting the sensor\n");
return -1;
}
}

/**
* @b Description
* @n
* This is the CLI Handler for stopping the sensor
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t SRR_MSS_CLISensorStop (int32_t argc, char* argv[])
{
int32_t errCode;

if (gSrrMSSMCB.runningStatus == false)
{
return 0; // Already stopped.
}

/* The sensor can only be stopped; if the link has been configured */
if (gSrrMSSMCB.cfgStatus == true)
{
/* Stop the sensor */
if (MMWave_stop (gSrrMSSMCB.ctrlHandle, &errCode) < 0)
{
/* Error: Unable to stop the mmWave control module */
System_printf ("Error: mmWave stop failed [Error code %d]\n", errCode);
return -1;
}
System_printf ("Debug: Sensor has been stopped\n");

/* The link is no longer configured. */
gSrrMSSMCB.runningStatus = true;
return 0;
}
else
{
/* Invalid CLI use case; doing a sensor stop multiple times. Inform the user and return an error code. */
System_printf ("Error: Sensor has already been stopped. Reconfigure and start the sensor if required\n");
return -1;
}
}

/**
* @b Description
* @n
* This is the CLI Handler for basic configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t SRR_MSS_CLIBasicCfg (int32_t argc, char* argv[])
{
MMWave_OpenCfg openCfg;
int32_t errCode;
rlProfileCfg_t profileCfg;
rlChirpCfg_t chirpCfg;
rlFrameCfg_t frameCfg;
int32_t retVal;

if (gSrrMSSMCB.cfgStatus == true)
{
/* Radar has already been configured. */
return 0;
}

/* Setup the calibration frequency: */
openCfg.freqLimitLow = 760U;
openCfg.freqLimitHigh = 810U;
openCfg.defaultAsyncEventHandler = MMWave_DefaultAsyncEventHandler_MSS;

/* Initialize the minimal configuration: */
Cfg_ChannelCfgInitParams (&openCfg.chCfg);
Cfg_LowPowerModeInitParams(&openCfg.lowPowerMode);
Cfg_ADCOutCfgInitParams (&openCfg.adcOutCfg);

/* Open the mmWave module: */
if (MMWave_open (gSrrMSSMCB.ctrlHandle, &openCfg, NULL, &errCode) < 0)
{
System_printf ("Error: MMWDemoMSS mmWave open configuration failed [Error code %d]\n", errCode);
return -1;
}

/********************************************************************************
* MMWave Link and BSS is operational now. In minimal mode we have access to all
* the mmWave Link API to perform the configuration
*
* Profile configuration:
********************************************************************************/
Cfg_ProfileCfgInitParams (0U, &profileCfg);
retVal = rlSetProfileConfig (RL_DEVICE_MAP_INTERNAL_BSS, 1U, &profileCfg);
if (retVal != RL_RET_CODE_OK)
{
System_printf ("Error: Unable to configure the profile [Error %d]\n", retVal);
return -1;
}

/********************************************************************************
* Chirp configuration:
********************************************************************************/
Cfg_ChirpCfgInitParams (0U, &chirpCfg);
retVal = rlSetChirpConfig(RL_DEVICE_MAP_INTERNAL_BSS, 1U, &chirpCfg);
if (retVal != RL_RET_CODE_OK)
{
System_printf ("Error: Unable to configure the chirp [Error %d]\n", retVal);
return -1;
}

/********************************************************************************
* Frame configuration:
********************************************************************************/
Cfg_FrameCfgInitParams (&frameCfg);
retVal = rlSetFrameConfig(RL_DEVICE_MAP_INTERNAL_BSS, &frameCfg);
if (retVal != RL_RET_CODE_OK)
{
System_printf ("Error: Unable to configure the frame [Error %d]\n", retVal);
return -1;
}

/* The link has been configured. */
gSrrMSSMCB.cfgStatus = true;
System_printf ("Debug: Basic configuration completed. Start the sensor...\n");
return 0;
}

/**
* @b Description
* @n
* This is the CLI Handler for advanced frame configuration
*
* @param[in] argc
* Number of arguments
* @param[in] argv
* Arguments
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
static int32_t SRR_MSS_CLIAdvancedFrameCfg (int32_t argc, char* argv[])
{
MMWave_OpenCfg openCfg;
int32_t errCode;
rlProfileCfg_t profileCfg;
rlChirpCfg_t chirpCfg;
rlAdvFrameCfg_t advFrameCfg;
int32_t retVal;
int32_t indx;

if (gSrrMSSMCB.cfgStatus == true)
{
/* Radar has already been configured. */
return 0;
}

/* Setup the calibration frequency: */
openCfg.freqLimitLow = 760U;
openCfg.freqLimitHigh = 810U;
openCfg.defaultAsyncEventHandler = MMWave_DefaultAsyncEventHandler_MSS;

/* Initialize the minimal configuration: */
Cfg_ChannelCfgInitParams (&openCfg.chCfg);
Cfg_LowPowerModeInitParams(&openCfg.lowPowerMode);
Cfg_ADCOutCfgInitParams (&openCfg.adcOutCfg);

/* Open the mmWave module: */
if (MMWave_open (gSrrMSSMCB.ctrlHandle, &openCfg, NULL, &errCode) < 0)
{
System_printf ("Error: MMWDemoMSS mmWave open configuration failed [Error code %d]\n", errCode);
return -1;
}


/********************************************************************************
* MMWave Link and BSS is operational now. In minimal mode we have access to all
* the mmWave Link API to perform the configuration
*
* Profile configurations:
********************************************************************************/
for (indx = 0; indx < NUM_PROFILES; indx++)
{

Cfg_ProfileCfgInitParams (indx, &profileCfg);
retVal = rlSetProfileConfig (RL_DEVICE_MAP_INTERNAL_BSS, 1U, &profileCfg);
if (retVal != RL_RET_CODE_OK)
{
System_printf ("Error: Unable to configure the profile %d [Error %d]\n", indx, retVal);
return -1;
}

}

/********************************************************************************
* Chirp configurations:
********************************************************************************/
for (indx = 0; indx < NUM_CHIRP_PROG; indx++)
{
Cfg_ChirpCfgInitParams (indx, &chirpCfg);
retVal = rlSetChirpConfig(RL_DEVICE_MAP_INTERNAL_BSS, 1U, &chirpCfg);
if (retVal != RL_RET_CODE_OK)
{
System_printf ("Error: Unable to configure chirp %d [Error %d]\n", indx, retVal);
return -1;
}
}


/* Advanced Frame configuration. */
Cfg_AdvFrameCfgInitParams (&advFrameCfg);
retVal = rlSetAdvFrameConfig(RL_DEVICE_MAP_INTERNAL_BSS, &advFrameCfg);
if (retVal != RL_RET_CODE_OK)
{
System_printf ("Error: Advanced Frame configuration failed [Error %d]\n", retVal);
return -1;
}

/* The link has been configured. */
gSrrMSSMCB.cfgStatus = true;
System_printf ("Debug: MMWave has been configured for SRR.\n");
return 0;
}

/**
* @b Description
* @n
* This is the CLI Execution Task
*
* @retval
* Not Applicable.
*/
void SRR_MSS_CLIInit (void)
{
CLI_Cfg cliCfg;

/* Initialize the CLI configuration: */
memset ((void *)&cliCfg, 0, sizeof(CLI_Cfg));

/* Populate the CLI configuration: */
cliCfg.cliPrompt = "SrrTIDesign:/>";
cliCfg.cliUartHandle = gSrrMSSMCB.commandUartHandle;
cliCfg.taskPriority = 3;
cliCfg.mmWaveHandle = gSrrMSSMCB.ctrlHandle;
cliCfg.enableMMWaveExtension = 0U;
cliCfg.usePolledMode = true;

cliCfg.tableEntry[0].cmd = "basicCfg";
cliCfg.tableEntry[0].helpString = "Basic Cfg [Hardcoded Parameters]";
cliCfg.tableEntry[0].cmdHandlerFxn = SRR_MSS_CLIBasicCfg;

cliCfg.tableEntry[1].cmd = "advFrameCfg";
cliCfg.tableEntry[1].helpString = "Advanced Frame Cfg [Hardcoded Parameters]";
cliCfg.tableEntry[1].cmdHandlerFxn = SRR_MSS_CLIAdvancedFrameCfg;

cliCfg.tableEntry[2].cmd = "sensorStart";
cliCfg.tableEntry[2].helpString = "Start the sensor; ensure that the configuration is completed";
cliCfg.tableEntry[2].cmdHandlerFxn = SRR_MSS_CLISensorStart;

cliCfg.tableEntry[3].cmd = "sensorStop";
cliCfg.tableEntry[3].helpString = "Stop the sensor";
cliCfg.tableEntry[3].cmdHandlerFxn = SRR_MSS_CLISensorStop;

/* Open the CLI: */
if (CLI_open (&cliCfg) < 0)
{
System_printf ("Error: Unable to open the CLI\n");
return;
}


}

/* The link is not configured. */
gSrrMSSMCB.cfgStatus = false
gSrrMSSMCB.runningStatus = false
gSrrMSSMCB.isMMWaveOpen = false
/*

static char *dummy[1];
int flag;
SRR_MSS_CLIBasicCfg(1, dummy);
SRR_MSS_CLIAdvancedFrameCfg(1, dummy);
flag = SRR_MSS_CLISensorStart(2, dummy);
if (flag){
System_printf ("\nSENSOR FAILED TO START\n");} else{System_printf ("\nSENSOR STARTED SUCCESSFULLY\n");}
return;*/
}

#ifdef CLI_BYPASS

static int32_t CLI_ByPassApi(CLI_Cfg* ptrCLICfg)
{
//uint8_t cmdString[128];
char* tokenizedArgs[CLI_MAX_ARGS];
char* ptrCLICommand;
char delimitter[] = " \r\n";
uint32_t argIndex;
CLI_CmdTableEntry* ptrCLICommandEntry;
int32_t cliStatus;
uint32_t index, idx;
uint16_t numCLICommands = 0U;

/* Sanity Check: Validate the arguments */
if (ptrCLICfg == NULL)
return -1;

/* Cycle through and determine the number of supported CLI commands: */
for (index = 0; index < CLI_MAX_CMD; index++)
{
/* Do we have a valid entry? */
if (ptrCLICfg->tableEntry[index].cmd == NULL)
{
/* NO: This is the last entry */
break;
}
else
{
/* YES: Increment the number of CLI commands */
numCLICommands = numCLICommands + 1;
}
}

/* Execute All Radar Commands */
for (idx = 0; idx < MAX_RADAR_CMD; idx++)
{
/* Reset all the tokenized arguments: */
memset ((void *)&tokenizedArgs, 0, sizeof(tokenizedArgs));
argIndex = 0;
ptrCLICommand = (char*)radarCmdString[idx];

/* Set the CLI status: */
cliStatus = -1;

/* The command has been entered we now tokenize the command message */
while (1)
{
/* Tokenize the arguments: */
tokenizedArgs[argIndex] = strtok(ptrCLICommand, delimitter);
if (tokenizedArgs[argIndex] == NULL)
break;

/* Increment the argument index: */
argIndex++;
if (argIndex >= CLI_MAX_ARGS)
break;

/* Reset the command string */
ptrCLICommand = NULL;
}

/* Were we able to tokenize the CLI command? */
if (argIndex == 0)
continue;

/* Cycle through all the registered CLI commands: */
for (index = 0; index < numCLICommands; index++)
{
ptrCLICommandEntry = &ptrCLICfg->tableEntry[index];

/* Do we have a match? */
if (strcmp(ptrCLICommandEntry->cmd, tokenizedArgs[0]) == 0)
{
/* YES: Pass this to the CLI registered function */
cliStatus = ptrCLICommandEntry->cmdHandlerFxn (argIndex, tokenizedArgs);
if (cliStatus == 0)
{
CLI_write ("Done\n");
}
else
{
CLI_write ("Error %d\n", cliStatus);
}
break;
}
}

/* Did we get a matching CLI command? */
if (index == numCLICommands)
{
/* NO matching command found. Is the mmWave extension enabled? */
if (ptrCLICfg->enableMMWaveExtension == 1U)
{
/* Yes: Pass this to the mmWave extension handler */
cliStatus = CLI_MMWaveExtensionHandler (argIndex, tokenizedArgs);
}

/* Was the CLI command found? */
if (cliStatus == -1)
{
/* No: The command was still not found */
CLI_write ("'%s' is not recognized as a CLI command\n", tokenizedArgs[0]);
}
}
}

return 0;
}

#endif

static void CLI_task(UArg arg0, UArg arg1)
{
#ifndef CLI_BYPASS
uint8_t cmdString[256];
char* tokenizedArgs[CLI_MAX_ARGS];
char* ptrCLICommand;
char delimitter[] = " \r\n";
uint32_t argIndex;
CLI_CmdTableEntry* ptrCLICommandEntry;
int32_t cliStatus;
uint32_t index;

/* Do we have a banner to be displayed? */
if (gCLI.cfg.cliBanner != NULL)
{
/* YES: Display the banner */
CLI_write (gCLI.cfg.cliBanner);
}

/* Loop around forever: */
while (1)
{
/* Demo Prompt: */
CLI_write (gCLI.cfg.cliPrompt);

/* Reset the command string: */
memset ((void *)&cmdString[0], 0, sizeof(cmdString));

/* Read the command message from the UART: */
UART_read (gCLI.cfg.cliUartHandle, &cmdString[0], (sizeof(cmdString) - 1));

/* Reset all the tokenized arguments: */
memset ((void *)&tokenizedArgs, 0, sizeof(tokenizedArgs));
argIndex = 0;
ptrCLICommand = (char*)&cmdString[0];

/* comment lines found - ignore the whole line*/
if (cmdString[0]=='%') {
CLI_write ("Skipped\n");
continue;
}

/* Set the CLI status: */
cliStatus = -1;

/* The command has been entered we now tokenize the command message */
while (1)
{
/* Tokenize the arguments: */
tokenizedArgs[argIndex] = strtok(ptrCLICommand, delimitter);
if (tokenizedArgs[argIndex] == NULL)
break;

/* Increment the argument index: */
argIndex++;
if (argIndex >= CLI_MAX_ARGS)
break;

/* Reset the command string */
ptrCLICommand = NULL;
}

/* Were we able to tokenize the CLI command? */
if (argIndex == 0)
continue;

/* Cycle through all the registered CLI commands: */
for (index = 0; index < gCLI.numCLICommands; index++)
{
ptrCLICommandEntry = &gCLI.cfg.tableEntry[index];

/* Do we have a match? */
if (strcmp(ptrCLICommandEntry->cmd, tokenizedArgs[0]) == 0)
{
/* YES: Pass this to the CLI registered function */
cliStatus = ptrCLICommandEntry->cmdHandlerFxn (argIndex, tokenizedArgs);
if (cliStatus == 0)
{
CLI_write ("Done\n");
}
else
{
CLI_write ("Error %d\n", cliStatus);
}
break;
}
}

/* Did we get a matching CLI command? */
if (index == gCLI.numCLICommands)
{
/* NO matching command found. Is the mmWave extension enabled? */
if (gCLI.cfg.enableMMWaveExtension == 1U)
{
/* Yes: Pass this to the mmWave extension handler */
cliStatus = CLI_MMWaveExtensionHandler (argIndex, tokenizedArgs);
}

/* Was the CLI command found? */
if (cliStatus == -1)
{
/* No: The command was still not found */
CLI_write ("'%s' is not recognized as a CLI command\n", tokenizedArgs[0]);
}
}
}
#else

CLI_ByPassApi(&gCLI.cfg);
#endif