完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
本帖最后由 376220024 于 2013-1-9 10:37 编辑
各位叔叔大爷,我搞了几天还没搞明白这个问题,求你们了。是这样的 在MDk上STM32嵌入ucos,但是进入临界状态时报错cpu_sr没定义,怎么搞的? 爷爷帮我; /* ********************************************************************************************************* * Cortex-M1 * Critical Section Management * * Method #1: Disable/Enable interrupts using simple instructions. After critical section, interrupts * will be enabled even if they were disabled before entering the critical section. * NOT IMPLEMENTED * * Method #2: Disable/Enable interrupts by preserving the state of interrupts. In other words, if * interrupts were disabled before entering the critical section, they will be disabled when * leaving the critical section. * NOT IMPLEMENTED * * Method #3: Disable/Enable interrupts by preserving the state of interrupts. Generally speaking you * would store the state of the interrupt disable flag in the local variable 'cpu_sr' and then * disable interrupts. 'cpu_sr' is allocated in all of uC/OS-II's functions that need to * disable interrupts. You would restore the interrupt disable state by copying back 'cpu_sr' * into the CPU's status register. ********************************************************************************************************* */ #define OS_CRITICAL_METHOD 3 #if OS_CRITICAL_METHOD == 3
#define OS_ENTER_CRITICAL() {cpu_sr = OS_CPU_SR_Save();}// #define OS_EXIT_CRITICAL() {OS_CPU_SR_Restore(cpu_sr);}// #endif
|
|
相关推荐
10 个讨论
|
|
|
编译的时候通过了吗?
|
|
|
|
|
|
|
|
wjshyshr 发表于 2013-6-3 18:30 这个其实挺简单的,cpu_sr是在在OS_CPU.h 中定义的宏OS_ENTER_CRITICAL()和OS_EXIT_CRITICAL()中的一个参数,只要你在使用这两个宏之前定义一个unsegned int 的cpu_sr(局部变量就行,用来保存当前中断状态的一个变量)就可以了,而且这个变量必须写成cpu_sr |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
UCOSII中断中添加OSSemPost(Sem);程序无法运行
5262 浏览 1 评论
在BC5.0上编译uC/OS-II出现"eeror writing object file",怎样处理???
3468 浏览 1 评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-3 02:12 , Processed in 0.977541 second(s), Total 63, Slave 53 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
4348