HW_RESET_ATY.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * @file HW_RESET_ATY.c
  3. *
  4. * @param Project DEVICE_GENERAL_ATY_LIB
  5. *
  6. * @author ATY
  7. *
  8. * @copyright
  9. * - Copyright 2017 - 2025 MZ-ATY
  10. * - This code follows:
  11. * - MZ-ATY Various Contents Joint Statement -
  12. * <a href="https://mengze.top/MZ-ATY_VCJS">
  13. * https://mengze.top/MZ-ATY_VCJS</a>
  14. * - CC 4.0 BY-NC-SA -
  15. * <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
  16. * https://creativecommons.org/licenses/by-nc-sa/4.0/</a>
  17. * - Your use will be deemed to have accepted the terms of this statement.
  18. *
  19. * @brief Familiar functions of soft reset for CMSIS device
  20. *
  21. * @version
  22. * - 1_01_221029 > ATY
  23. * -# Preliminary version, first Release
  24. ********************************************************************************
  25. */
  26. #ifndef __HW_RESET_ATY_C
  27. #define __HW_RESET_ATY_C
  28. #include "HW_RESET_ATY.h"
  29. /******************************* For user *************************************/
  30. /******************************************************************************/
  31. /**
  32. * @brief reset chip
  33. */
  34. __WEAK_ATY void SoftReset(void)
  35. {
  36. #if defined (__STC51_ATY)
  37. IAP_CONTR |= 0x60; // @STCISP# Auto ISP Flash Download
  38. #elif defined(__HC32_ATY) || \
  39. defined(__STM32_SPL_ATY) || \
  40. defined(__STM32_HAL_ATY)|| \
  41. defined(__STM32_LL_ATY)
  42. // defined(__ICCARM__) ||
  43. // defined(__CC_ARM)
  44. // for all CMSIS devices
  45. __set_FAULTMASK(1); // close all IT
  46. __NVIC_SystemReset(); // reset
  47. #endif
  48. }
  49. #endif /* __HW_RESET_ATY_C */
  50. /******************************** End Of File *********************************/