TI-radar AWR1843 ARM-Cortex R4F core  1
mss_main.c File Reference
#include <stdint.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <xdc/std.h>
#include <xdc/cfg/global.h>
#include <xdc/runtime/IHeap.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/Memory.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/family/arm/v7a/Pmu.h>
#include <ti/sysbios/family/arm/v7r/vim/Hwi.h>
#include <ti/control/mmwavelink/mmwavelink.h>
#include <ti/control/mmwave/mmwave.h>
#include <ti/control/mmwavelink/include/rl_driver.h>
#include <ti/common/sys_common.h>
#include <ti/drivers/soc/soc.h>
#include <ti/drivers/esm/esm.h>
#include <ti/drivers/crc/crc.h>
#include <ti/drivers/uart/UART.h>
#include <ti/drivers/gpio/gpio.h>
#include <ti/drivers/mailbox/mailbox.h>
#include <ti/drivers/pinmux/include/pinmux_xwr18xx.h>
#include <ti/drivers/osal/DebugP.h>
#include <ti/drivers/canfd/canfd.h>
#include <ti/drivers/pinmux/pinmux.h>
#include <ti/drivers/cbuff/cbuff.h>
#include <ti/utils/testlogger/logger.h>
#include <ti/utils/cli/cli.h>
#include "common/mmw_messages.h"
#include "common/mmWave_XSS.h"
#include <common/app_cfg.h>
Include dependency graph for mss_main.c:

Go to the source code of this file.

Macros

#define TASK_PRIO_1   1
 
#define TASK_PRIO_2   2
 
#define TASK_PRIO_3   3
 
#define TASK_PRIO_4   4
 
#define TASK_PRIO_5   5
 
#define TASK_PRIO_6   6
 

Functions

static void MSS_mmWaveInitTASK (UArg arg0, UArg arg1)
 Initialize the MCPI Log Message Buffer. More...
 
static void MSS_mmWaveConfigCallbackFxn (MMWave_CtrlCfg *ptrCtrlCfg)
 This is the application registered callback function which is invoked after the configuration has been used to configure the mmWave link and the BSS. More...
 
static void MSS_chirpIntCallback (uintptr_t arg)
 This is the callback function registered with the ADC Driver which is invoked when a chirp is available. This is executed in the ISR context which is registered to the listener function listenerFxn; defined within SOC_SysIntListenerCfg. Hence; In our design, there's no frame segmentation (Advanced Frame Configuration) (in other words, frame := 1 sub-frame). However, advanced frame configuration will allow the use of different subframes in the radar configuration to support and meet the requirements of different ranges: i.e ultra-short, short, medium, long ranges. Accordingly, different subframes results in different chirp sizes which is totally depending on the each sub-frameType. Therefore, It's important to identify this for each sub-frame before the start of the next subframe, at the end of the previous subframes last chirp. More...
 
static void MSS_mmWaveStartCallbackFxn (MMWave_CalibrationCfg *ptrCalibrationCfg)
 Application registered callback function which is invoked on the peer domain just before the mmWave link is started on the BSS. More...
 
static void MSS_mmWaveStopCallbackFxn (void)
 This is the application registered callback function which is invoked after the MSS has been stopped. Hence, possible sceanarios: More...
 
static void MSS_frameStartIntCallback (uintptr_t arg)
 This is the callback function registered with the ADC Driver which is invoked when a frame is started. This is executed in the ISR context which is registered to the listener function listenerFxn; defined within SOC_SysIntListenerCfg Inside the function we Check if the frames are coming correctly, and no chirps have been missed. More...
 
static void MSS_mmWaveCtrlTask (UArg arg0, UArg arg1)
 This is the task which provides an execution context for the mmWave control module. More...
 
static void MSS_mmWaveOpenCallbackFxn (MMWave_OpenCfg *ptrOpenCfg)
 This is the application registered callback function which is invoked after the MSS has been opened. More...
 
static void MSS_mmWaveCloseCallbackFxn (void)
 This is the application registered callback function which is invoked after the MSS has been closed. More...
 
static int32_t MSS_eventFxn (uint16_t msgId, uint16_t sbId, uint16_t sbLen, uint8_t *payload)
 This is a registered event function which is invoked when an event is recieved from the BSS. This event is passed to the peer domain/core BSS. More...
 
