|
20 | 20 | * stack. The library could be made unavailable by removing FEATURE_COMMON_PAL
|
21 | 21 | * from the mbed_app.json to save RAM.
|
22 | 22 | */
|
23 |
| -#if defined(FEATURE_COMMON_PAL) |
24 | 23 |
|
25 |
| - #include "platform/PlatformMutex.h" |
26 |
| - #include "mbed_trace.h" |
| 24 | +#include "mbed_trace.h" |
27 | 25 |
|
28 |
| - /** |
29 |
| - * Local mutex object for synchronization |
30 |
| - */ |
31 |
| - static PlatformMutex mutex; |
| 26 | +#ifdef FEA_TRACE_SUPPORT |
| 27 | +#include "platform/PlatformMutex.h" |
32 | 28 |
|
33 |
| - static void serial_lock(); |
34 |
| - static void serial_unlock(); |
| 29 | +/** |
| 30 | + * Local mutex object for synchronization |
| 31 | + */ |
| 32 | +static PlatformMutex mutex; |
35 | 33 |
|
36 |
| - /** |
37 |
| - * Sets up trace for the application |
38 |
| - * Wouldn't do anything if the FEATURE_COMMON_PAL is not added |
39 |
| - * or if the trace is disabled using mbed_app.json |
40 |
| - */ |
41 |
| - void setup_trace() |
42 |
| - { |
43 |
| - // setting up Mbed trace. |
44 |
| - mbed_trace_mutex_wait_function_set(serial_lock); |
45 |
| - mbed_trace_mutex_release_function_set(serial_unlock); |
46 |
| - mbed_trace_init(); |
47 |
| - } |
| 34 | +static void serial_lock(); |
| 35 | +static void serial_unlock(); |
48 | 36 |
|
49 |
| - /** |
50 |
| - * Lock provided for serial printing used by trace library |
51 |
| - */ |
52 |
| - static void serial_lock() |
53 |
| - { |
54 |
| - mutex.lock(); |
55 |
| - } |
| 37 | +/** |
| 38 | + * Sets up trace for the application |
| 39 | + * Wouldn't do anything if the FEATURE_COMMON_PAL is not added |
| 40 | + * or if the trace is disabled using mbed_app.json |
| 41 | + */ |
| 42 | +void setup_trace() |
| 43 | +{ |
| 44 | + // setting up Mbed trace. |
| 45 | + mbed_trace_mutex_wait_function_set(serial_lock); |
| 46 | + mbed_trace_mutex_release_function_set(serial_unlock); |
| 47 | + mbed_trace_init(); |
| 48 | +} |
56 | 49 |
|
57 |
| - /** |
58 |
| - * Releasing lock provided for serial printing used by trace library |
59 |
| - */ |
60 |
| - static void serial_unlock() |
61 |
| - { |
62 |
| - mutex.unlock(); |
63 |
| - } |
| 50 | +/** |
| 51 | + * Lock provided for serial printing used by trace library |
| 52 | + */ |
| 53 | +static void serial_lock() |
| 54 | +{ |
| 55 | + mutex.lock(); |
| 56 | +} |
64 | 57 |
|
| 58 | +/** |
| 59 | + * Releasing lock provided for serial printing used by trace library |
| 60 | + */ |
| 61 | +static void serial_unlock() |
| 62 | +{ |
| 63 | + mutex.unlock(); |
| 64 | +} |
65 | 65 | #else
|
| 66 | +void setup_trace() |
| 67 | +{ |
66 | 68 |
|
67 |
| - void setup_trace() |
68 |
| - { |
69 |
| - } |
70 |
| - |
| 69 | +} |
71 | 70 | #endif
|
72 | 71 |
|
| 72 | + |
0 commit comments