Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Keyboard Man_俊
rt-thread
提交
eff767a0
R
rt-thread
项目概览
Keyboard Man_俊
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
eff767a0
编写于
12月 17, 2018
作者:
S
shaojinchun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove rt_hw_mb define
sync smp skeleton
上级
f5426f4a
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
97 addition
and
107 deletion
+97
-107
bsp/qemu-vexpress-a9/cpu/cpu.c
bsp/qemu-vexpress-a9/cpu/cpu.c
+0
-51
bsp/qemu-vexpress-a9/cpu/cpuport.c
bsp/qemu-vexpress-a9/cpu/cpuport.c
+89
-0
bsp/qemu-vexpress-a9/drivers/board.c
bsp/qemu-vexpress-a9/drivers/board.c
+4
-50
include/rtdef.h
include/rtdef.h
+2
-2
include/rthw.h
include/rthw.h
+0
-2
src/scheduler.c
src/scheduler.c
+2
-2
未找到文件。
bsp/qemu-vexpress-a9/cpu/cpu.c
已删除
100644 → 0
浏览文件 @
f5426f4a
/*
* File : cpu.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Develop Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2011-09-15 Bernard first version
* 2018-11-22 Jesven add rt_hw_cpu_id()
*/
#include <rthw.h>
#include <rtthread.h>
#include <board.h>
#ifdef RT_USING_SMP
int
rt_hw_cpu_id
(
void
)
{
int
cpu_id
;
__asm__
volatile
(
"mrc p15, 0, %0, c0, c0, 5"
:
"=r"
(
cpu_id
)
);
cpu_id
&=
0xf
;
return
cpu_id
;
};
#endif
/**
* @addtogroup ARM CPU
*/
/*@{*/
/** shutdown CPU */
void
rt_hw_cpu_shutdown
()
{
rt_uint32_t
level
;
rt_kprintf
(
"shutdown...
\n
"
);
level
=
rt_hw_interrupt_disable
();
while
(
level
)
{
RT_ASSERT
(
0
);
}
}
/*@}*/
bsp/qemu-vexpress-a9/cpu/cpuport.c
0 → 100644
浏览文件 @
eff767a0
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2011-09-15 Bernard first version
* 2018-11-22 Jesven add rt_hw_cpu_id()
*/
#include <rthw.h>
#include <rtthread.h>
#include <board.h>
#ifdef RT_USING_SMP
int
rt_hw_cpu_id
(
void
)
{
int
cpu_id
;
__asm__
volatile
(
"mrc p15, 0, %0, c0, c0, 5"
:
"=r"
(
cpu_id
)
);
cpu_id
&=
0xf
;
return
cpu_id
;
};
void
rt_hw_spin_lock
(
rt_hw_spinlock_t
*
lock
)
{
unsigned
long
tmp
;
unsigned
long
newval
;
rt_hw_spinlock_t
lockval
;
__asm__
__volatile__
(
"pld [%0]"
::
"r"
(
&
lock
->
slock
)
);
__asm__
__volatile__
(
"1: ldrex %0, [%3]
\n
"
" add %1, %0, %4
\n
"
" strex %2, %1, [%3]
\n
"
" teq %2, #0
\n
"
" bne 1b"
:
"=&r"
(
lockval
),
"=&r"
(
newval
),
"=&r"
(
tmp
)
:
"r"
(
&
lock
->
slock
),
"I"
(
1
<<
16
)
:
"cc"
);
while
(
lockval
.
tickets
.
next
!=
lockval
.
tickets
.
owner
)
{
__asm__
__volatile__
(
"wfe"
:::
"memory"
);
lockval
.
tickets
.
owner
=
*
(
volatile
unsigned
short
*
)(
&
lock
->
tickets
.
owner
);
}
__asm__
volatile
(
"dmb"
:::
"memory"
);
}
void
rt_hw_spin_unlock
(
rt_hw_spinlock_t
*
lock
)
{
__asm__
volatile
(
"dmb"
:::
"memory"
);
lock
->
tickets
.
owner
++
;
__asm__
volatile
(
"dsb ishst
\n
sev"
:::
"memory"
);
}
#endif
/*RT_USING_SMP*/
void
idle_wfi
(
void
)
{
asm
volatile
(
"wfi"
);
}
/**
* @addtogroup ARM CPU
*/
/*@{*/
/** shutdown CPU */
void
rt_hw_cpu_shutdown
()
{
rt_uint32_t
level
;
rt_kprintf
(
"shutdown...
\n
"
);
level
=
rt_hw_interrupt_disable
();
while
(
level
)
{
RT_ASSERT
(
0
);
}
}
/*@}*/
bsp/qemu-vexpress-a9/drivers/board.c
浏览文件 @
eff767a0
...
...
@@ -19,10 +19,8 @@
#define SYS_CTRL __REG32(REALVIEW_SCTL_BASE)
void
idle_wfi
(
void
)
{
asm
volatile
(
"wfi"
);
}
extern
void
idle_wfi
(
void
);
extern
void
rt_hw_ipi_handler_install
(
int
ipi_vector
,
rt_isr_handler_t
ipi_isr_handler
);
/**
* This function will initialize beaglebone board
...
...
@@ -40,52 +38,8 @@ void rt_hw_board_init(void)
rt_thread_idle_sethook
(
idle_wfi
);
#ifdef RT_USING_SMP
/* install IPI interrupt */
rt_hw_interrupt_install
(
RT_SCHEDULE_IPI_IRQ
,
rt_scheduler_ipi_handler
,
RT_NULL
,
"ipi"
);
rt_hw_interrupt_umask
(
RT_SCHEDULE_IPI_IRQ
);
/* install IPI handle */
rt_hw_ipi_handler_install
(
RT_SCHEDULE_IPI
,
rt_scheduler_ipi_handler
);
#endif
}
#ifdef RT_USING_SMP
void
rt_hw_spin_lock
(
rt_hw_spinlock_t
*
lock
)
{
unsigned
long
tmp
;
unsigned
long
newval
;
rt_hw_spinlock_t
lockval
;
__asm__
__volatile__
(
"pld [%0]"
::
"r"
(
&
lock
->
slock
)
);
__asm__
__volatile__
(
"1: ldrex %0, [%3]
\n
"
" add %1, %0, %4
\n
"
" strex %2, %1, [%3]
\n
"
" teq %2, #0
\n
"
" bne 1b"
:
"=&r"
(
lockval
),
"=&r"
(
newval
),
"=&r"
(
tmp
)
:
"r"
(
&
lock
->
slock
),
"I"
(
1
<<
16
)
:
"cc"
);
while
(
lockval
.
tickets
.
next
!=
lockval
.
tickets
.
owner
)
{
__asm__
__volatile__
(
"wfe"
:::
"memory"
);
lockval
.
tickets
.
owner
=
*
(
volatile
unsigned
short
*
)(
&
lock
->
tickets
.
owner
);
}
__asm__
volatile
(
"dmb"
:::
"memory"
);
}
void
rt_hw_spin_unlock
(
rt_hw_spinlock_t
*
lock
)
{
__asm__
volatile
(
"dmb"
:::
"memory"
);
lock
->
tickets
.
owner
++
;
__asm__
volatile
(
"dsb ishst
\n
sev"
:::
"memory"
);
}
void
rt_hw_mb
(
void
)
{
__asm__
volatile
(
"dmb"
:::
"memory"
);
}
#endif
/*RT_USING_SMP*/
include/rtdef.h
浏览文件 @
eff767a0
...
...
@@ -507,8 +507,8 @@ typedef siginfo_t rt_siginfo_t;
#define RT_CPU_DETACHED RT_CPUS_NR
/**< The thread not running on cpu. */
#define RT_CPU_MASK ((1 << RT_CPUS_NR) - 1)
/**< All CPUs mask bit. */
#ifndef RT_SCHEDULE_IPI
_IRQ
#define RT_SCHEDULE_IPI
_IRQ
0
#ifndef RT_SCHEDULE_IPI
#define RT_SCHEDULE_IPI
0
#endif
/**
...
...
include/rthw.h
浏览文件 @
eff767a0
...
...
@@ -146,8 +146,6 @@ typedef union {
void
rt_hw_spin_lock
(
rt_hw_spinlock_t
*
lock
);
void
rt_hw_spin_unlock
(
rt_hw_spinlock_t
*
lock
);
void
rt_hw_mb
(
void
);
int
rt_hw_cpu_id
(
void
);
extern
rt_hw_spinlock_t
_cpus_lock
;
...
...
src/scheduler.c
浏览文件 @
eff767a0
...
...
@@ -600,7 +600,7 @@ void rt_schedule_insert_thread(struct rt_thread *thread)
rt_list_insert_before
(
&
(
rt_thread_priority_table
[
thread
->
current_priority
]),
&
(
thread
->
tlist
));
cpu_mask
=
RT_CPU_MASK
^
(
1
<<
cpu_id
);
rt_hw_ipi_send
(
RT_SCHEDULE_IPI
_IRQ
,
cpu_mask
);
rt_hw_ipi_send
(
RT_SCHEDULE_IPI
,
cpu_mask
);
}
else
{
...
...
@@ -617,7 +617,7 @@ void rt_schedule_insert_thread(struct rt_thread *thread)
if
(
cpu_id
!=
bind_cpu
)
{
cpu_mask
=
1
<<
bind_cpu
;
rt_hw_ipi_send
(
RT_SCHEDULE_IPI
_IRQ
,
cpu_mask
);
rt_hw_ipi_send
(
RT_SCHEDULE_IPI
,
cpu_mask
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录