/ * @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. *****************************************************************************/
| 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 |
nothing calls this directly
no test coverage detected