您的位置:首页 > 其它

uc/os ii 学习笔记 2010-03-19 b

2010-03-19 10:36 357 查看
摘抄一段原文:

The code for the idle task is shown below. Interrupts are disabled then
enabled around the increment because on 8-bit and most 16-bit processors, a 32-bit increment requires multiple
instructions which must be protected from being accessed by higher priority tasks or an ISR. The idle task can never
be deleted by application software.
void OSTaskIdle (void *pdata)
{
pdata = pdata;
for (;;) {
OS_ENTER_CRITICAL();
OSIdleCtr++;
OS_EXIT_CRITICAL();
}
}
这段论述需要关注一下,在我们c写的一条累加代码可能会是几条汇编才能执行完毕,这之间是可能被中断打断的,所以对一些关键的变量值在改变时要做中端屏蔽,这个在嵌入式开发我想要多注意培养这个意识。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: