MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / TRACE_ProfilerEnable

Function TRACE_ProfilerEnable

bsp/efm32/EFM32GG_DK3750/trace.h:63–101  ·  view source on GitHub ↗

/ * @brief Set or clear word in user page which enables or disables SWO * for TRACE_ProfilerSetup. If TRACE_ProfilerEnable(false) has been run, * no example project will enable SWO trace. * @param[in] enable * @note Add "em_msc.c" to build to use this function. *****************************************************************************/

Source from the content-addressed store, hash-verified

61 * @note Add "em_msc.c" to build to use this function.
62 *****************************************************************************/
63__STATIC_INLINE void TRACE_ProfilerEnable(bool enable)
64{
65 uint32_t data;
66 volatile uint32_t *userpage = (uint32_t *) USER_PAGE;
67
68 /* Check that configuration needs to change */
69 data = *userpage;
70 if(enable)
71 {
72 if(data == 0xFFFFFFFF)
73 {
74 return;
75 }
76 }
77 else
78 {
79 if(data == 0x00000000)
80 {
81 return;
82 }
83 }
84
85 /* Initialize MSC */
86 MSC_Init();
87
88 /* Write enble or disable trigger word into flash */
89 if(enable)
90 {
91 data = 0xFFFFFFFF;
92 MSC_ErasePage((uint32_t *)USER_PAGE);
93 MSC_WriteWord((uint32_t *)USER_PAGE, (void *) &data, 4);
94 }
95 else
96 {
97 data = 0x00000000;
98 MSC_ErasePage((uint32_t *)USER_PAGE);
99 MSC_WriteWord((uint32_t *)USER_PAGE, (void *) &data, 4);
100 }
101}
102
103
104#ifdef __cplusplus

Callers

nothing calls this directly

Calls 3

MSC_InitFunction · 0.85
MSC_ErasePageFunction · 0.85
MSC_WriteWordFunction · 0.85

Tested by

no test coverage detected