Functions
Communication Protocol

mmwave Communication Driver Module More...

Functions

rlReturnVal_t rlDriverOsiInit (void)
 Initializes the OSI layer abstraction for mmwavelink. More...
 
rlReturnVal_t rlDriverAddDevice (rlUInt8_t deviceMap)
 Adds mmwave radar device. More...
 
rlReturnVal_t rlDriverRemoveDevices (rlUInt8_t deviceMap)
 Disconnects the mmwave radar devices. More...
 
rlReturnVal_t rlDriverDeInit (void)
 De Initializes the mmwave radar Driver. More...
 
rlDriverData_trlDriverGetHandle (void)
 Returns mmwave radar Driver Global Structure. More...
 
rlUInt8_t rlDriverGetPlatformId (void)
 Returns RL Platform ID (i.e. where mmWaveLink is executing) More...
 
rlUInt8_t rlDriverGetArDeviceType (void)
 Returns AR device type which mmWavelink is communicating. More...
 
rlReturnVal_t rlDriverIsDeviceMapValid (rlUInt8_t deviceMap)
 Checks if given deviecMap is valid wrt to global DeviceMap set to mmWaveLink. More...
 
rlReturnVal_t rlDriverWaitForResponse (rlUInt8_t devIndex, rlDriverMsg_t *outMsg)
 : Wait for Device's response More...
 
rlReturnVal_t rlDriverCmdInvoke (rlUInt8_t deviceMap, rlDriverMsg_t inMsg, rlDriverMsg_t *outMsg)
 Invokes a command to mmwave radar Device. Implements mmwave radar Host Communication Protocol(RHCP) More...
 
rlReturnVal_t rlDriverConfigureCrc (rlCrcType_t crcType)
 Configures the CRC Type in mmwavelink Driver. More...
 
rlReturnVal_t rlDriverConfigureAckTimeout (rlUInt32_t ackTimeout)
 Configures the Acknowledgement timeout in mmwavelink Driver. More...
 
rlReturnVal_t rlDriverCalCRC (rlUInt8_t *data, rlUInt16_t dataLen, rlUInt8_t crcType, rlUInt8_t crc[RL_CRC_LEN_MAX])
 Calculates 16bit/32bit/64bit CRC. More...
 
rlReturnVal_t rlDriverVerifyCRC (rlUInt8_t *data, rlUInt16_t dataLen, rlUInt8_t crcType, rlUInt8_t crc[RL_CRC_LEN_MAX])
 Compares received CRC with Calculated CRC. More...
 
void rlDriverShiftDWord (rlUInt8_t buf[])
 Shifts one byte in the byte array. More...
 
rlReturnVal_t rlDriverValidateHdr (rlProtHeader_t protHdr)
 Validates the header by comparing Checksum. More...
 
rlReturnVal_t rlDriverAsyncEventHandler (rlUInt8_t devIndex, rlUInt16_t nsbc, rlUInt8_t *payload, rlUInt16_t payloadLen)
 Handles asynchronous response/error from mmwave radar device. More...
 
rlUInt8_t rlDeviceIdentifyCmdDir (rlUInt16_t msgId, rlUInt8_t platform)
 Get the direction of command packet based on MsgID and platform. More...
 
void rlDriverHostIrqHandler (rlUInt8_t deviceIndex, void *pValue)
 Interrupt Service Routine to handle host interrupt from mmwave radar device. More...
 
rlReturnVal_t rlDriverMsgReadCmdCtx (rlUInt8_t devIndex)
 Wait and handle command response. More...
 
rlReturnVal_t rlDriverMsgRead (rlDriverData_t *rlDrvData, rlUInt8_t devIndex)
 Receive and validate protocol header and payload. More...
 
rlReturnVal_t rlDriverMsgWrite (rlDriverData_t *rlDrvData, rlUInt8_t devIndex, rlComIfHdl_t comIfHdl)
 Write command header and payload data over communication channel. More...
 
rlReturnVal_t rlDriverRxHdrRead (rlUInt8_t hdrBuf[RHCP_HEADER_LEN], rlComIfHdl_t comIfHdl)
 Read SYNC and Header from communication channel. More...
 
void rlDriverFillPayload (rlUInt16_t msgId, rlUInt16_t sbcID, rlPayloadSb_t *payloadPtr, rlUInt8_t *data, rlUInt16_t inLen)
 : Fill payload based on given message-ID, sub-block ID and data. More...
 
void rlDriverConstructInMsg (rlUInt16_t msgId, rlDriverMsg_t *inMsg, rlPayloadSb_t *payloadPtr)
 : Construct command packet (inMsg) based on given message-ID and payload More...
 
