Other Parts Discussed in Thread: AWR2944
我是想自定义CLI 的 命令,所以尝试修改了channelCfg命令。
在ccs 工程中,MmwDemo_CLIInit 中 如下代码所示,比如channelCfg中没有,那不是在执行AWR2944_CLI_ByPassApi(&cliCfg);这个函数的时候,如果截图1所示 执行到channelCfg的时候,是不是就会去执行cli_mmwave.c文件中的CLI_MMWaveChannelCfg这个函数,如图2所示。
有几个问题想咨询一下:
1.比如我把channelCfg 换成testCfg ,在cli_mmwave.c文件中也将channelCfg 换成testCfg,对应的函数也进行函数名的修改,发现程序执行后发现channnelCfg中的TX enable 和 RXenable 都没有使能;程序报错,显示chirp config error;是不是channelCfg是CLI 的内部函数不能进行修改;
2.如果可以修改的话,除了cli_mmwave.c文件需要修改,哪些文件还需要修改;

图1

图2
void MmwDemo_CLIInit (uint8_t taskPriority)
{
CLI_Cfg cliCfg;
char demoBanner[256];
uint32_t cnt;
/* Create Demo Banner to be printed out by CLI */
// sprintf(&demoBanner[0],
// "******************************************\n" \
// "AWR294X MMW Demo %02d.%02d.%02d.%02d\n" \
// "******************************************\n",
// MMWAVE_SDK_VERSION_MAJOR,
// MMWAVE_SDK_VERSION_MINOR,
// MMWAVE_SDK_VERSION_BUGFIX,
// MMWAVE_SDK_VERSION_BUILD
// );
/* Initialize the CLI configuration: */
memset ((void *)&cliCfg, 0, sizeof(CLI_Cfg));
/* Populate the CLI configuration: */
cliCfg.cliPrompt = "mmwDemo:/>";
cliCfg.cliBanner = demoBanner;
cliCfg.cliUartHandle = gMmwMssMCB.commandUartHandle;
cliCfg.taskPriority = taskPriority;
cliCfg.mmWaveHandle = gMmwMssMCB.ctrlHandle;
cliCfg.enableMMWaveExtension = 1U;
cliCfg.usePolledMode = true;
cliCfg.overridePlatform = false;
cliCfg.overridePlatformString = "AWR294X";
#ifdef MMWDEMO_DDM
cliCfg.procChain = 1;
#else
cliCfg.procChain = 0;
#endif
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 = "aoaFovCfg";
cliCfg.tableEntry[cnt].helpString = "<subFrameIdx> <minAzimuthDeg> <maxAzimuthDeg> <minElevationDeg> <maxElevationDeg>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLIAoAFovCfg;
cnt++;
#ifdef MMWDEMO_TDM
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++;
#endif
cliCfg.tableEntry[cnt].cmd = "adcbufCfg";
cliCfg.tableEntry[cnt].helpString = "<subFrameIdx> <adcOutputFmt> <SampleSwap> <ChanInterleave> <ChirpThreshold>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLIADCBufCfg;
cnt++;
#ifdef MMWDEMO_TDM
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 = "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++;
#endif
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++;
cliCfg.tableEntry[cnt].cmd = "configDataPort";
cliCfg.tableEntry[cnt].helpString = "<baudrate> <ackPing>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLIConfigDataPort;
cnt++;
cliCfg.tableEntry[cnt].cmd = "queryDemoStatus";
cliCfg.tableEntry[cnt].helpString = "";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLIQueryDemoStatus;
cnt++;
#ifdef ENET_STREAM
cliCfg.tableEntry[cnt].cmd = "queryLocalIp";
cliCfg.tableEntry[cnt].helpString = "";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLIQueryLocalIp;
cnt++;
#endif
cliCfg.tableEntry[cnt].cmd = "calibData";
cliCfg.tableEntry[cnt].helpString = "<save enable> <restore enable> <Flash offset>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLICalibDataSaveRestore;
cnt++;
#ifdef ENET_STREAM
cliCfg.tableEntry[cnt].cmd = "enetStreamCfg";
cliCfg.tableEntry[cnt].helpString = "<isEnabled> <remoteIpD> <remoteIpC> <remoteIpB> <remoteIpA>"; /* Ip: D.C.B.A */
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLIEnetCfg;
cnt++;
#endif
#ifdef MMWDEMO_DDM
cliCfg.tableEntry[cnt].cmd = "compressionCfg";
cliCfg.tableEntry[cnt].helpString = "<subFrameIdx> <compressionRatio> <rangeBinsPerBlock> <compressionMethod>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLICompressionCfg;
cnt++;
cliCfg.tableEntry[cnt].cmd = "localMaxCfg";
cliCfg.tableEntry[cnt].helpString = "<subFrameIdx> <azimThreshdB> <dopplerThreshdB>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLILocalMaxCfg;
cnt++;
cliCfg.tableEntry[cnt].cmd = "intfMitigCfg";
cliCfg.tableEntry[cnt].helpString = "<subFrameIdx> <magSNRdB> <magDiffSNRdB>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLIIntfMitigCfg;
cnt++;
cliCfg.tableEntry[cnt].cmd = "antennaCalibParams";
cliCfg.tableEntry[cnt].helpString = "<I0> <Q0> .... <I11> <Q11>";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLIAntennaCalibParams;
cnt++;
#endif
cliCfg.tableEntry[cnt].cmd = "procChain";
cliCfg.tableEntry[cnt].helpString = "";
cliCfg.tableEntry[cnt].cmdHandlerFxn = MmwDemo_CLIProcChain;
cnt++;
/* Open the CLI: */
if (CLI_open (&cliCfg) < 0)
{
test_print ("Error: Unable to open the CLI\n");
return;
}
test_print ("Debug: CLI is operational\n");
#ifdef CLI_BYPASS
AWR2944_CLI_ByPassApi(&cliCfg);
test_print ("Debug: CLI is config\n");
#endif
return;
}
static int32_t AWR2944_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;
uint16_t countTemp = 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++)
{
// DebugP_log (" index = %d \n", index);
// DebugP_log ("cmd = %s \n", ptrCLICfg->tableEntry[index].cmd);
// DebugP_log ("helpString = %s \n", ptrCLICfg->tableEntry[index].helpString);
/* Do we have a valid entry? */
if (ptrCLICfg->tableEntry[index].cmd == NULL)
{
// DebugP_log (" index = %d \n", index);
// DebugP_log ("break\r\n\n");
/* 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*)gHardcodedCliConfigs[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)
{
// DebugP_log (" index = %d \n", index);
// DebugP_log ("cmd = %s \n", ptrCLICommandEntry->cmd);
//
// DebugP_log ("helpString = %s \n", ptrCLICommandEntry->helpString);
CLI_write("%d\n", index);
CLI_write("%s\n", gCLI.cfg.tableEntry[index].cmd);
/* YES: Pass this to the CLI registered function */
cliStatus = ptrCLICommandEntry->cmdHandlerFxn (argIndex, tokenizedArgs);
if (cliStatus == 0)
{
countTemp = countTemp + 1;
DebugP_log ("countTemp %d\r\n", countTemp);
DebugP_log ("Done\r\n\n");
}
else
{
DebugP_log ("Error %d\r\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;
}


