关于UCOSII进出中断时的临界…
来源:互联网 发布:js 两个时间相减 编辑:程序博客网 时间:2024/05/02 01:41
临界状态保护程序如下:
其中?????????????????是自己添加的代码行。
对如上程序解释如下:
一、#if OS_CRITICAL_METHOD == 3
Method #1: Disable/Enable interrupts using simple instructions.Aftercritical
Method #2: Disable/Enable interrupts by preserving the state ofinterrupts. In other words, if interrupts were disabled beforeentering the critical section, they will be disabled when leavingthe critical section.
Method #3: Disable/Enable interrupts by preserving the state ofinterrupts. Generally speaking you would store the state of theinterrupt disable flag in the local variable 'cpu_sr' and thendisable interrupts. 'cpu_sr' is allocated in all of uC/OS-II's sthat need to disable interrupts. You would restore the interruptdisable state by copying back 'cpu_sr' into the CPU's statusregister
根据UCOSII中提示:
(1)、当OS_CRITICAL_METHOD为1时,无论调用criticalsection之前是否开中断,在退出后中断将使能。这样的话把本身不需要的中断也将打开,这是我们所不希望看到的。
(2)、当OS_CRITICAL_METHOD为2时,在进入criticalsection之前对中断状态进行压栈,当从critical section退出的时候并不改变中断的状态。
(3)、将处理器状态字保存在局部变量cpu_sr中,也就是说先保存原来的中断状态到cpu_sr,然后再关闭中断。
二、OS_CPU_SR
三、OSIntNesting是中断嵌套层数的变量,ucossii通过这个全局变量确保在中断嵌套的时候不进行任务调度。
四、OSIntExit(),在此函数中先进行OSintNesting减1,然后判断是否有中断嵌套,如果没有的话就退出中断进行任务调度。
- 关于UCOSII进出中断时的临界…
- 关于uCOS-II进出临界区时使用开关中断方式的疑问
- uCOS-III开关中断进出临界区的三个宏
- ucosii关于PC的中断基础知识
- ucosii的中断和时钟
- 关于ucosII中断中任务调度
- 关于ucosii的邮箱
- uCOSII下的STM32外部中断
- 关于Switch语句进出的理解
- 临界区和开关中断的区别
- stm32 UCOSII 中断
- s3c2440对与ucosII的开关中断的处理
- 界面跳转时的进出动画
- 关于创建临界区的问题
- 进出的动画
- Fragment的进出动画
- 关于ucosii移植后的问题及思考
- 关于ucosii操作系统的音频播放任务优先级划分
- C语言我的bug!
- 我的C语言学生管理系统!
- C const来自百度
- 3DES加密模式
- 深入理解7816(1)
- 关于UCOSII进出中断时的临界…
- 第五篇:uCOS-II 信号量及其…
- 串口 CTS/RTS
- C语言register关键字—最快的…
- TS流解析之PAT表格解析
- C++ Primer 学习笔记与思考_3 ---头文件那些事儿(extern)
- 单链表之删除某一位置节点
- TS流解析之PMT表格解析
- NC - 网络编码的Java实现(1)-GF28基本运算