void rlDriverConstructOutMsg (rlUInt16_t numSblk, rlDriverMsg_t *outMsg, rlPayloadSb_t *payloadPtr)
 : Construct command packet based on given message-ID and payload More...
 
rlReturnVal_t rlDriverExecuteGetApi (rlUInt8_t deviceMap, rlUInt16_t msgId, rlUInt16_t sbcID, rlUInt8_t *msgData, rlUInt16_t inLen)
 : Construct get message and invoke command. More...
 
rlReturnVal_t rlDriverExecuteSetApi (rlUInt8_t deviceMap, rlUInt16_t msgId, rlUInt16_t sbcID, rlUInt8_t *msgData, rlUInt16_t inLen)
 : Construct set message and invoke command. More...
 
rlReturnVal_t rlDriverProcRdMsg (rlUInt8_t devIdx, rlReturnVal_t inVal)
 Process received message for Async event message. More...
 
rlReturnVal_t rlDriverMsgCmdReply (rlDriverData_t *rlDrvData, rlUInt8_t devIndex)
 Wait and handle command response. More...
 
rlReturnVal_t rlDriverCmdSendRetry (rlUInt8_t devIndex, rlDriverMsg_t *outMsg)
 : Send command and wait for response More...
 
rlReturnVal_t rlDriverSetRetryCount (rlUInt8_t retryCnt)
 : Set the retry count for re-sending command More...
 
void rlLogSpiReadWrite (rlUInt8_t deviceIdx, rlUInt8_t *pBuffer, rlUInt32_t BufferLength, rlUInt8_t readEn)
 : Logging SPI Read/Write command More...
 

Detailed Description

mmwave Communication Driver Module

The mmwave radar Host Communication Driver Module implements the mmwave radar communication protocol:

  1. It is a simple stop and wait protocol. Each message needs to be acknowledged by receiver before next message can be sent.
  2. Messages are classifieds as "Command", "Response" and "Asynchronous Event"
  3. If Command can not be processed immediately, ACK response is sent immediately (If requested). "Asynchronous Event" is sent upon completion of the command execution.

Function Documentation

◆ rlDeviceIdentifyCmdDir()

rlUInt8_t rlDeviceIdentifyCmdDir ( rlUInt16_t  msgId,
rlUInt8_t  platform 
)

Get the direction of command packet based on MsgID and platform.

Parameters
[in]msgId- Message ID of data packet
[in]platform- Platform Type where mmWaveLink instance is running
Returns
rlUInt8_t command packet direction

Returns direction of command packet based on MsgID and platform.

Definition at line 412 of file rl_driver.c.

◆ rlDriverAddDevice()

rlReturnVal_t rlDriverAddDevice ( rlUInt8_t  deviceMap)

Adds mmwave radar device.

Parameters
[in]deviceMap- Bitmap of device to be connected
Returns
rlReturnVal_t Success - 0, Failure - Error Code

Adds mmwave radar device Open communication channel, Register Interrupt Handler with device

Definition at line 2136 of file rl_driver.c.

◆ rlDriverAsyncEventHandler()

rlReturnVal_t rlDriverAsyncEventHandler ( rlUInt8_t  devIndex,
rlUInt16_t  nsbc,
rlUInt8_t *  payload,
rlUInt16_t  payloadLen 
)

Handles asynchronous response/error from mmwave radar device.

Parameters
[in]devIndex- Device Index
[in]nsbc- No. of Sub-Block in MSG
[in]payload- Protocol payload message data
[in]payloadLen- Length of payload message data
Returns
rlReturnVal_t Success - 0, Failure - Error Code

Handles asynchronous response/error from mmwave radar device

Definition at line 500 of file rl_driver.c.

◆ rlDriverCalCRC()

rlReturnVal_t rlDriverCalCRC ( rlUInt8_t *  data,
rlUInt16_t  dataLen,
rlUInt8_t  crcType,
rlUInt8_t  crc[RL_CRC_LEN_MAX] 
)

Calculates 16bit/32bit/64bit CRC.

Parameters
[in]data- Byte array
[in]dataLen- Length of the byte array
[in]crcType- Type of CRC 16/32/64bit
[in]crc- Received CRC
Returns
rlReturnVal_t Success - 0, Failure - Error Code

Calculates 16bit/32bit/64bit CRC

Definition at line 209 of file rl_driver.c.

◆ rlDriverCmdInvoke()

rlReturnVal_t rlDriverCmdInvoke ( rlUInt8_t  deviceMap,
rlDriverMsg_t  inMsg,
rlDriverMsg_t outMsg 
)

