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