bsp_trace.h
Go to the documentation of this file.00001
00018 #ifndef __BSP_TRACE_H
00019 #define __BSP_TRACE_H
00020
00021 #include "em_device.h"
00022 #if (defined(BSP_ETM_TRACE) && defined( ETM_PRESENT )) || defined( GPIO_ROUTE_SWOPEN )
00023
00024 #include <stdint.h>
00025 #include <stdbool.h>
00026 #include "em_msc.h"
00027 #include "traceconfig.h"
00028
00029
00033
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041
00042 #if defined(BSP_ETM_TRACE) && defined( ETM_PRESENT )
00043 void BSP_TraceEtmSetup(void);
00044 #endif
00045
00046 #if defined( GPIO_ROUTE_SWOPEN )
00047 bool BSP_TraceProfilerSetup(void);
00048 void BSP_TraceSwoSetup(void);
00049 #endif
00050
00052 #define USER_PAGE 0x0FE00000UL
00053
00055
00062 __STATIC_INLINE void BSP_TraceProfilerEnable(bool enable)
00063 {
00064 uint32_t data;
00065 volatile uint32_t *userpage = (uint32_t *) USER_PAGE;
00066
00067
00068 data = *userpage;
00069 if (enable)
00070 {
00071 if (data == 0xFFFFFFFF)
00072 {
00073 return;
00074 }
00075 }
00076 else
00077 {
00078 if (data == 0x00000000)
00079 {
00080 return;
00081 }
00082 }
00083
00084
00085 MSC_Init();
00086
00087
00088 if (enable)
00089 {
00090 data = 0xFFFFFFFF;
00091 MSC_ErasePage((uint32_t *) USER_PAGE);
00092 MSC_WriteWord((uint32_t *) USER_PAGE, (void *) &data, 4);
00093 }
00094 else
00095 {
00096 data = 0x00000000;
00097 MSC_ErasePage((uint32_t *) USER_PAGE);
00098 MSC_WriteWord((uint32_t *) USER_PAGE, (void *) &data, 4);
00099 }
00100 }
00101
00102 #ifdef __cplusplus
00103 }
00104 #endif
00105
00109 #endif
00110 #endif