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, 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 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 deviceMap, rlDriverMsg_t *outMsg)
 : Send command and wait for response 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

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 407 of file rl_driver.c.

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 1880 of file rl_driver.c.

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 495 of file rl_driver.c.

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 204 of file rl_driver.c.

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 2406 of file rl_driver.c.

rlReturnVal_t rlDriverCmdSendRetry ( rlUInt8_t  deviceMap,
rlDriverMsg_t outMsg 
)

: Send command and wait for response

Parameters
[in]deviceMap- device map contains bitmap of all device connected
[out]outMsg- output msg
Returns
Success : 0, Fail : Error code

Send command and wait for response

Definition at line 2344 of file rl_driver.c.

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 2572 of file rl_driver.c.

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 2538 of file rl_driver.c.

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 strucutre input pointer
[in]payloadPtr- payload data pointer
Returns
- none

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

Definition at line 2703 of file rl_driver.c.

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 strucutre input pointer
[in]payloadPtr- payload data pointer
Returns
- none

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

Definition at line 2738 of file rl_driver.c.

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 2018 of file rl_driver.c.

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 2769 of file rl_driver.c.

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 2115 of file rl_driver.c.

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 2081 of file rl_driver.c.

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 2097 of file rl_driver.c.

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 560 of file rl_driver.c.

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 2134 of file rl_driver.c.

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 791 of file rl_driver.c.

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 1193 of file rl_driver.c.

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 892 of file rl_driver.c.

rlReturnVal_t rlDriverMsgWrite ( rlDriverData_t rlDrvData,
rlComIfHdl_t  comIfHdl 
)

Write command header and payload data over communication channel.

Parameters
[in]rlDrvData- Pointer to mmwavelink global structure
[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 1314 of file rl_driver.c.

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 1637 of file rl_driver.c.

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 631 of file rl_driver.c.

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 1973 of file rl_driver.c.

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 1521 of file rl_driver.c.

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 174 of file rl_driver.c.

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 361 of file rl_driver.c.

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 243 of file rl_driver.c.

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 2177 of file rl_driver.c.


Copyright 2018, Texas Instruments Incorporated