1 /***************************************************************************//**
\r
3 * @brief Debug (DBG) API
\r
5 *******************************************************************************
\r
7 * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
\r
8 *******************************************************************************
\r
10 * Permission is granted to anyone to use this software for any purpose,
\r
11 * including commercial applications, and to alter it and redistribute it
\r
12 * freely, subject to the following restrictions:
\r
14 * 1. The origin of this software must not be misrepresented; you must not
\r
15 * claim that you wrote the original software.
\r
16 * 2. Altered source versions must be plainly marked as such, and must not be
\r
17 * misrepresented as being the original software.
\r
18 * 3. This notice may not be removed or altered from any source distribution.
\r
20 * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
\r
21 * obligation to support this Software. Silicon Labs is providing the
\r
22 * Software "AS IS", with no express or implied warranties of any kind,
\r
23 * including, but not limited to, any implied warranties of merchantability
\r
24 * or fitness for any particular purpose or warranties against infringement
\r
25 * of any proprietary rights of a third party.
\r
27 * Silicon Labs will not be liable for any consequential, incidental, or
\r
28 * special damages, or any other relief, or for any claim by any third party,
\r
29 * arising from your use of this Software.
\r
31 ******************************************************************************/
\r
34 #ifndef __SILICON_LABS_EM_DBG_H_
\r
35 #define __SILICON_LABS_EM_DBG_H_
\r
37 #include <stdbool.h>
\r
38 #include "em_device.h"
\r
40 #if defined ( CoreDebug_DHCSR_C_DEBUGEN_Msk )
\r
46 /***************************************************************************//**
\r
47 * @addtogroup EM_Library
\r
49 ******************************************************************************/
\r
51 /***************************************************************************//**
\r
54 ******************************************************************************/
\r
56 /*******************************************************************************
\r
57 ***************************** PROTOTYPES **********************************
\r
58 ******************************************************************************/
\r
60 #if defined( GPIO_ROUTE_SWCLKPEN )
\r
61 /***************************************************************************//**
\r
63 * Check if a debugger is connected (and debug session activated)
\r
66 * Used to make run-time decisions depending on whether a debug session
\r
67 * has been active since last reset, ie using a debug probe or similar. In
\r
68 * some cases special handling is required in that scenario.
\r
71 * true if a debug session is active since last reset, otherwise false.
\r
72 ******************************************************************************/
\r
73 __STATIC_INLINE bool DBG_Connected(void)
\r
75 return ((CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) ? true : false);
\r
80 #if defined( GPIO_ROUTE_SWOPEN )
\r
81 void DBG_SWOEnable(unsigned int location);
\r
84 /** @} (end addtogroup DBG) */
\r
85 /** @} (end addtogroup EM_Library) */
\r
91 #endif /* defined ( CoreDebug_DHCSR_C_DEBUGEN_Msk ) */
\r
93 #endif /* __SILICON_LABS_EM_DBG_H_ */
\r