Radio Control Layer (RCL)
LRFLPF3_Interface.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2025-2026, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 #ifndef ti_drivers_rcl_lrf_LRFLPF3_Interface__include
33 #define ti_drivers_rcl_lrf_LRFLPF3_Interface__include
34 
35 #include <stdint.h>
36 
37 #include <ti/devices/DeviceFamily.h>
38 #include DeviceFamily_constructPath(inc/hw_types.h)
39 #include DeviceFamily_constructPath(inc/hw_lrfddbell.h)
40 #include DeviceFamily_constructPath(inc/hw_lrfdmdm.h)
41 #include DeviceFamily_constructPath(inc/hw_lrfdpbe.h)
42 #include DeviceFamily_constructPath(inc/hw_lrfdpbe32.h)
43 #include DeviceFamily_constructPath(inc/hw_memmap.h)
44 #include DeviceFamily_constructPath(inc/pbe_common_ram_regs.h)
45 #include DeviceFamily_constructPath(inc/pbe_generic_regdef_regs.h)
46 
47 #if (DeviceFamily_PARENT != DeviceFamily_PARENT_CC23X0) && (DeviceFamily_PARENT != DeviceFamily_PARENT_CC27XX)
48  #error "This LRFLPF3_Interface.h header file is only for CC23X0 and CC27XX devices!"
49 #endif
50 
51 /* ============================================================================
52  * Macros
53  * ============================================================================
54  */
55 #define LRF_INTERFACE_ENDCAUSE_STAT_ENDOK (uint16_t)(PBE_COMMON_RAM_ENDCAUSE_STAT_ENDOK)
56 #define LRF_INTERFACE_ENDCAUSE_STAT_RXTIMEOUT (uint16_t)(PBE_COMMON_RAM_ENDCAUSE_STAT_RXTIMEOUT)
57 #define LRF_INTERFACE_ENDCAUSE_STAT_NOSYNC (uint16_t)(PBE_COMMON_RAM_ENDCAUSE_STAT_NOSYNC)
58 #define LRF_INTERFACE_ENDCAUSE_STAT_RXERR (uint16_t)(PBE_COMMON_RAM_ENDCAUSE_STAT_RXERR)
59 #define LRF_INTERFACE_ENDCAUSE_STAT_CONNECT (uint16_t)(PBE_COMMON_RAM_ENDCAUSE_STAT_CONNECT)
60 #define LRF_INTERFACE_ENDCAUSE_STAT_MAXNAK (uint16_t)(PBE_COMMON_RAM_ENDCAUSE_STAT_MAXNAK)
61 #define LRF_INTERFACE_ENDCAUSE_STAT_SCANRSP (uint16_t)(PBE_COMMON_RAM_ENDCAUSE_STAT_SCANRSP)
62 #define LRF_INTERFACE_ENDCAUSE_STAT_EOPSTOP (uint16_t)(PBE_COMMON_RAM_ENDCAUSE_STAT_EOPSTOP)
63 #define LRF_INTERFACE_ENDCAUSE_STAT_ERR_RXF (uint16_t)(PBE_COMMON_RAM_ENDCAUSE_STAT_ERR_RXF)
64 #define LRF_INTERFACE_ENDCAUSE_STAT_ERR_TXF (uint16_t)(PBE_COMMON_RAM_ENDCAUSE_STAT_ERR_TXF)
65 #define LRF_INTERFACE_ENDCAUSE_STAT_ERR_SYNTH (uint16_t)(PBE_COMMON_RAM_ENDCAUSE_STAT_ERR_SYNTH)
66 #define LRF_INTERFACE_ENDCAUSE_STAT_ERR_STOP (uint16_t)(PBE_COMMON_RAM_ENDCAUSE_STAT_ERR_STOP)
67 #define LRF_INTERFACE_ENDCAUSE_STAT_ERR_PAR (uint16_t)(PBE_COMMON_RAM_ENDCAUSE_STAT_ERR_PAR)
68 #define LRF_INTERFACE_ENDCAUSE_STAT_ERR_BADOP (uint16_t)(PBE_COMMON_RAM_ENDCAUSE_STAT_ERR_BADOP)
69 #define LRF_INTERFACE_ENDCAUSE_STAT_ERR_INTERNAL (uint16_t)(PBE_COMMON_RAM_ENDCAUSE_STAT_ERR_INTERNAL)
70 
71 /* =========================================================================
72  * Inline APIs
73  * =========================================================================
74  */
75 static inline void LRF_Interface_sendOp(uint16_t op)
76 {
77  HWREGH_WRITE_LRF(LRFDPBE_BASE + LRFDPBE_O_API) = op;
78 }
79 
80 static inline void LRF_Interface_programSyncWordA(uint32_t syncWord)
81 {
82  HWREG_WRITE_LRF(LRFDPBE32_BASE + LRFDPBE32_O_MDMSYNCA) = syncWord;
83 }
84 
85 static inline void LRF_Interface_programSyncWordB(uint32_t syncWord)
86 {
87  HWREG_WRITE_LRF(LRFDPBE32_BASE + LRFDPBE32_O_MDMSYNCB) = syncWord;
88 }
89 
90 static inline uint16_t LRF_Interface_getCmdEndCause(void)
91 {
92  return HWREGH_READ_LRF(LRFD_BUFRAM_BASE + PBE_COMMON_RAM_O_ENDCAUSE);
93 }
94 
95 static inline bool LRF_Interface_isCmdEndCauseEopStop(void)
96 {
97  return (LRF_Interface_getCmdEndCause() == PBE_COMMON_RAM_ENDCAUSE_STAT_EOPSTOP);
98 }
99 
100 static inline bool LRF_Interface_isCmdEndCauseEndOk(uint16_t endCause)
101 {
102  return (endCause == PBE_COMMON_RAM_ENDCAUSE_STAT_ENDOK);
103 }
104 
105 static inline bool LRF_Interface_isCmdEndCauseEndedWithoutSync(uint16_t endCause)
106 {
107  return (endCause == PBE_COMMON_RAM_ENDCAUSE_STAT_NOSYNC);
108 }
109 
110 #endif /* ti_drivers_rcl_lrf_LRFLPF3_Interface__include */
static bool LRF_Interface_isCmdEndCauseEndOk(uint16_t endCause)
Definition: LRFLPF3_Interface.h:100
static void LRF_Interface_programSyncWordB(uint32_t syncWord)
Definition: LRFLPF3_Interface.h:85
static void LRF_Interface_sendOp(uint16_t op)
Definition: LRFLPF3_Interface.h:75
static uint16_t LRF_Interface_getCmdEndCause(void)
Definition: LRFLPF3_Interface.h:90
static bool LRF_Interface_isCmdEndCauseEndedWithoutSync(uint16_t endCause)
Definition: LRFLPF3_Interface.h:105
static bool LRF_Interface_isCmdEndCauseEopStop(void)
Definition: LRFLPF3_Interface.h:95
static void LRF_Interface_programSyncWordA(uint32_t syncWord)
Definition: LRFLPF3_Interface.h:80