rl_monitoring.c
1 /****************************************************************************************
2  * FileName : rl_monitoring.c
3  *
4  * Description : This file defines the functions required to configure monitoring reports from
5  * mmWave Device.
6  *
7  ****************************************************************************************
8  * (C) Copyright 2014, Texas Instruments Incorporated. - TI web address www.ti.com
9  *---------------------------------------------------------------------------------------
10  *
11  * Redistribution and use in source and binary forms, with or without modification,
12  * are permitted provided that the following conditions are met:
13  *
14  * Redistributions of source code must retain the above copyright notice,
15  * this list of conditions and the following disclaimer.
16  *
17  * Redistributions in binary form must reproduce the above copyright notice,
18  * this list of conditions and the following disclaimer in the documentation
19  * and/or other materials provided with the distribution.
20  *
21  * Neither the name of Texas Instruments Incorporated nor the names of its
22  * contributors may be used to endorse or promote products derived from this
23  * software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
27  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
29  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, data, OR PROFITS; OR BUSINESS
32  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35  * POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 /*
39 ****************************************************************************************
40 * Revision History :
41 *---------------------------------------------------------------------------------------
42 * Version Date Author Defect No Description
43 *---------------------------------------------------------------------------------------
44 * 0.1.0 12May2015 Kaushal Kukkar - Initial Version
45 *
46 * 0.8.6 24Jul2017 Jitendra Gupta MMWL-30 RF/Analog Monitoring APIs
47 * Kaushal Kukkar MMWL-23 Big Endian Support
48 * Kaushal Kukkar MMWL-13 Fault Injection API
49 *
50 * 1.2.2.4 20Feb2019 Pavan Penikalapati MMWL162 Fixed comment for rlRfTxPowrMonConfig
51 ****************************************************************************************
52 */
53 
54 /******************************************************************************
55  * INCLUDE FILES
56  ******************************************************************************
57  */
58 #include <stdlib.h>
59 #include <string.h>
60 #include <ti/control/mmwavelink/mmwavelink.h>
61 #include <ti/control/mmwavelink/include/rl_driver.h>
62 #include <ti/control/mmwavelink/include/rl_monitoring.h>
63 #include <ti/control/mmwavelink/include/rl_trace.h>
64 
65 
66 /******************************************************************************
67  * GLOBAL VARIABLES/DATA-TYPES DEFINITIONS
68  ******************************************************************************
69  */
70 
71 /******************************************************************************
72  * FUNCTION DEFINITIONS
73  ******************************************************************************
74  */
75 
76 
90 /* DesignId : MMWL_DesignId_073 */
91 /* Requirements : AUTORADAR_REQ-768 */
92 rlReturnVal_t rlRfDigMonEnableConfig(rlUInt8_t deviceMap, rlMonDigEnables_t* data)
93 {
94  rlReturnVal_t retVal;
95 
96  /* check if deviceIndex is out of defined value */
97  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || (RL_NULL_PTR == data))
98  {
99  /* set return error code */
100  retVal = RL_RET_CODE_INVALID_INPUT;
101  }
102  else
103  {
104  /* Package the command with given data and send it to device */
105  retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_MONITORING_CONF_SET_MSG,
106  RL_RF_DIG_MON_EN_SB, (rlUInt8_t*)data,
107  (rlUInt16_t)sizeof(rlMonDigEnables_t));
108  }
109  return retVal;
110 }
111 
123 /* DesignId : MMWL_DesignId_074 */
124 /* Requirements : AUTORADAR_REQ-768 */
125 rlReturnVal_t rlRfDigMonPeriodicConfig(rlUInt8_t deviceMap, rlDigMonPeriodicConf_t* data)
126 {
127  rlReturnVal_t retVal;
128 
129  /* check if deviceIndex is out of defined value */
130  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || (RL_NULL_PTR == data))
131  {
132  /* set return error code */
133  retVal = RL_RET_CODE_INVALID_INPUT;
134  }
135  else
136  {
137  /* Package the command with given data and send it to device */
138  retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_MONITORING_CONF_SET_MSG,
139  RL_RF_DIG_MON_PERIODIC_CONF_SB, (rlUInt8_t*)data,
140  (rlUInt16_t)sizeof(rlDigMonPeriodicConf_t));
141  }
142  return retVal;
143 }
144 
168 /* DesignId : MMWL_DesignId_075 */
169 /* Requirements : AUTORADAR_REQ-769, AUTORADAR_REQ-602, AUTORADAR_REQ-215 */
170 rlReturnVal_t rlRfAnaMonConfig(rlUInt8_t deviceMap, rlMonAnaEnables_t* data)
171 {
172  rlReturnVal_t retVal;
173 
174  /* check if deviceIndex is out of defined value */
175  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || (RL_NULL_PTR == data))
176  {
177  /* set return error code */
178  retVal = RL_RET_CODE_INVALID_INPUT;
179  }
180  else
181  {
182  /* Package the command with given data and send it to device */
183  retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_MONITORING_CONF_SET_MSG,
184  RL_RF_ANA_MON_EN_SB, (rlUInt8_t*)data,
185  (rlUInt16_t)sizeof(rlMonAnaEnables_t));
186  }
187  return retVal;
188 }
189 
208 /* DesignId : MMWL_DesignId_076 */
209 /* Requirements : AUTORADAR_REQ-857 */
210 rlReturnVal_t rlRfTempMonConfig(rlUInt8_t deviceMap, rlTempMonConf_t* data)
211 {
212  rlReturnVal_t retVal;
213 
214  /* check if deviceIndex is out of defined value */
215  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || (RL_NULL_PTR == data))
216  {
217  /* set return error code */
218  retVal = RL_RET_CODE_INVALID_INPUT;
219  }
220  else
221  {
222  /* Package the command with given data and send it to device */
223  retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_MONITORING_CONF_SET_MSG,
224  RL_RF_TEMP_MON_CONF_SB, (rlUInt8_t*)data,
225  (rlUInt16_t)sizeof(rlTempMonConf_t));
226  }
227  return retVal;
228 }
229 
249 /* DesignId : MMWL_DesignId_077 */
250 /* Requirements : AUTORADAR_REQ-858, AUTORADAR_REQ-1041 */
251 rlReturnVal_t rlRfRxGainPhMonConfig(rlUInt8_t deviceMap, rlRxGainPhaseMonConf_t* data)
252 {
253  rlReturnVal_t retVal;
254 
255  /* check if deviceIndex is out of defined value */
256  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) ||\
257  (RL_NULL_PTR == data))
258  {
259  /* set return error code */
260  retVal = RL_RET_CODE_INVALID_INPUT;
261  }
262  else
263  {
264  /* Package the command with given data and send it to device */
265  retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_MONITORING_CONF_SET_MSG,
266  RL_RF_RX_GAIN_PHASE_MON_CONF_SB, (rlUInt8_t*)data,
267  (rlUInt16_t)sizeof(rlRxGainPhaseMonConf_t));
268  }
269  return retVal;
270 }
271 
293 /* DesignId : MMWL_DesignId_078 */
294 /* Requirements : AUTORADAR_REQ-859*/
295 rlReturnVal_t rlRfRxNoiseMonConfig(rlUInt8_t deviceMap, rlRxNoiseMonConf_t* data)
296 {
297  rlReturnVal_t retVal;
298 
299  /* check if deviceIndex is out of defined value */
300  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) ||\
301  (RL_NULL_PTR == data))
302  {
303  /* set return error code */
304  retVal = RL_RET_CODE_INVALID_INPUT;
305  }
306  else
307  {
308  /* Package the command with given data and send it to device */
309  retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_MONITORING_CONF_SET_MSG,
310  RL_RF_RX_NOISE_MON_CONF_SB, (rlUInt8_t*)data,
311  (rlUInt16_t)sizeof(rlRxNoiseMonConf_t));
312  }
313  return retVal;
314 }
315 
329 /* DesignId : MMWL_DesignId_079 */
330 /* Requirements : AUTORADAR_REQ-860 */
331 rlReturnVal_t rlRfRxIfStageMonConfig(rlUInt8_t deviceMap, rlRxIfStageMonConf_t* data)
332 {
333  rlReturnVal_t retVal;
334 
335  /* check if deviceIndex is out of defined value */
336  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || (RL_NULL_PTR == data))
337  {
338  /* set return error code */
339  retVal = RL_RET_CODE_INVALID_INPUT;
340  }
341  else
342  {
343  /* Package the command with given data and send it to device */
344  retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_MONITORING_CONF_SET_MSG,
345  RL_RF_RX_IFSTAGE_MON_CONF_SB, (rlUInt8_t*)data,
346  (rlUInt16_t)sizeof(rlRxIfStageMonConf_t));
347  }
348  return retVal;
349 }
350 
368 /* DesignId : MMWL_DesignId_080 */
369 /* Requirements : AUTORADAR_REQ-861 */
370 rlReturnVal_t rlRfTxPowrMonConfig(rlUInt8_t deviceMap, rlAllTxPowMonConf_t *data)
371 {
372  rlReturnVal_t retVal;
373  /* Initialize Command and Response Sub Blocks */
374  rlDriverMsg_t inMsg;
375  rlDriverMsg_t outMsg = {0};
376  rlUInt16_t numSbc = 0U;
377 
378  /* Initialize Command and Response Sub Blocks */
379  rlPayloadSb_t inPayloadSb[RL_MAX_SB_IN_MSG] = {0};
380 
381  RL_LOGV_ARG0("rlRfTxPowrMonConfig starts...\n");
382 
383  /* Construct command packet */
384  rlDriverConstructInMsg(RL_RF_MONITORING_CONF_SET_MSG, &inMsg, &inPayloadSb[0U]);
385 
386  /* check if deviceIndex is out of defined value */
387  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
388  (RL_NULL_PTR == data))
389  {
390  retVal = RL_RET_CODE_INVALID_INPUT;
391  RL_LOGE_ARG0("rlRfTxPowrMonConfig, Invalid input \n");
392  }
393  else
394  {
395  /* check for NULL pointer */
396  if ((RL_NULL_PTR != data->tx0PowrMonCfg))
397  {
398  /* Fill in-message Payload */
399  rlDriverFillPayload(RL_RF_MONITORING_CONF_SET_MSG,
400  RL_RF_TX0_POW_MON_CONF_SB,
401  &inPayloadSb[numSbc],
402  (rlUInt8_t* )data->tx0PowrMonCfg,
403  (rlUInt16_t)sizeof(rlTxPowMonConf_t));
404  numSbc++;
405  }
406  /* check for NULL pointer */
407  if ((RL_NULL_PTR != data->tx1PowrMonCfg))
408  {
409  /* Fill in-message Payload */
410  rlDriverFillPayload(RL_RF_MONITORING_CONF_SET_MSG,
411  RL_RF_TX1_POW_MON_CONF_SB,
412  &inPayloadSb[numSbc],
413  (rlUInt8_t* )data->tx1PowrMonCfg,
414  (rlUInt16_t)sizeof(rlTxPowMonConf_t));
415  numSbc++;
416  }
417  /* check for NULL pointer */
418  if ((RL_NULL_PTR != data->tx2PowrMonCfg))
419  {
420  /* Fill in-message Payload */
421  rlDriverFillPayload(RL_RF_MONITORING_CONF_SET_MSG,
422  RL_RF_TX2_POW_MON_CONF_SB,
423  &inPayloadSb[numSbc],
424  (rlUInt8_t* )data->tx2PowrMonCfg,
425  (rlUInt16_t)sizeof(rlTxPowMonConf_t));
426  numSbc++;
427  }
428 
429  if (numSbc > 0U)
430  {
431  /* setting num of sub-block to inMsg */
432  inMsg.opcode.nsbc = numSbc;
433 
434  /* Send Command to mmWave Radar Device */
435  retVal = rlDriverCmdInvoke(deviceMap, inMsg, &outMsg);
436  }
437  else
438  {
439  retVal = RL_RET_CODE_INVALID_INPUT;
440  RL_LOGE_ARG0("sub block is NULL\n");
441  }
442  }
443 
444  return retVal;
445 }
446 
460 /* DesignId : MMWL_DesignId_081 */
461 /* Requirements : AUTORADAR_REQ-862 */
462 rlReturnVal_t rlRfTxBallbreakMonConfig(rlUInt8_t deviceMap, rlAllTxBallBreakMonCfg_t* data)
463 {
464  rlReturnVal_t retVal;
465  /* Initialize Command and Response Sub Blocks */
466  rlDriverMsg_t inMsg;
467  rlDriverMsg_t outMsg = {0};
468  rlUInt16_t numSbc = 0U;
469 
470  /* Initialize Command and Response Sub Blocks */
471  rlPayloadSb_t inPayloadSb[RL_MAX_SB_IN_MSG] = {0};
472 
473  RL_LOGV_ARG0("rlRfTxBallBreakMonConfig starts...\n");
474 
475  /* Construct command packet */
476  rlDriverConstructInMsg(RL_RF_MONITORING_CONF_SET_MSG, &inMsg, &inPayloadSb[0U]);
477 
478  /* check if deviceIndex is out of defined value */
479  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
480  (RL_NULL_PTR == data) )
481  {
482  retVal = RL_RET_CODE_INVALID_INPUT;
483  RL_LOGE_ARG0("rlRfTxBallBreakMonConfig, Invalid input \n");
484  }
485  else
486  {
487  /* check for NULL pointer */
488  if ((RL_NULL_PTR != data->tx0BallBrkMonCfg))
489  {
490  /* Fill in-message Payload */
491  rlDriverFillPayload(RL_RF_MONITORING_CONF_SET_MSG,
492  RL_RF_TX0_BALLBREAK_MON_CONF_SB,
493  &inPayloadSb[numSbc],
494  (rlUInt8_t* )data->tx0BallBrkMonCfg,
495  (rlUInt16_t)sizeof(rlTxBallbreakMonConf_t));
496  numSbc++;
497  }
498  /* check for NULL pointer */
499  if ((RL_NULL_PTR != data->tx1BallBrkMonCfg))
500  {
501  /* Fill in-message Payload */
502  rlDriverFillPayload(RL_RF_MONITORING_CONF_SET_MSG,
503  RL_RF_TX1_BALLBREAK_MON_CONF_SB,
504  &inPayloadSb[numSbc],
505  (rlUInt8_t* )data->tx1BallBrkMonCfg,
506  (rlUInt16_t)sizeof(rlTxBallbreakMonConf_t));
507  numSbc++;
508  }
509  /* check for NULL pointer */
510  if ((RL_NULL_PTR != data->tx2BallBrkMonCfg))
511  {
512  /* Fill in-message Payload */
513  rlDriverFillPayload(RL_RF_MONITORING_CONF_SET_MSG,
514  RL_RF_TX2_BALLBREAK_MON_CONF_SB,
515  &inPayloadSb[numSbc],
516  (rlUInt8_t* )data->tx2BallBrkMonCfg,
517  (rlUInt16_t)sizeof(rlTxBallbreakMonConf_t));
518  numSbc++;
519  }
520 
521  if (numSbc > 0U)
522  {
523  /* setting num of sub-block to inMsg */
524  inMsg.opcode.nsbc = numSbc;
525 
526  /* Send Command to mmWave Radar Device */
527  retVal = rlDriverCmdInvoke(deviceMap, inMsg, &outMsg);
528  }
529  else
530  {
531  retVal = RL_RET_CODE_INVALID_INPUT;
532  RL_LOGE_ARG0("sub block is NULL\n");
533  }
534  }
535 
536  return retVal;
537 
538 }
539 
562 /* DesignId : MMWL_DesignId_082 */
563 /* Requirements : AUTORADAR_REQ-863 */
564 rlReturnVal_t rlRfTxGainPhaseMismatchMonConfig(rlUInt8_t deviceMap,
566 {
567  rlReturnVal_t retVal;
568 
569  /* check if deviceIndex is out of defined value */
570  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || (RL_NULL_PTR == data))
571  {
572  /* set return error code */
573  retVal = RL_RET_CODE_INVALID_INPUT;
574  }
575  else
576  {
577  /* Package the command with given data and send it to device */
578  retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_MONITORING_CONF_SET_MSG,
579  RL_RF_TX_GAIN_PHASE_MISMATCH_MON_CONF_SB,
580  (rlUInt8_t*)data,
581  (rlUInt16_t)sizeof(rlTxGainPhaseMismatchMonConf_t));
582  }
583  return retVal;
584 }
585 
623 /* DesignId : MMWL_DesignId_084 */
624 /* Requirements : AUTORADAR_REQ-865, AUTORADAR_REQ-1052 */
625 rlReturnVal_t rlRfSynthFreqMonConfig(rlUInt8_t deviceMap, rlSynthFreqMonConf_t* data)
626 {
627  rlReturnVal_t retVal;
628 
629  /* check if deviceIndex is out of defined value */
630  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || (RL_NULL_PTR == data))
631  {
632  /* set return error code */
633  retVal = RL_RET_CODE_INVALID_INPUT;
634  }
635  else
636  {
637  /* Package the command with given data and send it to device */
638  retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_MONITORING_CONF_SET_MSG,
639  RL_RF_SYNTH_FREQ_MON_CONF_SB, (rlUInt8_t*)data,
640  (rlUInt16_t)sizeof(rlSynthFreqMonConf_t));
641  }
642  return retVal;
643 }
644 
659 /* DesignId : MMWL_DesignId_085 */
660 /* Requirements : AUTORADAR_REQ-866 */
661 rlReturnVal_t rlRfExtAnaSignalsMonConfig(rlUInt8_t deviceMap,
663 {
664  rlReturnVal_t retVal;
665 
666  /* check if deviceIndex is out of defined value */
667  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) ||\
668  (RL_NULL_PTR == data))
669  {
670  /* set return error code */
671  retVal = RL_RET_CODE_INVALID_INPUT;
672  }
673  else
674  {
675  /* Package the command with given data and send it to device */
676  retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_MONITORING_CONF_SET_MSG,
677  RL_RF_EXT_ANA_SIGNALS_MON_CONF_SB, (rlUInt8_t*)data,
678  (rlUInt16_t)sizeof(rlExtAnaSignalsMonConf_t));
679  }
680  return retVal;
681 }
682 
698 /* DesignId : MMWL_DesignId_086 */
699 /* Requirements : AUTORADAR_REQ-867, AUTORADAR_REQ-1062 */
700 rlReturnVal_t rlRfTxIntAnaSignalsMonConfig(rlUInt8_t deviceMap,
702 {
703  rlReturnVal_t retVal;
704  /* Initialize Command and Response Sub Blocks */
705  rlDriverMsg_t inMsg;
706  rlDriverMsg_t outMsg = {0};
707  rlUInt16_t numSbc = 0U;
708 
709  /* Initialize Command and Response Sub Blocks */
710  rlPayloadSb_t inPayloadSb[RL_MAX_SB_IN_MSG] = {0};
711 
712  RL_LOGV_ARG0("rlRfTxIntAnaSignalsMonConfig starts...\n");
713 
714  /* Construct command packet */
715  rlDriverConstructInMsg(RL_RF_MONITORING_CONF_SET_MSG, &inMsg, &inPayloadSb[0U]);
716 
717  /* check if deviceIndex is out of defined value */
718  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
719  (RL_NULL_PTR == data) )
720  {
721  retVal = RL_RET_CODE_INVALID_INPUT;
722  RL_LOGE_ARG0("rlRfTxIntAnaSignalsMonConfig, Invalid input \n");
723  }
724  else
725  {
726  /* check for NULL pointer */
727  if ((RL_NULL_PTR != data->tx0IntAnaSgnlMonCfg))
728  {
729  /* Fill in-message Payload */
730  rlDriverFillPayload(RL_RF_MONITORING_CONF_SET_MSG,
731  RL_RF_TX0_INT_ANA_SIGNALS_MON_CONF_SB,
732  &inPayloadSb[numSbc],
733  (rlUInt8_t* )data->tx0IntAnaSgnlMonCfg,
734  (rlUInt16_t)sizeof(rlTxIntAnaSignalsMonConf_t));
735  numSbc++;
736  }
737  /* check for NULL pointer */
738  if ((RL_NULL_PTR != data->tx1IntAnaSgnlMonCfg))
739  {
740  /* Fill in-message Payload */
741  rlDriverFillPayload(RL_RF_MONITORING_CONF_SET_MSG,
742  RL_RF_TX1_INT_ANA_SIGNALS_MON_CONF_SB,
743  &inPayloadSb[numSbc],
744  (rlUInt8_t* )data->tx1IntAnaSgnlMonCfg,
745  (rlUInt16_t)sizeof(rlTxIntAnaSignalsMonConf_t));
746  numSbc++;
747  }
748  /* check for NULL pointer */
749  if ((RL_NULL_PTR != data->tx2IntAnaSgnlMonCfg))
750  {
751  /* Fill in-message Payload */
752  rlDriverFillPayload(RL_RF_MONITORING_CONF_SET_MSG,
753  RL_RF_TX2_INT_ANA_SIGNALS_MON_CONF_SB,
754  &inPayloadSb[numSbc],
755  (rlUInt8_t* )data->tx2IntAnaSgnlMonCfg,
756  (rlUInt16_t)sizeof(rlTxIntAnaSignalsMonConf_t));
757  numSbc++;
758  }
759 
760  if (numSbc > 0U)
761  {
762  /* setting num of sub-block to inMsg */
763  inMsg.opcode.nsbc = numSbc;
764 
765  /* Send Command to mmWave Radar Device */
766  retVal = rlDriverCmdInvoke(deviceMap, inMsg, &outMsg);
767  }
768  else
769  {
770  retVal = RL_RET_CODE_INVALID_INPUT;
771  RL_LOGE_ARG0("sub block is NULL\n");
772  }
773  }
774 
775  return retVal;
776 }
777 
792 /* DesignId : MMWL_DesignId_087 */
793 /* Requirements : AUTORADAR_REQ-868 */
794 rlReturnVal_t rlRfRxIntAnaSignalsMonConfig(rlUInt8_t deviceMap,
795  rlRxIntAnaSignalsMonConf_t* data)
796 {
797  rlReturnVal_t retVal;
798 
799  /* check if deviceIndex is out of defined value */
800  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) ||\
801  (RL_NULL_PTR == data))
802  {
803  /* set return error code */
804  retVal = RL_RET_CODE_INVALID_INPUT;
805  }
806  else
807  {
808  /* Package the command with given data and send it to device */
809  retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_MONITORING_CONF_SET_MSG,
810  RL_RF_RX_INT_ANA_SIGNALS_MON_CONF_SB, (rlUInt8_t*)data,
811  (rlUInt16_t)sizeof(rlRxIntAnaSignalsMonConf_t));
812  }
813  return retVal;
814 }
815 
831 /* DesignId : MMWL_DesignId_088 */
832 /* Requirements : AUTORADAR_REQ-869 */
833 rlReturnVal_t rlRfPmClkLoIntAnaSignalsMonConfig(rlUInt8_t deviceMap,
835 {
836  rlReturnVal_t retVal;
837 
838  /* check if deviceIndex is out of defined value */
839  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) ||\
840  (RL_NULL_PTR == data))
841  {
842  /* set return error code */
843  retVal = RL_RET_CODE_INVALID_INPUT;
844  }
845  else
846  {
847  /* Package the command with given data and send it to device */
848  retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_MONITORING_CONF_SET_MSG,
849  RL_RF_PMCLKLO_INT_ANA_SIGNALS_MON_CONF_SB,
850  (rlUInt8_t*)data,
851  (rlUInt16_t)sizeof(rlPmClkLoIntAnaSignalsMonConf_t));
852  }
853  return retVal;
854 }
855 
870 /* DesignId : MMWL_DesignId_089 */
871 /* Requirements : AUTORADAR_REQ-870 */
872 rlReturnVal_t rlRfGpadcIntAnaSignalsMonConfig(rlUInt8_t deviceMap,
874 {
875  rlReturnVal_t retVal;
876 
877  /* check if deviceIndex is out of defined value */
878  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) ||\
879  (RL_NULL_PTR == data))
880  {
881  /* set return error code */
882  retVal = RL_RET_CODE_INVALID_INPUT;
883  }
884  else
885  {
886  /* Package the command with given data and send it to device */
887  retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_MONITORING_CONF_SET_MSG,
888  RL_RF_GPADC_INT_ANA_SIGNALS_MON_CONF_SB,
889  (rlUInt8_t*)data,
890  (rlUInt16_t)sizeof(rlGpadcIntAnaSignalsMonConf_t));
891  }
892  return retVal;
893 }
894 
909 /* DesignId : MMWL_DesignId_090 */
910 /* Requirements : AUTORADAR_REQ-871 */
911 rlReturnVal_t rlRfPllContrlVoltMonConfig(rlUInt8_t deviceMap,
913 {
914  rlReturnVal_t retVal;
915 
916  /* check if deviceIndex is out of defined value */
917  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) ||\
918  (RL_NULL_PTR == data))
919  {
920  /* set return error code */
921  retVal = RL_RET_CODE_INVALID_INPUT;
922  }
923  else
924  {
925  /* Package the command with given data and send it to device */
926  retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_MONITORING_CONF_SET_MSG,
927  RL_RF_PLL_CONTROL_VOLT_MON_CONF_SB,
928  (rlUInt8_t*)data,
929  (rlUInt16_t)sizeof(rlPllContrVoltMonConf_t));
930  }
931  return retVal;
932 }
933 
947 /* DesignId : MMWL_DesignId_091 */
948 /* Requirements : AUTORADAR_REQ-872 */
949 rlReturnVal_t rlRfDualClkCompMonConfig(rlUInt8_t deviceMap,
951 {
952  rlReturnVal_t retVal;
953 
954  /* check if deviceIndex is out of defined value */
955  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) ||\
956  (RL_NULL_PTR == data))
957  {
958  /* set return error code */
959  retVal = RL_RET_CODE_INVALID_INPUT;
960  }
961  else
962  {
963  /* Package the command with given data and send it to device */
964  retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_MONITORING_CONF_SET_MSG,
965  RL_RF_DUAL_CLOCK_COMP_MON_CONF_SB,
966  (rlUInt8_t*)data,
967  (rlUInt16_t)sizeof(rlDualClkCompMonConf_t));
968  }
969  return retVal;
970 }
971 
995 /* DesignId : MMWL_DesignId_092 */
996 /* Requirements : AUTORADAR_REQ-873 */
997 rlReturnVal_t rlRfRxIfSatMonConfig(rlUInt8_t deviceMap,
998  rlRxSatMonConf_t* data)
999 {
1000  rlReturnVal_t retVal;
1001 
1002  /* check if deviceIndex is out of defined value */
1003  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) ||\
1004  (RL_NULL_PTR == data))
1005  {
1006  /* set return error code */
1007  retVal = RL_RET_CODE_INVALID_INPUT;
1008  }
1009  else
1010  {
1011  /* Package the command with given data and send it to device */
1012  retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_MONITORING_CONF_SET_MSG,
1013  RL_RF_RX_SATURATION_MON_CONF_SB,
1014  (rlUInt8_t*)data,
1015  (rlUInt16_t)sizeof(rlRxSatMonConf_t));
1016  }
1017  return retVal;
1018 }
1019 
1044 /* DesignId : MMWL_DesignId_093 */
1045 /* Requirements : AUTORADAR_REQ-874 */
1046 rlReturnVal_t rlRfRxSigImgMonConfig(rlUInt8_t deviceMap,
1047  rlSigImgMonConf_t* data)
1048 {
1049  rlReturnVal_t retVal;
1050 
1051  /* check if deviceIndex is out of defined value */
1052  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) ||\
1053  (RL_NULL_PTR == data))
1054  {
1055  /* set return error code */
1056  retVal = RL_RET_CODE_INVALID_INPUT;
1057  }
1058  else
1059  {
1060  /* Package the command with given data and send it to device */
1061  retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_MONITORING_CONF_SET_MSG,
1062  RL_RF_RX_SIGIMG_MON_CONF_SB,
1063  (rlUInt8_t*)data,
1064  (rlUInt16_t)sizeof(rlSigImgMonConf_t));
1065  }
1066  return retVal;
1067 }
1068 
1083 /* DesignId : MMWL_DesignId_094 */
1084 /* Requirements : AUTORADAR_REQ-875 */
1085 rlReturnVal_t rlRfRxMixerInPwrConfig(rlUInt8_t deviceMap,
1086  rlRxMixInPwrMonConf_t* data)
1087 {
1088  rlReturnVal_t retVal;
1089 
1090  /* check if deviceIndex is out of defined value */
1091  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) ||\
1092  (RL_NULL_PTR == data))
1093  {
1094  /* set return error code */
1095  retVal = RL_RET_CODE_INVALID_INPUT;
1096  }
1097  else
1098  {
1099  /* Package the command with given data and send it to device */
1100  retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_MONITORING_CONF_SET_MSG,
1101  RL_RF_RX_MIXER_IN_POWR_CONF_SB,
1102  (rlUInt8_t*)data,
1103  (rlUInt16_t)sizeof(rlRxMixInPwrMonConf_t));
1104  }
1105  return retVal;
1106 }
1107 
1128 /* DesignId : MMWL_DesignId_095 */
1129 /* Requirements : AUTORADAR_REQ-876 */
1130 rlReturnVal_t rlRfAnaFaultInjConfig(rlUInt8_t deviceMap,
1131  rlAnaFaultInj_t* data)
1132 {
1133  rlReturnVal_t retVal;
1134 
1135  /* check if deviceIndex is out of defined value */
1136  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) ||\
1137  (RL_NULL_PTR == data))
1138  {
1139  /* set return error code */
1140  retVal = RL_RET_CODE_INVALID_INPUT;
1141  }
1142  else
1143  {
1144  /* Package the command with given data and send it to device */
1145  retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_MONITORING_CONF_SET_MSG,
1146  RL_RF_FAULT_INJECTION_CONF_SB,
1147  (rlUInt8_t*)data,
1148  (rlUInt16_t)sizeof(rlAnaFaultInj_t));
1149  }
1150  return retVal;
1151 }
1152 
1181 /* DesignId : MMWL_DesignId_083 */
1182 /* Requirements : AUTORADAR_REQ-1066, AUTORADAR_REQ-864 */
1183 rlReturnVal_t rlRfTxPhShiftMonConfig(rlUInt8_t deviceMap, rlAllTxPhShiftMonConf_t* data)
1184 {
1185  rlReturnVal_t retVal;
1186  /* Initialize Command and Response Sub Blocks */
1187  rlDriverMsg_t inMsg;
1188  rlDriverMsg_t outMsg = { 0 };
1189  rlUInt16_t numSbc = 0U;
1190 
1191  /* Initialize Command and Response Sub Blocks */
1192  rlPayloadSb_t inPayloadSb[RL_MAX_SB_IN_MSG] = { 0 };
1193 
1194  RL_LOGV_ARG0("rlRfTxPhShiftMonConfig starts...\n");
1195 
1196  /* Construct command packet */
1197  rlDriverConstructInMsg(RL_RF_MONITORING_CONF_SET_MSG, &inMsg, &inPayloadSb[0U]);
1198 
1199  /* check if deviceIndex is out of defined value */
1200  if ((rlDriverIsDeviceMapValid(deviceMap) != RL_RET_CODE_OK) || \
1201  (RL_NULL_PTR == data))
1202  {
1203  retVal = RL_RET_CODE_INVALID_INPUT;
1204  RL_LOGE_ARG0("rlRfTxPhShiftMonConfig, Invalid input \n");
1205  }
1206  else
1207  {
1208  /* check for NULL pointer */
1209  if ((RL_NULL_PTR != data->tx0PhShiftMonCfg))
1210  {
1211  /* Fill in-message Payload */
1212  rlDriverFillPayload(RL_RF_MONITORING_CONF_SET_MSG,
1213  RL_RF_TX0_PH_SHIFT_MON_CONF_SB,
1214  &inPayloadSb[numSbc],
1215  (rlUInt8_t*)data->tx0PhShiftMonCfg,
1216  (rlUInt16_t)sizeof(rlTxPhShiftMonConf_t));
1217  numSbc++;
1218  }
1219  /* check for NULL pointer */
1220  if ((RL_NULL_PTR != data->tx1PhShiftMonCfg))
1221  {
1222  /* Fill in-message Payload */
1223  rlDriverFillPayload(RL_RF_MONITORING_CONF_SET_MSG,
1224  RL_RF_TX1_PH_SHIFT_MON_CONF_SB,
1225  &inPayloadSb[numSbc],
1226  (rlUInt8_t*)data->tx1PhShiftMonCfg,
1227  (rlUInt16_t)sizeof(rlTxPhShiftMonConf_t));
1228  numSbc++;
1229  }
1230  /* check for NULL pointer */
1231  if ((RL_NULL_PTR != data->tx2PhShiftMonCfg))
1232  {
1233  /* Fill in-message Payload */
1234  rlDriverFillPayload(RL_RF_MONITORING_CONF_SET_MSG,
1235  RL_RF_TX2_PH_SHIFT_MON_CONF_SB,
1236  &inPayloadSb[numSbc],
1237  (rlUInt8_t*)data->tx2PhShiftMonCfg,
1238  (rlUInt16_t)sizeof(rlTxPhShiftMonConf_t));
1239  numSbc++;
1240  }
1241 
1242  if (numSbc > 0U)
1243  {
1244  /* setting num of sub-block to inMsg */
1245  inMsg.opcode.nsbc = numSbc;
1246 
1247  /* Send Command to mmWave Radar Device */
1248  retVal = rlDriverCmdInvoke(deviceMap, inMsg, &outMsg);
1249  }
1250  else
1251  {
1252  retVal = RL_RET_CODE_INVALID_INPUT;
1253  RL_LOGE_ARG0("sub block is NULL\n");
1254  }
1255  }
1256 
1257  return retVal;
1258 }
1259 
1260 /*
1261  * END OF rl_monitoring.c FILE
1262  */
TX power monitoring configuration.
Internal signals for DCC based clock monitoring configuration.
Signal and image band energy monitoring configuration.
External analog signals monitoring configuration.
RX saturation monitoring configuration.
rlReturnVal_t rlRfTxBallbreakMonConfig(rlUInt8_t deviceMap, rlAllTxBallBreakMonCfg_t *data)
Sets information related to TX ball break detection.
rlReturnVal_t rlRfAnaMonConfig(rlUInt8_t deviceMap, rlMonAnaEnables_t *data)
This function contains the consolidated configuration of all analog monitoring. The enabled monitorin...
rlTxPhShiftMonConf_t * tx2PhShiftMonCfg
Tx-2 Phase shifter monitoring config.
Digital monitoring latent fault reporting configuration.
rlReturnVal_t rlRfRxGainPhMonConfig(rlUInt8_t deviceMap, rlRxGainPhaseMonConf_t *data)
This API is to set RX gain and phase monitoring config to device.
rlReturnVal_t rlRfRxSigImgMonConfig(rlUInt8_t deviceMap, rlSigImgMonConf_t *data)
Sets information related to signal and image band energy.
rlTxBallbreakMonConf_t * tx0BallBrkMonCfg
Tx ballbreak monitoring config for Tx0.
Internal signals for PLL control voltage monitoring configuration.
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:2977
rlReturnVal_t rlRfRxIfStageMonConfig(rlUInt8_t deviceMap, rlRxIfStageMonConf_t *data)
Sets information related to RX IF filter attenuation monitoring.
rlReturnVal_t rlRfTxPhShiftMonConfig(rlUInt8_t deviceMap, rlAllTxPhShiftMonConf_t *data)
Sets information related to TX Phase shifter monitoring.
rlTxBallbreakMonConf_t * tx1BallBrkMonCfg
Tx ballbreak monitoring config for Tx1.
rlUInt16_t nsbc
Number of Sub Blocks in Payload.
Definition: rl_driver.h:343
rlReturnVal_t rlRfSynthFreqMonConfig(rlUInt8_t deviceMap, rlSynthFreqMonConf_t *data)
Sets information related to synthesizer frequency.
rlReturnVal_t rlRfDigMonEnableConfig(rlUInt8_t deviceMap, rlMonDigEnables_t *data)
Sets the consolidated configuration of all digital monitoring.
Definition: rl_monitoring.c:92
rlReturnVal_t rlRfAnaFaultInjConfig(rlUInt8_t deviceMap, rlAnaFaultInj_t *data)
Sets information related to RF fault injection.
TX Phase shifter monitoring configuration.
TX power monitoring configuration.
RX noise monitoring configuration.
RX IF stage monitoring configuration.
rlTxIntAnaSignalsMonConf_t * tx2IntAnaSgnlMonCfg
Internal signals in the Tx-2 path monitoring config.
TX ballbreak monitoring configuration.
rlReturnVal_t rlRfPllContrlVoltMonConfig(rlUInt8_t deviceMap, rlPllContrVoltMonConf_t *data)
Sets information related to APLL and Synthesizer's control voltage signals monitoring.
Internal signals in the TX path monitoring configuration.
rlReturnVal_t rlRfRxIfSatMonConfig(rlUInt8_t deviceMap, rlRxSatMonConf_t *data)
Sets information related to RX saturation detector monitoring.
rlTxPowMonConf_t * tx1PowrMonCfg
Power Monitoring Configuration for Tx1.
rlReturnVal_t rlRfTempMonConfig(rlUInt8_t deviceMap, rlTempMonConf_t *data)
This API configure the on chip temperature monitors and report the soft results from the monitor....
TX gain and phase mismatch monitoring configuration.
rlTxPhShiftMonConf_t * tx1PhShiftMonCfg
Tx-1 Phase shifter monitoring config.
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:2684
rlReturnVal_t rlRfGpadcIntAnaSignalsMonConfig(rlUInt8_t deviceMap, rlGpadcIntAnaSignalsMonConf_t *data)
Sets information related to GPADC Internal Analog Signals monitoring.
rlReturnVal_t rlRfDigMonPeriodicConfig(rlUInt8_t deviceMap, rlDigMonPeriodicConf_t *data)
Sets the consolidated configuration.
mmwave radar Driver Payload
Definition: rl_driver.h:349
TX ballbreak monitoring configuration.
rlReturnVal_t rlRfExtAnaSignalsMonConfig(rlUInt8_t deviceMap, rlExtAnaSignalsMonConf_t *data)
Sets information related to external DC signals monitoring.
Synthesizer frequency monitoring configuration.
Digital monitoring configuration.
Definition: rl_monitoring.h:72
rlTxIntAnaSignalsMonConf_t * tx1IntAnaSgnlMonCfg
Internal signals in the Tx-1 path monitoring config.
rlReturnVal_t rlRfPmClkLoIntAnaSignalsMonConfig(rlUInt8_t deviceMap, rlPmClkLoIntAnaSignalsMonConf_t *data)
Sets information related to Power Management, Clock generation and LO distribution.
Internal signals for GPADC monitoring configuration.
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:3043
TX Phase shifter monitoring configuration.
rlTxIntAnaSignalsMonConf_t * tx0IntAnaSgnlMonCfg
Internal signals in the Tx-0 path monitoring config.
RX mixer input power monitoring configuration.
rlReturnVal_t rlRfTxIntAnaSignalsMonConfig(rlUInt8_t deviceMap, rlAllTxIntAnaSignalsMonConf_t *data)
Sets information related to TX Internal Analog Signals monitoring.
rlReturnVal_t rlRfRxNoiseMonConfig(rlUInt8_t deviceMap, rlRxNoiseMonConf_t *data)
Sets information related to RX noise monitoring.
rlTxBallbreakMonConf_t * tx2BallBrkMonCfg
Tx ballbreak monitoring config for Tx2.
Analog monitoring configuration.
rlTxPowMonConf_t * tx2PowrMonCfg
Power Monitoring Configuration for Tx2.
rlReturnVal_t rlRfRxIntAnaSignalsMonConfig(rlUInt8_t deviceMap, rlRxIntAnaSignalsMonConf_t *data)
Sets information related to RX Internal Analog Signals monitoring.
Temperature sensor monitoring configuration.
Internal signals in the TX path monitoring configuration.
Internal signals for PM, CLK and LO monitoring configuration.
rlReturnVal_t rlRfDualClkCompMonConfig(rlUInt8_t deviceMap, rlDualClkCompMonConf_t *data)
Sets information related to the DCC based clock frequency monitoring.
rlTxPowMonConf_t * tx0PowrMonCfg
Power Monitoring Configuration for Tx0.
rlTxPhShiftMonConf_t * tx0PhShiftMonCfg
Tx-0 Phase shifter monitoring config.
rlReturnVal_t rlRfTxGainPhaseMismatchMonConfig(rlUInt8_t deviceMap, rlTxGainPhaseMismatchMonConf_t *data)
Sets information related to TX gain and phase mismatch monitoring.
RX gain and phase monitoring configuration.
rlReturnVal_t rlRfTxPowrMonConfig(rlUInt8_t deviceMap, rlAllTxPowMonConf_t *data)
Sets information related to TX power monitoring.
rlReturnVal_t rlDriverExecuteSetApi(rlUInt8_t deviceMap, rlUInt16_t msgId, rlUInt16_t sbcID, rlUInt8_t *msgData, rlUInt16_t inLen)
: Construct set message and invoke command.
Definition: rl_driver.c:3132
rlReturnVal_t rlDriverIsDeviceMapValid(rlUInt8_t deviceMap)
Checks if given deviecMap is valid wrt to global DeviceMap set to mmWaveLink.
Definition: rl_driver.c:2339

Copyright 2020, Texas Instruments Incorporated