1
0

reset.c 991 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2011-01-13 weety modified from mini2440
  9. */
  10. #include <rthw.h>
  11. #include <rtthread.h>
  12. #include "at91sam926x.h"
  13. /**
  14. * @addtogroup AT91SAM926X
  15. */
  16. /*@{*/
  17. void machine_reset(void)
  18. {
  19. at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
  20. }
  21. void machine_shutdown(void)
  22. {
  23. at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW);
  24. }
  25. #ifdef RT_USING_FINSH
  26. #include <finsh.h>
  27. FINSH_FUNCTION_EXPORT_ALIAS(rt_hw_cpu_reset, reset, restart the system);
  28. #ifdef FINSH_USING_MSH
  29. int cmd_reset(int argc, char** argv)
  30. {
  31. rt_hw_cpu_reset();
  32. return 0;
  33. }
  34. MSH_CMD_EXPORT_ALIAS(cmd_reset, reset, restart the system);
  35. int cmd_shutdown(int argc, char** argv)
  36. {
  37. rt_hw_cpu_shutdown();
  38. return 0;
  39. }
  40. MSH_CMD_EXPORT_ALIAS(cmd_shutdown, shutdown, shutdown the system);
  41. #endif
  42. #endif
  43. /*@}*/