1
0

em_dbg.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /***************************************************************************//**
  2. * @file
  3. * @brief Debug (DBG) API
  4. * @author Energy Micro AS
  5. * @version 3.0.0
  6. *******************************************************************************
  7. * @section License
  8. * <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
  9. *******************************************************************************
  10. *
  11. * Permission is granted to anyone to use this software for any purpose,
  12. * including commercial applications, and to alter it and redistribute it
  13. * freely, subject to the following restrictions:
  14. *
  15. * 1. The origin of this software must not be misrepresented; you must not
  16. * claim that you wrote the original software.
  17. * 2. Altered source versions must be plainly marked as such, and must not be
  18. * misrepresented as being the original software.
  19. * 3. This notice may not be removed or altered from any source distribution.
  20. *
  21. * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
  22. * obligation to support this Software. Energy Micro AS is providing the
  23. * Software "AS IS", with no express or implied warranties of any kind,
  24. * including, but not limited to, any implied warranties of merchantability
  25. * or fitness for any particular purpose or warranties against infringement
  26. * of any proprietary rights of a third party.
  27. *
  28. * Energy Micro AS will not be liable for any consequential, incidental, or
  29. * special damages, or any other relief, or for any claim by any third party,
  30. * arising from your use of this Software.
  31. *
  32. ******************************************************************************/
  33. #ifndef __EM_DBG_H
  34. #define __EM_DBG_H
  35. #include <stdbool.h>
  36. #include "em_part.h"
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. /***************************************************************************//**
  41. * @addtogroup EM_Library
  42. * @{
  43. ******************************************************************************/
  44. /***************************************************************************//**
  45. * @addtogroup DBG
  46. * @{
  47. ******************************************************************************/
  48. /*******************************************************************************
  49. ***************************** PROTOTYPES **********************************
  50. ******************************************************************************/
  51. /***************************************************************************//**
  52. * @brief
  53. * Check if a debugger is connected (and debug session activated)
  54. *
  55. * @details
  56. * Used to make run-time decisions depending on whether a debug session
  57. * has been active since last reset, ie using a debug probe or similar. In
  58. * some cases special handling is required in that scenario.
  59. *
  60. * @return
  61. * true if a debug session is active since last reset, otherwise false.
  62. ******************************************************************************/
  63. __STATIC_INLINE bool DBG_Connected(void)
  64. {
  65. if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)
  66. {
  67. return true;
  68. }
  69. return false;
  70. }
  71. void DBG_SWOEnable(unsigned int location);
  72. /** @} (end addtogroup DBG) */
  73. /** @} (end addtogroup EM_Library) */
  74. #ifdef __cplusplus
  75. }
  76. #endif
  77. #endif /* __EM_DBG_H */