at32f413_debug.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /**
  2. **************************************************************************
  3. * @file at32f413_debug.c
  4. * @brief contains all the functions for the debug firmware library
  5. **************************************************************************
  6. * Copyright notice & Disclaimer
  7. *
  8. * The software Board Support Package (BSP) that is made available to
  9. * download from Artery official website is the copyrighted work of Artery.
  10. * Artery authorizes customers to use, copy, and distribute the BSP
  11. * software and its related documentation for the purpose of design and
  12. * development in conjunction with Artery microcontrollers. Use of the
  13. * software is governed by this copyright notice and the following disclaimer.
  14. *
  15. * THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
  16. * GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
  17. * TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
  18. * STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
  19. * INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
  21. *
  22. **************************************************************************
  23. */
  24. #include "at32f413_conf.h"
  25. /** @addtogroup AT32F413_periph_driver
  26. * @{
  27. */
  28. /** @defgroup DEBUG
  29. * @brief DEBUG driver modules
  30. * @{
  31. */
  32. #ifdef DEBUG_MODULE_ENABLED
  33. /** @defgroup DEBUG_private_functions
  34. * @{
  35. */
  36. /**
  37. * @brief get debug device id
  38. * @param none
  39. * @retval the debug device id
  40. */
  41. uint32_t debug_device_id_get(void)
  42. {
  43. return DEBUGMCU->pid;
  44. }
  45. /**
  46. * @brief set periph debug mode
  47. * @param periph_debug_mode
  48. * this parameter can be any combination of the following values:
  49. * - DEBUG_SLEEP
  50. * - DEBUG_DEEPSLEEP
  51. * - DEBUG_STANDBY
  52. * - DEBUG_WDT_PAUSE
  53. * - DEBUG_WWDT_PAUSE
  54. * - DEBUG_TMR1_PAUSE
  55. * - DEBUG_TMR2_PAUSE
  56. * - DEBUG_TMR3_PAUSE
  57. * - DEBUG_TMR4_PAUSE
  58. * - DEBUG_CAN1_PAUSE
  59. * - DEBUG_I2C1_SMBUS_TIMEOUT
  60. * - DEBUG_I2C2_SMBUS_TIMEOUT
  61. * - DEBUG_TMR8_PAUSE
  62. * - DEBUG_TMR5_PAUSE
  63. * - DEBUG_CAN2_PAUSE
  64. * - DEBUG_TMR9_PAUSE
  65. * - DEBUG_TMR10_PAUSE
  66. * - DEBUG_TMR11_PAUSE
  67. * @param new_state (TRUE or FALSE)
  68. * @retval none
  69. */
  70. void debug_periph_mode_set(uint32_t periph_debug_mode, confirm_state new_state)
  71. {
  72. if(new_state != FALSE)
  73. {
  74. DEBUGMCU->ctrl |= periph_debug_mode;
  75. }
  76. else
  77. {
  78. DEBUGMCU->ctrl &= ~periph_debug_mode;
  79. }
  80. }
  81. /**
  82. * @}
  83. */
  84. #endif
  85. /**
  86. * @}
  87. */
  88. /**
  89. * @}
  90. */