EFM32 Giant Gecko Software Documentation  efm32gg-doc-5.1.2
em_dbg.c
Go to the documentation of this file.
1 /***************************************************************************/
33 #include "em_dbg.h"
34 
35 #if defined( CoreDebug_DHCSR_C_DEBUGEN_Msk )
36 
37 #include "em_assert.h"
38 #include "em_cmu.h"
39 #include "em_gpio.h"
40 
41 /***************************************************************************/
46 /***************************************************************************/
56 /*******************************************************************************
57  ************************** GLOBAL FUNCTIONS *******************************
58  ******************************************************************************/
59 
60 #if defined( GPIO_ROUTE_SWOPEN ) || defined( GPIO_ROUTEPEN_SWVPEN )
61 /***************************************************************************/
92 void DBG_SWOEnable(unsigned int location)
93 {
94  int port;
95  int pin;
96 
97  EFM_ASSERT(location < AFCHANLOC_MAX);
98 
99 #if defined ( AF_DBG_SWO_PORT )
100  port = AF_DBG_SWO_PORT(location);
101  pin = AF_DBG_SWO_PIN(location);
102 #elif defined (AF_DBG_SWV_PORT )
103  port = AF_DBG_SWV_PORT(location);
104  pin = AF_DBG_SWV_PIN(location);
105 #else
106 #warning "AF debug port is not defined."
107 #endif
108 
109  /* Port/pin location not defined for device? */
110  if ((pin < 0) || (port < 0))
111  {
112  EFM_ASSERT(0);
113  return;
114  }
115 
116  /* Ensure auxiliary clock going to the Cortex debug trace module is enabled */
118 
119  /* Set selected pin location for SWO pin and enable it */
120  GPIO_DbgLocationSet(location);
121  GPIO_DbgSWOEnable(true);
122 
123  /* Configure SWO pin for output */
125 }
126 #endif
127 
130 #endif /* defined( CoreDebug_DHCSR_C_DEBUGEN_Msk ) */
Clock management unit (CMU) API.
void DBG_SWOEnable(unsigned int location)
Enable Serial Wire Output (SWO) pin.
Definition: em_dbg.c:92
Debug (DBG) API.
GPIO_Port_TypeDef
Definition: em_gpio.h:345
Emlib peripheral API "assert" implementation.
void GPIO_DbgLocationSet(unsigned int location)
Sets the pin location of the debug pins (Serial Wire interface).
Definition: em_gpio.c:83
void GPIO_PinModeSet(GPIO_Port_TypeDef port, unsigned int pin, GPIO_Mode_TypeDef mode, unsigned int out)
Set the mode for a GPIO pin.
Definition: em_gpio.c:269
General Purpose IO (GPIO) peripheral API.
void CMU_OscillatorEnable(CMU_Osc_TypeDef osc, bool enable, bool wait)
Enable/disable oscillator.
Definition: em_cmu.c:3594
__STATIC_INLINE void GPIO_DbgSWOEnable(bool enable)
Enable/Disable serial wire output pin.
Definition: em_gpio.h:541