static void mboxCallbackFxn_MSS_ch0 (Mbox_Handle handle, Mailbox_Type peer)
 mboxCallbackFxn_MSS_ch0 is a callback function. Function is invoked for each received messege from the DSS peer endpoint. When invoked, release the resources and wakeup the mmWave thread to process the received message. Hence: the address of this function is passed to mboxCfg.readCallback More...
 
static void mboxIn_uartOut_TASK (UArg arg0, UArg arg1)
 The Task is used to handle the recieved messages from the DSS Peer over the mailbox virtual communication channel. More...
 
int32_t MSS_mboxWrite (mmWaveMSG *msg)
 
int32_t main (void)
 Main Program entrypoint. This is the entrypoint for the MSS firmware which describe the startup sequence for the AWR1843 application running on top of MSS. The MSS application must have the following startup sequence at bootup time. Clear all the ESM group errors and register Disable the firewall for JTAG and LOGGER (UART) Start the BIOS and further initialize required peripherals. More...
 

Variables

MCB gMCB
 gMCB structure contains the tracking information required by the design is aligned using DATA_ALIGN paragma to increase the performance of MSS core by aligning the structure gMCB (Master Control Block) to be divisable by 16. More...
 

Macro Definition Documentation

◆ TASK_PRIO_1

#define TASK_PRIO_1   1

Definition at line 76 of file mss_main.c.

◆ TASK_PRIO_2

#define TASK_PRIO_2   2

Definition at line 77 of file mss_main.c.

◆ TASK_PRIO_3

#define TASK_PRIO_3   3

Definition at line 78 of file mss_main.c.

◆ TASK_PRIO_4

#define TASK_PRIO_4   4

Definition at line 79 of file mss_main.c.

◆ TASK_PRIO_5

#define TASK_PRIO_5   5

Definition at line 80 of file mss_main.c.

◆ TASK_PRIO_6

#define TASK_PRIO_6   6

Definition at line 81 of file mss_main.c.

Function Documentation

◆ main()

int32_t main ( void  )

Main Program entrypoint. This is the entrypoint for the MSS firmware which describe the startup sequence for the AWR1843 application running on top of MSS. The MSS application must have the following startup sequence at bootup time. Clear all the ESM group errors and register Disable the firewall for JTAG and LOGGER (UART) Start the BIOS and further initialize required peripherals.

  • N/A
    Returns
    0

Definition at line 916 of file mss_main.c.

References gMCB, MSS_mmWaveInitTASK(), MCB_t::socHandle, and TASK_PRIO_1.

Here is the call graph for this function:

◆ mboxCallbackFxn_MSS_ch0()

static void mboxCallbackFxn_MSS_ch0 ( Mbox_Handle  handle,
Mailbox_Type  peer 
)
static

mboxCallbackFxn_MSS_ch0 is a callback function. Function is invoked for each received messege from the DSS peer endpoint. When invoked, release the resources and wakeup the mmWave thread to process the received message. Hence: the address of this function is passed to mboxCfg.readCallback

  • [0] Handle to the Mailbox on which data was received
  • [1] Peer from which data was received (DSS)
    Returns
    void

Definition at line 596 of file mss_main.c.

References gMCB, and MCB_t::mboxSemHandle.

Referenced by MSS_mmWaveInitTASK().

Here is the caller graph for this function:

◆ mboxIn_uartOut_TASK()

static void mboxIn_uartOut_TASK ( UArg  arg0,
UArg  arg1 
)
static

The Task is used to handle the recieved messages from the DSS Peer over the mailbox virtual communication channel.

  • [0] arg0 of the Task.
  • [1] arg1 of the Task.
    Returns
    Success -0 Fail < -1

Definition at line 457 of file mss_main.c.

References gMCB, MCB_t::loggingUartHandle, MBOX_DSS2MSS_ASSERT_INFO, MBOX_DSS2MSS_DETOBJ_READY, MBOX_MSS2DSS_DETOBJ_SHIPPED, MCB_t::mboxHandle, MCB_t::mboxSemHandle, MMW_OUTPUT_MSG_SEGMENT_LEN, and MSS_mboxWrite().

Referenced by MSS_mmWaveInitTASK().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MSS_chirpIntCallback()

static void MSS_chirpIntCallback ( uintptr_t  arg)
static