Invokes a command to mmwave radar Device. Implements mmwave radar Host Communication Protocol(RHCP)

Parameters
[in]deviceMap- Bitmap of devices to send the message
[in]inMsg- Command Opcode(Direction, Class, MsgId) and Subblocks
[out]outMsg- Response Opcode(Direction, Class, MsgId) and Subblocks
Returns
rlReturnVal_t Success - 0, Failure - Error Code

Invokes a command to mmwave radar Device. Waits for Response if ACK is requested. Computes CRC/Checksum according to mmwave radar Host Communication Protocol(RHCP)

Definition at line 2739 of file rl_driver.c.

◆ rlDriverCmdSendRetry()

rlReturnVal_t rlDriverCmdSendRetry ( rlUInt8_t  devIndex,
rlDriverMsg_t outMsg 
)

: Send command and wait for response

Parameters
[in]devIndex- device index (device connected)
[out]outMsg- output msg
Returns
Success : 0, Fail : Error code

Send command and wait for response

Definition at line 2632 of file rl_driver.c.

◆ rlDriverConfigureAckTimeout()

rlReturnVal_t rlDriverConfigureAckTimeout ( rlUInt32_t  ackTimeout)

Configures the Acknowledgement timeout in mmwavelink Driver.

Parameters
[in]ackTimeout- ACK timeout, 0 - No ACK
Returns
rlReturnVal_t Success - 0, Failure - Error Code

Configures the Acknowledgement timeout in mmwavelink Driver

Definition at line 2901 of file rl_driver.c.

◆ rlDriverConfigureCrc()

rlReturnVal_t rlDriverConfigureCrc ( rlCrcType_t  crcType)

Configures the CRC Type in mmwavelink Driver.

Parameters
[in]crcType- CRC Types
Returns
rlReturnVal_t Success - 0, Failure - Error Code

Configures the CRC Type in mmwavelink Driver

Definition at line 2867 of file rl_driver.c.

◆ rlDriverConstructInMsg()

void rlDriverConstructInMsg ( rlUInt16_t  msgId,
rlDriverMsg_t inMsg,
rlPayloadSb_t payloadPtr 
)

: Construct command packet (inMsg) based on given message-ID and payload

Parameters
[in]msgId- message ID of command packet
[out]inMsg- Message structure input pointer
[in]payloadPtr- payload data pointer
Returns
- none

Construct Set command packet based on given message-ID and payload

Definition at line 3033 of file rl_driver.c.

◆ rlDriverConstructOutMsg()

void rlDriverConstructOutMsg ( rlUInt16_t  numSblk,
rlDriverMsg_t outMsg,
rlPayloadSb_t payloadPtr 
)

: Construct command packet based on given message-ID and payload

Parameters
[in]numSblk- number of sub-blocks in message
[out]outMsg- Message structure input pointer
[in]payloadPtr- payload data pointer
Returns
- none

Construct Get command packet based on given message-ID and payload

Definition at line 3068 of file rl_driver.c.

◆ rlDriverDeInit()

rlReturnVal_t rlDriverDeInit ( void  )

De Initializes the mmwave radar Driver.

Returns
rlReturnVal_t Success - 0, Failure - Error Code

DeInitializes the mmwave radar Driver. Clear memory, destroy OS objects, Close communication channel, Unregister Interrupt Handler

Definition at line 2274 of file rl_driver.c.

◆ rlDriverExecuteGetApi()

rlReturnVal_t rlDriverExecuteGetApi ( rlUInt8_t  deviceMap,
rlUInt16_t  msgId,
rlUInt16_t  sbcID,
rlUInt8_t *  msgData,
rlUInt16_t  inLen 
)

: Construct get message and invoke command.

Parameters
[in]deviceMap- Bitmap of devices to send the message
[in]msgId- message ID of command packet
[in]sbcID- sub block ID of command packet
[out]msgData- message data pointer
[in]inLen- message payload length
Returns
rlReturnVal_t Success - 0, Failure - Error Code

Construct get message and invoke command where it waits for response from device.

Definition at line 3132 of file rl_driver.c.

◆ rlDriverExecuteSetApi()

rlReturnVal_t rlDriverExecuteSetApi ( rlUInt8_t  deviceMap,
rlUInt16_t  msgId,
rlUInt16_t  sbcID,
rlUInt8_t *  msgData,
rlUInt16_t  inLen 
)

: Construct set message and invoke command.

Parameters
[in]deviceMap- Bitmap of devices to send the message
[in]msgId- message ID of command packet
[in]sbcID- sub block ID of command packet
[in]msgData- message data pointer
[in]inLen- message payload length
Returns
rlReturnVal_t Success - 0, Failure - Error Code

