bsp_trace.h

Go to the documentation of this file.
00001 /**************************************************************************/
00035 #ifndef __BSP_TRACE_H
00036 #define __BSP_TRACE_H
00037 
00038 #include <stdint.h>
00039 #include <stdbool.h>
00040 #include "em_msc.h"
00041 #include "traceconfig.h"
00042 
00043 /***************************************************************************/
00047 /***************************************************************************/
00052 #ifdef __cplusplus
00053 extern "C" {
00054 #endif
00055 
00056 #if defined(BSP_ETM_TRACE) && defined( ETM_PRESENT )
00057 void BSP_TraceEtmSetup(void);
00058 #endif
00059 
00060 bool BSP_TraceProfilerSetup(void);
00061 void BSP_TraceSwoSetup(void);
00062 
00064 #define USER_PAGE    0x0FE00000UL /* Address to flash memory */
00065 
00067 /**************************************************************************/
00074 __STATIC_INLINE void BSP_TraceProfilerEnable(bool enable)
00075 {
00076   uint32_t          data;
00077   volatile uint32_t *userpage = (uint32_t *) USER_PAGE;
00078 
00079   /* Check that configuration needs to change */
00080   data = *userpage;
00081   if (enable)
00082   {
00083     if (data == 0xFFFFFFFF)
00084     {
00085       return;
00086     }
00087   }
00088   else
00089   {
00090     if (data == 0x00000000)
00091     {
00092       return;
00093     }
00094   }
00095 
00096   /* Initialize MSC */
00097   MSC_Init();
00098 
00099   /* Write enable or disable trigger word into flash */
00100   if (enable)
00101   {
00102     data = 0xFFFFFFFF;
00103     MSC_ErasePage((uint32_t *) USER_PAGE);
00104     MSC_WriteWord((uint32_t *) USER_PAGE, (void *) &data, 4);
00105   }
00106   else
00107   {
00108     data = 0x00000000;
00109     MSC_ErasePage((uint32_t *) USER_PAGE);
00110     MSC_WriteWord((uint32_t *) USER_PAGE, (void *) &data, 4);
00111   }
00112 }
00113 
00114 #ifdef __cplusplus
00115 }
00116 #endif
00117 
00121 #endif  /* __BSP_TRACE_H */