提交 71311b73 编写于 作者: B Bernard Xiong

[Kernel] Fix the wrong indentation

上级 5cd65092
...@@ -20,7 +20,7 @@ config RT_USING_ARCH_DATA_TYPE ...@@ -20,7 +20,7 @@ config RT_USING_ARCH_DATA_TYPE
config RT_USING_SMP config RT_USING_SMP
bool "Enable SMP(Symmetric multiprocessing)" bool "Enable SMP(Symmetric multiprocessing)"
default n default n
help help
This option should be selected by machines which have an SMP- This option should be selected by machines which have an SMP-
capable CPU. capable CPU.
The only effect of this option is to make the SMP-related The only effect of this option is to make the SMP-related
...@@ -28,10 +28,10 @@ config RT_USING_SMP ...@@ -28,10 +28,10 @@ config RT_USING_SMP
config RT_CPUS_NR config RT_CPUS_NR
int "Number of CPUs" int "Number of CPUs"
default 2 default 2
depends on RT_USING_SMP depends on RT_USING_SMP
help help
Number of CPUs in the system Number of CPUs in the system
config RT_ALIGN_SIZE config RT_ALIGN_SIZE
int "Alignment size for CPU architecture data access" int "Alignment size for CPU architecture data access"
......
...@@ -7,9 +7,8 @@ ...@@ -7,9 +7,8 @@
* Date Author Notes * Date Author Notes
* 2018-10-30 Bernard The first version * 2018-10-30 Bernard The first version
*/ */
#include <rtthread.h>
#include <rthw.h> #include <rthw.h>
#include <rtthread.h>
#ifdef RT_USING_SMP #ifdef RT_USING_SMP
static struct rt_cpu rt_cpus[RT_CPUS_NR]; static struct rt_cpu rt_cpus[RT_CPUS_NR];
...@@ -20,24 +19,24 @@ rt_hw_spinlock_t _cpus_lock; ...@@ -20,24 +19,24 @@ rt_hw_spinlock_t _cpus_lock;
*/ */
static void rt_preempt_disable(void) static void rt_preempt_disable(void)
{ {
register rt_base_t level; register rt_base_t level;
struct rt_thread *current_thread; struct rt_thread *current_thread;
/* disable interrupt */ /* disable interrupt */
level = rt_hw_local_irq_disable(); level = rt_hw_local_irq_disable();
current_thread = rt_thread_self(); current_thread = rt_thread_self();
if (!current_thread) if (!current_thread)
{ {
rt_hw_local_irq_enable(level); rt_hw_local_irq_enable(level);
return; return;
} }
/* lock scheduler for local cpu */ /* lock scheduler for local cpu */
current_thread->scheduler_lock_nest ++; current_thread->scheduler_lock_nest ++;
/* enable interrupt */ /* enable interrupt */
rt_hw_local_irq_enable(level); rt_hw_local_irq_enable(level);
} }
/* /*
...@@ -45,66 +44,66 @@ static void rt_preempt_disable(void) ...@@ -45,66 +44,66 @@ static void rt_preempt_disable(void)
*/ */
static void rt_preempt_enable(void) static void rt_preempt_enable(void)
{ {
register rt_base_t level; register rt_base_t level;
struct rt_thread *current_thread; struct rt_thread *current_thread;
/* disable interrupt */ /* disable interrupt */
level = rt_hw_local_irq_disable(); level = rt_hw_local_irq_disable();
current_thread = rt_thread_self(); current_thread = rt_thread_self();
if (!current_thread) if (!current_thread)
{ {
rt_hw_local_irq_enable(level); rt_hw_local_irq_enable(level);
return; return;
} }
/* unlock scheduler for local cpu */ /* unlock scheduler for local cpu */
current_thread->scheduler_lock_nest --; current_thread->scheduler_lock_nest --;
rt_schedule(); rt_schedule();
/* enable interrupt */ /* enable interrupt */
rt_hw_local_irq_enable(level); rt_hw_local_irq_enable(level);
} }
void rt_spin_lock_init(struct rt_spinlock *lock) void rt_spin_lock_init(struct rt_spinlock *lock)
{ {
rt_hw_spin_lock_init(&lock->lock); rt_hw_spin_lock_init(&lock->lock);
} }
RTM_EXPORT(rt_spin_lock_init) RTM_EXPORT(rt_spin_lock_init)
void rt_spin_lock(struct rt_spinlock *lock) void rt_spin_lock(struct rt_spinlock *lock)
{ {
rt_preempt_disable(); rt_preempt_disable();
rt_hw_spin_lock(&lock->lock); rt_hw_spin_lock(&lock->lock);
} }
RTM_EXPORT(rt_spin_lock) RTM_EXPORT(rt_spin_lock)
void rt_spin_unlock(struct rt_spinlock *lock) void rt_spin_unlock(struct rt_spinlock *lock)
{ {
rt_hw_spin_unlock(&lock->lock); rt_hw_spin_unlock(&lock->lock);
rt_preempt_enable(); rt_preempt_enable();
} }
RTM_EXPORT(rt_spin_unlock) RTM_EXPORT(rt_spin_unlock)
rt_base_t rt_spin_lock_irqsave(struct rt_spinlock *lock) rt_base_t rt_spin_lock_irqsave(struct rt_spinlock *lock)
{ {
unsigned long level; unsigned long level;
rt_preempt_disable(); rt_preempt_disable();
level = rt_hw_local_irq_disable(); level = rt_hw_local_irq_disable();
rt_hw_spin_lock(&lock->lock); rt_hw_spin_lock(&lock->lock);
return level; return level;
} }
RTM_EXPORT(rt_spin_lock_irqsave) RTM_EXPORT(rt_spin_lock_irqsave)
void rt_spin_unlock_irqrestore(struct rt_spinlock *lock, rt_base_t level) void rt_spin_unlock_irqrestore(struct rt_spinlock *lock, rt_base_t level)
{ {
rt_hw_spin_unlock(&lock->lock); rt_hw_spin_unlock(&lock->lock);
rt_hw_local_irq_enable(level); rt_hw_local_irq_enable(level);
rt_preempt_enable(); rt_preempt_enable();
} }
RTM_EXPORT(rt_spin_unlock_irqrestore) RTM_EXPORT(rt_spin_unlock_irqrestore)
......
...@@ -83,7 +83,7 @@ static void _rt_scheduler_stack_check(struct rt_thread *thread) ...@@ -83,7 +83,7 @@ static void _rt_scheduler_stack_check(struct rt_thread *thread)
RT_ASSERT(thread != RT_NULL); RT_ASSERT(thread != RT_NULL);
#if defined(ARCH_CPU_STACK_GROWS_UPWARD) #if defined(ARCH_CPU_STACK_GROWS_UPWARD)
if (*((rt_uint8_t *)((rt_ubase_t)thread->stack_addr + thread->stack_size - 1)) != '#' || if (*((rt_uint8_t *)((rt_ubase_t)thread->stack_addr + thread->stack_size - 1)) != '#' ||
#else #else
if (*((rt_uint8_t *)thread->stack_addr) != '#' || if (*((rt_uint8_t *)thread->stack_addr) != '#' ||
#endif #endif
...@@ -958,7 +958,7 @@ rt_uint16_t rt_critical_level(void) ...@@ -958,7 +958,7 @@ rt_uint16_t rt_critical_level(void)
return current_thread->critical_lock_nest; return current_thread->critical_lock_nest;
#else #else
return rt_scheduler_lock_nest; return rt_scheduler_lock_nest;
#endif /*RT_USING_SMP*/ #endif /*RT_USING_SMP*/
} }
RTM_EXPORT(rt_critical_level); RTM_EXPORT(rt_critical_level);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册