rl_device.c
1 /****************************************************************************************
2  * FileName : rl_device.c
3  *
4  * Description : This file defines the functions required to Control mmwave radar Device.
5  *
6  ****************************************************************************************
7  * (C) Copyright 2014, Texas Instruments Incorporated. - TI web address www.ti.com
8  *---------------------------------------------------------------------------------------
9  *
10  * Redistribution and use in source and binary forms, with or without modification,
11  * are permitted provided that the following conditions are met:
12  *
13  * Redistributions of source code must retain the above copyright notice,
14  * this list of conditions and the following disclaimer.
15  *
16  * Redistributions in binary form must reproduce the above copyright notice,
17  * this list of conditions and the following disclaimer in the documentation
18  * and/or other materials provided with the distribution.
19  *
20  * Neither the name of Texas Instruments Incorporated nor the names of its
21  * contributors may be used to endorse or promote products derived from this
22  * software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
26  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
28  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  */
36 
37  /*
38  ****************************************************************************************
39  * Revision History :
40  *---------------------------------------------------------------------------------------
41  * Version Date Author Defect No Description
42  *---------------------------------------------------------------------------------------
43  * 0.1.0 12May2015 Kaushal Kukkar - Initial Version
44  *
45  * 0.5.2 23Sep2016 Kaushal Kukkar AUTORADAR-541 xWR1642 Support
46  *
47  * 0.6.0 15Nov2016 Kaushal Kukkar AUTORADAR-666 Logging Feature
48  * Kaushal Kukkar AUTORADAR-716 Cascade API change
49  *
50  * 0.7.0 11May2017 Kaushal Kukkar MMWSDK-362 LDRA static analysis Issue Fix
51  *
52  * 0.8.6 24Jul2017 Jitendra Gupta MMWL-19 MSS Test pattern, Monitoring APIs
53  * Kaushal Kukkar MMWL-23 Big Endian Support
54  * Jitendra Gupta MMWL-26 MSS Data path Get APIs
55  *
56  * 0.9.1 - Jitendra Gupta MMWL-5 Code size optimization
57  ****************************************************************************************
58  */
59 
60 /******************************************************************************
61  * INCLUDE FILES
62  ******************************************************************************
63  */
64 #include <stdlib.h>
65 #include <string.h>
66 #include <ti/control/mmwavelink/mmwavelink.h>
67 #include <ti/control/mmwavelink/include/rl_device.h>
68 #include <ti/control/mmwavelink/include/rl_driver.h>
69 #include <ti/control/mmwavelink/include/rl_messages.h>
70 #include <ti/control/mmwavelink/include/rl_controller.h>
71 #include <ti/control/mmwavelink/include/rl_trace.h>
72 
73 /******************************************************************************
74  * GLOBAL VARIABLES/DATA-TYPES DEFINITIONS
75  ******************************************************************************
76  */
77 
78 /******************************************************************************
79  * FUNCTION DEFINITIONS
80  ******************************************************************************
81  */
82 
94 /* DesignId : MMWL_DesignId_004 */
95 /* Requirements : AUTORADAR_REQ-707 */
96 rlReturnVal_t rlDevicePowerOn(rlUInt8_t deviceMap, rlClientCbs_t clientCb)
97 {
98  rlReturnVal_t retVal;
99  rlUInt8_t index = 0U;
100  /* get rlDriver global structure pointer */
101  rlDriverData_t *rlDrvData = rlDriverGetHandle();
102 
103  /* if driver is already initialized */
104  if ((rlDrvData != NULL) && (rlDrvData->isDriverInitialized == 1U))
105  {
106  /* DeInitialize Device */
107  retVal = rlDevicePowerOff();
108  }
109  else
110  {
111  retVal = RL_RET_CODE_OK;
112  }
113 
114  /* if there is no error found from above conditioning then go ahead and poweron
115  mmwavelink & device */
116  if (retVal == RL_RET_CODE_OK)
117  {
118  /* Initialize Host Communication Protocol Driver */
119  if (rlDriverInit(deviceMap, clientCb) < 0)
120  {
121  /* if driver Init failed then set return error code */
122  retVal += RL_RET_CODE_RADAR_IF_ERROR;
123  }
124  else
125  {
126  /* Power up mmwave Device */
127  do
128  {
129  /* loop for all devices connected to device/Host */
130  if ((deviceMap & (1U << index)) != 0U)
131  {
132  /* Enable the 12xx device where it will power up the device and read
133  first Async Event */
134  if (clientCb.devCtrlCb.rlDeviceEnable(index) < 0)
135  {
136  /* set return error code */
137  retVal += RL_RET_CODE_RADAR_IF_ERROR;
138  RL_LOGE_ARG0("mmWaveLink: Enabling device failed \n");
139  /* if device enable is failed the de-init mmwavelink driver */
140  (void)rlDriverDeInit();
141  RL_LOGW_ARG0("mmWaveLink Driver DeInit done\n");
142  }
143  /* Reset device Index in DeviceMap for which device has been enabled */
144  deviceMap &= ~(1U << index);
145  }
146  /* increment device index */
147  index++;
148  }
149  while ((deviceMap != 0U) && (index < RL_DEVICE_CONNECTED_MAX));
150  }
151  }
152  RL_LOGV_ARG0("mmWaveLink Power Up completes\n");
153 
154  return retVal;
155 }
156 
169 /* DesignId : MMWL_DesignId_021 */
170 /* Requirements : AUTORADAR_REQ-757 */
171 rlReturnVal_t rlDeviceAddDevices(rlUInt8_t deviceMap)
172 {
173  rlReturnVal_t retVal;
174 
175  RL_LOGV_ARG0("rlDeviceAddDevices starts\n");
176 
177  /* add device for requested deviceMap */
178  retVal = rlDriverAddDevice(deviceMap);
179 
180  RL_LOGV_ARG0("rlDeviceAddDevices completes\n");
181 
182  return retVal;
183 }
184 
196 /* DesignId : MMWL_DesignId_034 */
197 /* Requirements : AUTORADAR_REQ-757 */
198 rlReturnVal_t rlDeviceRemoveDevices(rlUInt8_t deviceMap)
199 {
200  rlReturnVal_t retVal = RL_RET_CODE_OK;
201  rlUInt8_t index = 0U;
202  /* get rlDriver global structure pointer */
203  rlDriverData_t *rlDrvData = rlDriverGetHandle();
204 
205  /* if driver is already initialized and deviceDisable API is not NULL */
206  if ((rlDrvData != NULL) && (rlDrvData->isDriverInitialized == 1U) && \
207  (rlDrvData->clientCtx.devCtrlCb.rlDeviceDisable != RL_NULL_PTR))
208  {
209  rlUInt8_t lclDeviceMap = deviceMap;
210  do
211  {
212  /* loop for device index connected to device/Host */
213  if ((lclDeviceMap & (1U << index)) != 0U)
214  {
215  /* Enable the 12xx device where it will power up the
216  * device and read first Async Event
217  */
218  if (rlDrvData->clientCtx.devCtrlCb.rlDeviceDisable(index)
219  < 0)
220  {
221  /* Device Power Off Failed */
222  retVal += RL_RET_CODE_RADAR_IF_ERROR;
223  RL_LOGE_ARG0("mmWave device Power Off failed\n");
224  }
225  /* Reset device Index in DeviceMap for which device has been disabled */
226  lclDeviceMap &= ~(1U << index);
227  }
228  /* increment device index */
229  index++;
230  }
231  while ((lclDeviceMap != 0U) && (index < RL_DEVICE_CONNECTED_MAX));
232 
233  RL_LOGI_ARG0("mmwave device Power Off Successful\n");
234  /* Remove the devices from Driver */
235  retVal += rlDriverRemoveDevices(deviceMap);
236  }
237  else
238  {
239  /* set return error code */
240  retVal += RL_RET_CODE_SELF_ERROR;
241  RL_LOGD_ARG0("Either rlDrvData is NULL or not initialised\n");
242  }
243 
244  RL_LOGV_ARG0("rlDeviceRemoveDevices complete...\n");
245  return retVal;
246 }
247 
256 /* DesignId : MMWL_DesignId_005 */
257 /* Requirements : AUTORADAR_REQ-711 */
258 rlReturnVal_t rlDevicePowerOff(void)
259 {
260  rlReturnVal_t retVal = RL_RET_CODE_OK;
261  rlUInt8_t index = 0U;
262  /* get rlDriver global structure pointer */
263  rlDriverData_t *rlDrvData = rlDriverGetHandle();
264 
265  /* if driver is already initialized and deviceDisable API is not NULL */
266  if ((rlDrvData != NULL) && (rlDrvData->isDriverInitialized == 1U) && \
267  (rlDrvData->clientCtx.devCtrlCb.rlDeviceDisable != RL_NULL_PTR))
268  {
269  rlUInt8_t deviceMap = rlDrvData->deviceMap;
270  /* disable all connected devices */
271  do
272  {
273  /* if device Index is valid out of deviceMap */
274  if ((deviceMap & (1U << index)) != 0U)
275  {
276  /* Enable the 12xx device where it will power up the
277  * device and read first Async Event
278  */
279  if (rlDrvData->clientCtx.devCtrlCb.rlDeviceDisable(index)
280  < 0)
281  {
282  /* Device Power Off Failed */
283  retVal += RL_RET_CODE_RADAR_IF_ERROR;
284  RL_LOGE_ARG0("mmWave device Power Off failed\n");
285  }
286  /* Reset device Index in DeviceMap for which device has been disabled */
287  deviceMap &= ~(1U << index);
288  }
289  /* increment device index */
290  index++;
291  }
292  while ((deviceMap != 0U) || (index < RL_DEVICE_CONNECTED_MAX));
293 
294  RL_LOGI_ARG0("Power Off Successful\n");
295  /* DeInitialize Host Communication Protocol Driver */
296  retVal += rlDriverDeInit();
297  RL_LOGV_ARG0("Driver De-initialization complete\n");
298  }
299  else
300  {
301  /* set return error code */
302  retVal += RL_RET_CODE_SELF_ERROR;
303  RL_LOGD_ARG0("Either rlDrvData is NULL or not initialised\n");
304  }
305 
306  RL_LOGV_ARG0("Device power-off complete...\n");
307  return retVal;
308 }
309 
319 /* DesignId : MMWL_DesignId_027 */
320 /* Requirements : AUTORADAR_REQ-761 */
321 rlReturnVal_t rlDeviceRfStart(rlUInt8_t deviceMap)
322 {
323  rlReturnVal_t retVal;
324 
325  RL_LOGV_ARG0("rlDeviceRfStart starts...\n");
326 
327  /* check if deviceIndex is out of defined value */
328  if (rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK)
329  {
330  /* set return error code */
331  retVal = RL_RET_CODE_INVALID_INPUT;
332  RL_LOGE_ARG0("Device map id is invalid\n");
333  }
334  else
335  {
336  /* Package the command with given data and send it to device */
337  retVal = rlDriverExecuteSetApi(deviceMap, RL_DEV_POWERUP_MSG,
338  RL_SYS_RF_POWERUP_SB, NULL, 0U);
339  }
340 
341  RL_LOGV_ARG0("rlDeviceRfStart complete...\n");
342 
343  return retVal;
344 }
345 
359 /* DesignId : MMWL_DesignId_006 */
360 /* Requirements : AUTORADAR_REQ-708 */
361 rlReturnVal_t rlDeviceFileDownload(rlUInt8_t deviceMap, rlFileData_t* data,
362  rlUInt16_t remChunks)
363 {
364  rlReturnVal_t retVal;
365 
366  /* check if deviceIndex is out of defined value */
367  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
368  (RL_NULL_PTR == data))
369  {
370  /* set error code if DeviceMAP is invalid or data pointer is null */
371  retVal = RL_RET_CODE_INVALID_INPUT;
372  RL_LOGE_ARG0("Invalid input");
373  }
374  /* This API is valid only when mmWaveLink instance is running on
375  External Host Processor */
376  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
377  {
378  /* set error code of Platform is not set to HOST */
379  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
380  }
381  else
382  {
383  /* LDRA waiver 8 D - DD data flow anomalies found- */
384  /* Initialize in-message structure to zero */
385  rlDriverMsg_t inMsg = {0};
386  /* Initialize out-message structure to zero */
387  rlDriverMsg_t outMsg = {0};
388  /* Initialize in-payload sub-block structure to zero */
389  rlPayloadSb_t inPayloadSb = {0};
390 
391  /* Construct command packet */
392  rlDriverConstructInMsg(RL_DEV_FILE_DOWNLOAD_MSG, &inMsg, &inPayloadSb);
393 
394  /* set the remaining chunk in command message */
395  inMsg.remChunks = remChunks;
396  /* Fill in-message Payload */
397  /* AR_CODE_REVIEW MR:R.11.1 <APPROVED> "conversion required." */
398  /*LDRA_INSPECTED 95 S */
399  rlDriverFillPayload(RL_DEV_FILE_DOWNLOAD_MSG, RL_SYS_FILE_DWLD_SB, &inPayloadSb,\
400  (rlUInt8_t*)&data->fData[0U], (rlUInt16_t)data->chunkLen);
401 
402  /* Send Command to mmWave Radar Device */
403  /* LDRA waiver 45 D - can't be NULL */
404  /* LDRA waiver 45 D - can't be NULL */
405  retVal = rlDriverCmdInvoke(deviceMap, inMsg, &outMsg);
406  }
407  return retVal;
408 }
409 
421 rlReturnVal_t rlDeviceGetMssVersion(rlUInt8_t deviceMap, rlFwVersionParam_t *data)
422 {
423  rlReturnVal_t retVal;
424 
425  /* check for NULL pointer */
426  if (data == RL_NULL_PTR)
427  {
428  /* set error code if data pointer is passed NULL */
429  retVal = RL_RET_CODE_NULL_PTR;
430  }
431  /* This API is valid only when mmWaveLink instance is running on
432  External Host Processor */
433  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
434  {
435  /* set error code of Platform is not set to HOST */
436  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
437  }
438  else
439  {
440  /* Package the command with given data and send it to device */
441  retVal = rlDriverExecuteGetApi(deviceMap, RL_DEV_STATUS_GET_MSG,
442  RL_SYS_VERSION_SB, (rlUInt8_t*)data, 0U);
443  }
444 
445  return retVal;
446 }
447 
458 rlReturnVal_t rlDeviceGetRfVersion(rlUInt8_t deviceMap, rlFwVersionParam_t *data)
459 {
460  rlReturnVal_t retVal;
461 
462  /* check for NULL pointer */
463  if (data == RL_NULL_PTR)
464  {
465  /* set error code if data pointer is passed NULL */
466  retVal = RL_RET_CODE_NULL_PTR;
467  }
468  else
469  {
470  /* Package the command with given data and send it to device */
471  retVal = rlDriverExecuteGetApi(deviceMap, RL_RF_STATUS_GET_MSG,
472  RL_RF_RFVERSION_SB, (rlUInt8_t*)data, 0U);
473  }
474 
475  return retVal;
476 }
477 
488 /* DesignId : MMWL_DesignId_007 */
489 /* Requirements : AUTORADAR_REQ-709 */
490 rlReturnVal_t rlDeviceGetVersion(rlUInt8_t deviceMap, rlVersion_t* data)
491 {
492  rlReturnVal_t retVal;
493 
494  RL_LOGV_ARG0("rlDeviceGetVersion starts...\n");
495 
496  /* check if deviceIndex is out of defined value */
497  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
498  (RL_NULL_PTR == data))
499  {
500  /* set error code */
501  retVal = RL_RET_CODE_INVALID_INPUT;
502  RL_LOGE_ARG0("Invalid inputs");
503  }
504  else
505  {
506  /* If mmWaveLink is runing on ext host */
507  if (RL_PLATFORM_HOST == rlDriverGetPlatformId())
508  {
509  /* get mmwave MSS ROM or Application version */
510  retVal = rlDeviceGetMssVersion(deviceMap, &data->master);
511  }
512  else
513  {
514  /* if mmwavelink is not running on Host then no need to get MSS version */
515  retVal = RL_RET_CODE_OK;
516  RL_LOGD_ARG0(" rlPlatform is not host \n");
517  }
518 
519  if (retVal == RL_RET_CODE_OK)
520  {
521  /* get RF (RadarSS) version */
522  retVal += rlDeviceGetRfVersion(deviceMap, &data->rf);
523  }
524 
525  if (retVal == RL_RET_CODE_OK)
526  {
527  /* get mmwavelink library version */
528  retVal += rlDeviceGetMmWaveLinkVersion(&data->mmWaveLink);
529  }
530  }
531 
532  RL_LOGV_ARG0("rlDeviceGetVersion complete...\n");
533 
534  return retVal;
535 }
545 /* DesignId : MMWL_DesignId_008 */
546 /* Requirements : AUTORADAR_REQ-709 */
548 {
549  rlReturnVal_t retVal;
550 
551  RL_LOGV_ARG0("rlDeviceGetMmWaveLinkVersion starts...\n");
552 
553  if (RL_NULL_PTR != data)
554  {
555  /* mmWaveLink Version */
556  /* mmWaveLink SW Major verison */
557  data->major = RL_MMWAVELINK_VERSION_MAJOR;
558  /* mmWaveLink SW Minor verison */
559  data->minor = RL_MMWAVELINK_VERSION_MINOR;
560  /* mmWaveLink SW Build verison */
561  data->build = RL_MMWAVELINK_VERSION_BUILD;
562  /* mmWaveLink SW Debug verison */
563  data->debug = RL_MMWAVELINK_VERSION_DEBUG;
564  /* mmWaveLink SW Release Year */
565  data->year = RL_MMWAVELINK_VERSION_YEAR;
566  /* mmWaveLink SW Release Month */
567  data->month = RL_MMWAVELINK_VERSION_MONTH;
568  /* mmWaveLink SW Release date */
569  data->day = RL_MMWAVELINK_VERSION_DAY;
570  /* Set error code */
571  retVal = RL_RET_CODE_OK;
572  RL_LOGD_ARG0("Extracted MmWavelink version\n");
573  }
574  else
575  {
576  /* set error code */
577  retVal = RL_RET_CODE_INVALID_INPUT;
578  RL_LOGE_ARG0("rlDeviceGetMmWaveLinkVersion, Output param is NULL \n");
579  }
580 
581  RL_LOGV_ARG0("rlDeviceGetMmWaveLinkVersion complete...\n");
582 
583  return retVal;
584 }
585 
597 /* DesignId : MMWL_DesignId_104 */
598 /* Requirements : AUTORADAR_REQ-762 */
599 rlReturnVal_t rlDeviceSetDataFmtConfig(rlUInt8_t deviceMap, rlDevDataFmtCfg_t* data)
600 {
601  rlReturnVal_t retVal;
602 
603  RL_LOGV_ARG0("rlDeviceSetDataFmtConfig starts...\n");
604 
605  /* check if deviceIndex is out of defined value */
606  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
607  (RL_NULL_PTR == data))
608  {
609  /* set error code if DeviceMAP is invalid or data pointer is null */
610  retVal = RL_RET_CODE_INVALID_INPUT;
611  RL_LOGE_ARG0("Invalid device mapping\n");
612  }
613  /* This API is valid only when mmWaveLink instance is running on
614  External Host Processor */
615  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
616  {
617  /* set error code of Platform is not set to HOST */
618  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
619  }
620  else
621  {
622  /* Package the command with given data and send it to device */
623  retVal = rlDriverExecuteSetApi(deviceMap, RL_DEV_CONFIG_SET_MSG,
624  RL_DEV_RX_DATA_FORMAT_CONF_SET_SB, (rlUInt8_t*)data,
625  (rlUInt16_t)sizeof(rlDevDataFmtCfg_t));
626  }
627 
628  RL_LOGV_ARG0("rlDeviceSetDataFmtConfig complete...\n");
629 
630  return retVal;
631 }
632 
645 /* DesignId : MMWL_DesignId_112 */
646 /* Requirements : AUTORADAR_REQ-762 */
647 rlReturnVal_t rlDeviceGetDataFmtConfig(rlUInt8_t deviceMap, rlDevDataFmtCfg_t* data)
648 {
649  rlReturnVal_t retVal;
650 
651  RL_LOGV_ARG0("rlDeviceGetDataFmtConfig starts...\n");
652 
653  /* check if deviceIndex is out of defined value */
654  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
655  (RL_NULL_PTR == data))
656  {
657  /* set error code if DeviceMAP is invalid or data pointer is null */
658  retVal = RL_RET_CODE_INVALID_INPUT;
659  RL_LOGE_ARG0("rlDeviceGetDataFmtConfig, Invalid device map\n");
660  }
661  /* This API is valid only when mmWaveLink instance is running on
662  External Host Processor */
663  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
664  {
665  /* set error code of Platform is not set to HOST */
666  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
667  }
668  else
669  {
670  /* Package the command with given data and send it to device */
671  retVal = rlDriverExecuteGetApi(deviceMap, RL_DEV_CONFIG_GET_MSG,
672  RL_DEV_RX_DATA_FORMAT_CONF_SET_SB,
673  (rlUInt8_t*)data, 0U);
674  }
675 
676  RL_LOGV_ARG0("rlDeviceGetDataFmtConfig ends...\n");
677  return retVal;
678 }
679 
691 /* DesignId : MMWL_DesignId_105 */
692 /* Requirements : AUTORADAR_REQ-763 */
693 rlReturnVal_t rlDeviceSetDataPathConfig(rlUInt8_t deviceMap, rlDevDataPathCfg_t* data)
694 {
695  rlReturnVal_t retVal;
696 
697  RL_LOGV_ARG0("rlDeviceSetDataPathConfig starts...\n");
698 
699  /* check if deviceIndex is out of defined value */
700  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
701  (RL_NULL_PTR == data))
702  {
703  /* set error code if DeviceMAP is invalid or data pointer is null */
704  retVal = RL_RET_CODE_INVALID_INPUT;
705  RL_LOGE_ARG0("Invalid input");
706  }
707  /* This API is valid only when mmWaveLink instance is running on
708  External Host Processor */
709  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
710  {
711  /* set error code of Platform is not set to HOST */
712  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
713  }
714  else
715  {
716  /* Package the command with given data and send it to device */
717  retVal = rlDriverExecuteSetApi(deviceMap, RL_DEV_CONFIG_SET_MSG,
718  RL_DEV_RX_DATA_PATH_CONF_SET_SB, (rlUInt8_t*)data,
719  (rlUInt16_t)sizeof(rlDevDataPathCfg_t));
720  }
721 
722  RL_LOGV_ARG0("rlDeviceSetDataPathConfig ends...\n");
723  return retVal;
724 }
725 
738 /* DesignId : MMWL_DesignId_113 */
739 /* Requirements : AUTORADAR_REQ-763 */
740 rlReturnVal_t rlDeviceGetDataPathConfig(rlUInt8_t deviceMap,
741  rlDevDataPathCfg_t* data)
742 {
743  rlReturnVal_t retVal;
744 
745  RL_LOGV_ARG0("rlDeviceGetDataPathConfig starts...\n");
746 
747  /* check if deviceIndex is out of defined value */
748  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
749  (RL_NULL_PTR == data))
750  {
751  /* set error code if DeviceMAP is invalid or data pointer is null */
752  retVal = RL_RET_CODE_INVALID_INPUT;
753  RL_LOGE_ARG0("rlDeviceGetDataPathConfig, Invalid device map\n");
754  }
755  /* This API is valid only when mmWaveLink instance is running on
756  External Host Processor */
757  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
758  {
759  /* set error code of Platform is not set to HOST */
760  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
761  }
762  else
763  {
764  /* Package the command with given data and send it to device */
765  retVal = rlDriverExecuteGetApi(deviceMap, RL_DEV_CONFIG_GET_MSG,
766  RL_DEV_RX_DATA_PATH_CONF_SET_SB,
767  (rlUInt8_t*)data, 0U);
768  }
769 
770  RL_LOGV_ARG0("rlDeviceGetDataPathConfig ends...\n");
771  return retVal;
772 }
773 
785 /* DesignId : MMWL_DesignId_033 */
786 /* Requirements : AUTORADAR_REQ-756, AUTORADAR_REQ-764 */
787 rlReturnVal_t rlDeviceSetLaneConfig(rlUInt8_t deviceMap, rlDevLaneEnable_t* data)
788 {
789  rlReturnVal_t retVal;
790 
791  RL_LOGV_ARG0("rlDeviceSetLaneConfig starts...\n");
792 
793  /* check if deviceIndex is out of defined value */
794  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
795  (RL_NULL_PTR == data))
796  {
797  /* set error code if DeviceMAP is invalid or data pointer is null */
798  retVal = RL_RET_CODE_INVALID_INPUT;
799  RL_LOGE_ARG0("Invalid input\n");
800  }
801  /* This API is valid only when mmWaveLink instance is running on
802  External Host Processor */
803  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
804  {
805  /* set error code of Platform is not set to HOST */
806  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
807  }
808  else
809  {
810  /* Package the command with given data and send it to device */
811  retVal = rlDriverExecuteSetApi(deviceMap, RL_DEV_CONFIG_SET_MSG,
812  RL_DEV_DATA_PATH_LANEEN_SET_SB, (rlUInt8_t*)data,
813  (rlUInt16_t)sizeof(rlDevLaneEnable_t));
814  }
815  RL_LOGV_ARG0("rlDeviceSetLaneConfig ends...\n");
816 
817  return retVal;
818 }
819 
832 /* DesignId : MMWL_DesignId_115 */
833 /* Requirements : AUTORADAR_REQ-765, AUTORADAR_REQ-764 */
834 rlReturnVal_t rlDeviceGetLaneConfig(rlUInt8_t deviceMap, rlDevLaneEnable_t* data)
835 {
836  rlReturnVal_t retVal;
837 
838  RL_LOGV_ARG0("rlDeviceGetLaneConfig starts...\n");
839 
840  /* check if deviceIndex is out of defined value */
841  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
842  (RL_NULL_PTR == data))
843  {
844  /* set error code if DeviceMAP is invalid or data pointer is null */
845  retVal = RL_RET_CODE_INVALID_INPUT;
846  RL_LOGE_ARG0("rlDeviceGetLaneConfig, Invalid device map\n");
847  }
848  /* This API is valid only when mmWaveLink instance is running on
849  External Host Processor */
850  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
851  {
852  /* set error code of Platform is not set to HOST */
853  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
854  }
855  else
856  {
857  /* Package the command with given data and send it to device */
858  retVal = rlDriverExecuteGetApi(deviceMap, RL_DEV_CONFIG_GET_MSG,
859  RL_DEV_DATA_PATH_LANEEN_SET_SB,
860  (rlUInt8_t*)data, 0U);
861  }
862 
863  RL_LOGV_ARG0("rlDeviceGetLaneConfig ends...\n");
864  return retVal;
865 }
866 
879 /* DesignId : MMWL_DesignId_106 */
880 /* Requirements : AUTORADAR_REQ-764 */
881 rlReturnVal_t rlDeviceSetDataPathClkConfig(rlUInt8_t deviceMap,
882  rlDevDataPathClkCfg_t* data )
883 {
884  rlReturnVal_t retVal;
885 
886  RL_LOGV_ARG0("rlDeviceSetDataPathClkConfig starts...\n");
887 
888  /* check if deviceIndex is out of defined value */
889  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || (RL_NULL_PTR == data))
890  {
891  /* set error code if DeviceMAP is invalid or data pointer is null */
892  retVal = RL_RET_CODE_INVALID_INPUT;
893  RL_LOGE_ARG0("Invalid input\n");
894  }
895  /* This API is valid only when mmWaveLink instance is running on
896  External Host Processor */
897  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
898  {
899  /* set error code of Platform is not set to HOST */
900  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
901  }
902  else
903  {
904  /* Package the command with given data and send it to device */
905  retVal = rlDriverExecuteSetApi(deviceMap, RL_DEV_CONFIG_SET_MSG,
906  RL_DEV_DATA_PATH_CLOCK_SET_SB, (rlUInt8_t*)data,
907  (rlUInt16_t)sizeof(rlDevDataPathClkCfg_t));
908  }
909  RL_LOGV_ARG0("rlDeviceSetDataPathClkConfig ends...\n");
910 
911  return retVal;
912 }
913 
926 /* DesignId : MMWL_DesignId_114 */
927 /* Requirements : AUTORADAR_REQ-764 */
928 rlReturnVal_t rlDeviceGetDataPathClkConfig(rlUInt8_t deviceMap, rlDevDataPathClkCfg_t* data)
929 {
930  rlReturnVal_t retVal;
931 
932  RL_LOGV_ARG0("rlDeviceGetDataPathClkConfig starts...\n");
933 
934  /* check if deviceIndex is out of defined value */
935  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
936  (RL_NULL_PTR == data))
937  {
938  /* set error code if DeviceMAP is invalid or data pointer is null */
939  retVal = RL_RET_CODE_INVALID_INPUT;
940  RL_LOGE_ARG0("rlDeviceGetDataPathClkConfig, Invalid device map\n");
941  }
942  /* This API is valid only when mmWaveLink instance is running on
943  External Host Processor */
944  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
945  {
946  /* set error code of Platform is not set to HOST */
947  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
948  }
949  else
950  {
951  /* Package the command with given data and send it to device */
952  retVal = rlDriverExecuteGetApi(deviceMap, RL_DEV_CONFIG_GET_MSG,
953  RL_DEV_DATA_PATH_CLOCK_SET_SB,
954  (rlUInt8_t*)data, 0U);
955  }
956 
957  RL_LOGV_ARG0("rlDeviceGetDataPathClkConfig ends...\n");
958  return retVal;
959 }
960 
972 /* DesignId : MMWL_DesignId_030 */
973 /* Requirements : AUTORADAR_REQ-767 */
974 rlReturnVal_t rlDeviceSetLvdsLaneConfig(rlUInt8_t deviceMap, rlDevLvdsLaneCfg_t* data)
975 {
976  rlReturnVal_t retVal;
977 
978  RL_LOGV_ARG0("rlDeviceSetLvdsLaneConfig starts...\n");
979 
980  /* check if deviceIndex is out of defined value */
981  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
982  (RL_NULL_PTR == data))
983  {
984  /* set error code if DeviceMAP is invalid or data pointer is null */
985  retVal = RL_RET_CODE_INVALID_INPUT;
986  RL_LOGE_ARG0("Invalid input\n");
987  }
988  /* This API is valid only when mmWaveLink instance is running on
989  External Host Processor */
990  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
991  {
992  /* set error code of Platform is not set to HOST */
993  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
994  }
995  else
996  {
997  /* Package the command with given data and send it to device */
998  retVal = rlDriverExecuteSetApi(deviceMap, RL_DEV_CONFIG_SET_MSG,
999  RL_DEV_DATA_PATH_CFG_SET_SB, (rlUInt8_t*)data,
1000  (rlUInt16_t)sizeof(rlDevLvdsLaneCfg_t));
1001  }
1002 
1003  RL_LOGV_ARG0("rlDeviceSetLvdsLaneConfig ends...\n");
1004 
1005  return retVal;
1006 }
1007 
1020 /* DesignId : MMWL_DesignId_116 */
1021 /* Requirements : AUTORADAR_REQ-767 */
1022 rlReturnVal_t rlDeviceGetLvdsLaneConfig(rlUInt8_t deviceMap, rlDevLvdsLaneCfg_t* data)
1023 {
1024  rlReturnVal_t retVal;
1025 
1026  RL_LOGV_ARG0("rlDeviceGetLvdsLaneConfig starts...\n");
1027 
1028  /* check if deviceIndex is out of defined value */
1029  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
1030  (RL_NULL_PTR == data))
1031  {
1032  /* set error code if DeviceMAP is invalid or data pointer is null */
1033  retVal = RL_RET_CODE_INVALID_INPUT;
1034  RL_LOGE_ARG0("rlDeviceGetLvdsLaneConfig, Invalid device map\n");
1035  }
1036  /* This API is valid only when mmWaveLink instance is running on
1037  External Host Processor */
1038  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
1039  {
1040  /* set error code of Platform is not set to HOST */
1041  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
1042  }
1043  else
1044  {
1045  /* Package the command with given data and send it to device */
1046  retVal = rlDriverExecuteGetApi(deviceMap, RL_DEV_CONFIG_GET_MSG,
1047  RL_DEV_DATA_PATH_CFG_SET_SB,
1048  (rlUInt8_t*)data, 0U);
1049  }
1050 
1051  RL_LOGV_ARG0("rlDeviceGetLvdsLaneConfig ends...\n");
1052  return retVal;
1053 }
1054 
1071 /* DesignId : MMWL_DesignId_040 */
1072 /* Requirements : AUTORADAR_REQ-829 */
1073 rlReturnVal_t rlDeviceSetContStreamingModeConfig(rlUInt8_t deviceMap,
1075 {
1076  rlReturnVal_t retVal;
1077 
1078  RL_LOGV_ARG0("rlDeviceSetContStreamingModeConfig ends...\n");
1079 
1080  /* check if deviceIndex is out of defined value */
1081  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
1082  (RL_NULL_PTR == data))
1083  {
1084  /* set error code if DeviceMAP is invalid or data pointer is null */
1085  retVal = RL_RET_CODE_INVALID_INPUT;
1086  RL_LOGE_ARG0("Invalid input");
1087  }
1088  /* This API is valid only when mmWaveLink instance is running on
1089  External Host Processor */
1090  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
1091  {
1092  /* set error code of Platform is not set to HOST */
1093  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
1094  }
1095  else
1096  {
1097  /* Package the command with given data and send it to device */
1098  retVal = rlDriverExecuteSetApi(deviceMap, RL_DEV_CONFIG_SET_MSG,
1099  RL_DEV_RX_CONTSTREAMING_MODE_CONF_SET_SB,
1100  (rlUInt8_t*)data,
1101  (rlUInt16_t)sizeof(rlDevContStreamingModeCfg_t));
1102  }
1103 
1104  RL_LOGV_ARG0("rlDeviceSetContStreamingModeConfig ends...\n");
1105 
1106  return retVal;
1107 
1108 }
1109 
1123 /* DesignId : MMWL_DesignId_121 */
1124 /* Requirements : AUTORADAR_REQ-829 */
1126  rlUInt8_t deviceMap, rlDevContStreamingModeCfg_t* data)
1127 {
1128  rlReturnVal_t retVal;
1129 
1130  RL_LOGV_ARG0("rlDeviceGetContStreamingModeConfig starts...\n");
1131 
1132  /* check if deviceIndex is out of defined value */
1133  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
1134  (RL_NULL_PTR == data))
1135  {
1136  /* set error code if DeviceMAP is invalid or data pointer is null */
1137  retVal = RL_RET_CODE_INVALID_INPUT;
1138  RL_LOGE_ARG0("rlDeviceGetContStreamingModeConfig, Invalid device map\n");
1139  }
1140  /* This API is valid only when mmWaveLink instance is running on
1141  External Host Processor */
1142  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
1143  {
1144  /* set error code of Platform is not set to HOST */
1145  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
1146  }
1147  else
1148  {
1149  /* Package the command with given data and send it to device */
1150  retVal = rlDriverExecuteGetApi(deviceMap, RL_DEV_CONFIG_GET_MSG,
1151  RL_DEV_RX_CONTSTREAMING_MODE_CONF_SET_SB,
1152  (rlUInt8_t*)data, 0U);
1153  }
1154 
1155  RL_LOGV_ARG0("rlDeviceGetContStreamingModeConfig ends...\n");
1156  return retVal;
1157 }
1158 
1170 /* DesignId : MMWL_DesignId_048 */
1171 /* Requirements : AUTORADAR_REQ-756, AUTORADAR_REQ-766 */
1172 rlReturnVal_t rlDeviceSetCsi2Config(rlUInt8_t deviceMap, rlDevCsi2Cfg_t* data)
1173 {
1174  rlReturnVal_t retVal;
1175 
1176  RL_LOGV_ARG0("rlDeviceSetCsi2Config starts...\n");
1177 
1178  /* check if deviceIndex is out of defined value */
1179  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
1180  (RL_NULL_PTR == data))
1181  {
1182  /* set error code if DeviceMAP is invalid or data pointer is null */
1183  retVal = RL_RET_CODE_INVALID_INPUT;
1184  RL_LOGE_ARG0("Invalid input");
1185  }
1186  /* This API is valid only when mmWaveLink instance is running on
1187  External Host Processor */
1188  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
1189  {
1190  /* set error code of Platform is not set to HOST */
1191  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
1192  }
1193  else
1194  {
1195  /* Package the command with given data and send it to device */
1196  retVal = rlDriverExecuteSetApi(deviceMap, RL_DEV_CONFIG_SET_MSG,
1197  RL_DEV_CSI2_CFG_SET_SB, (rlUInt8_t*)data,
1198  (rlUInt16_t)sizeof(rlDevCsi2Cfg_t));
1199  }
1200  RL_LOGV_ARG0("rlDeviceSetCsi2Config ends...\n");
1201 
1202  return retVal;
1203 }
1204 
1217 /* DesignId : MMWL_DesignId_111 */
1218 /* Requirements : AUTORADAR_REQ-756, AUTORADAR_REQ-766 */
1219 rlReturnVal_t rlDeviceGetCsi2Config(rlUInt8_t deviceMap, rlDevCsi2Cfg_t* data)
1220 {
1221  rlReturnVal_t retVal;
1222 
1223  RL_LOGV_ARG0("rlDeviceGetCsi2Config starts...\n");
1224 
1225  /* check if deviceIndex is out of defined value */
1226  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
1227  (RL_NULL_PTR == data))
1228  {
1229  /* set error code if DeviceMAP is invalid or data pointer is null */
1230  retVal = RL_RET_CODE_INVALID_INPUT;
1231  RL_LOGE_ARG0("rlDeviceGetCsi2Config, Invalid device map\n");
1232  }
1233  /* This API is valid only when mmWaveLink instance is running on
1234  External Host Processor */
1235  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
1236  {
1237  /* set error code of Platform is not set to HOST */
1238  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
1239  }
1240  else
1241  {
1242  /* Package the command with given data and send it to device */
1243  retVal = rlDriverExecuteGetApi(deviceMap, RL_DEV_CONFIG_GET_MSG,
1244  RL_DEV_CSI2_CFG_SET_SB,
1245  (rlUInt8_t*)data, 0U);
1246  }
1247 
1248  RL_LOGV_ARG0("rlDeviceGetCsi2Config ends...\n");
1249  return retVal;
1250 }
1251 
1266 /* DesignId : MMWL_DesignId_020 */
1267 /* Requirements : AUTORADAR_REQ-756 */
1268 rlReturnVal_t rlDeviceSetHsiConfig(rlUInt8_t deviceMap,
1269  rlDevHsiCfg_t* data )
1270 {
1271  rlReturnVal_t retVal;
1272  /* Initialize Command and Response Sub Blocks */
1273  rlDriverMsg_t inMsg;
1274  rlDriverMsg_t outMsg = {0};
1275  rlUInt16_t sbcCnt = 0U;
1276 
1277  /* Initialize Command and Response Sub Blocks */
1278  rlPayloadSb_t inPayloadSb[3U] = {0};
1279 
1280  RL_LOGV_ARG0("rlDeviceSetHsiConfig starts...\n");
1281 
1282  /* check if deviceIndex is out of defined value */
1283  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
1284  (RL_NULL_PTR == data) )
1285  {
1286  /* set error code if DeviceMAP is invalid or data pointer is null */
1287  retVal = RL_RET_CODE_INVALID_INPUT;
1288  RL_LOGE_ARG0("rlDeviceSetHsiConfig, Invalid input \n");
1289  }
1290  else
1291  {
1292  /* Data Format config SubBlock */
1293  if (RL_NULL_PTR != data->datafmt)
1294  {
1295  /* Fill in-message Payload */
1296  rlDriverFillPayload(RL_DEV_CONFIG_SET_MSG,
1297  RL_DEV_RX_DATA_FORMAT_CONF_SET_SB,
1298  &inPayloadSb[sbcCnt],
1299  (rlUInt8_t* )data->datafmt,
1300  (rlUInt16_t)sizeof(rlDevDataFmtCfg_t));
1301  /* increament Sub-block count */
1302  sbcCnt++;
1303  }
1304 
1305  /* Data Path Config SubBlock */
1306  if (RL_NULL_PTR != data->dataPath)
1307  {
1308  /* Fill in-message Payload */
1309  rlDriverFillPayload(RL_DEV_CONFIG_SET_MSG,
1310  RL_DEV_RX_DATA_PATH_CONF_SET_SB,
1311  &inPayloadSb[sbcCnt],
1312  (rlUInt8_t* )data->dataPath,
1313  (rlUInt16_t)sizeof(rlDevDataPathCfg_t));
1314  /* increament Sub-block count */
1315  sbcCnt++;
1316  }
1317 
1318  /* Data Path clock Config SubBlock */
1319  if (RL_NULL_PTR != data->dataPathClk)
1320  {
1321  /* Fill in-message Payload */
1322  rlDriverFillPayload(RL_DEV_CONFIG_SET_MSG,
1323  RL_DEV_DATA_PATH_CLOCK_SET_SB,
1324  &inPayloadSb[sbcCnt],
1325  (rlUInt8_t* )data->dataPathClk,
1326  (rlUInt16_t)sizeof(rlDevDataPathClkCfg_t));
1327  /* increament Sub-block count */
1328  sbcCnt++;
1329  }
1330 
1331  /* Construct command packet */
1332  rlDriverConstructInMsg(RL_DEV_CONFIG_SET_MSG, &inMsg, &inPayloadSb[0U]);
1333 
1334  if (sbcCnt > 0U)
1335  {
1336  /* setting num of sub-block to inMsg */
1337  inMsg.opcode.nsbc = sbcCnt;
1338 
1339  /* Send Command to mmWave Radar Device */
1340  retVal = rlDriverCmdInvoke(deviceMap, inMsg, &outMsg);
1341  }
1342  else
1343  {
1344  /* set error code if application doesn't pass any subBlock data */
1345  retVal = RL_RET_CODE_INVALID_INPUT;
1346  RL_LOGE_ARG0("sub block is NULL\n");
1347  }
1348  }
1349 
1350  RL_LOGV_ARG0("rlDeviceSetHsiConfig ends...\n");
1351 
1352  return retVal;
1353 }
1354 
1366 /* DesignId : MMWL_DesignId_101 */
1367 /* Requirements : AUTORADAR_REQ-765 */
1368 rlReturnVal_t rlDeviceSetHsiClk(rlUInt8_t deviceMap, rlDevHsiClk_t* data)
1369 {
1370  rlReturnVal_t retVal;
1371 
1372  RL_LOGV_ARG0("rlDeviceSetHsiClk starts...\n");
1373 
1374  /* check if deviceIndex is out of defined value */
1375  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
1376  (RL_NULL_PTR == data))
1377  {
1378  /* set error code if DeviceMAP is invalid or data pointer is null */
1379  retVal = RL_RET_CODE_INVALID_INPUT;
1380  RL_LOGE_ARG0("Invalid input\n");
1381  }
1382  else
1383  {
1384  /* Package the command with given data and send it to device */
1385  retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_STATIC_CONF_SET_MSG,
1386  RL_RF_HIGHSPEEDINTFCLK_CONF_SET_SB,
1387  (rlUInt8_t*)data,
1388  (rlUInt16_t)sizeof(rlDevHsiClk_t));
1389  }
1390  RL_LOGV_ARG0("rlDeviceSetHsiClk ends...\n");
1391 
1392  return retVal;
1393 }
1394 
1407 /* DesignId : MMWL_DesignId_069 */
1408 /* Requirements : AUTORADAR_REQ-713 */
1409 rlReturnVal_t rlDeviceMcuClkConfig(rlUInt8_t deviceMap, rlMcuClkCfg_t * data)
1410 {
1411  rlReturnVal_t retVal;
1412 
1413  RL_LOGV_ARG0("rlDeviceMcuClkConfig starts...\n");
1414 
1415  /* check if deviceIndex is out of defined value */
1416  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
1417  (RL_NULL_PTR == data))
1418  {
1419  /* set error code if DeviceMAP is invalid or data pointer is null */
1420  retVal = RL_RET_CODE_INVALID_INPUT;
1421  RL_LOGE_ARG0("Invalid input");
1422  }
1423  /* This API is valid only when mmWaveLink instance is running on
1424  External Host Processor */
1425  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
1426  {
1427  /* set error code of Platform is not set to HOST */
1428  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
1429  }
1430  else
1431  {
1432  /* Package the command with given data and send it to device */
1433  retVal = rlDriverExecuteSetApi(deviceMap, RL_DEV_CONFIG_SET_MSG,
1434  RL_DEV_MCUCLOCK_CONF_SET_SB, (rlUInt8_t*)data,
1435  (rlUInt16_t)sizeof(rlMcuClkCfg_t));
1436  }
1437  RL_LOGV_ARG0("rlDeviceMcuClkConfig ends...\n");
1438 
1439  return retVal;
1440 }
1441 
1453 /* DesignId : MMWL_DesignId_070 */
1454 /* Requirements : AUTORADAR_REQ-907 */
1455 rlReturnVal_t rlDevicePmicClkConfig(rlUInt8_t deviceMap, rlPmicClkCfg_t * data)
1456 {
1457  rlReturnVal_t retVal;
1458 
1459  RL_LOGV_ARG0("rlDevicePmicClkConfig starts...\n");
1460 
1461  /* check if deviceIndex is out of defined value */
1462  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
1463  (RL_NULL_PTR == data))
1464  {
1465  /* set error code if DeviceMAP is invalid or data pointer is null */
1466  retVal = RL_RET_CODE_INVALID_INPUT;
1467  RL_LOGE_ARG0("Invalid input");
1468  }
1469  /* This API is valid only when mmWaveLink instance is running on
1470  External Host Processor */
1471  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
1472  {
1473  /* set error code of Platform is not set to HOST */
1474  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
1475  }
1476  else
1477  {
1478  /* Package the command with given data and send it to device */
1479  retVal = rlDriverExecuteSetApi(deviceMap, RL_DEV_CONFIG_SET_MSG,
1480  RL_DEV_PMICCLOCK_CONF_SET_SB, (rlUInt8_t*)data,
1481  (rlUInt16_t)sizeof(rlPmicClkCfg_t));
1482  }
1483  RL_LOGV_ARG0("rlDevicePmicClkConfig ends...\n");
1484 
1485  return retVal;
1486 }
1487 
1499 /* DesignId : MMWL_DesignId_071 */
1500 /* Requirements : AUTORADAR_REQ-908 */
1501 rlReturnVal_t rlDeviceLatentFaultTests(rlUInt8_t deviceMap, rllatentFault_t * data)
1502 {
1503  rlReturnVal_t retVal;
1504 
1505  RL_LOGV_ARG0("rlDeviceLatentFaultTests starts...\n");
1506 
1507  /* check if deviceIndex is out of defined value */
1508  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
1509  (RL_NULL_PTR == data))
1510  {
1511  /* set error code if DeviceMAP is invalid or data pointer is null */
1512  retVal = RL_RET_CODE_INVALID_INPUT;
1513  RL_LOGE_ARG0("Invalid input");
1514  }
1515  /* This API is valid only when mmWaveLink instance is running on
1516  External Host Processor */
1517  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
1518  {
1519  /* set error code of Platform is not set to HOST */
1520  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
1521  }
1522  else
1523  {
1524  /* Package the command with given data and send it to device */
1525  retVal = rlDriverExecuteSetApi(deviceMap, RL_DEV_CONFIG_SET_MSG,
1526  RL_DEV_LATENTFAULT_TEST_CONF_SB, (rlUInt8_t*)data,
1527  (rlUInt16_t)sizeof(rllatentFault_t));
1528  }
1529  RL_LOGV_ARG0("rlDeviceLatentFaultTests ends...\n");
1530 
1531  return retVal;
1532 }
1533 
1545 /* DesignId : MMWL_DesignId_072 */
1546 /* Requirements : AUTORADAR_REQ-909 */
1547 rlReturnVal_t rlDeviceEnablePeriodicTests(rlUInt8_t deviceMap, rlperiodicTest_t * data)
1548 {
1549  rlReturnVal_t retVal;
1550 
1551  RL_LOGV_ARG0("rlDeviceEnablePeriodicTests starts...\n");
1552 
1553  /* check if deviceIndex is out of defined value */
1554  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
1555  (RL_NULL_PTR == data))
1556  {
1557  /* set error code if DeviceMAP is invalid or data pointer is null */
1558  retVal = RL_RET_CODE_INVALID_INPUT;
1559  RL_LOGE_ARG0("Invalid input");
1560  }
1561  /* This API is valid only when mmWaveLink instance is running on
1562  External Host Processor */
1563  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
1564  {
1565  /* set error code of Platform is not set to HOST */
1566  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
1567  }
1568  else
1569  {
1570  /* Package the command with given data and send it to device */
1571  retVal = rlDriverExecuteSetApi(deviceMap, RL_DEV_CONFIG_SET_MSG,
1572  RL_DEV_PERIODICTESTS_CONF_SB, (rlUInt8_t*)data,
1573  (rlUInt16_t)sizeof(rlperiodicTest_t));
1574  }
1575  RL_LOGV_ARG0("rlDeviceEnablePeriodicTests ends...\n");
1576 
1577  return retVal;
1578 }
1579 
1592 /* DesignId : MMWL_DesignId_103 */
1593 /* Requirements : AUTORADAR_REQ-910 */
1594 rlReturnVal_t rlDeviceSetTestPatternConfig(rlUInt8_t deviceMap, rltestPattern_t * data)
1595 {
1596  rlReturnVal_t retVal;
1597 
1598  RL_LOGV_ARG0("rlDeviceSetTestPatternConfig starts...\n");
1599 
1600  /* check if deviceIndex is out of defined value */
1601  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
1602  (RL_NULL_PTR == data))
1603  {
1604  /* set error code if DeviceMAP is invalid or data pointer is null */
1605  retVal = RL_RET_CODE_INVALID_INPUT;
1606  RL_LOGE_ARG0("Invalid input");
1607  }
1608  /* This API is valid only when mmWaveLink instance is running on
1609  External Host Processor */
1610  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
1611  {
1612  /* set error code of Platform is not set to HOST */
1613  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
1614  }
1615  else
1616  {
1617  /* Package the command with given data and send it to device */
1618  retVal = rlDriverExecuteSetApi(deviceMap, RL_DEV_CONFIG_SET_MSG,
1619  RL_DEV_TESTPATTERN_GEN_SET_SB, (rlUInt8_t*)data,
1620  (rlUInt16_t)sizeof(rltestPattern_t));
1621  }
1622  RL_LOGV_ARG0("rlDeviceSetTestPatternConfig ends...\n");
1623 
1624  return retVal;
1625 }
1626 
1639 /* DesignId : MMWL_DesignId_117 */
1640 /* Requirements : AUTORADAR_REQ-886 */
1641 rlReturnVal_t rlDeviceSetMiscConfig(rlUInt8_t deviceMap, rlDevMiscCfg_t *data)
1642 {
1643  rlReturnVal_t retVal;
1644 
1645  RL_LOGV_ARG0("rlDeviceSetMiscConfig starts...\n");
1646 
1647  /* check if deviceIndex is out of defined value */
1648  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
1649  (RL_NULL_PTR == data))
1650  {
1651  /* set error code if DeviceMAP is invalid or data pointer is null */
1652  retVal = RL_RET_CODE_INVALID_INPUT;
1653  RL_LOGE_ARG0("Invalid input");
1654  }
1655  /* This API is valid only when mmWaveLink instance is running on
1656  External Host Processor */
1657  else if (RL_PLATFORM_HOST != rlDriverGetPlatformId())
1658  {
1659  /* set error code of Platform is not set to HOST */
1660  retVal = RL_RET_CODE_API_NOT_SUPPORTED;
1661  }
1662  else
1663  {
1664  /* Package the command with given data and send it to device */
1665  retVal = rlDriverExecuteSetApi(deviceMap, RL_DEV_CONFIG_SET_MSG,
1666  RL_DEV_MISC_CFG_SET_SB, (rlUInt8_t*)data,
1667  (rlUInt16_t)sizeof(rlDevMiscCfg_t));
1668  }
1669  RL_LOGV_ARG0("rlDeviceSetMiscConfig ends...\n");
1670 
1671  return retVal;
1672 }
1673 
1683 /* DesignId : MMWL_DesignId_028 */
1684 /* Requirements : AUTORADAR_REQ-710 */
1685 rlReturnVal_t rlDeviceConfigureCrc(rlCrcType_t crcType)
1686 {
1687  /* set CRC Type passed by application to rlDriver */
1688  return rlDriverConfigureCrc(crcType);
1689 }
1690 
1700 /* DesignId : MMWL_DesignId_028 */
1701 /* Requirements : AUTORADAR_REQ_710 */
1702 rlReturnVal_t rlDeviceConfigureAckTimeout(rlUInt32_t ackTimeout)
1703 {
1704  /* Set Ack Timeout value passed by applicatio to rlDriver */
1705  return rlDriverConfigureAckTimeout(ackTimeout);
1706 }
1707 
1708 /*
1709  * END OF rl_device.c FILE
1710  */
rlReturnVal_t rlDevicePmicClkConfig(rlUInt8_t deviceMap, rlPmicClkCfg_t *data)
Sets the configurations for PMIC clock.
Definition: rl_device.c:1455
rlReturnVal_t rlDeviceSetDataFmtConfig(rlUInt8_t deviceMap, rlDevDataFmtCfg_t *data)
Sets LVDS/CSI2 Data output format.
Definition: rl_device.c:599
rlReturnVal_t rlDeviceRfStart(rlUInt8_t deviceMap)
Enables mmwave RF/Analog Sub system.
Definition: rl_device.c:321
mmWaveLink client callback structure
Definition: mmwavelink.h:1330
rlReturnVal_t rlDeviceMcuClkConfig(rlUInt8_t deviceMap, rlMcuClkCfg_t *data)
Sets the configurations to setup the desired frequency of the MCU Clock.
Definition: rl_device.c:1409
rlReturnVal_t rlDeviceGetCsi2Config(rlUInt8_t deviceMap, rlDevCsi2Cfg_t *data)
Gets Csi2 data format Configuration.
Definition: rl_device.c:1219
rlInt32_t(* rlDeviceEnable)(rlUInt8_t deviceIndex)
Bring mmWave radar device out of Reset.
Definition: mmwavelink.h:1206
rlReturnVal_t rlDeviceLatentFaultTests(rlUInt8_t deviceMap, rllatentFault_t *data)
Sets the configurations for latent fault test.
Definition: rl_device.c:1501
rlReturnVal_t rlDriverConfigureCrc(rlCrcType_t crcType)
Configures the CRC Type in mmwavelink Driver.
Definition: rl_driver.c:2538
mmWaveLink firmware version structure
Definition: mmwavelink.h:2263
rlReturnVal_t rlDeviceGetMmWaveLinkVersion(rlSwVersionParam_t *data)
Get mmWaveLink Version.
Definition: rl_device.c:547
rlReturnVal_t rlDeviceSetTestPatternConfig(rlUInt8_t deviceMap, rltestPattern_t *data)
Setup for test pattern to be generated.
Definition: rl_device.c:1594
rlReturnVal_t rlDeviceSetDataPathClkConfig(rlUInt8_t deviceMap, rlDevDataPathClkCfg_t *data)
Sets LVDS Clock Configuration.
Definition: rl_device.c:881
rlReturnVal_t rlDeviceSetContStreamingModeConfig(rlUInt8_t deviceMap, rlDevContStreamingModeCfg_t *data)
Sets Continous Streaming Mode Configuration.
Definition: rl_device.c:1073
rlReturnVal_t rlDeviceRemoveDevices(rlUInt8_t deviceMap)
Removes connected mmwave devices.
Definition: rl_device.c:198
rlUInt8_t rlDriverGetPlatformId(void)
Returns RL Platform ID (i.e. where mmWaveLink is executing)
Definition: rl_driver.c:2097
rlDevDataPathCfg_t * dataPath
Data path config.
Definition: rl_device.h:1028
mmwave radar data path config.
Definition: rl_device.h:653
rlReturnVal_t rlDeviceSetHsiClk(rlUInt8_t deviceMap, rlDevHsiClk_t *data)
Sets High Speed Interface Clock.
Definition: rl_device.c:1368
Continous streaming mode configuration.
Definition: rl_device.h:929
rlReturnVal_t rlDeviceEnablePeriodicTests(rlUInt8_t deviceMap, rlperiodicTest_t *data)
Sets the configurations for periodic test.
Definition: rl_device.c:1547
rlFwVersionParam_t master
Master Sub System version.
Definition: mmwavelink.h:2484
mmwave radar high speed Data path configuraiton
Definition: rl_device.h:1019
DataPath clock configuration.
Definition: rl_device.h:837
mmwave radar high speed clock configuration
Definition: rl_device.h:998
mmwave radar device latent fault test
Definition: rl_device.h:319
rlUInt8_t minor
SW version minor number.
Definition: mmwavelink.h:2415
void rlDriverConstructInMsg(rlUInt16_t msgId, rlDriverMsg_t *inMsg, rlPayloadSb_t *payloadPtr)
: Construct command packet (inMsg) based on given message-ID and payload
Definition: rl_driver.c:2703
rlReturnVal_t rlDeviceGetRfVersion(rlUInt8_t deviceMap, rlFwVersionParam_t *data)
Get mmWave RF ROM and patch version.
Definition: rl_device.c:458
mmwave radar Driver Global Structure
Definition: rl_driver.h:235
LVDS Lane configuration.
Definition: rl_device.h:887
rlReturnVal_t rlDeviceGetMssVersion(rlUInt8_t deviceMap, rlFwVersionParam_t *data)
Get mmWave Master SS version.
Definition: rl_device.c:421
rlUInt8_t isDriverInitialized
Driver Status.
Definition: rl_driver.h:244
rlUInt16_t nsbc
Number of Sub Blocks in Payload.
Definition: rl_driver.h:332
rlSwVersionParam_t mmWaveLink
mmWaveLink version
Definition: mmwavelink.h:2492
rlUInt8_t month
Software Release Month.
Definition: mmwavelink.h:2431
rlReturnVal_t rlDeviceFileDownload(rlUInt8_t deviceMap, rlFileData_t *data, rlUInt16_t remChunks)
Download mmwave Firmware/Patches over SPI.
Definition: rl_device.c:361
mmwave radar test pattern config
Definition: rl_device.h:451
CSI2 configuration.
Definition: rl_device.h:944
rlDevDataPathClkCfg_t * dataPathClk
Data path clock configuration.
Definition: rl_device.h:1032
rlReturnVal_t rlDriverDeInit(void)
De Initializes the mmwave radar Driver.
Definition: rl_driver.c:2018
rlDriverData_t * rlDriverGetHandle(void)
Returns mmwave radar Driver Global Structure.
Definition: rl_driver.c:2081
rlReturnVal_t rlDeviceConfigureAckTimeout(rlUInt32_t ackTimeout)
Configures the Acknowledgement timeout in mmWaveLink Driver.
Definition: rl_device.c:1702
mmwave radar data path lane enable
Definition: rl_device.h:809
rlReturnVal_t rlDeviceSetLaneConfig(rlUInt8_t deviceMap, rlDevLaneEnable_t *data)
Sets Lane enable Configuration.
Definition: rl_device.c:787
rlFwVersionParam_t rf
RF Sub System version.
Definition: mmwavelink.h:2488
rlReturnVal_t rlDeviceGetDataPathConfig(rlUInt8_t deviceMap, rlDevDataPathCfg_t *data)
Gets data path Configuration.
Definition: rl_device.c:740
rlReturnVal_t rlDeviceSetHsiConfig(rlUInt8_t deviceMap, rlDevHsiCfg_t *data)
: This function sets the High Speed Interface(LVDS/CSI2) clock, lane, data rate and data format ...
Definition: rl_device.c:1268
RHCP Payload Structure.
Definition: rl_driver.h:155
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) ...
Definition: rl_driver.c:2406
mmwave radar periodicity test config
Definition: rl_device.h:406
rlReturnVal_t rlDeviceSetCsi2Config(rlUInt8_t deviceMap, rlDevCsi2Cfg_t *data)
Sets CSI2 data format Configuration.
Definition: rl_device.c:1172
rlUInt32_t chunkLen
File data length.
Definition: rl_device.h:89
mmwave radar data format config
Definition: rl_device.h:585
mmwave radar device MCU Clock output
Definition: rl_device.h:100
mmwave radar Driver Payload
Definition: rl_driver.h:338
mmwave radar device PMIC Clock output
Definition: rl_device.h:172
rlReturnVal_t rlDeviceSetMiscConfig(rlUInt8_t deviceMap, rlDevMiscCfg_t *data)
Setup misc. device configurations.
Definition: rl_device.c:1641
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.
Definition: rl_driver.c:2769
rlReturnVal_t rlDevicePowerOn(rlUInt8_t deviceMap, rlClientCbs_t clientCb)
Bring mmwave Device Out of Reset.
Definition: rl_device.c:96
rlReturnVal_t rlDriverConfigureAckTimeout(rlUInt32_t ackTimeout)
Configures the Acknowledgement timeout in mmwavelink Driver.
Definition: rl_driver.c:2572
rlUInt8_t major
SW version major number.
Definition: mmwavelink.h:2411
mmwavelink software version structure
Definition: mmwavelink.h:2405
rlReturnVal_t rlDriverRemoveDevices(rlUInt8_t deviceMap)
Disconnects the mmwave radar devices.
Definition: rl_driver.c:1973
rlReturnVal_t rlDevicePowerOff(void)
Shutdown mmwave Device.
Definition: rl_device.c:258
File Dowload data structure.
Definition: rl_device.h:84
rlInt32_t(* rlDeviceDisable)(rlUInt8_t deviceIndex)
Power off mmWave radar device.
Definition: mmwavelink.h:1220
rlUInt16_t fData[RL_CMD_PL_LEN_MAX/2U]
File data buffer.
Definition: rl_device.h:93
mmwavelink version structure
Definition: mmwavelink.h:2479
rlClientCbs_t clientCtx
Client context.
Definition: rl_driver.h:288
rlReturnVal_t rlDeviceSetDataPathConfig(rlUInt8_t deviceMap, rlDevDataPathCfg_t *data)
Sets LVDS/CSI2 Path Configuration.
Definition: rl_device.c:693
rlReturnVal_t rlDeviceGetContStreamingModeConfig(rlUInt8_t deviceMap, rlDevContStreamingModeCfg_t *data)
Gets continuous Streaming Mode Configuration.
Definition: rl_device.c:1125
rlDeviceCtrlCbs_t devCtrlCb
Device Control Callback.
Definition: mmwavelink.h:1347
rlUInt8_t debug
SW version debug number.
Definition: mmwavelink.h:2423
rlReturnVal_t rlDriverAddDevice(rlUInt8_t deviceMap)
Adds mmwave radar device.
Definition: rl_driver.c:1880
rlReturnVal_t rlDeviceGetDataFmtConfig(rlUInt8_t deviceMap, rlDevDataFmtCfg_t *data)
Gets LVDS/CSI2 Data output format.
Definition: rl_device.c:647
rlReturnVal_t rlDeviceConfigureCrc(rlCrcType_t crcType)
Configures the CRC Type in mmWaveLink Driver.
Definition: rl_device.c:1685
rlUInt8_t deviceMap
Bitmap of devices connected radarSS/DSS Mailbox in case of 16xx autonomous.
Definition: rl_driver.h:248
rlReturnVal_t rlDeviceAddDevices(rlUInt8_t deviceMap)
Bring mmwave Device Out of Reset.
Definition: rl_device.c:171
rlUInt8_t year
Software Release Year.
Definition: mmwavelink.h:2427
rlReturnVal_t rlDeviceGetLaneConfig(rlUInt8_t deviceMap, rlDevLaneEnable_t *data)
Gets Lane enable Configuration.
Definition: rl_device.c:834
rlDevDataFmtCfg_t * datafmt
Data format config.
Definition: rl_device.h:1024
rlUInt8_t day
Software Release Day.
Definition: mmwavelink.h:2435
rlUInt8_t build
SW version buid number.
Definition: mmwavelink.h:2419
rlReturnVal_t rlDeviceGetVersion(rlUInt8_t deviceMap, rlVersion_t *data)
Get mmWave Hardware, Firmware/patch and mmWaveLink version.
Definition: rl_device.c:490
rlReturnVal_t rlDriverIsDeviceMapValid(rlUInt8_t deviceMap)
Checks if given deviecMap is valid wrt to global DeviceMap set to mmWaveLink.
Definition: rl_driver.c:2134

Copyright 2018, Texas Instruments Incorporated