Skip to content

Commit 0c29bed

Browse files
HelloByeAllGuozhanxin
authored andcommitted
内核Kconfig增加AMP选项, api:rt_hw_cpu_id和 RT_USING_SMP宏解耦,增加rt_hw_ipi_send对RT_USING_AMP的依赖
1 parent 09ea44a commit 0c29bed

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

include/rthw.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,15 @@ void rt_hw_exception_install(rt_err_t (*exception_handle)(void *context));
160160
*/
161161
void rt_hw_us_delay(rt_uint32_t us);
162162

163+
int rt_hw_cpu_id(void);
164+
165+
#if defined(RT_USING_SMP) || defined(RT_USING_AMP)
166+
/**
167+
* ipi function
168+
*/
169+
void rt_hw_ipi_send(int ipi_vector, unsigned int cpu_mask);
170+
#endif
171+
163172
#ifdef RT_USING_SMP
164173
#include <cpuport.h> /* for spinlock from arch */
165174

@@ -172,8 +181,6 @@ void rt_hw_spin_lock_init(rt_hw_spinlock_t *lock);
172181
void rt_hw_spin_lock(rt_hw_spinlock_t *lock);
173182
void rt_hw_spin_unlock(rt_hw_spinlock_t *lock);
174183

175-
int rt_hw_cpu_id(void);
176-
177184
extern rt_hw_spinlock_t _cpus_lock;
178185
extern rt_hw_spinlock_t _rt_critical_lock;
179186

@@ -185,11 +192,6 @@ extern rt_hw_spinlock_t _rt_critical_lock;
185192
#define RT_DEFINE_SPINLOCK(x) rt_hw_spinlock_t x = __RT_HW_SPIN_LOCK_UNLOCKED(x)
186193
#define RT_DECLARE_SPINLOCK(x)
187194

188-
/**
189-
* ipi function
190-
*/
191-
void rt_hw_ipi_send(int ipi_vector, unsigned int cpu_mask);
192-
193195
/**
194196
* boot secondary cpu
195197
*/

src/Kconfig

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,22 @@ config RT_USING_SMART
3838
help
3939
RT-Thread Smart is a microkernel based operating system on RT-Thread.
4040

41+
config RT_USING_AMP
42+
bool "Enable AMP(Asymmetric Multi-Processing)"
43+
default n
44+
if RT_USING_AMP
45+
choice
46+
prompt "Select the AMP role"
47+
default RT_AMP_SLAVE
48+
49+
config RT_AMP_MASTER
50+
bool "amp role MASTER"
51+
52+
config RT_AMP_SLAVE
53+
bool "amp role SLAVE"
54+
endchoice
55+
endif
56+
4157
config RT_USING_SMP
4258
bool "Enable SMP(Symmetric multiprocessing)"
4359
default n
@@ -50,7 +66,7 @@ config RT_USING_SMP
5066
config RT_CPUS_NR
5167
int "Number of CPUs"
5268
default 2
53-
depends on RT_USING_SMP
69+
depends on RT_USING_SMP || RT_USING_AMP
5470
help
5571
Number of CPUs in the system
5672

0 commit comments

Comments
 (0)