Construct set message and invoke command where it waits for response from device.

Definition at line 3188 of file rl_driver.c.

◆ rlDriverFillPayload()

void rlDriverFillPayload ( rlUInt16_t  msgId,
rlUInt16_t  sbcID,
rlPayloadSb_t payloadPtr,
rlUInt8_t *  data,
rlUInt16_t  inLen 
)

: Fill payload based on given message-ID, sub-block ID and data.

Parameters
[in]msgId- message ID of command packet
[in]sbcID- sub block ID of command packet
[in]payloadPtr- payload data pointer
[out]data- data pointer
[in]inLen- lenght of data
Returns
- none

Fill payload based on given message-ID, sub-block ID and data.

Definition at line 3099 of file rl_driver.c.

◆ rlDriverGetArDeviceType()

rlDriverGetArDeviceType ( void  )

Returns AR device type which mmWavelink is communicating.

Returns
rlUInt8_t platform

Returns AR device type which mmWavelink is communicating

Definition at line 2375 of file rl_driver.c.

◆ rlDriverGetHandle()

rlDriverData_t * rlDriverGetHandle ( void  )

Returns mmwave radar Driver Global Structure.

Returns
rlDriverData_t Pointer to mmwave radar Driver Global Structure

Returns mmwave radar Driver Global Structure

Definition at line 2341 of file rl_driver.c.

◆ rlDriverGetPlatformId()

rlDriverGetPlatformId ( void  )

Returns RL Platform ID (i.e. where mmWaveLink is executing)

Returns
rlUInt8_t platform

Returns Device run ID (i.e. where mmWaveLink is executing)

Definition at line 2357 of file rl_driver.c.

◆ rlDriverHostIrqHandler()

void rlDriverHostIrqHandler ( rlUInt8_t  deviceIndex,
void *  pValue 
)

Interrupt Service Routine to handle host interrupt from mmwave radar device.

Parameters
[in]deviceIndex- source device Index
[in]pValue- Interrupt Routine Argument
Returns
none

Interrupt Service Routine to handle host interrupt from mmwave radar device

Definition at line 565 of file rl_driver.c.

◆ rlDriverIsDeviceMapValid()

rlUInt8_t rlDriverIsDeviceMapValid ( rlUInt8_t  deviceMap)

Checks if given deviecMap is valid wrt to global DeviceMap set to mmWaveLink.

Parameters
[in]deviceMap- Bitmap of devices to send the message
Returns
rlReturnVal_t Success - 0, Failure - Error Code

It enables RF/Analog Subsystem.

Definition at line 2394 of file rl_driver.c.

◆ rlDriverMsgCmdReply()

rlReturnVal_t rlDriverMsgCmdReply ( rlDriverData_t rlDrvData,
rlUInt8_t  devIndex 
)

Wait and handle command response.

Parameters
[in]rlDrvData- Pointer to mmWaveLink global structure
[in]devIndex- Device index of slave device from where response is expected
Returns
rlReturnVal_t Success - 0, Failure - Error Code

Wait and handle command response

Definition at line 846 of file rl_driver.c.

◆ rlDriverMsgRead()

rlReturnVal_t rlDriverMsgRead ( rlDriverData_t rlDrvData,
rlUInt8_t  devIndex 
)

Receive and validate protocol header and payload.

Parameters
[in]rlDrvData- Pointer to mmwavelink global structure
[in]devIndex- Device index of slave device from where data is received
Returns
rlReturnVal_t Success - 0, Failure - Error Code

Receive and validate protocol header and payload

Definition at line 1289 of file rl_driver.c.

◆ rlDriverMsgReadCmdCtx()

rlReturnVal_t rlDriverMsgReadCmdCtx ( rlUInt8_t  devIndex)

Wait and handle command response.

Parameters
[in]devIndex- Device index of slave device from where response is expected
Returns
rlReturnVal_t Success - 0, Failure - Error Code

Wait and handle command response

Definition at line 980 of file rl_driver.c.

◆ rlDriverMsgWrite()

rlReturnVal_t rlDriverMsgWrite ( rlDriverData_t rlDrvData,
rlUInt8_t  devIndex,
rlComIfHdl_t  comIfHdl 
)

Write command header and payload data over communication channel.

Parameters
[in]rlDrvData- Pointer to mmwavelink global structure
[in]devIndex- device index
[in]comIfHdl- Communication interface handle
Returns
rlReturnVal_t Success - 0, Failure - Error Code

Write command header and payload data over communication channel

Definition at line 1469 of file rl_driver.c.

◆ rlDriverOsiInit()

rlReturnVal_t rlDriverOsiInit ( void  )

