ft2004_cpu.S 673 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. * 2021-04-29 Carl the first version
  9. *
  10. */
  11. #include "rtconfig.h"
  12. .globl rt_hw_cpu_id
  13. rt_hw_cpu_id:
  14. mrc p15, 0, r0, c0, c0, 5
  15. ubfx r0, r0, #0, #12
  16. cmp r0, #0
  17. beq core0
  18. cmp r0, #1
  19. beq core1
  20. cmp r0, #256
  21. beq core2
  22. ldr r1,= #257
  23. cmp r0, r1
  24. beq core3
  25. b default
  26. core0:
  27. mov r0, #0
  28. b return
  29. core1:
  30. mov r0, #1
  31. b return
  32. core2:
  33. mov r0, #2
  34. b return
  35. core3:
  36. mov r0, #3
  37. b return
  38. default:
  39. and r0, r0, #15
  40. return:
  41. bx lr