1 Star 0 Fork 1

swunzg/rtos

forked from erickhuang/rtos 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
os_chip.c 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
erickhuang 提交于 2017-07-15 19:24 . first commit
#include "os.h"
#define OS_INT_ENABLE()
#define OS_INT_DISABLE()
static U16 int_cnt = 0;
#define VAL_XPSR 0
void os_stackreg_init(OS_StackReg *pStack, TASK_FUNC func)
{
pStack->XPSR = VAL_XPSR;
pStack->R0 = 0;
pStack->R1 = 0;
pStack->R2 = 0;
pStack->R3 = 0;
pStack->R4 = 0;
pStack->R5 = 0;
pStack->R6 = 0;
pStack->R7 = 0;
pStack->R8 = 0;
pStack->R9 = 0;
pStack->R10 = 0;
pStack->R11 = 0;
pStack->R12 = 0;
pStack->R13 = (U32)pStack;
pStack->R14 = (U32)os_task_selfdelete;
pStack->R15 = (U32)func;
}
Status_t os_int_lock(void)
{
if (NULL == cur_tcb)
return RET_SUCCESS;
if (RET_SUCCESS == MDS_RunInInt())
return RET_SUCCESS;
if (int_cnt == 0) {
OS_INT_DISABLE();
++int_cnt;
return RET_SUCCESS;
}
else if (int_cnt < 0xffff){
++int_cnt;
return RET_SUCCESS;
}
else {
return RET_FAILURE;
}
}
Status_t os_int_unlock(void)
{
if (NULL == cur_tcb)
return RET_SUCCESS;
if (RET_SUCCESS == MDS_RunInInt())
return RET_SUCCESS;
if (int_cnt > 0) {
--int_cnt;
if (int_cnt == 0) {
OS_INT_ENABLE();
}
return RET_SUCCESS;
}
else {
return RET_FAILURE;
}
}
void os_swi_trigger(void)
{
MDS_TaskOccurSwi();
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/swunzg/rtos.git
git@gitee.com:swunzg/rtos.git
swunzg
rtos
rtos
master

搜索帮助