firstone
This commit is contained in:
@@ -44,15 +44,6 @@ void MmwDemo_sleep(void)
|
|||||||
asm(" IDLE ");
|
asm(" IDLE ");
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t split(uint8_t *mes){
|
|
||||||
uint32_t i;
|
|
||||||
for(i = 0; i < BIG_MSG_SIZE; i++){
|
|
||||||
if(mes[i] == '\n') break;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t mboxWrite_ch0(uint8_t message, int32_t len)
|
static int32_t mboxWrite_ch0(uint8_t message, int32_t len)
|
||||||
{
|
{
|
||||||
@@ -85,9 +76,9 @@ static void mboxReadProc_ch0()
|
|||||||
{
|
{
|
||||||
Mailbox_readFlush (peerMailbox);
|
Mailbox_readFlush (peerMailbox);
|
||||||
id = message[1];
|
id = message[1];
|
||||||
if(message[0] == 0) {
|
if(message[0] == 1) {
|
||||||
ret = mboxWrite_ch0(buffer[id], 1);
|
ret = mboxWrite_ch0(buffer[id], 1);
|
||||||
} else if(message[0] == 1) {
|
} else if(message[0] == 0) {
|
||||||
buffer[id] = message[2];
|
buffer[id] = message[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,7 @@
|
|||||||
</toolChain>
|
</toolChain>
|
||||||
</folderInfo>
|
</folderInfo>
|
||||||
<sourceEntries>
|
<sourceEntries>
|
||||||
<entry excluding="src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||||
</sourceEntries>
|
</sourceEntries>
|
||||||
</configuration>
|
</configuration>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
@@ -291,7 +291,7 @@
|
|||||||
</toolChain>
|
</toolChain>
|
||||||
</folderInfo>
|
</folderInfo>
|
||||||
<sourceEntries>
|
<sourceEntries>
|
||||||
<entry excluding="src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||||
</sourceEntries>
|
</sourceEntries>
|
||||||
</configuration>
|
</configuration>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
|
|||||||
351
mmw_mss_16xx/mmwave_common.c
Normal file
351
mmw_mss_16xx/mmwave_common.c
Normal file
@@ -0,0 +1,351 @@
|
|||||||
|
/* Standard Include Files. */
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/* BIOS/XDC Include Files. */
|
||||||
|
#include <xdc/std.h>
|
||||||
|
#include <xdc/cfg/global.h>
|
||||||
|
#include <xdc/runtime/IHeap.h>
|
||||||
|
#include <xdc/runtime/System.h>
|
||||||
|
|
||||||
|
/* mmWave SK Include Files: */
|
||||||
|
#include <ti/common/sys_common.h>
|
||||||
|
#include <ti/drivers/mailbox/mailbox.h>
|
||||||
|
#include <ti/control/mmwave/mmwave.h>
|
||||||
|
#include <ti/drivers/crc/crc.h>
|
||||||
|
#include <ti/drivers/soc/soc.h>
|
||||||
|
#include <ti/drivers/osal/DebugP.h>
|
||||||
|
#include <ti/utils/testlogger/logger.h>
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
************************* Extern Declarations ****************************
|
||||||
|
**************************************************************************/
|
||||||
|
extern uint32_t gConfigDetected;
|
||||||
|
extern uint32_t gStartDetected;
|
||||||
|
extern uint32_t gStopDetected;
|
||||||
|
extern uint32_t gOpenDetected;
|
||||||
|
extern uint32_t gCloseDetected;
|
||||||
|
extern MMWave_Handle gMMWaveHandle;
|
||||||
|
|
||||||
|
#define CQ_NUM_SLICES 13U
|
||||||
|
#define MON_REPORT_MODE_PERIODIC_WITH_THRESHOLD_CHECK (2U)
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
************************* Common Test Functions **************************
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @b Description
|
||||||
|
* @n
|
||||||
|
* The function is used to populate the default open configuration.
|
||||||
|
*
|
||||||
|
* @param[out] ptrOpenCfg
|
||||||
|
* Pointer to the open configuration
|
||||||
|
*
|
||||||
|
* @retval
|
||||||
|
* Not applicable
|
||||||
|
*/
|
||||||
|
|
||||||
|
int32_t MonitoringEnable() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mmwave_populateDefaultOpenCfg (MMWave_OpenCfg* ptrOpenCfg)
|
||||||
|
{
|
||||||
|
/* Initialize the open configuration: */
|
||||||
|
memset ((void*)ptrOpenCfg, 0, sizeof(MMWave_OpenCfg));
|
||||||
|
|
||||||
|
/* Setup the frequency for calibrations. */
|
||||||
|
ptrOpenCfg->freqLimitLow = 760U;
|
||||||
|
ptrOpenCfg->freqLimitHigh = 810U;
|
||||||
|
|
||||||
|
ptrOpenCfg->defaultAsyncEventHandler = MMWave_DefaultAsyncEventHandler_MSS;
|
||||||
|
|
||||||
|
/* Enable start/stop async events */
|
||||||
|
ptrOpenCfg->disableFrameStartAsyncEvent = false;
|
||||||
|
ptrOpenCfg->disableFrameStopAsyncEvent = false;
|
||||||
|
|
||||||
|
/* Initialize the channel configuration: */
|
||||||
|
ptrOpenCfg->chCfg.rxChannelEn = 0xF;
|
||||||
|
ptrOpenCfg->chCfg.txChannelEn = 3;
|
||||||
|
ptrOpenCfg->chCfg.cascading = 0;
|
||||||
|
|
||||||
|
/* Initialize the low power mode configuration: */
|
||||||
|
ptrOpenCfg->lowPowerMode.lpAdcMode = 1;
|
||||||
|
|
||||||
|
/* Initialize the ADCOut configuration: */
|
||||||
|
ptrOpenCfg->adcOutCfg.fmt.b2AdcBits = 2;
|
||||||
|
ptrOpenCfg->adcOutCfg.fmt.b2AdcOutFmt = 2;
|
||||||
|
|
||||||
|
/* No custom calibration: */
|
||||||
|
ptrOpenCfg->useCustomCalibration = false;
|
||||||
|
ptrOpenCfg->customCalibrationEnableMask = 0x0;
|
||||||
|
|
||||||
|
/* calibration monitoring base time unit
|
||||||
|
* setting it to one frame duration as the test doesnt support any
|
||||||
|
* monitoring related functionality
|
||||||
|
*/
|
||||||
|
ptrOpenCfg->calibMonTimeUnit = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @b Description
|
||||||
|
* @n
|
||||||
|
* The function is used to test the usage of the mmWave Link API
|
||||||
|
* since we are testing minimal mode.
|
||||||
|
*
|
||||||
|
* @retval
|
||||||
|
* Not applicable
|
||||||
|
*/
|
||||||
|
int32_t Mmwave_testLinkAPI (void)
|
||||||
|
{
|
||||||
|
rlProfileCfg_t profileCfg;
|
||||||
|
rlChirpCfg_t chirpCfg;
|
||||||
|
rlFrameCfg_t frameCfg;
|
||||||
|
int32_t retVal;
|
||||||
|
|
||||||
|
/* Initialize the chirp configuration: */
|
||||||
|
memset ((void*)&profileCfg, 0, sizeof(rlProfileCfg_t));
|
||||||
|
|
||||||
|
/* Populate the profile configuration: */
|
||||||
|
profileCfg.profileId = 0;
|
||||||
|
profileCfg.startFreqConst = (uint32_t) ((float)77 * (1U << 26) / 3.6);
|
||||||
|
profileCfg.idleTimeConst = 20 * 1000 / 10;
|
||||||
|
profileCfg.adcStartTimeConst = 5 * 1000 / 10;
|
||||||
|
profileCfg.rampEndTime = 50 * 1000 /10;
|
||||||
|
profileCfg.txOutPowerBackoffCode = 0;
|
||||||
|
profileCfg.txPhaseShifter = 0;
|
||||||
|
profileCfg.freqSlopeConst = 20 * 1000 / 48;
|
||||||
|
profileCfg.txStartTime = 1 * 1000 / 10;
|
||||||
|
profileCfg.numAdcSamples = 256;
|
||||||
|
profileCfg.digOutSampleRate = 6000;
|
||||||
|
profileCfg.hpfCornerFreq1 = 0;
|
||||||
|
profileCfg.hpfCornerFreq2 = 0;
|
||||||
|
profileCfg.rxGain = 30;
|
||||||
|
|
||||||
|
/* Setup the profile configuration: */
|
||||||
|
retVal = rlSetProfileConfig (RL_DEVICE_MAP_INTERNAL_BSS, 1U, &profileCfg);
|
||||||
|
if (retVal != RL_RET_CODE_OK)
|
||||||
|
{
|
||||||
|
/* Error: Unable to configure the profile module */
|
||||||
|
System_printf ("Error: mmWave link profile configuration failed [Error code %d]\n", retVal);
|
||||||
|
|
||||||
|
/* Log into the MCPI Test Logger: */
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Initialize the chirp configuration: */
|
||||||
|
memset ((void*)&chirpCfg, 0, sizeof(rlChirpCfg_t));
|
||||||
|
|
||||||
|
/* Setup the chirp configuration: */
|
||||||
|
chirpCfg.chirpStartIdx = 0;
|
||||||
|
chirpCfg.chirpEndIdx = 0;
|
||||||
|
chirpCfg.profileId = 0;
|
||||||
|
chirpCfg.startFreqVar = 0;
|
||||||
|
chirpCfg.freqSlopeVar = 0;
|
||||||
|
chirpCfg.idleTimeVar = 0;
|
||||||
|
chirpCfg.adcStartTimeVar = 0;
|
||||||
|
chirpCfg.txEnable = 1;
|
||||||
|
|
||||||
|
/* Setup the chirp configuration: Using the mmWave Link API directly */
|
||||||
|
retVal = rlSetChirpConfig (RL_DEVICE_MAP_INTERNAL_BSS, 1U, &chirpCfg);
|
||||||
|
if (retVal != RL_RET_CODE_OK)
|
||||||
|
{
|
||||||
|
/* Error: Unable to configure the chirp module */
|
||||||
|
System_printf ("Error: mmWave link chirp configuration failed [Error code %d]\n", retVal);
|
||||||
|
|
||||||
|
/* Log into the MCPI Test Logger: */
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Initialize the frame configuration: */
|
||||||
|
memset ((void*)&frameCfg, 0, sizeof(rlFrameCfg_t));
|
||||||
|
|
||||||
|
/* Populate the frame configuration: */
|
||||||
|
frameCfg.chirpStartIdx = 0;
|
||||||
|
frameCfg.chirpEndIdx = 0;
|
||||||
|
frameCfg.numLoops = 128;
|
||||||
|
frameCfg.numFrames = 0; //infinity frames
|
||||||
|
frameCfg.numAdcSamples = 256;
|
||||||
|
frameCfg.framePeriodicity = 200 * 1000000 / 5; //period of frame 1 LSB = 5 ns
|
||||||
|
frameCfg.triggerSelect = 1;
|
||||||
|
frameCfg.frameTriggerDelay = 0; //period of frame 1 LSB = 5 ns
|
||||||
|
|
||||||
|
/* Setup the frame configuration: Using the mmWave Link API directly */
|
||||||
|
retVal = rlSetFrameConfig (RL_DEVICE_MAP_INTERNAL_BSS, &frameCfg);
|
||||||
|
if (retVal != RL_RET_CODE_OK)
|
||||||
|
{
|
||||||
|
/* Error: Unable to configure the chirp module */
|
||||||
|
System_printf ("Error: mmWave link frame configuration failed [Error code %d]\n", retVal);
|
||||||
|
|
||||||
|
/* Log into the MCPI Test Logger: */
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @b Description
|
||||||
|
* @n
|
||||||
|
* Registered event function which is invoked when an event from the
|
||||||
|
* BSS is received.
|
||||||
|
*
|
||||||
|
* @param[in] msgId
|
||||||
|
* Message Identifier
|
||||||
|
* @param[in] sbId
|
||||||
|
* Subblock identifier
|
||||||
|
* @param[in] sbLen
|
||||||
|
* Length of the subblock
|
||||||
|
* @param[in] payload
|
||||||
|
* Pointer to the payload buffer
|
||||||
|
*
|
||||||
|
* @retval
|
||||||
|
* Always return 0 to pass the event to the peer domain
|
||||||
|
*/
|
||||||
|
int32_t Mmwave_eventFxn(uint16_t msgId, uint16_t sbId, uint16_t sbLen, uint8_t *payload)
|
||||||
|
{
|
||||||
|
uint16_t asyncSB = RL_GET_SBID_FROM_UNIQ_SBID(sbId);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @b Description
|
||||||
|
* @n
|
||||||
|
* Application registered callback function which is invoked after the configuration
|
||||||
|
* has been used to configure the mmWave link and the BSS. This is applicable only for
|
||||||
|
* the XWR16xx. The BSS can be configured only by the MSS *or* DSS. The callback API is
|
||||||
|
* triggered on the remote execution domain (which did not configure the BSS).
|
||||||
|
*
|
||||||
|
* @param[in] ptrCtrlCfg
|
||||||
|
* Pointer to the control configuration
|
||||||
|
*
|
||||||
|
* @retval
|
||||||
|
* Not applicable
|
||||||
|
*/
|
||||||
|
void Mmwave_cfgFxn(MMWave_CtrlCfg* ptrCtrlCfg)
|
||||||
|
{
|
||||||
|
/* Error: We are executing the test in MINIMAL mode and so the callback function
|
||||||
|
* should never be invoked because in this mode the application is responsible
|
||||||
|
* for passing the configuration and not the mmWave module. */
|
||||||
|
/* Set the global flag to indicate that the function was invoked. */
|
||||||
|
gConfigDetected = 1;
|
||||||
|
|
||||||
|
/* Assertion: In MINIMAL mode this should never ever occur. */
|
||||||
|
DebugP_assert (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @b Description
|
||||||
|
* @n
|
||||||
|
* Application registered callback function which is invoked the mmWave link on BSS
|
||||||
|
* has been started. This is applicable only for the XWR16xx. The BSS can be configured
|
||||||
|
* only by the MSS *or* DSS. The callback API is triggered on the remote execution
|
||||||
|
* domain (which did not configure the BSS)
|
||||||
|
*
|
||||||
|
* @retval
|
||||||
|
* Not applicable
|
||||||
|
*/
|
||||||
|
void Mmwave_startFxn(MMWave_CalibrationCfg* ptrCalibrationCfg)
|
||||||
|
{
|
||||||
|
/* Set the flag to indicate the start has been detected */
|
||||||
|
gStartDetected = 1U;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @b Description
|
||||||
|
* @n
|
||||||
|
* Application registered callback function which is invoked the mmWave link on BSS
|
||||||
|
* has been stopped. This is applicable only for the XWR16xx. The BSS can be configured
|
||||||
|
* only by the MSS *or* DSS. The callback API is triggered on the remote execution
|
||||||
|
* domain (which did not configure the BSS)
|
||||||
|
*
|
||||||
|
* @retval
|
||||||
|
* Not applicable
|
||||||
|
*/
|
||||||
|
void Mmwave_stopFxn(void)
|
||||||
|
{
|
||||||
|
/* Set the flag to indicate the stop has been detected */
|
||||||
|
System_printf("stop0");
|
||||||
|
gStopDetected = 1U;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @b Description
|
||||||
|
* @n
|
||||||
|
* Application registered callback function which is invoked after the mmWave
|
||||||
|
* module has been opened.
|
||||||
|
*
|
||||||
|
* @param[in] ptrOpenCfg
|
||||||
|
* Pointer to the open configuration
|
||||||
|
*
|
||||||
|
* @retval
|
||||||
|
* Not applicable
|
||||||
|
*/
|
||||||
|
void Mmwave_openFxn (MMWave_OpenCfg* ptrOpenCfg)
|
||||||
|
{
|
||||||
|
System_printf("open0");
|
||||||
|
MMWave_OpenCfg defaultOpenCfg;
|
||||||
|
|
||||||
|
/* Get the default open configuration */
|
||||||
|
Mmwave_populateDefaultOpenCfg (&defaultOpenCfg);
|
||||||
|
|
||||||
|
/* Compare the default with the received configuration: */
|
||||||
|
if (memcmp ((void *)&defaultOpenCfg, (void *)ptrOpenCfg, sizeof(MMWave_OpenCfg)) != 0)
|
||||||
|
{
|
||||||
|
/* Error: There is a mismatch in the open configuration */
|
||||||
|
System_printf ("Error: Mismatch in the open configuration\n");
|
||||||
|
DebugP_assert (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the flag to indicate that the open has been detected */
|
||||||
|
gOpenDetected = 1U;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @b Description
|
||||||
|
* @n
|
||||||
|
* Application registered callback function which is invoked after the mmWave
|
||||||
|
* module has been closed.
|
||||||
|
*
|
||||||
|
* @retval
|
||||||
|
* Not applicable
|
||||||
|
*/
|
||||||
|
void Mmwave_closeFxn (void)
|
||||||
|
{
|
||||||
|
/* Set the flag to indicate that the close has been detected */
|
||||||
|
gCloseDetected = 1U;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @b Description
|
||||||
|
* @n
|
||||||
|
* The task is used to provide an execution context for the mmWave
|
||||||
|
* control task
|
||||||
|
*
|
||||||
|
* @retval
|
||||||
|
* Not Applicable.
|
||||||
|
*/
|
||||||
|
void Mmwave_ctrlTask(UArg arg0, UArg arg1)
|
||||||
|
{
|
||||||
|
int32_t errCode;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
/* Execute the mmWave control module: */
|
||||||
|
if (MMWave_execute (gMMWaveHandle, &errCode) < 0)
|
||||||
|
System_printf ("Error: mmWave control execution failed [Error code %d]\n", errCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -38,6 +38,32 @@
|
|||||||
#include <ti/drivers/pinmux/pinmux.h>
|
#include <ti/drivers/pinmux/pinmux.h>
|
||||||
#include <ti/drivers/osal/MemoryP.h>
|
#include <ti/drivers/osal/MemoryP.h>
|
||||||
#include <ti/utils/testlogger/logger.h>
|
#include <ti/utils/testlogger/logger.h>
|
||||||
|
/* Global Variable: The variable detects if the configuration has been
|
||||||
|
* detected or not. */
|
||||||
|
uint32_t gConfigDetected = 0U;
|
||||||
|
|
||||||
|
/* Global Variable: The variable detects if the start has been
|
||||||
|
* detected or not. */
|
||||||
|
uint32_t gStartDetected = 0U;
|
||||||
|
|
||||||
|
/* Global Variable: The variable detects if the start has been
|
||||||
|
* detected or not. */
|
||||||
|
uint32_t gStopDetected = 0U;
|
||||||
|
|
||||||
|
/* Global Variable: The variable detects if the open has been
|
||||||
|
* detected or not. */
|
||||||
|
uint32_t gOpenDetected = 0U;
|
||||||
|
|
||||||
|
/* Global Variable: The variable detects if the close has been
|
||||||
|
* detected or not. */
|
||||||
|
uint32_t gCloseDetected = 0U;
|
||||||
|
|
||||||
|
/* Global Variable: This is the handle to the mmWave module */
|
||||||
|
MMWave_Handle gMMWaveHandle;
|
||||||
|
|
||||||
|
/* Global Variable: The variable detects the test selection as entered on the MSS */
|
||||||
|
int32_t gTestSelection;
|
||||||
|
|
||||||
SOC_Handle socHandle;
|
SOC_Handle socHandle;
|
||||||
Event_Handle event;
|
Event_Handle event;
|
||||||
uint8_t period = 0;
|
uint8_t period = 0;
|
||||||
@@ -49,6 +75,7 @@ uint8_t id = 0;
|
|||||||
uint8_t metka = 0;
|
uint8_t metka = 0;
|
||||||
|
|
||||||
UART_Handle handle;
|
UART_Handle handle;
|
||||||
|
MMWave_Handle handleMMwave;
|
||||||
|
|
||||||
UInt eventMask1 = Event_Id_00;
|
UInt eventMask1 = Event_Id_00;
|
||||||
UInt eventMask2 = Event_Id_01;
|
UInt eventMask2 = Event_Id_01;
|
||||||
@@ -95,12 +122,16 @@ Mbox_Handle peerMailbox;
|
|||||||
#define BIG_MSG_SIZE 3
|
#define BIG_MSG_SIZE 3
|
||||||
|
|
||||||
volatile uint8_t mboxProcToken = 0;
|
volatile uint8_t mboxProcToken = 0;
|
||||||
|
extern void Mmwave_populateDefaultOpenCfg (MMWave_OpenCfg* ptrOpenCfg);
|
||||||
//void MmwDemo_sleep(void)
|
extern int32_t Mmwave_testLinkAPI (void);
|
||||||
//{
|
extern int32_t Mmwave_eventFxn(uint16_t msgId, uint16_t sbId, uint16_t sbLen, uint8_t *payload);
|
||||||
// /* issue WFI (Wait For Interrupt) instruction */
|
extern void Mmwave_cfgFxn(MMWave_CtrlCfg* ptrCtrlCfg);
|
||||||
// asm(" IDLE ");
|
extern void Mmwave_startFxn(MMWave_CalibrationCfg* ptrCalibrationCfg);
|
||||||
//}
|
extern void Mmwave_stopFxn(void);
|
||||||
|
extern void Mmwave_openFxn (MMWave_OpenCfg* ptrOpenCfg);
|
||||||
|
extern void Mmwave_closeFxn (void);
|
||||||
|
extern void Mmwave_ctrlTask(UArg arg0, UArg arg1);
|
||||||
|
extern int32_t MonitoringEnable();
|
||||||
|
|
||||||
static int32_t mboxWrite_ch0(uint8_t *message, int32_t len)
|
static int32_t mboxWrite_ch0(uint8_t *message, int32_t len)
|
||||||
{
|
{
|
||||||
@@ -132,11 +163,30 @@ static void mboxReadProc_ch0()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Mailbox_readFlush (peerMailbox);
|
Mailbox_readFlush (peerMailbox);
|
||||||
UART_write(handle, "\n", 1);
|
int i;
|
||||||
System_printf("%d\n", mes);
|
if(mes/100 > 0) {
|
||||||
UART_write(handle, &mes, 1);
|
i = 3;
|
||||||
UART_write(handle, "\n", 1);
|
} else if((mes - (mes / 100) * 100) / 10 > 0) {
|
||||||
|
i = 2;
|
||||||
|
} else {
|
||||||
|
i = 1;
|
||||||
|
}
|
||||||
|
char str[i];
|
||||||
|
if(i == 3) {
|
||||||
|
str[0] = '0' + mes / 100;
|
||||||
|
mes = mes - (mes / 100) * 100;
|
||||||
|
str[1] = '0' + mes / 10;
|
||||||
|
mes = mes - (mes / 10) * 10;
|
||||||
|
str[2] = '0' + mes;
|
||||||
|
} else if(i == 2) {
|
||||||
|
str[0] = '0' + mes / 10;
|
||||||
|
mes = mes - (mes / 10) * 10;
|
||||||
|
str[1] = '0' + mes;
|
||||||
|
} else {
|
||||||
|
str[0] = '0' + mes;
|
||||||
|
}
|
||||||
|
CLI_write(str);
|
||||||
|
CLI_write("\n");
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
System_printf ("Error: Mailbox send message failed \n");
|
System_printf ("Error: Mailbox send message failed \n");
|
||||||
@@ -150,7 +200,7 @@ static void mboxReadProc_ch0()
|
|||||||
void mboxCallback_ch0 (Mbox_Handle handle, Mailbox_Type peer)
|
void mboxCallback_ch0 (Mbox_Handle handle, Mailbox_Type peer)
|
||||||
{
|
{
|
||||||
/* Message has been received from the peer endpoint. */
|
/* Message has been received from the peer endpoint. */
|
||||||
// mboxReadProc_ch0();
|
// mboxReadProc_ch0();
|
||||||
mboxProcToken = 1;
|
mboxProcToken = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,12 +217,33 @@ void mBox(UArg a0, UArg a1)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t SetVal(int32_t argc, char* argv[])
|
||||||
|
{
|
||||||
|
uint8_t message[BIG_MSG_SIZE];
|
||||||
|
message[0] = 0;
|
||||||
|
int id = atoi(argv[1]);
|
||||||
|
int value = atoi(argv[2]);
|
||||||
|
if((value > 255) || (id > 128)) return -1;
|
||||||
|
message[1] = (uint8_t)atoi(argv[1]);
|
||||||
|
message[2] = (uint8_t)atoi(argv[2]);
|
||||||
|
mboxWrite_ch0(message, BIG_MSG_SIZE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Get(int32_t argc, char* argv[])
|
||||||
|
{
|
||||||
|
uint8_t message[BIG_MSG_SIZE];
|
||||||
|
message[0] = 1;
|
||||||
|
int id = atoi(argv[1]);
|
||||||
|
if(id > 128) return -1;
|
||||||
|
message[1] = (uint8_t)atoi(argv[1]);
|
||||||
|
mboxWrite_ch0(message, BIG_MSG_SIZE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void Work_UART(UArg arg0, UArg arg1)
|
void Work_UART(UArg arg0, UArg arg1)
|
||||||
{
|
{
|
||||||
uint8_t index[128];
|
|
||||||
uint8_t message[BIG_MSG_SIZE];
|
|
||||||
UART_Params params;
|
UART_Params params;
|
||||||
uint8_t len;
|
|
||||||
|
|
||||||
/* Setup the default UART Parameters */
|
/* Setup the default UART Parameters */
|
||||||
UART_Params_init(¶ms);
|
UART_Params_init(¶ms);
|
||||||
@@ -189,76 +260,156 @@ void Work_UART(UArg arg0, UArg arg1)
|
|||||||
printf("Error: Unable to open the UART Instance\n");
|
printf("Error: Unable to open the UART Instance\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
while(TRUE)
|
void init_mmWave() {
|
||||||
|
MMWave_InitCfg initCfg;
|
||||||
|
Task_Params taskParams;
|
||||||
|
MMWave_CalibrationCfg calibrationCfg;
|
||||||
|
MMWave_OpenCfg openCfg;
|
||||||
|
int32_t errCode;
|
||||||
|
/* Initialize the configuration: */
|
||||||
|
memset ((void *)&initCfg, 0, sizeof(MMWave_InitCfg));
|
||||||
|
memset ((void *)&calibrationCfg, 0, sizeof(MMWave_CalibrationCfg));
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* [Isolation Mode]: MSS executes the mmWave link
|
||||||
|
***********************************************************************/
|
||||||
|
initCfg.domain = MMWave_Domain_MSS;
|
||||||
|
initCfg.socHandle = socHandle;
|
||||||
|
initCfg.eventFxn = Mmwave_eventFxn;
|
||||||
|
initCfg.cfgMode = MMWave_ConfigurationMode_MINIMAL;
|
||||||
|
initCfg.executionMode = MMWave_ExecutionMode_ISOLATION;
|
||||||
|
initCfg.linkCRCCfg.useCRCDriver = 1U;
|
||||||
|
initCfg.linkCRCCfg.crcChannel = CRC_Channel_CH1;
|
||||||
|
|
||||||
|
/* Initialize and setup the mmWave Control module */
|
||||||
|
gMMWaveHandle = MMWave_init (&initCfg, &errCode);
|
||||||
|
if (gMMWaveHandle == NULL)
|
||||||
{
|
{
|
||||||
len = UART_read(handle, index, sizeof(index)/sizeof(uint8_t)) - 1;
|
/* Error: Unable to initialize the mmWave control module */
|
||||||
if(len <= 13)
|
System_printf ("Error: mmWave Control Initialization failed [Error code %d]\n", errCode);
|
||||||
{
|
|
||||||
if(memcmp(index, "Get ID ", 7) == 0)
|
/* Log into the MCPI Test Logger: */
|
||||||
{
|
return;
|
||||||
int i;
|
|
||||||
for(i = 7; i < len; i++)
|
|
||||||
{
|
|
||||||
if(index[i] >= '0' && index[i] <= '9')
|
|
||||||
{
|
|
||||||
id_buf = id_buf * 10 + (index[i] - '0');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
message[0] = 0;
|
|
||||||
id = id_buf;
|
|
||||||
id_buf = 0;
|
|
||||||
message[1] = id;
|
|
||||||
mboxWrite_ch0(message, BIG_MSG_SIZE);
|
|
||||||
}
|
|
||||||
else if(memcmp(index, "Set ", 4) == 0)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
int pointer = 0;
|
|
||||||
for(i = 4; i < len; i++)
|
|
||||||
{
|
|
||||||
if(index[i] >= '0' && index[i] <= '9')
|
|
||||||
{
|
|
||||||
value_buf = value_buf * 10 + (index[i] - '0');
|
|
||||||
} else if(index[i] == 'I') {
|
|
||||||
pointer = i;
|
|
||||||
value = value_buf;
|
|
||||||
value_buf = 0;
|
|
||||||
message[2] = value;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(memcmp(index, " ID ", 4)) {
|
|
||||||
int i;
|
|
||||||
for(i = pointer + 2; i < len; i++)
|
|
||||||
{
|
|
||||||
if(index[i] >= '0' && index[i] <= '9')
|
|
||||||
{
|
|
||||||
id_buf = id_buf * 10 + (index[i] - '0');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
id = id_buf;
|
|
||||||
id_buf = 0;
|
|
||||||
message[0] = 1;
|
|
||||||
message[1] = id;
|
|
||||||
mboxWrite_ch0(message, BIG_MSG_SIZE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
UART_write(handle, "\nError\n", 7);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
/******************************************************************************
|
||||||
|
* TEST: Synchronization
|
||||||
|
* - The synchronization API always needs to be invoked [Irrespective of the
|
||||||
|
* mode]
|
||||||
|
******************************************************************************/
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
int32_t syncStatus;
|
||||||
|
|
||||||
|
/* Get the synchronization status: */
|
||||||
|
syncStatus = MMWave_sync (gMMWaveHandle, &errCode);
|
||||||
|
if (syncStatus < 0)
|
||||||
|
{
|
||||||
|
/* Error: Unable to synchronize the mmWave control module */
|
||||||
|
System_printf ("Error: mmWave Control Synchronization failed [Error code %d]\n", errCode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (syncStatus == 1)
|
||||||
|
{
|
||||||
|
/* Synchronization acheived: */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* Sleep and poll again: */
|
||||||
|
Task_sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* Launch the mmWave control execution task
|
||||||
|
* - This should have a higher priroity than any other task which uses the
|
||||||
|
* mmWave control API
|
||||||
|
*****************************************************************************/
|
||||||
|
Task_Params_init(&taskParams);
|
||||||
|
taskParams.priority = 6;
|
||||||
|
taskParams.stackSize = 4*1024;
|
||||||
|
Task_create(Mmwave_ctrlTask, &taskParams, NULL);
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* [Isolation Mode]: MSS executes the mmWave link
|
||||||
|
***********************************************************************/
|
||||||
|
Mmwave_populateDefaultOpenCfg (&openCfg);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Open the mmWave:
|
||||||
|
************************************************************************/
|
||||||
|
if (MMWave_open (gMMWaveHandle, &openCfg, NULL, &errCode) < 0)
|
||||||
|
{
|
||||||
|
/* Error: Unable to configure the mmWave control module */
|
||||||
|
System_printf ("Error: mmWave open failed [Error code %d]\n", errCode);
|
||||||
|
int16_t mmWaveError;
|
||||||
|
int16_t subSysError;
|
||||||
|
MMWave_ErrorLevel errorLevel;
|
||||||
|
MMWave_decodeError(errCode, &errorLevel, &mmWaveError, &subSysError);
|
||||||
|
System_printf ("Error Level: %s mmWave: %d Subsys: %d\n",
|
||||||
|
(errorLevel == MMWave_ErrorLevel_ERROR) ? "Error" : "Warning",
|
||||||
|
mmWaveError, subSysError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Minimal Mode: We can now call the mmWave Link API to perform the
|
||||||
|
* profile/chirp/frame configuration. This is just an illustration
|
||||||
|
************************************************************************/
|
||||||
|
if (Mmwave_testLinkAPI () < 0){
|
||||||
|
System_printf("Error: Link Api failed\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (MonitoringEnable() != 0){
|
||||||
|
System_printf("Error: temperature monitoring failed\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if (GPADCMonitoringEnable() != 0){
|
||||||
|
System_printf("Error: Gpadc monitoring failed\n");
|
||||||
|
return;
|
||||||
|
}*/
|
||||||
|
/* Populate the calibration configuration: */
|
||||||
|
calibrationCfg.dfeDataOutputMode = MMWave_DFEDataOutputMode_FRAME;
|
||||||
|
calibrationCfg.u.chirpCalibrationCfg.enableCalibration = true;
|
||||||
|
calibrationCfg.u.chirpCalibrationCfg.enablePeriodicity = true;
|
||||||
|
calibrationCfg.u.chirpCalibrationCfg.periodicTimeInFrames = 10U;
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Start the mmWave:
|
||||||
|
************************************************************************/
|
||||||
|
if (MMWave_start (gMMWaveHandle, &calibrationCfg, &errCode) < 0)
|
||||||
|
{
|
||||||
|
/* Error: Unable to configure the mmWave control module */
|
||||||
|
System_printf ("Error: mmWave start failed [Error code %d]\n", errCode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/**************************************************************************
|
||||||
|
************************** Extern Definitions ****************************
|
||||||
|
**************************************************************************/
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int32_t MmwDemo_mssMmwaveEventCallbackFxn(uint16_t msgId, uint16_t sbId, uint16_t sbLen, uint8_t *payload){
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void InitTask(UArg arg0, UArg arg1)
|
static void InitTask(UArg arg0, UArg arg1)
|
||||||
{
|
{
|
||||||
Task_Params taskParamsUART;
|
|
||||||
Task_Params taskParams;
|
Task_Params taskParams;
|
||||||
int32_t errCode;
|
int32_t errCode;
|
||||||
Mailbox_Config cfg;
|
Mailbox_Config cfg;
|
||||||
|
|
||||||
|
CLI_Cfg cliCfg;
|
||||||
|
|
||||||
|
/* Initialize the UART */
|
||||||
|
UART_init();
|
||||||
|
|
||||||
Mailbox_init(MAILBOX_TYPE_MSS);
|
Mailbox_init(MAILBOX_TYPE_MSS);
|
||||||
|
|
||||||
if(Mailbox_Config_init(&cfg) < 0)
|
if(Mailbox_Config_init(&cfg) < 0)
|
||||||
{
|
{
|
||||||
System_printf ("Error: Mailbox init failed\n");
|
System_printf ("Error: Mailbox init failed\n");
|
||||||
@@ -279,34 +430,58 @@ static void InitTask(UArg arg0, UArg arg1)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the UART */
|
|
||||||
UART_init();
|
|
||||||
|
|
||||||
/* Test the GPIO Output: Configure pin K13 as GPIO_2 output */
|
|
||||||
|
|
||||||
/* Setup the PINMUX to bring out the MSS UART-1 */
|
/* Setup the PINMUX to bring out the MSS UART-1 */
|
||||||
Pinmux_Set_FuncSel(SOC_XWR16XX_PINN5_PADBE, SOC_XWR16XX_PINN5_PADBE_MSS_UARTA_TX);
|
Pinmux_Set_FuncSel(SOC_XWR16XX_PINN5_PADBE, SOC_XWR16XX_PINN5_PADBE_MSS_UARTA_TX);
|
||||||
Pinmux_Set_OverrideCtrl(SOC_XWR16XX_PINN5_PADBE, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
|
Pinmux_Set_OverrideCtrl(SOC_XWR16XX_PINN5_PADBE, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
|
||||||
Pinmux_Set_FuncSel(SOC_XWR16XX_PINN4_PADBD, SOC_XWR16XX_PINN4_PADBD_MSS_UARTA_RX);
|
Pinmux_Set_FuncSel(SOC_XWR16XX_PINN4_PADBD, SOC_XWR16XX_PINN4_PADBD_MSS_UARTA_RX);
|
||||||
Pinmux_Set_OverrideCtrl(SOC_XWR16XX_PINN4_PADBD, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
|
Pinmux_Set_OverrideCtrl(SOC_XWR16XX_PINN4_PADBD, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
|
||||||
|
|
||||||
/* Initialize the Task Parameters. */
|
Work_UART(0,0);
|
||||||
Task_Params_init(&taskParamsUART);
|
|
||||||
taskParamsUART.stackSize = 4*1024;
|
/* Initialize the CLI configuration: */
|
||||||
taskParamsUART.priority = 3;
|
memset ((void *)&cliCfg, 0, sizeof(CLI_Cfg));
|
||||||
Task_create(Work_UART, &taskParamsUART, NULL);
|
|
||||||
|
init_mmWave();
|
||||||
|
|
||||||
|
cliCfg.cliPrompt = "mmwDemo:/>";
|
||||||
|
cliCfg.cliUartHandle = handle;
|
||||||
|
cliCfg.taskPriority = 3;
|
||||||
|
cliCfg.socHandle = socHandle;
|
||||||
|
cliCfg.mmWaveHandle = gMMWaveHandle;
|
||||||
|
cliCfg.enableMMWaveExtension = 0U;
|
||||||
|
cliCfg.usePolledMode = true;
|
||||||
|
|
||||||
|
cliCfg.tableEntry[0].cmd = "set";
|
||||||
|
cliCfg.tableEntry[0].helpString = "Set val and ID to buffer";
|
||||||
|
cliCfg.tableEntry[0].cmdHandlerFxn = SetVal;
|
||||||
|
|
||||||
|
cliCfg.tableEntry[1].cmd = "get";
|
||||||
|
cliCfg.tableEntry[1].helpString = "Get ID from buffer";
|
||||||
|
cliCfg.tableEntry[1].cmdHandlerFxn = Get;
|
||||||
|
|
||||||
|
// Open the CLI:
|
||||||
|
|
||||||
|
errCode = CLI_open (&cliCfg);
|
||||||
|
if (errCode < 0)
|
||||||
|
{
|
||||||
|
System_printf ("Error: Unable to open the CLI: %d\n", errCode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
System_printf ("Debug: CLI is operational\n");
|
||||||
|
|
||||||
/* Initialize the Task Parameters Mailbox. */
|
/* Initialize the Task Parameters Mailbox. */
|
||||||
Task_Params_init(&taskParams);
|
Task_Params_init(&taskParams);
|
||||||
taskParams.priority = 2;
|
taskParams.priority = 2;
|
||||||
taskParams.stackSize = 3 * 1024;
|
taskParams.stackSize = 1 * 1024;
|
||||||
Task_create(mBox, &taskParams, NULL);
|
Task_create(mBox, &taskParams, NULL);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main (void)
|
int main (void)
|
||||||
{
|
{
|
||||||
|
|
||||||
int32_t errCode;
|
int32_t errCode;
|
||||||
Task_Params taskParams;
|
Task_Params taskParams;
|
||||||
SOC_Cfg socCfg;
|
SOC_Cfg socCfg;
|
||||||
@@ -337,7 +512,8 @@ int main (void)
|
|||||||
|
|
||||||
/* Initialize the Task Parameters. */
|
/* Initialize the Task Parameters. */
|
||||||
Task_Params_init(&taskParams);
|
Task_Params_init(&taskParams);
|
||||||
taskParams.stackSize = 2*1024;
|
taskParams.priority = 3;
|
||||||
|
taskParams.stackSize = 5*1024;
|
||||||
Task_create(InitTask, &taskParams, NULL);
|
Task_create(InitTask, &taskParams, NULL);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user