Cortex-M0 Atomic/integral access

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Cortex-M0 Atomic/integral access

1,244 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by JoWi on Wed May 14 01:02:13 MST 2014
Hi.
I am currently mirgrating from 8051 to M0.

For simple IRQ<->UserSoftware comunication the 8051 had 1-bit flags. What is the smallest way (without disabling IRQs) to replace this on the M0 or do I have to use 32-bit ints?

Thanks, Jo
0 项奖励
回复
3 回复数

1,017 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rocketdawg on Wed May 14 09:26:53 MST 2014
variable access may not be atomic and M0 do not have bit band
start some where near here
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0321a/BIHBIHDF.html
0 项奖励
回复

1,017 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by JoWi on Wed May 14 06:44:57 MST 2014
Ok, Thx ;-)
0 项奖励
回复

1,017 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wmues on Wed May 14 05:45:58 MST 2014
You might use any 8bit, 16bit or 32bit memory location to replace "flag bits".

Do not use C bitfields!

Don't forget to add the "volatile" keyword if you want interrupt communication!


volatile unsigned char/short/int this_is_a_flag;

0 项奖励
回复