at32f425_debug.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /**
  2. **************************************************************************
  3. * @file at32f425_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 "at32f425_conf.h"
  25. /** @addtogroup AT32F425_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. uint16_t debug_device_id_get(void)
  42. {
  43. return (uint16_t)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_CAN_PAUSE
  53. * - DEBUG_WDT_PAUSE
  54. * - DEBUG_WWDT_PAUSE
  55. * - DEBUG_TMR1_PAUSE
  56. * - DEBUG_TMR2_PAUSE
  57. * - DEBUG_TMR3_PAUSE
  58. * - DEBUG_ERTC_PAUSE
  59. * - DEBUG_I2C1_SMBUS_TIMEOUT
  60. * - DEBUG_I2C2_SMBUS_TIMEOUT
  61. * - DEBUG_TMR6_PAUSE
  62. * - DEBUG_TMR7_PAUSE
  63. * - DEBUG_ERTC_512_PAUSE
  64. * - DEBUG_TMR15_PAUSE
  65. * - DEBUG_TMR16_PAUSE
  66. * - DEBUG_TMR17_PAUSE
  67. * - DEBUG_TMR13_PAUSE
  68. * - DEBUG_TMR14_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. */