1 /*
2  * Trace Recorder for Tracealyzer v4.6.6
3  * Copyright 2021 Percepio AB
4  * www.percepio.com
5  *
6  * SPDX-License-Identifier: Apache-2.0
7  *
8  * The ThreadX specific parts needed by the trace recorder
9  */
10 
11 #ifndef TRC_KERNEL_PORT_H
12 #define TRC_KERNEL_PORT_H
13 
14 #include <trcRecorder.h>
15 #include <tx_api.h>
16 #include <tx_trace.h>
17 #include "trcKernelPortHooks.h"
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 /**
24  * @def TRC_USE_TRACEALYZER_RECORDER
25  * @brief Enables/Disables the recorder.
26  */
27 #define TRC_USE_TRACEALYZER_RECORDER 1
28 
29 /**
30  * @def TRACE_KERNEL_VERSION
31  * @brief This defines the kernel version/identity.
32  */
33 #define TRACE_KERNEL_VERSION 0xEAAE
34 
35 /**
36  * @def TRC_PLATFORM_CFG
37  * @brief This defines the basis for version specific lookup of
38  * platform configuration files. If left empty the default
39  * RTOS XML files are used.
40  */
41 #define TRC_PLATFORM_CFG "ThreadX"
42 
43 /**
44  * @def TRC_PLATFORM_CFG_MAJOR
45  * @brief Major release version for recorder.
46  */
47 #define TRC_PLATFORM_CFG_MAJOR 1
48 
49 /**
50  * @def TRC_PLATFORM_CFG_MINOR
51  * @brief Minor release version for recorder.
52  */
53 #define TRC_PLATFORM_CFG_MINOR 0
54 
55 /**
56  * @def TRC_PLATFORM_CFG_PATCH
57  * @brief Patchlevel release version for recorder.
58  */
59 #define TRC_PLATFORM_CFG_PATCH 0
60 
61 /**
62  * @def TRACE_CPU_CLOCK_HZ
63  * @brief Trace CPU clock speed in Hz.
64  */
65 #define TRACE_CPU_CLOCK_HZ TRC_CFG_CPU_CLOCK_HZ
66 
67 /**
68  * @def TRC_TICK_RATE_HZ
69  * @brief Trace RTOS tick rate in Hz.
70  */
71 #define TRC_TICK_RATE_HZ TX_TIMER_TICKS_PER_SECOND
72 
73 /**
74  * @def TraceKernelPortTaskHandle_t
75  * @brief RTOS data type for tasks/threads.
76  */
77 #define TraceKernelPortTaskHandle_t TX_THREAD
78 
79 extern TraceHeapHandle_t xSystemHeapHandle;
80 
81 #if (TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC)
82 #error "Dynamic allocation mode isn't supported for ThreadX, there is no system heap to allocate from. Use custom allocation mode to map trace buffer to your own heap."
83 
84 /**
85  * @internal Kernel port specific heap initialization
86  */
87 #define TRC_KERNEL_PORT_HEAP_INIT(size)
88 
89 /**
90  * @internal Kernel port specific heap malloc definition
91  */
92 #define TRC_KERNEL_PORT_HEAP_MALLOC(size) TX_NULL
93 #endif /* (TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC) */
94 
95 /**
96  * @brief A structure representing the kernel port buffer.
97  */
98 typedef struct TraceKernelPortDataBuffer
99 {
100 	uint32_t buffer[(sizeof(TraceHeapHandle_t) + sizeof(TraceKernelPortTaskHandle_t)) / sizeof(uint32_t)];
101 } TraceKernelPortDataBuffer_t;
102 
103 /**
104  * @internal Kernel port initialize callback.
105  *
106  * This function is called by the recorder as part of its initialization phase.
107  *
108  * @param[in] pxBuffer Buffer
109  * @retval TRC_FAIL Initialization failed
110  * @retval TRC_SUCCESS Success
111  */
112 traceResult xTraceKernelPortInitialize(TraceKernelPortDataBuffer_t* pxBuffer);
113 
114 /**
115  * @brief Kernel port begin callback.
116  *
117  * This function is called by the recorder as part of its begin phase.
118  *
119  * @retval TRC_FAIL Enabling failed
120  * @retval TRC_SUCCESS Success
121  */
122 traceResult xTraceKernelPortEnable(void);
123 
124 /**
125  * @brief Get unused stack size for kernel port thread.
126  *
127  * @param[in] pvThread Thread
128  * @param[out] puxUnusedStack Unused stack
129  * @retval TRC_FAIL Failed to get size
130  * @retval TRC_SUCCESS Success
131  */
132 traceResult xTraceKernelPortGetUnusedStack(void* pvThread, TraceUnsignedBaseType_t* puxUnusedStack);
133 
134 /**
135  * @brief Get kernel port system heap handle.
136  *
137  * @return TraceHeapHandle_t
138  */
139 TraceHeapHandle_t xTraceKernelPortGetSystemHeapHandle(void);
140 
141 /**
142  * @brief Get kernel port scheduler suspended state
143  *
144  * @retval 0 Scheduler not suspended
145  * @retval 1 Scheduler suspended
146  */
147 unsigned char xTraceKernelPortIsSchedulerSuspended(void);
148 
149 /**
150  * @brief Sets a name for Queue objects for display in Tracealyzer.
151  *
152  * @param[in] object Pointer to the Queue that shall be named
153  * @param[in] name Name to set (const string literal)
154  */
155 void vTraceSetQueueName(void* object, const char* name);
156 
157 /**
158  * @brief Sets a name for Semaphore objects for display in Tracealyzer.
159  *
160  * @param[in] object Pointer to the Seamaphore that shall be named
161  * @param[in] name Name to set (const string literal)
162  */
163 void vTraceSetSemaphoreName(void* object, const char* name);
164 
165 /**
166  * @brief Sets a name for Mutex objects for display in Tracealyzer.
167  *
168  * @param[in] object Pointer to the Mutex that shall be named
169  * @param[in] name Name to set (const string literal)
170  */
171 void vTraceSetMutexName(void* object, const char* name);
172 
173 /**
174  * @brief Sets a name for Event Group objects for display in Tracealyzer.
175  *
176  * @param[in] object Pointer to the Event Group that shall be named
177  * @param[in] name Name to set (const string literal)
178  */
179 void vTraceSetEventGroupName(void* object, const char* name);
180 
181 /**
182  * @brief Sets a name for Stream Buffer objects for display in Tracealyzer.
183  *
184  * @param[in] object Pointer to the Stream Buffer that shall be named
185  * @param[in] name Name to set (const string literal)
186  */
187 void vTraceSetStreamBufferName(void* object, const char* name);
188 
189 /**
190  * @brief Sets a name for Message Buffer objects for display in Tracealyzer.
191  *
192  * @param[in] object Pointer to the Message Buffer that shall be named
193  * @param[in] name Name to set (const string literal)
194  */
195 void vTraceSetMessageBufferName(void* object, const char* name);
196 
197 
198 /* Event codes - should match the offline config file. */
199 #define PSF_EVENT_NULL_EVENT										0
200 
201 #define PSF_EVENT_TRACE_START										1
202 #define PSF_EVENT_TS_CONFIG											2
203 #define PSF_EVENT_OBJ_NAME											3
204 #define PSF_EVENT_DEFINE_ISR										7
205 
206 #define PSF_EVENT_STATEMACHINE_STATE_CREATE							0
207 #define PSF_EVENT_STATEMACHINE_CREATE								0
208 #define PSF_EVENT_STATEMACHINE_STATECHANGE							0
209 #define PSF_EVENT_MALLOC											0
210 #define PSF_EVENT_MALLOC_FAILED 									0
211 #define PSF_EVENT_FREE												0
212 #define PSF_EVENT_FREE_FAILED 										0
213 #define PSF_EVENT_INTERVAL_CHANNEL_CREATE							0
214 #define PSF_EVENT_INTERVAL_CHANNEL_SET_CREATE						0
215 #define PSF_EVENT_INTERVAL_CREATE									0
216 #define PSF_EVENT_INTERVAL_STATECHANGE								0
217 #define PSF_EVENT_INTERVAL_CHANNEL_CREATE							0
218 #define PSF_EVENT_INTERVAL_CHANNEL_SET_CREATE						0
219 #define PSF_EVENT_INTERVAL_START									0
220 #define PSF_EVENT_INTERVAL_STOP										0
221 #define PSF_EVENT_TASK_DELETE										PSF_EVENT_THREAD_DELETE_SUCCESS
222 #define PSF_EVENT_COUNTER_CREATE									0
223 #define PSF_EVENT_COUNTER_CHANGE									0
224 #define PSF_EVENT_COUNTER_LIMIT_EXCEEDED							0
225 #define PSF_EVENT_EXTENSION_CREATE									0
226 #define PSF_EVENT_HEAP_CREATE										0
227 
228 #define PSF_EVENT_IFE_NEXT											0
229 #define PSF_EVENT_IFE_DIRECT										0
230 
231 /**
232  * 0000-999  Default ThreadX Codes
233  * 1000-1999 Tz Segment 1
234  * 2000-2999 Tz Segment 2
235  * 3000-3999 Tz Segment 3
236  * 4000-4095 Tz Internal
237  */
238 #define PSF_EVENT_S1_OFFSET 1000
239 #define PSF_EVENT_S2_OFFSET 2000
240 #define PSF_EVENT_S3_OFFSET 3000
241 
242 #define PSF_EVENT_BLOCK_ALLOCATE_SUCCESS							TX_TRACE_BLOCK_ALLOCATE + PSF_EVENT_S2_OFFSET
243 #define PSF_EVENT_BLOCK_ALLOCATE_FAILED								TX_TRACE_BLOCK_ALLOCATE + PSF_EVENT_S3_OFFSET
244 #define PSF_EVENT_BLOCK_ALLOCATE_BLOCKED							TX_TRACE_BLOCK_ALLOCATE
245 #define PSF_EVENT_BLOCK_ALLOCATE_TIMEOUT							TX_TRACE_BLOCK_ALLOCATE + PSF_EVENT_S1_OFFSET
246 #define PSF_EVENT_BLOCK_POOL_CREATE_SUCCESS							TX_TRACE_BLOCK_POOL_CREATE
247 #define PSF_EVENT_BLOCK_POOL_CREATE_FAILED							TX_TRACE_BLOCK_POOL_CREATE + PSF_EVENT_S1_OFFSET
248 #define PSF_EVENT_BLOCK_POOL_DELETE_SUCCESS							TX_TRACE_BLOCK_POOL_DELETE
249 #define PSF_EVENT_BLOCK_POOL_DELETE_FAILED							TX_TRACE_BLOCK_POOL_DELETE + PSF_EVENT_S1_OFFSET
250 #define PSF_EVENT_BLOCK_POOL_INFO_GET_SUCCESS						TX_TRACE_BLOCK_POOL_INFO_GET
251 #define PSF_EVENT_BLOCK_POOL_INFO_GET_FAILED						TX_TRACE_BLOCK_POOL_INFO_GET + PSF_EVENT_S1_OFFSET
252 #define PSF_EVENT_BLOCK_POOL_PERFORMANCE_INFO_GET_SUCCESS			TX_TRACE_BLOCK_POOL_PERFORMANCE_INFO_GET
253 #define PSF_EVENT_BLOCK_POOL_PERFORMANCE_INFO_GET_FAILED			TX_TRACE_BLOCK_POOL_PERFORMANCE_INFO_GET + PSF_EVENT_S1_OFFSET
254 #define PSF_EVENT_BLOCK_POOL__PERFORMANCE_SYSTEM_INFO_GET_SUCCESS	TX_TRACE_BLOCK_POOL__PERFORMANCE_SYSTEM_INFO_GET
255 #define PSF_EVENT_BLOCK_POOL__PERFORMANCE_SYSTEM_INFO_GET_FAILED	TX_TRACE_BLOCK_POOL__PERFORMANCE_SYSTEM_INFO_GET + PSF_EVENT_S1_OFFSET
256 #define PSF_EVENT_BLOCK_POOL_PRIORITIZE_SUCCESS						TX_TRACE_BLOCK_POOL_PRIORITIZE
257 #define PSF_EVENT_BLOCK_POOL_PRIORITIZE_FAILED						TX_TRACE_BLOCK_POOL_PRIORITIZE + PSF_EVENT_S1_OFFSET
258 #define PSF_EVENT_BLOCK_POOL_RELEASE_SUCCESS						TX_TRACE_BLOCK_RELEASE
259 #define PSF_EVENT_BLOCK_POOL_RELEASE_FAILED							TX_TRACE_BLOCK_RELEASE + PSF_EVENT_S1_OFFSET
260 
261 #define PSF_EVENT_BYTE_ALLOCATE_SUCCESS								TX_TRACE_BYTE_ALLOCATE + PSF_EVENT_S2_OFFSET
262 #define PSF_EVENT_BYTE_ALLOCATE_FAILED								TX_TRACE_BYTE_ALLOCATE + PSF_EVENT_S3_OFFSET
263 #define PSF_EVENT_BYTE_ALLOCATE_BLOCKED								TX_TRACE_BYTE_ALLOCATE
264 #define PSF_EVENT_BYTE_ALLOCATE_TIMEOUT								TX_TRACE_BYTE_ALLOCATE + PSF_EVENT_S1_OFFSET
265 #define PSF_EVENT_BYTE_POOL_CREATE_SUCCESS							TX_TRACE_BYTE_POOL_CREATE
266 #define PSF_EVENT_BYTE_POOL_CREATE_FAILED							TX_TRACE_BYTE_POOL_CREATE + PSF_EVENT_S1_OFFSET
267 #define PSF_EVENT_BYTE_POOL_DELETE_SUCCESS							TX_TRACE_BYTE_POOL_DELETE
268 #define PSF_EVENT_BYTE_POOL_DELETE_FAILED							TX_TRACE_BYTE_POOL_DELETE + PSF_EVENT_S1_OFFSET
269 #define PSF_EVENT_BYTE_POOL_INFO_GET_SUCCESS						TX_TRACE_BYTE_POOL_INFO_GET
270 #define PSF_EVENT_BYTE_POOL_INFO_GET_FAILED							TX_TRACE_BYTE_POOL_INFO_GET + PSF_EVENT_S1_OFFSET
271 #define PSF_EVENT_BYTE_POOL_PERFORMANCE_INFO_GET_SUCCESS			TX_TRACE_BYTE_POOL_PERFORMANCE_INFO_GET
272 #define PSF_EVENT_BYTE_POOL_PERFORMANCE_INFO_GET_FAILED				TX_TRACE_BYTE_POOL_PERFORMANCE_INFO_GET + PSF_EVENT_S1_OFFSET
273 #define PSF_EVENT_BYTE_POOL__PERFORMANCE_SYSTEM_INFO_GET_SUCCESS	TX_TRACE_BYTE_POOL__PERFORMANCE_SYSTEM_INFO_GET
274 #define PSF_EVENT_BYTE_POOL__PERFORMANCE_SYSTEM_INFO_GET_FAILED		TX_TRACE_BYTE_POOL__PERFORMANCE_SYSTEM_INFO_GET + PSF_EVENT_S1_OFFSET
275 #define PSF_EVENT_BYTE_POOL_PRIORITIZE_SUCCESS						TX_TRACE_BYTE_POOL_PRIORITIZE
276 #define PSF_EVENT_BYTE_POOL_PRIORITIZE_FAILED						TX_TRACE_BYTE_POOL_PRIORITIZE + PSF_EVENT_S1_OFFSET
277 #define PSF_EVENT_BYTE_POOL_RELEASE_SUCCESS							TX_TRACE_BYTE_RELEASE
278 #define PSF_EVENT_BYTE_POOL_RELEASE_FAILED							TX_TRACE_BYTE_RELEASE + PSF_EVENT_S1_OFFSET
279 
280 #define PSF_EVENT_FLAGS_CREATE_SUCCESS                 				TX_TRACE_EVENT_FLAGS_CREATE
281 #define PSF_EVENT_FLAGS_CREATE_FAILED								TX_TRACE_EVENT_FLAGS_CREATE + PSF_EVENT_S1_OFFSET
282 #define PSF_EVENT_FLAGS_DELETE_SUCCESS								TX_TRACE_EVENT_FLAGS_DELETE
283 #define PSF_EVENT_FLAGS_DELETE_FAILED								TX_TRACE_EVENT_FLAGS_DELETE + PSF_EVENT_S1_OFFSET
284 #define PSF_EVENT_FLAGS_GET_SUCCESS                   			  	TX_TRACE_EVENT_FLAGS_GET + PSF_EVENT_S2_OFFSET
285 #define PSF_EVENT_FLAGS_GET_FAILED									TX_TRACE_EVENT_FLAGS_GET + PSF_EVENT_S3_OFFSET
286 #define PSF_EVENT_FLAGS_GET_BLOCKED									TX_TRACE_EVENT_FLAGS_GET
287 #define PSF_EVENT_FLAGS_GET_TIMEOUT									TX_TRACE_EVENT_FLAGS_GET + PSF_EVENT_S1_OFFSET
288 #define PSF_EVENT_FLAGS_INFO_GET_SUCCESS          		 	    	TX_TRACE_EVENT_FLAGS_INFO_GET
289 #define PSF_EVENT_FLAGS_INFO_GET_FAILED								TX_TRACE_EVENT_FLAGS_INFO_GET + PSF_EVENT_S1_OFFSET
290 #define PSF_EVENT_FLAGS_PERFORMANCE_INFO_GET_SUCCESS				TX_TRACE_EVENT_FLAGS_PERFORMANCE_INFO_GET
291 #define PSF_EVENT_FLAGS_PERFORMANCE_INFO_GET_FAILED					TX_TRACE_EVENT_FLAGS_PERFORMANCE_INFO_GET + PSF_EVENT_S1_OFFSET
292 #define PSF_EVENT_FLAGS__PERFORMANCE_SYSTEM_INFO_GET_SUCCESS		TX_TRACE_EVENT_FLAGS__PERFORMANCE_SYSTEM_INFO_GET
293 #define PSF_EVENT_FLAGS__PERFORMANCE_SYSTEM_INFO_GET_FAILED			TX_TRACE_EVENT_FLAGS__PERFORMANCE_SYSTEM_INFO_GET + PSF_EVENT_S1_OFFSET
294 #define PSF_EVENT_FLAGS_SET_SUCCESS            	        			TX_TRACE_EVENT_FLAGS_SET
295 #define PSF_EVENT_FLAGS_SET_FAILED									TX_TRACE_EVENT_FLAGS_SET + PSF_EVENT_S1_OFFSET
296 #define PSF_EVENT_FLAGS_SET_NOTIFY_SUCCESS	       			     	TX_TRACE_EVENT_FLAGS_SET_NOTIFY
297 #define PSF_EVENT_FLAGS_SET_NOTIFY_FAILED							TX_TRACE_EVENT_FLAGS_SET_NOTIFY + PSF_EVENT_S1_OFFSET
298 
299 #define PSF_EVENT_MUTEX_CREATE_SUCCESS								TX_TRACE_MUTEX_CREATE
300 #define PSF_EVENT_MUTEX_CREATE_FAILED								TX_TRACE_MUTEX_CREATE + PSF_EVENT_S1_OFFSET
301 #define PSF_EVENT_MUTEX_DELETE_SUCCESS								TX_TRACE_MUTEX_DELETE
302 #define PSF_EVENT_MUTEX_DELETE_FAILED								TX_TRACE_MUTEX_DELETE + PSF_EVENT_S1_OFFSET
303 #define PSF_EVENT_MUTEX_GET_SUCCESS									TX_TRACE_MUTEX_GET + PSF_EVENT_S2_OFFSET
304 #define PSF_EVENT_MUTEX_GET_FAILED									TX_TRACE_MUTEX_GET + PSF_EVENT_S3_OFFSET
305 #define PSF_EVENT_MUTEX_GET_BLOCKED									TX_TRACE_MUTEX_GET
306 #define PSF_EVENT_MUTEX_GET_TIMEOUT									1052
307 #define PSF_EVENT_MUTEX_INFO_GET_SUCCESS							TX_TRACE_MUTEX_INFO_GET
308 #define PSF_EVENT_MUTEX_INFO_GET_FAILED								TX_TRACE_MUTEX_INFO_GET + PSF_EVENT_S1_OFFSET
309 #define PSF_EVENT_MUTEX_PERFORMANCE_INFO_GET_SUCCESS				TX_TRACE_MUTEX_PERFORMANCE_INFO_GET
310 #define PSF_EVENT_MUTEX_PERFORMANCE_INFO_GET_FAILED					TX_TRACE_MUTEX_PERFORMANCE_INFO_GET + PSF_EVENT_S1_OFFSET
311 #define PSF_EVENT_MUTEX_PERFORMANCE_SYSTEM_INFO_GET_SUCCESS			TX_TRACE_MUTEX_PERFORMANCE_SYSTEM_INFO_GET
312 #define PSF_EVENT_MUTEX_PERFORMANCE_SYSTEM_INFO_GET_FAILED			TX_TRACE_MUTEX_PERFORMANCE_SYSTEM_INFO_GET + PSF_EVENT_S1_OFFSET
313 #define PSF_EVENT_MUTEX_PRIORITIZE_SUCCESS							TX_TRACE_MUTEX_PRIORITIZE
314 #define PSF_EVENT_MUTEX_PRIORITIZE_FAILED							TX_TRACE_MUTEX_PRIORITIZE + PSF_EVENT_S1_OFFSET
315 #define PSF_EVENT_MUTEX_PUT_SUCCESS									TX_TRACE_MUTEX_PUT
316 #define PSF_EVENT_MUTEX_PUT_FAILED									TX_TRACE_MUTEX_PUT + PSF_EVENT_S1_OFFSET
317 
318 #define PSF_EVENT_QUEUE_CREATE_SUCCESS								TX_TRACE_QUEUE_CREATE
319 #define PSF_EVENT_QUEUE_CREATE_FAILED								TX_TRACE_QUEUE_CREATE + PSF_EVENT_S1_OFFSET
320 #define PSF_EVENT_QUEUE_DELETE_SUCCESS								TX_TRACE_QUEUE_DELETE
321 #define PSF_EVENT_QUEUE_DELETE_FAILED								TX_TRACE_QUEUE_DELETE + PSF_EVENT_S1_OFFSET
322 #define PSF_EVENT_QUEUE_FLUSH_SUCCESS								TX_TRACE_QUEUE_FLUSH
323 #define PSF_EVENT_QUEUE_FLUSH_FAILED								TX_TRACE_QUEUE_FLUSH + PSF_EVENT_S1_OFFSET
324 #define PSF_EVENT_QUEUE_FRONT_SEND_SUCCESS							TX_TRACE_QUEUE_FRONT_SEND + PSF_EVENT_S2_OFFSET
325 #define PSF_EVENT_QUEUE_FRONT_SEND_FAILED							TX_TRACE_QUEUE_FRONT_SEND + PSF_EVENT_S3_OFFSET
326 #define PSF_EVENT_QUEUE_FRONT_SEND_BLOCKED							TX_TRACE_QUEUE_FRONT_SEND
327 #define PSF_EVENT_QUEUE_FRONT_SEND_TIMEOUT							1063
328 #define PSF_EVENT_QUEUE_INFO_GET_SUCCESS							TX_TRACE_QUEUE_INFO_GET
329 #define PSF_EVENT_QUEUE_INFO_GET_FAILED								TX_TRACE_QUEUE_INFO_GET + PSF_EVENT_S1_OFFSET
330 #define PSF_EVENT_QUEUE_PERFORMANCE_INFO_GET_SUCCESS				TX_TRACE_QUEUE_PERFORMANCE_INFO_GET
331 #define PSF_EVENT_QUEUE_PERFORMANCE_INFO_GET_FAILED					TX_TRACE_QUEUE_PERFORMANCE_INFO_GET + PSF_EVENT_S1_OFFSET
332 #define PSF_EVENT_QUEUE_PERFORMANCE_SYSTEM_INFO_GET_SUCCESS			TX_TRACE_QUEUE_PERFORMANCE_SYSTEM_INFO_GET
333 #define PSF_EVENT_QUEUE_PERFORMANCE_SYSTEM_INFO_GET_FAILED			TX_TRACE_QUEUE_PERFORMANCE_SYSTEM_INFO_GET + PSF_EVENT_S1_OFFSET
334 #define PSF_EVENT_QUEUE_PRIORITIZE_SUCCESS							TX_TRACE_QUEUE_PRIORITIZE
335 #define PSF_EVENT_QUEUE_PRIORITIZE_FAILED							TX_TRACE_QUEUE_PRIORITIZE + PSF_EVENT_S1_OFFSET
336 #define PSF_EVENT_QUEUE_RECEIVE_SUCCESS								TX_TRACE_QUEUE_RECEIVE + PSF_EVENT_S2_OFFSET
337 #define PSF_EVENT_QUEUE_RECEIVE_FAILED								TX_TRACE_QUEUE_RECEIVE + PSF_EVENT_S3_OFFSET
338 #define PSF_EVENT_QUEUE_RECEIVE_BLOCKED								TX_TRACE_QUEUE_RECEIVE
339 #define PSF_EVENT_QUEUE_RECEIVE_TIMEOUT								1068
340 #define PSF_EVENT_QUEUE_SEND_NOTIFY_SUCCESS							TX_TRACE_QUEUE_SEND_NOTIFY
341 #define PSF_EVENT_QUEUE_SEND_NOTIFY_FAILED							TX_TRACE_QUEUE_SEND_NOTIFY + PSF_EVENT_S1_OFFSET
342 #define PSF_EVENT_QUEUE_SEND_SUCCESS								TX_TRACE_QUEUE_SEND + PSF_EVENT_S2_OFFSET
343 #define PSF_EVENT_QUEUE_SEND_FAILED									3069
344 #define PSF_EVENT_QUEUE_SEND_BLOCKED								TX_TRACE_QUEUE_SEND
345 #define PSF_EVENT_QUEUE_SEND_TIMEOUT								1069
346 
347 #define PSF_EVENT_SEMAPHORE_CREATE_SUCCESS							TX_TRACE_SEMAPHORE_CREATE
348 #define PSF_EVENT_SEMAPHORE_CREATE_FAILED							TX_TRACE_SEMAPHORE_CREATE + PSF_EVENT_S1_OFFSET
349 #define PSF_EVENT_SEMAPHORE_CEILING_PUT_SUCCESS						TX_TRACE_SEMAPHORE_CEILING_PUT + PSF_EVENT_S1_OFFSET
350 #define PSF_EVENT_SEMAPHORE_CEILING_PUT_FAILED						TX_TRACE_SEMAPHORE_CEILING_PUT + PSF_EVENT_S2_OFFSET
351 #define PSF_EVENT_SEMAPHORE_CEILING_PUT_BLOCKED						TX_TRACE_SEMAPHORE_CEILING_PUT
352 #define PSF_EVENT_SEMAPHORE_DELETE_SUCCESS							TX_TRACE_SEMAPHORE_DELETE
353 #define PSF_EVENT_SEMAPHORE_DELETE_FAILED							TX_TRACE_SEMAPHORE_DELETE + PSF_EVENT_S1_OFFSET
354 #define PSF_EVENT_SEMAPHORE_GET_SUCCESS								TX_TRACE_SEMAPHORE_GET + PSF_EVENT_S2_OFFSET
355 #define PSF_EVENT_SEMAPHORE_GET_FAILED								TX_TRACE_SEMAPHORE_GET + PSF_EVENT_S3_OFFSET
356 #define PSF_EVENT_SEMAPHORE_GET_BLOCKED								TX_TRACE_SEMAPHORE_GET
357 #define PSF_EVENT_SEMAPHORE_GET_TIMEOUT								1083
358 #define PSF_EVENT_SEMAPHORE_INFO_GET_SUCCESS						TX_TRACE_SEMAPHORE_INFO_GET
359 #define PSF_EVENT_SEMAPHORE_INFO_GET_FAILED							TX_TRACE_SEMAPHORE_INFO_GET + PSF_EVENT_S1_OFFSET
360 #define PSF_EVENT_SEMAPHORE_PERFORMANCE_INFO_GET_SUCCESS			TX_TRACE_SEMAPHORE_PERFORMANCE_INFO_GET
361 #define PSF_EVENT_SEMAPHORE_PERFORMANCE_INFO_GET_FAILED				TX_TRACE_SEMAPHORE_PERFORMANCE_INFO_GET + PSF_EVENT_S1_OFFSET
362 #define PSF_EVENT_SEMAPHORE__PERFORMANCE_SYSTEM_INFO_GET_SUCCESS	TX_TRACE_SEMAPHORE__PERFORMANCE_SYSTEM_INFO_GET
363 #define PSF_EVENT_SEMAPHORE__PERFORMANCE_SYSTEM_INFO_GET_FAILED		TX_TRACE_SEMAPHORE__PERFORMANCE_SYSTEM_INFO_GET + PSF_EVENT_S1_OFFSET
364 #define PSF_EVENT_SEMAPHORE_PRIORITIZE_SUCCESS						TX_TRACE_SEMAPHORE_PRIORITIZE
365 #define PSF_EVENT_SEMAPHORE_PRIORITIZE_FAILED						TX_TRACE_SEMAPHORE_PRIORITIZE + PSF_EVENT_S1_OFFSET
366 #define PSF_EVENT_SEMAPHORE_PUT_NOTIFY_SUCCESS						TX_TRACE_SEMAPHORE_PUT_NOTIFY
367 #define PSF_EVENT_SEMAPHORE_PUT_NOTIFY_FAILED						TX_TRACE_SEMAPHORE_PUT_NOTIFY + PSF_EVENT_S1_OFFSET
368 #define PSF_EVENT_SEMAPHORE_PUT_SUCCESS								TX_TRACE_SEMAPHORE_PUT
369 #define PSF_EVENT_SEMAPHORE_PUT_FAILED								TX_TRACE_SEMAPHORE_PUT + PSF_EVENT_S1_OFFSET
370 
371 #define PSF_EVENT_THREAD_SYSTEM_RESUME_SUCCESS						1001
372 #define PSF_EVENT_THREAD_SYSTEM_SUSPEND_SUCCESS						1002
373 #define PSF_EVENT_THREAD_CREATE_SUCCESS								TX_TRACE_THREAD_CREATE
374 #define PSF_EVENT_THREAD_CREATE_FAILED								TX_TRACE_THREAD_DELETE + PSF_EVENT_S1_OFFSET
375 #define PSF_EVENT_THREAD_DELETE_SUCCESS								TX_TRACE_THREAD_DELETE
376 #define PSF_EVENT_THREAD_DELETE_FAILED								TX_TRACE_THREAD_DELETE + PSF_EVENT_S1_OFFSET
377 #define PSF_EVENT_THREAD_ENTRY_EXIT_NOTIFY_SUCCESS					TX_TRACE_THREAD_ENTRY_EXIT_NOTIFY
378 #define PSF_EVENT_THREAD_ENTRY_EXIT_NOTIFY_FAILED					TX_TRACE_THREAD_ENTRY_EXIT_NOTIFY + PSF_EVENT_S1_OFFSET
379 #define PSF_EVENT_THREAD_IDENTIFY									TX_TRACE_THREAD_IDENTIFY
380 #define PSF_EVENT_THREAD_INFO_GET_SUCCESS							TX_TRACE_THREAD_INFO_GET
381 #define PSF_EVENT_THREAD_INFO_GET_FAILED							TX_TRACE_THREAD_INFO_GET + PSF_EVENT_S1_OFFSET
382 #define PSF_EVENT_THREAD_PERFORMANCE_INFO_GET_SUCCESS				TX_TRACE_THREAD_PERFORMANCE_INFO_GET
383 #define PSF_EVENT_THREAD_PERFORMANCE_INFO_GET_FAILED				TX_TRACE_THREAD_PERFORMANCE_INFO_GET + PSF_EVENT_S1_OFFSET
384 #define PSF_EVENT_THREAD_PERFORMANCE_SYSTEM_INFO_GET_SUCCESS		TX_TRACE_THREAD_PERFORMANCE_SYSTEM_INFO_GET
385 #define PSF_EVENT_THREAD_PERFORMANCE_SYSTEM_INFO_GET_FAILED			TX_TRACE_THREAD_PERFORMANCE_SYSTEM_INFO_GET + PSF_EVENT_S1_OFFSET
386 #define PSF_EVENT_THREAD_PREEMPTION_CHANGE_SUCCESS					TX_TRACE_THREAD_PREEMPTION_CHANGE
387 #define PSF_EVENT_THREAD_PREEMPTION_CHANGE_FAILED					TX_TRACE_THREAD_PREEMPTION_CHANGE + PSF_EVENT_S1_OFFSET
388 #define PSF_EVENT_THREAD_PRIORITY_CHANGE_SUCCESS					TX_TRACE_THREAD_PRIORITY_CHANGE
389 #define PSF_EVENT_THREAD_PRIORITY_CHANGE_FAILED						TX_TRACE_THREAD_PRIORITY_CHANGE + PSF_EVENT_S1_OFFSET
390 #define PSF_EVENT_THREAD_RELINQUISH									TX_TRACE_THREAD_RELINQUISH
391 #define PSF_EVENT_THREAD_RESET_SUCCESS								TX_TRACE_THREAD_RESET
392 #define PSF_EVENT_THREAD_RESET_FAILED								TX_TRACE_THREAD_RESET + PSF_EVENT_S1_OFFSET
393 #define PSF_EVENT_THREAD_RESUME_SUCCESS								TX_TRACE_THREAD_RESUME_API
394 #define PSF_EVENT_THREAD_RESUME_FAILED								TX_TRACE_THREAD_RESUME_API + PSF_EVENT_S1_OFFSET
395 #define PSF_EVENT_THREAD_SLEEP_SUCCESS								TX_TRACE_THREAD_SLEEP
396 #define PSF_EVENT_THREAD_SLEEP_FAILED								TX_TRACE_THREAD_SLEEP + PSF_EVENT_S1_OFFSET
397 #define PSF_EVENT_THREAD_SLEEP_BLOCKED								TX_TRACE_THREAD_SLEEP + PSF_EVENT_S2_OFFSET
398 #define PSF_EVENT_THREAD_STACK_ERROR_NOTIFY							TX_TRACE_THREAD_STACK_ERROR_NOTIFY
399 #define PSF_EVENT_THREAD_SUSPEND_SUCCESS							TX_TRACE_THREAD_SUSPEND_API
400 #define PSF_EVENT_THREAD_SUSPEND_FAILED								TX_TRACE_THREAD_SUSPEND_API + PSF_EVENT_S1_OFFSET
401 #define PSF_EVENT_THREAD_TERMINATE_SUCCESS							TX_TRACE_THREAD_TERMINATE
402 #define PSF_EVENT_THREAD_TERMINATE_FAILED							TX_TRACE_THREAD_TERMINATE + PSF_EVENT_S1_OFFSET
403 #define PSF_EVENT_THREAD_TIME_SLICE									TX_TRACE_TIME_SLICE
404 #define PSF_EVENT_THREAD_TIME_SLICE_CHANGE_SUCCESS					TX_TRACE_THREAD_TIME_SLICE_CHANGE
405 #define PSF_EVENT_THREAD_TIME_SLICE_CHANGE_FAILED					TX_TRACE_THREAD_TIME_SLICE_CHANGE + PSF_EVENT_S1_OFFSET
406 #define PSF_EVENT_THREAD_WAIT_ABORT_SUCCESS							TX_TRACE_THREAD_WAIT_ABORT
407 #define PSF_EVENT_THREAD_WAIT_ABORT_FAILED							TX_TRACE_THREAD_WAIT_ABORT + PSF_EVENT_S1_OFFSET
408 
409 #define PSF_EVENT_TIME_GET_SUCCESS									TX_TRACE_TIME_GET
410 #define PSF_EVENT_TIME_SET_SUCCESS									TX_TRACE_TIME_SET
411 #define PSF_EVENT_TIMER_CREATE_SUCCESS								TX_TRACE_TIMER_CREATE
412 #define PSF_EVENT_TIMER_CREATE_FAILED								TX_TRACE_TIMER_CREATE + PSF_EVENT_S1_OFFSET
413 #define PSF_EVENT_TIMER_DELETE_SUCCESS								TX_TRACE_TIMER_DELETE
414 #define PSF_EVENT_TIMER_DELETE_FAILED								TX_TRACE_TIMER_DELETE + PSF_EVENT_S1_OFFSET
415 #define PSF_EVENT_TIMER_DEACTIVATE_SUCCESS							TX_TRACE_TIMER_DEACTIVATE
416 #define PSF_EVENT_TIMER_DEACTIVATE_FAILED							TX_TRACE_TIMER_DEACTIVATE + PSF_EVENT_S1_OFFSET
417 #define PSF_EVENT_TIMER_INFO_GET_SUCCESS							TX_TRACE_TIMER_INFO_GET
418 #define PSF_EVENT_TIMER_INFO_GET_FAILED								TX_TRACE_TIMER_INFO_GET + PSF_EVENT_S1_OFFSET
419 #define PSF_EVENT_TIMER_PERFORMANCE_INFO_GET_SUCCESS				TX_TRACE_TIMER_PERFORMANCE_INFO_GET
420 #define PSF_EVENT_TIMER_PERFORMANCE_INFO_GET_FAILED					TX_TRACE_TIMER_PERFORMANCE_INFO_GET + PSF_EVENT_S1_OFFSET
421 #define PSF_EVENT_TIMER_PERFORMANCE_SYSTEM_INFO_GET_SUCCESS			TX_TRACE_TIMER_PERFORMANCE_SYSTEM_INFO_GET
422 #define PSF_EVENT_TIMER_PERFORMANCE_SYSTEM_INFO_GET_FAILED			TX_TRACE_TIMER_PERFORMANCE_SYSTEM_INFO_GET + PSF_EVENT_S1_OFFSET
423 #define PSF_EVENT_TIMER_CHANGE_SUCCESS								TX_TRACE_TIMER_CHANGE
424 #define PSF_EVENT_TIMER_CHANGE_FAILED								TX_TRACE_TIMER_CHANGE + PSF_EVENT_S1_OFFSET
425 #define PSF_EVENT_TIMER_ACTIVATE_SUCCESS							TX_TRACE_TIMER_ACTIVATE
426 #define PSF_EVENT_TIMER_ACTIVATE_FAILED								TX_TRACE_TIMER_ACTIVATE + PSF_EVENT_S1_OFFSET
427 
428 #define PSF_EVENT_ISR_BEGIN											4010
429 #define PSF_EVENT_ISR_RESUME										4011
430 #define PSF_EVENT_TASK_ACTIVATE										4016
431 #define PSF_EVENT_TASK_POTENTIAL_SWITCH								4016
432 #define PSF_EVENT_TASK_POTENTIAL_SWITCH_RESULT						4017
433 #define PSF_EVENT_UNUSED_STACK										4020
434 #define PSF_EVENT_USER_EVENT										4030
435 #define TRC_EVENT_LAST_ID											4096
436 
437 /* Assign recorder defaults to match ThreadX mappings. */
438 #define PSF_EVENT_TASK_READY										PSF_EVENT_THREAD_SYSTEM_RESUME_SUCCESS
439 #define PSF_EVENT_TASK_CREATE										PSF_EVENT_THREAD_CREATE_SUCCESS
440 #define PSF_EVENT_TASK_PRIORITY										PSF_EVENT_THREAD_PRIORITY_CHANGE_SUCCESS
441 
442 extern volatile uint32_t uiTraceSystemState;
443 
444 #ifdef __cplusplus
445 }
446 #endif /* C++ */
447 
448 #endif /* TRC_KERNEL_PORT_H */
449