cpu.c 1003 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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-09-15 Bernard first version
  9. */
  10. #include <rthw.h>
  11. #include <rtthread.h>
  12. #include <board.h>
  13. /**
  14. * @addtogroup AM33xx
  15. */
  16. /*@{*/
  17. /** shutdown CPU */
  18. void rt_hw_cpu_shutdown()
  19. {
  20. rt_uint32_t level;
  21. rt_kprintf("shutdown...\n");
  22. level = rt_hw_interrupt_disable();
  23. while (level)
  24. {
  25. RT_ASSERT(0);
  26. }
  27. }
  28. #ifdef RT_USING_CPU_FFS
  29. /**
  30. * This function finds the first bit set (beginning with the least significant bit)
  31. * in value and return the index of that bit.
  32. *
  33. * Bits are numbered starting at 1 (the least significant bit). A return value of
  34. * zero from any of these functions means that the argument was zero.
  35. *
  36. * @return return the index of the first bit set. If value is 0, then this function
  37. * shall return 0.
  38. */
  39. int __rt_ffs(int value)
  40. {
  41. return __builtin_ffs(value);
  42. }
  43. #endif
  44. /*@}*/