EZR32 Leopard Gecko Software Documentation  ezr32lg-doc-4.2.1
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 /***************************************************************************/
52 /*******************************************************************************
53  ************************** GLOBAL FUNCTIONS *******************************
54  ******************************************************************************/
55 
56 #if defined( GPIO_ROUTE_SWOPEN ) || defined( GPIO_ROUTEPEN_SWVPEN )
57 /***************************************************************************/
88 void DBG_SWOEnable(unsigned int location)
89 {
90  int port;
91  int pin;
92 
93  EFM_ASSERT(location < AFCHANLOC_MAX);
94 
95 #if defined ( AF_DBG_SWO_PORT )
96  port = AF_DBG_SWO_PORT(location);
97  pin = AF_DBG_SWO_PIN(location);
98 #elif defined (AF_DBG_SWV_PORT )
99  port = AF_DBG_SWV_PORT(location);
100  pin = AF_DBG_SWV_PIN(location);
101 #else
102 #warning "AF debug port is not defined."
103 #endif
104 
105  /* Port/pin location not defined for device? */
106  if ((pin < 0) || (port < 0))
107  {
108  EFM_ASSERT(0);
109  return;
110  }
111 
112  /* Ensure auxiliary clock going to the Cortex debug trace module is enabled */
114 
115  /* Set selected pin location for SWO pin and enable it */
116  GPIO_DbgLocationSet(location);
117  GPIO_DbgSWOEnable(true);
118 
119  /* Configure SWO pin for output */
121 }
122 #endif
123 
126 #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:88
Debug (DBG) API.
GPIO_Port_TypeDef
Definition: em_gpio.h:232
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:78
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:226
General Purpose IO (GPIO) peripheral API.
void CMU_OscillatorEnable(CMU_Osc_TypeDef osc, bool enable, bool wait)
Enable/disable oscillator.
Definition: em_cmu.c:3394
__STATIC_INLINE void GPIO_DbgSWOEnable(bool enable)
Enable/Disable serial wire output pin.
Definition: em_gpio.h:435