at32f403a_407_debug.c 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /**
  2. **************************************************************************
  3. * @file at32f403a_407_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 "at32f403a_407_conf.h"
  25. /** @addtogroup AT32F403A_407_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 - DEBUG_DEEPSLEEP
  50. * - DEBUG_STANDBY - DEBUG_WDT_PAUSE
  51. * - DEBUG_WWDT_PAUSE - DEBUG_TMR1_PAUSE
  52. * - DEBUG_TMR3_PAUSE - DEBUG_I2C1_SMBUS_TIMEOUT
  53. * - DEBUG_I2C2_SMBUS_TIMEOUT - DEBUG_I2C3_SMBUS_TIMEOUT
  54. * - DEBUG_TMR2_PAUSE - DEBUG_TMR4_PAUSE
  55. * - DEBUG_CAN1_PAUSE - DEBUG_TMR8_PAUSE
  56. * - DEBUG_TMR5_PAUSE - DEBUG_TMR6_PAUSE
  57. * - DEBUG_TMR7_PAUSE - DEBUG_CAN2_PAUSE
  58. * - DEBUG_TMR12_PAUSE - DEBUG_TMR13_PAUSE
  59. * - DEBUG_TMR14_PAUSE - DEBUG_TMR9_PAUSE
  60. * - DEBUG_TMR10_PAUSE - DEBUG_TMR11_PAUSE
  61. * @param new_state (TRUE or FALSE)
  62. * @retval none
  63. */
  64. void debug_periph_mode_set(uint32_t periph_debug_mode, confirm_state new_state)
  65. {
  66. if(new_state != FALSE)
  67. {
  68. DEBUGMCU->ctrl |= periph_debug_mode;
  69. }
  70. else
  71. {
  72. DEBUGMCU->ctrl &= ~periph_debug_mode;
  73. }
  74. }
  75. /**
  76. * @}
  77. */
  78. #endif
  79. /**
  80. * @}
  81. */
  82. /**
  83. * @}
  84. */