Initializes the OSI layer abstraction for mmwavelink.

Returns
rlReturnVal_t Success - 0, Failure - Error Code

Initializes the OS mutex, semaphore and queue interface for mmwavelink

Definition at line 1868 of file rl_driver.c.

◆ rlDriverProcRdMsg()

rlReturnVal_t rlDriverProcRdMsg ( rlUInt8_t  devIdx,
rlReturnVal_t  inVal 
)

Process received message for Async event message.

Parameters
[in]devIdx- device Index
[in]inVal- status value
Returns
error status

Process received message for Async event message

Definition at line 637 of file rl_driver.c.

◆ rlDriverRemoveDevices()

rlReturnVal_t rlDriverRemoveDevices ( rlUInt8_t  deviceMap)

Disconnects the mmwave radar devices.

Parameters
[in]deviceMap- Bitmap of mmwave devices to be disconnected
Returns
rlReturnVal_t Success - 0, Failure - Error Code

disconnects the mmwave radar devices Close communication channel, Unregister Interrupt Handler

Definition at line 2229 of file rl_driver.c.

◆ rlDriverRxHdrRead()

rlReturnVal_t rlDriverRxHdrRead ( rlUInt8_t  hdrBuf[RHCP_HEADER_LEN],
rlComIfHdl_t  comIfHdl 
)

Read SYNC and Header from communication channel.

Parameters
[in]comIfHdl- Communication interface handle
[out]hdrBuf- Buffer to hold SyncPattern+header information
Returns
rlReturnVal_t pattern matched type, Failure - Error Code

Read SYNC and Header from communication channel

Definition at line 1711 of file rl_driver.c.

◆ rlDriverSetRetryCount()

rlReturnVal_t rlDriverSetRetryCount ( rlUInt8_t  retryCnt)

: Set the retry count for re-sending command

Parameters
[in]retryCnt- Retry count [0: no retry, n: no. of retries] value limit to RL_API_CMD_RETRY_COUNT(3)
Returns
rlReturnVal_t Success - 0, Failure - Error Code(-2)

Set the retry count to global rlDriverData_t structure.

Definition at line 3230 of file rl_driver.c.

◆ rlDriverShiftDWord()

void rlDriverShiftDWord ( rlUInt8_t  buf[])

Shifts one byte in the byte array.

Parameters
[in]buf- Byte array

Shifts one byte in the byte array

Definition at line 179 of file rl_driver.c.

◆ rlDriverValidateHdr()

rlReturnVal_t rlDriverValidateHdr ( rlProtHeader_t  protHdr)

Validates the header by comparing Checksum.

Parameters
[in]protHdr- Protocol Header
Returns
rlReturnVal_t Success - 0, Failure - Error Code

Validates the header by comparing checksum

Definition at line 366 of file rl_driver.c.

◆ rlDriverVerifyCRC()

rlReturnVal_t rlDriverVerifyCRC ( rlUInt8_t *  data,
rlUInt16_t  dataLen,
rlUInt8_t  crcType,
rlUInt8_t  crc[RL_CRC_LEN_MAX] 
)

Compares received CRC with Calculated CRC.

Parameters
[in]data- Byte array
[in]dataLen- Length of the byte array
[in]crcType- Type of CRC 16/32/64bit
[in]crc- Received CRC
Returns
rlReturnVal_t CRC Check Pass - 0, CRC Check Fail - RL_RET_CODE_CRC_FAILED

Compares received CRC with Calculated CRC

Definition at line 248 of file rl_driver.c.

◆ rlDriverWaitForResponse()

rlReturnVal_t rlDriverWaitForResponse ( rlUInt8_t  devIndex,
rlDriverMsg_t outMsg 
)

: Wait for Device's response

Parameters
[in]devIndex- devIndex is index of device not the deviceMap
[out]outMsg- Driver msg
Returns
Success : 0, Fail : Error code

Wait for driver response

Definition at line 2437 of file rl_driver.c.

◆ rlLogSpiReadWrite()

void rlLogSpiReadWrite ( rlUInt8_t  deviceIdx,
rlUInt8_t *  pBuffer,
rlUInt32_t  BufferLength,
rlUInt8_t  readEn 
)

: Logging SPI Read/Write command

Parameters
[in]deviceIdx- device index for which the data needs to be read/written
[out]pBuffer- pointer to the Source buffer
[in]BufferLength- number of bytes to be read/written
[in]readEn- perform read/write operation. Write - 0; Read - 1
Returns
- none

Logging SPI Read/Write commands.

Definition at line 3278 of file rl_driver.c.


Copyright 2020, Texas Instruments Incorporated