How do I disable all interrupts on a MPC5604 (whats the equivalent to DisableInterrupts used on the S12 compiler)

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

How do I disable all interrupts on a MPC5604 (whats the equivalent to DisableInterrupts used on the S12 compiler)

跳至解决方案
3,874 次查看
dermotmurphy
Contributor I

I have an interrupt which is updating data, which can also be read using other functions.

I need to be able to read data knowing that it is not being updated mid way through the read.

 

On the S12 I would do this:

disable all interrupts using the DisableInterrupts function which would update the I bit in the CCR register.

perform the action

enable all interrupts using the EnableInterrupts function

 

What is the equivalent for the MPC5604?

标签 (1)
0 项奖励
回复
1 解答
2,148 次查看
stanish
NXP Employee
NXP Employee

You can e.g. set/clear EE bit in MSR register. See below the example of implementation using the custom macros.

#define DISABLE_INT __asm(wrteei  0)

#define ENABLE_INT  __asm(wrteei  1)

void main(void)

{

  ENABLE_INT;

DISABLE_INT;

}

在原帖中查看解决方案

0 项奖励
回复
2 回复数
2,147 次查看
dermotmurphy
Contributor I

Many thanks, that works great.

0 项奖励
回复
2,149 次查看
stanish
NXP Employee
NXP Employee

You can e.g. set/clear EE bit in MSR register. See below the example of implementation using the custom macros.

#define DISABLE_INT __asm(wrteei  0)

#define ENABLE_INT  __asm(wrteei  1)

void main(void)

{

  ENABLE_INT;

DISABLE_INT;

}

0 项奖励
回复