LoginSignup
0
0

More than 5 years have passed since last update.

naming > xxxEI | yyyDI > Enable Interrupt | Disable Interrupt

Last updated at Posted at 2018-02-02
  • 組込みの実装
  • 変数名にEIやDIが付いている
    • 例: xxxEI、yyyDI

EIやDIは何を意味するのか。

推測

Enable InterruptとDisable Interrupt

asm volatile(“di”); // Disable all interrupts
asm volatile(“ie”); // Enable all interrupts

補足: ieはeiの誤記だろう。

備考

On the pic32 you have global interrupt enable/disable and individual interrupt enable/disable capability (it is far more granular than on the pic18 parts).

関数としては以下があると、特定の割込みセットををEnableにしたり、特定の割込みセットをDisableにする時にコードは少なくできそう。

  • 全てをEIにする関数
  • 全てをDIにする関数
  • 個別でEIにする関数
  • 個別でDIにする関数

変数名に関しては、xxxEIとyyyDIの両者を定義するよりも、「xxxEIとyyyEIを定義してdisableの時はFALSEにする」という実装案もあるだろう。

どちらがソースメンテ時に有用だろうか。

MSP430

MSP430ではP1IEやP2IEのようにEnableの設定レジスタがあり、Disableにするには0にする。

https://courses.cs.washington.edu/courses/cse466/11au/calendar/04-Interrupts-posted.pdf
のp19あたり

P1IE & P2IE (Port 1 & 2 Interrupt Enable reg)
Bit 0: interrupt disabled
Bit 1: interrupt enabled

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0