RT-Thread RTOS 1.2.0
An open source embedded real-time operating system
载入中...
搜索中...
未找到
cpu_up.c
浏览该文件的文档.
1/*
2 * Copyright (c) 2006-2024, RT-Thread Development Team
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Change Logs:
7 * Date Author Notes
8 * 2024-04-19 Shell Fixup UP irq spinlock
9 * 2024-05-22 Shell Add UP cpu object and
10 * maintain the rt_current_thread inside it
11 */
12#include <rthw.h>
13#include <rtthread.h>
14
15static struct rt_cpu _cpu;
16
23{
24 RT_UNUSED(lock);
25}
26
35void rt_spin_lock(struct rt_spinlock *lock)
36{
39}
40
46void rt_spin_unlock(struct rt_spinlock *lock)
47{
48 rt_base_t critical_level;
49 RT_SPIN_UNLOCK_DEBUG(lock, critical_level);
50 rt_exit_critical_safe(critical_level);
51}
52
64{
65 rt_base_t level;
66 RT_UNUSED(lock);
70 return level;
71}
72
81{
82 rt_base_t critical_level;
83 RT_SPIN_UNLOCK_DEBUG(lock, critical_level);
84 rt_exit_critical_safe(critical_level);
86}
87
93struct rt_cpu *rt_cpu_self(void)
94{
95 return &_cpu;
96}
97
105struct rt_cpu *rt_cpu_index(int index)
106{
107 return index == 0 ? &_cpu : RT_NULL;
108}
struct rt_cpu * rt_cpu_index(int index)
This fucntion will return the cpu object corresponding to index.
struct rt_cpu * rt_cpu_self(void)
This fucntion will return current cpu object.
rt_base_t rt_spin_lock_irqsave(struct rt_spinlock *lock)
This function will disable the local interrupt and then lock the spinlock, will lock the thread sched...
void rt_spin_lock(struct rt_spinlock *lock)
This function will lock the spinlock, will lock the thread scheduler.
void rt_spin_lock_init(struct rt_spinlock *lock)
Initialize a static spinlock object.
void rt_spin_unlock(struct rt_spinlock *lock)
This function will unlock the spinlock, will unlock the thread scheduler.
void rt_spin_unlock_irqrestore(struct rt_spinlock *lock, rt_base_t level)
This function will unlock the spinlock and then restore current cpu interrupt status,...
void rt_exit_critical_safe(rt_base_t critical_level)
rt_base_t rt_enter_critical(void)
This function will lock the thread scheduler.
#define RT_UNUSED(x)
void rt_hw_interrupt_enable(rt_base_t level)
rt_base_t rt_hw_interrupt_disable(void)
rt_int32_t rt_base_t
#define RT_SPIN_UNLOCK_DEBUG(lock, critical)
#define RT_SPIN_LOCK_DEBUG(lock)
#define RT_NULL