This is the callback function registered with the ADC Driver which is invoked when a chirp is available. This is executed in the ISR context which is registered to the listener function listenerFxn; defined within SOC_SysIntListenerCfg. Hence; In our design, there's no frame segmentation (Advanced Frame Configuration) (in other words, frame := 1 sub-frame). However, advanced frame configuration will allow the use of different subframes in the radar configuration to support and meet the requirements of different ranges: i.e ultra-short, short, medium, long ranges. Accordingly, different subframes results in different chirp sizes which is totally depending on the each sub-frameType. Therefore, It's important to identify this for each sub-frame before the start of the next subframe, at the end of the previous subframes last chirp.

  • [0] Application registered argument
Todo:
Add sub-frames configurations and measure the performance

Definition at line 219 of file mss_main.c.

References MCB_t::chirpInt, gMCB, NUM_SUBFRAMES, MCB_t::numChirpsPerSubframe, MCB_t::subframeCntFromChirpInt, and MCB_t::subframeId.

Referenced by MSS_mmWaveInitTASK().

Here is the caller graph for this function:

◆ MSS_eventFxn()

static int32_t MSS_eventFxn ( uint16_t  msgId,
uint16_t  sbId,
uint16_t  sbLen,
uint8_t *  payload 
)
static

This is a registered event function which is invoked when an event is recieved from the BSS. This event is passed to the peer domain/core BSS.

  • [0] Message Identifier
  • [1] Subblock identifier
  • [2] Length of the subblock
  • [3] Pointer to the payload buffer
    Returns
    0

Definition at line 283 of file mss_main.c.

Referenced by MSS_mmWaveInitTASK().

Here is the caller graph for this function:

◆ MSS_frameStartIntCallback()

static void MSS_frameStartIntCallback ( uintptr_t  arg)
static

This is the callback function registered with the ADC Driver which is invoked when a frame is started. This is executed in the ISR context which is registered to the listener function listenerFxn; defined within SOC_SysIntListenerCfg Inside the function we Check if the frames are coming correctly, and no chirps have been missed.

  • [0] Application registered argument
    Returns
    void

Definition at line 253 of file mss_main.c.

References MCB_t::chirpInt, MCB_t::frameStartToken, and gMCB.

Referenced by MSS_mmWaveInitTASK().

Here is the caller graph for this function:

◆ MSS_mboxWrite()

int32_t MSS_mboxWrite ( mmWaveMSG msg)
  • [0] Pointer to the MMW demo message ASTRO.
    Returns
    Success - 0 Fail < -1

Definition at line 432 of file mss_main.c.

References gMCB, and MCB_t::mboxHandle.

Referenced by mboxIn_uartOut_TASK().

Here is the caller graph for this function:

◆ MSS_mmWaveCloseCallbackFxn()

static void MSS_mmWaveCloseCallbackFxn ( void  )
static

This is the application registered callback function which is invoked after the MSS has been closed.

  • N/A
    Returns
    N/A

Definition at line 416 of file mss_main.c.

Referenced by MSS_mmWaveInitTASK().

Here is the caller graph for this function:

◆ MSS_mmWaveConfigCallbackFxn()

static void MSS_mmWaveConfigCallbackFxn ( MMWave_CtrlCfg *  ptrCtrlCfg)
static

This is the application registered callback function which is invoked after the configuration has been used to configure the mmWave link and the BSS.

  • [0] Pointer to the control configuration
    Returns
    void

Definition at line 346 of file mss_main.c.

Referenced by MSS_mmWaveInitTASK().

Here is the caller graph for this function:

◆ MSS_mmWaveCtrlTask()

static void MSS_mmWaveCtrlTask ( UArg  arg0,
UArg  arg1 
)
static

This is the task which provides an execution context for the mmWave control module.

  • [0] arg0 Argument0 with which the task was created
  • [1] arg1 Argument1 with which the task was created
    Returns
    void

Definition at line 614 of file mss_main.c.

References MCB_t::ctrlHandle, and gMCB.

Referenced by MSS_mmWaveInitTASK().

Here is the caller graph for this function:

◆ MSS_mmWaveInitTASK()

static void MSS_mmWaveInitTASK ( UArg  arg0,
UArg  arg1 
)
static

