1 /***************************************************************************
2 * Copyright (c) 2024 Microsoft Corporation
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the MIT License which is available at
6 * https://opensource.org/licenses/MIT.
7 *
8 * SPDX-License-Identifier: MIT
9 **************************************************************************/
10
11
12 /**************************************************************************/
13 /**************************************************************************/
14 /** */
15 /** ThreadX Component */
16 /** */
17 /** Trace */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22 #ifndef TX_SOURCE_CODE
23 #define TX_SOURCE_CODE
24 #endif
25
26
27 /* Include necessary system files. */
28
29 #include "tx_api.h"
30 #include "tx_trace.h"
31
32
33 /**************************************************************************/
34 /* */
35 /* FUNCTION RELEASE */
36 /* */
37 /* _tx_trace_buffer_full_notify PORTABLE C */
38 /* 6.1 */
39 /* AUTHOR */
40 /* */
41 /* William E. Lamie, Microsoft Corporation */
42 /* */
43 /* DESCRIPTION */
44 /* */
45 /* This function sets up the application callback function that is */
46 /* called whenever the trace buffer becomes full. The application */
47 /* can then swap to a new trace buffer in order not to lose any */
48 /* events. */
49 /* */
50 /* INPUT */
51 /* */
52 /* full_buffer_callback Full trace buffer processing */
53 /* function */
54 /* */
55 /* OUTPUT */
56 /* */
57 /* Completion Status */
58 /* */
59 /* CALLS */
60 /* */
61 /* None */
62 /* */
63 /* CALLED BY */
64 /* */
65 /* Application Code */
66 /* */
67 /* RELEASE HISTORY */
68 /* */
69 /* DATE NAME DESCRIPTION */
70 /* */
71 /* 05-19-2020 William E. Lamie Initial Version 6.0 */
72 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
73 /* resulting in version 6.1 */
74 /* */
75 /**************************************************************************/
_tx_trace_buffer_full_notify(VOID (* full_buffer_callback)(VOID * buffer))76 UINT _tx_trace_buffer_full_notify(VOID (*full_buffer_callback)(VOID *buffer))
77 {
78
79 #ifdef TX_ENABLE_EVENT_TRACE
80
81 /* Setup the callback function pointer. */
82 _tx_trace_full_notify_function = full_buffer_callback;
83
84 /* Return success. */
85 return(TX_SUCCESS);
86
87 #else
88
89 UINT status;
90
91
92 /* Access input arguments just for the sake of lint, MISRA, etc. */
93 if (full_buffer_callback != TX_NULL)
94 {
95
96 /* Trace not enabled, return an error. */
97 status = TX_FEATURE_NOT_ENABLED;
98 }
99 else
100 {
101
102 /* Trace not enabled, return an error. */
103 status = TX_FEATURE_NOT_ENABLED;
104 }
105
106 /* Return completion status. */
107 return(status);
108 #endif
109 }
110
111