LogSinkTraceLPF3.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2024 Texas Instruments Incorporated - http://www.ti.com
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 
33 /*!*****************************************************************************
34  * @file LogSinkTraceLPF3.h
35  * @brief <b>PRELIMINARY</b> LogSinkTraceLPF3 interface
36  *
37  * <b>WARNING</b> These APIs are <b>PRELIMINARY</b>, and subject to
38  * change in the next few months.
39  *
40  * The LogSinkTraceLPF3 module is a sink that can be used in conjunction with the
41  * Log.h API. The API defined in this file should not be used directly, but
42  * is made available to the Logging framework and used as a transport layer
43  * for Log.h
44  *
45  * To use the LogSinkTraceLPF3 sink, ensure that the correct library for your
46  * device is linked in and include this header file as follows:
47  * @code
48  * #include <ti/log/LogSinkTraceLPF3.h>
49  * @endcode
50  *
51  * Additionally, LogSinkTraceLPF3_init must be called before LogSinkTraceLPF3 can be used.
52  * It is called from Board_init() and thus can only be called if SysConfig is used and the LogSinkTraceLPF3 module is
53  * enabled.
54  * @code
55  * // Initialize LogSinkTraceLPF3 sink
56  * LogSinkTraceLPF3_init();
57  * @endcode
58  *
59  * This module implements one function that is required by the Log API:
60  * - printf(const Log_Module *handle, uint32_t header, uint32_t headerPtr, uint32_t numArgs, ...);
61  *
62  * Whenever a log-statement is invoked, that uses LogSinkTraceLPF3 as its sink, the function above is ultimately
63  * invoked.
64  *
65  * Note: buf(const Log_Module *handle, uint32_t header, uint32_t headerPtr, uint8_t *data, size_t size) is not
66  * implemented due to hardware limitations with this sink.
67  *
68  * @anchor ti_log_LogSinkTraceLPF3_Overview
69  * # Overview
70  * LogSinkTraceLPF3 is a sink/transport layer that is able to output log-statements over the tracer.
71  * The tracer is a hardware module inside the radio core which can extract logs at high speed.
72  * LogSinkTraceLPF3 uses the tracer to stream data out onto a user-selectable pin. The frequency of the data stream is
73  * set by the RF tracer prescaler which divides the internal 24 MHz clock. Hardware and software needed to decode the
74  * data stream is currently only available through TI.
75  *
76  * @anchor ti_log_LogSinkTraceLPF3_Channels
77  * # Tracer Channels
78  * LogSinkTraceLPF3 uses certain channels for different purposes. Separate channels are used for data transfer,
79  * time synchronization, etc. Channel 1 is used for logs inside the CPU. The other channels are used by the internal
80  * parts of the radio.
81  *
82  * @anchor ti_log_LogSinkTraceLPF3_Timestamps
83  * # Tracer Timestamps
84  * Timestamps are automatically generated internally by the tracer hardware inside the radio core. A synchronization
85  * timestamp is sent over the tracer pin when a log statement is sent. The timestamp resolution is fixed to 0.5 us
86  * with a max range of 32 ms.
87  *
88  * @anchor ti_log_LogSinkTraceLPF3_Parameters
89  * The tracer supports a maximum of four 16bit parameters inside each log statement. If using two parameters or less,
90  * the parameters can be of 32bit.
91  * ============================================================================
92  */
93 
94 #ifndef ti_log_LogSinkTraceLPF3__include
95 #define ti_log_LogSinkTraceLPF3__include
96 
97 /*
98  * Helpers to set the configuration for the tracer
99  */
100 #define LogSinkTraceLPF3_CONFIG_CHANNELS_CPU_ONLY LRFDTRC_CFG_CH1EN_NORM | LRFDTRC_CFG_CH2EN_OFF | LRFDTRC_CFG_CH3EN_OFF
101 #define LogSinkTraceLPF3_CONFIG_CHANNELS_RADIO_ONLY \
102  LRFDTRC_CFG_CH1EN_OFF | LRFDTRC_CFG_CH2EN_TOPSM | LRFDTRC_CFG_CH3EN_TOPSM
103 #define LogSinkTraceLPF3_CONFIG_CHANNELS_CPU_RADIO \
104  LRFDTRC_CFG_CH1EN_NORM | LRFDTRC_CFG_CH2EN_TOPSM | LRFDTRC_CFG_CH3EN_TOPSM
105 
106 #define LogSinkTraceLPF3_CONFIG_TIMESTAMP_ENABLED LRFDTRC_CFG_TSEN_ON
107 #define LogSinkTraceLPF3_CONFIG_TIMESTAMP_DISABLED LRFDTRC_CFG_TSEN_OFF
108 
109 #define LogSinkTraceLPF3_CONFIG_PRESCALER_DIV1 LRFDTRC_CFG_PRESCAL_DIV1
110 #define LogSinkTraceLPF3_CONFIG_PRESCALER_DIV2 LRFDTRC_CFG_PRESCAL_DIV2
111 #define LogSinkTraceLPF3_CONFIG_PRESCALER_DIV3 LRFDTRC_CFG_PRESCAL_DIV3
112 #define LogSinkTraceLPF3_CONFIG_PRESCALER_DIV4 LRFDTRC_CFG_PRESCAL_DIV4
113 
114 #include <stdint.h>
115 #include <ti/log/Log.h>
116 #include <ti/devices/DeviceFamily.h>
117 #include DeviceFamily_constructPath(inc/hw_lrfdtrc.h)
118 
119 #if defined(__cplusplus)
120 extern "C" {
121 #endif
122 
135 typedef struct
136 {
137  uint32_t tracerConfig;
138  uint32_t lrfdTracerPin;
139  int32_t tracerPinMux;
140  uint32_t tracerPin;
142 
175 extern void LogSinkTraceLPF3_printfSingleton(const Log_Module *handle,
176  uint32_t header,
177  uint32_t headerPtr,
178  uint32_t numArgs,
179  ...);
180 
181 extern void LogSinkTraceLPF3_printfSingleton0(const Log_Module *handle, uint32_t header, uint32_t headerPtr, ...);
182 
183 extern void LogSinkTraceLPF3_printfSingleton1(const Log_Module *handle, uint32_t header, uint32_t headerPtr, ...);
184 
185 extern void LogSinkTraceLPF3_printfSingleton2(const Log_Module *handle, uint32_t header, uint32_t headerPtr, ...);
186 
187 extern void LogSinkTraceLPF3_printfSingleton3(const Log_Module *handle, uint32_t header, uint32_t headerPtr, ...);
188 
189 extern void LogSinkTraceLPF3_init(void);
219 extern void LogSinkTraceLPF3_bufSingleton(const Log_Module *handle,
220  uint32_t header,
221  uint32_t headerPtr,
222  uint8_t *data,
223  size_t size);
224 
225 /*
226  * Helpers to define/use instance. Tracer is a singleton so no arguments are taken.
227  */
228 
229 #define Log_MODULE_INIT_SINK_TRACELPF3(name, _levels, printfDelegate, bufDelegatee, _dynamicLevelsPtr) \
230  { \
231  .sinkConfig = NULL, .printf = LogSinkTraceLPF3_printfSingleton, .printf0 = LogSinkTraceLPF3_printfSingleton0, \
232  .printf1 = LogSinkTraceLPF3_printfSingleton1, .printf2 = LogSinkTraceLPF3_printfSingleton2, \
233  .printf3 = LogSinkTraceLPF3_printfSingleton3, .buf = LogSinkTraceLPF3_bufSingleton, .levels = _levels, \
234  .dynamicLevelsPtr = _dynamicLevelsPtr, \
235  }
236 
237 #if defined(__cplusplus)
238 }
239 #endif
240 
241 #endif /* ti_log_LogSinkTraceLPF3__include */
void LogSinkTraceLPF3_printfSingleton0(const Log_Module *handle, uint32_t header, uint32_t headerPtr,...)
uint32_t lrfdTracerPin
Definition: LogSinkTraceLPF3.h:138
uint32_t tracerConfig
Definition: LogSinkTraceLPF3.h:137
void LogSinkTraceLPF3_bufSingleton(const Log_Module *handle, uint32_t header, uint32_t headerPtr, uint8_t *data, size_t size)
uint32_t tracerPin
Definition: LogSinkTraceLPF3.h:140
const LogSinkTraceLPF3_Config LogSinkTraceLPF3_config
LogSinkTraceLPF3 global configuration.
Definition: LogSinkTraceLPF3.h:135
void LogSinkTraceLPF3_printfSingleton2(const Log_Module *handle, uint32_t header, uint32_t headerPtr,...)
void LogSinkTraceLPF3_printfSingleton1(const Log_Module *handle, uint32_t header, uint32_t headerPtr,...)
void LogSinkTraceLPF3_init(void)
int32_t tracerPinMux
Definition: LogSinkTraceLPF3.h:139
void LogSinkTraceLPF3_printfSingleton3(const Log_Module *handle, uint32_t header, uint32_t headerPtr,...)
void LogSinkTraceLPF3_printfSingleton(const Log_Module *handle, uint32_t header, uint32_t headerPtr, uint32_t numArgs,...)
Array with the configuration of each sink.
© Copyright 1995-2025, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale