secondary_cpu.c 789 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. */
  9. #include <rthw.h>
  10. #include <rtthread.h>
  11. #include <cpu.h>
  12. #include "gic.h"
  13. #include "interrupt.h"
  14. #include "mmu.h"
  15. #include "gtimer.h"
  16. #ifdef BSP_USING_GICV3
  17. #include <gicv3.h>
  18. #endif
  19. #ifdef RT_USING_SMP
  20. extern unsigned long MMUTable[];
  21. void rt_hw_secondary_cpu_bsp_start(void)
  22. {
  23. rt_hw_spin_lock(&_cpus_lock);
  24. rt_hw_mmu_ktbl_set((unsigned long)MMUTable);
  25. // interrupt init
  26. rt_hw_vector_init();
  27. arm_gic_cpu_init(0, 0);
  28. #ifdef BSP_USING_GICV3
  29. arm_gic_redist_init(0, 0);
  30. #endif /* BSP_USING_GICV3 */
  31. // local timer init
  32. rt_hw_gtimer_init();
  33. rt_system_scheduler_start();
  34. }
  35. #endif // SMP