1 /**************************************************************************//**
\r
3 * @brief SWO Trace API (for eAProfiler)
\r
5 ******************************************************************************
\r
7 * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
\r
8 *******************************************************************************
\r
10 * This file is licensed under the Silabs License Agreement. See the file
\r
11 * "Silabs_License_Agreement.txt" for details. Before using this software for
\r
12 * any purpose, you must agree to the terms of that agreement.
\r
14 ******************************************************************************/
\r
16 #ifndef __BSP_TRACE_H
\r
17 #define __BSP_TRACE_H
\r
19 #include "em_device.h"
\r
20 #if (defined( BSP_ETM_TRACE ) && defined( ETM_PRESENT )) || \
\r
21 defined( GPIO_ROUTE_SWOPEN ) || \
\r
22 defined( GPIO_ROUTEPEN_SWVPEN )
\r
25 #include <stdbool.h>
\r
27 #include "traceconfig.h"
\r
29 /***************************************************************************//**
\r
32 ******************************************************************************/
\r
33 /***************************************************************************//**
\r
34 * @addtogroup BSPCOMMON API common for all kits
\r
36 ******************************************************************************/
\r
42 #if defined(BSP_ETM_TRACE) && defined( ETM_PRESENT )
\r
43 void BSP_TraceEtmSetup(void);
\r
46 #if defined( GPIO_ROUTE_SWOPEN ) || defined( _GPIO_ROUTEPEN_SWVPEN_MASK )
\r
47 bool BSP_TraceProfilerSetup(void);
\r
48 void BSP_TraceSwoSetup(void);
\r
51 /** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */
\r
52 #define USER_PAGE 0x0FE00000UL /* Address to flash memory */
\r
55 /**************************************************************************//**
\r
56 * @brief Set or clear word in user page which enables or disables SWO
\r
57 * in BSP_TraceProfilerSetup. If BSP_TraceProfilerEnable(false) has been run,
\r
58 * no example project will enable SWO trace.
\r
60 * @note Add "em_msc.c" to build to use this function.
\r
61 *****************************************************************************/
\r
62 __STATIC_INLINE void BSP_TraceProfilerEnable(bool enable)
\r
65 volatile uint32_t *userpage = (uint32_t *) USER_PAGE;
\r
67 /* Check that configuration needs to change */
\r
71 if (data == 0xFFFFFFFF)
\r
78 if (data == 0x00000000)
\r
84 /* Initialize MSC */
\r
87 /* Write enable or disable trigger word into flash */
\r
91 MSC_ErasePage((uint32_t *) USER_PAGE);
\r
92 MSC_WriteWord((uint32_t *) USER_PAGE, (void *) &data, 4);
\r
97 MSC_ErasePage((uint32_t *) USER_PAGE);
\r
98 MSC_WriteWord((uint32_t *) USER_PAGE, (void *) &data, 4);
\r
106 /** @} (end group BSP) */
\r
107 /** @} (end group BSP) */
\r
109 #endif /* (defined(BSP_ETM_TRACE) && defined( ETM_PRESENT )) || defined( GPIO_ROUTE_SWOPEN ) */
\r
110 #endif /* __BSP_TRACE_H */
\r