Initialize the MCPI Log Message Buffer.

MSS Initialization Task which initializes the various components in the MSS subsystem including UART for logging and configurations and Mailbox for bi-directional communication between MSS and DSS subsystems.

  • [0] Argument0 with which the task was created
  • [1] Argument1 with which the task was created
    Returns
    void

setup the PINMUX (pin multiplexing) for bringing out the UART; (UART settings configuring, I/O cell characteristics specification)

Initialize the UART

Initialize the CAN interface

Todo:
CAN Interface is Semi-deployed in this system due to the hardware limitations. It Will be added anyway for future considerations

Initialize the Mailbox

Definition at line 643 of file mss_main.c.

References MCB_t::chirpIntHandle, MCB_t::commandUartHandle, MCB_t::ctrlHandle, MCB_t::frameStartIntHandle, gMCB, MCB_t::loggingUartHandle, mboxCallbackFxn_MSS_ch0(), MCB_t::mboxHandle, mboxIn_uartOut_TASK(), MCB_t::mboxSemHandle, MSS_chirpIntCallback(), MSS_CLIInit(), MSS_eventFxn(), MSS_frameStartIntCallback(), MSS_mmWaveCloseCallbackFxn(), MSS_mmWaveConfigCallbackFxn(), MSS_mmWaveCtrlTask(), MSS_mmWaveOpenCallbackFxn(), MSS_mmWaveStartCallbackFxn(), MSS_mmWaveStopCallbackFxn(), MCB_t::numChirpsPerSubframe, MCB_t::socHandle, SUBFRAME_MRR_NUM_CHIRPS_TOTAL, SUBFRAME_USRR_NUM_CHIRPS_TOTAL, and TASK_PRIO_6.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MSS_mmWaveOpenCallbackFxn()

static void MSS_mmWaveOpenCallbackFxn ( MMWave_OpenCfg *  ptrOpenCfg)
static

This is the application registered callback function which is invoked after the MSS has been opened.

  • [0] Pointer to the open configuration
    Returns
    N/A

Definition at line 400 of file mss_main.c.

Referenced by MSS_mmWaveInitTASK().

Here is the caller graph for this function:

◆ MSS_mmWaveStartCallbackFxn()

static void MSS_mmWaveStartCallbackFxn ( MMWave_CalibrationCfg *  ptrCalibrationCfg)
static

Application registered callback function which is invoked on the peer domain just before the mmWave link is started on the BSS.

  • [0] Pointer to the calibration configuration
    Returns
    void

Definition at line 362 of file mss_main.c.

References mmW_MSS_STATS_t::datapathStartEvt, DSS_START_COMPLETED_EVT, MCB_t::eventHandle, gMCB, and MCB_t::stats.

Referenced by MSS_mmWaveInitTASK().

Here is the caller graph for this function:

◆ MSS_mmWaveStopCallbackFxn()

static void MSS_mmWaveStopCallbackFxn ( void  )
static

This is the application registered callback function which is invoked after the MSS has been stopped. Hence, possible sceanarios:

  1. CLI sensorStop command triggers mmwave_stop() to be called from MSS
  2. In case of Error, mmwave_stop() will be triggered from MSS or DSS
    • N/A
      Returns
      N/A

Definition at line 385 of file mss_main.c.

References mmW_MSS_STATS_t::datapathStopEvt, gMCB, and MCB_t::stats.

Referenced by MSS_mmWaveInitTASK().

Here is the caller graph for this function:

Variable Documentation

◆ gMCB

MCB gMCB

gMCB structure contains the tracking information required by the design is aligned using DATA_ALIGN paragma to increase the performance of MSS core by aligning the structure gMCB (Master Control Block) to be divisable by 16.


TI-reference: spnu151j.pdf section #5.10.6

Definition at line 163 of file mss_main.c.

Referenced by main(), mboxCallbackFxn_MSS_ch0(), mboxIn_uartOut_TASK(), MSS_chirpIntCallback(), MSS_CLIBasicCfg(), MSS_CLISensorStart(), MSS_CLISensorStop(), MSS_frameStartIntCallback(), MSS_mboxWrite(), MSS_mmWaveCtrlTask(), MSS_mmWaveInitTASK(), MSS_mmWaveStartCallbackFxn(), and MSS_mmWaveStopCallbackFxn().