1
0

at32f413_debug.c 2.7 KB

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