S32K148 - interrupts disable/enable

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

S32K148 - interrupts disable/enable

2,779件の閲覧回数
jakub_mielczare
Contributor IV

Hello,

Assume I have following code sequence:

1. disable_interrupts()

2. some code

3. disable_interrupts()

4. some code

5. enable_interrupts()

6. some code

7. enable_interrupts()

disable_interrupts() is done by __asm("cpsid i")

enable_interrupts() is done by __asm("cpsie i")

When will interrupts become enabled back in the above sequence, at 5. or at 7.? Does S32K148 keep track of nested "cpsid" and "cpsie"?

Kind regards,

Jakub

タグ(1)
3 返答(返信)

2,688件の閲覧回数
Joey_van_Hummel
Contributor IV

It's safe in the sense that the documentation doesn't state not to do it.

If you want to enable interrupt nesting, calling CPSIE inside the ISR (like you would on an S12X) is not the way to go, since PRIMASK and FAULTMASK are  unchanged upon exception entry. It won't have any effect. You can make use of the priority levels. Higher priority exceptions can interrupt lower priority exceptions.

If you want to prevent interrupts from interrupting your ISR, you can safely call CPSID and then re-enable with CPSIE when you're done.

0 件の賞賛
返信

2,688件の閲覧回数
Joey_van_Hummel
Contributor IV

CPS Instructions in the ARMv7-M architecture directly influence PRIMASK and FAULTMASK registers. No nesting is performed.

See also ARMv7-M reference manual section B5.2.1.

2,688件の閲覧回数
jakub_mielczare
Contributor IV

Thank you.

Is it safe to call those instructions from ISR?

0 件の賞賛
返信