⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interrupt.cfg

📁 flash programming STI 5.5.1.4 DCU3
💻 CFG
字号:
## Definitions of procedures that the debugger calls to
## control the state of global interrupts

InterruptsEnabled = 1
EnableInterrupts = 2
DisableInterrupts = 3
RestoreInterrupts = 4

## General format is 
##    InterruptProc (InterruptsEnabled) -> 1 if enabled else 0
##    InterruptProc (EnableInterrupts)  -> enables interrupts and returns interrupt state
##    InterruptProc (DisableInterrupts) -> disables interrupts and returns interrupt state
##    InterruptProc (RestoreInterrupts, value) -> restores interrupt state to value

## C1(MC2/AP1) interrupt procedure 

C1InterruptMask = (1<<14)

proc C1Interrupts {
  $$ = display -q -r status
  if ($1 == InterruptsEnabled) {
    $$ = ($$ & C1InterruptMask) == C1InterruptMask
  } else if ($1 == EnableInterrupts) {
    modify -r status ($$ | C1InterruptMask) 
  } else if ($1 == DisableInterrupts) {
    modify -r status ($$ & ~C1InterruptMask)
  } else {
    modify -r status ($2)
  }
}

## C2 interrupt procedure 

C2InterruptMask = 0x00ff0000

proc C2Interrupts {
  $$ = display -q -r enables 
  if ($1 == InterruptsEnabled) {
    $$ = ($$ & C2InterruptMask) == C2InterruptMask 
  } else if ($1 == EnableInterrupts) {
    modify -r enables ($$ | C2InterruptMask)
  } else if ($1 == DisableInterrupts) {
    modify -r enables ($$ & ~C2InterruptMask)
  } else {
    modify -r enables ($2)
  }
}

## SC1 interrupt procedure 

SC1InterruptControl=0x20000000 + 0xc0
SC1InterruptMask=(1<<16)

proc SC1Interrupts {
  $$ = peek -q (SC1InterruptControl)
  if ($1 == InterruptsEnabled) {
    $$ = ($$ & SC1InterruptMask) == SC1InterruptMask 
  } else if ($1 == EnableInterrupts) {
    poke (SC1InterruptControl, $$ | SC1InterruptMask)
  } else if ($1 == DisableInterrupts) {
    poke (SC1InterruptControl, $$ & ~SC1InterruptMask)
  } else {
    poke (SC1InterruptControl, $2)
  }
}

## interrupt user command - debugger defines InterruptProc and InterruptRestoreValue

proc interrupts {
  if (clsymbol("InterruptProc["+(mkstr(spaceid))+"]")) {
    if ($# == 0) {
      if (eval (InterruptProc[spaceid], InterruptsEnabled)) {
        write interrupts enabled
      } else {
        write interrupts disabled
      }
    } else if ($1 == "-disable" || $1 == "-d") {
      InterruptRestoreValue[spaceid] = eval(InterruptProc[spaceid], DisableInterrupts)
    } else if ($1 == "-enable" || $1 == "-e") {
      InterruptRestoreValue[spaceid] = eval(InterruptProc[spaceid], EnableInterrupts)
    } else if ($1 == "-restore" || $1 == "-r") {
      eval(InterruptProc[spaceid], RestoreInterrupts, InterruptRestoreValue[spaceid])
    }
  }
}

addhelp interrupts \
"interrupts -d[isable] -e[nable] -r[estore]\n\
   show if global interrupts are enabled\n\
   -d[isable] global interrupts\n\
   -e[nable] global interrupts\n\
   -r[estore] last interrupt state\n"

proc action { interrupts $* }
addhelp action "synonym for interrupts command\n"

proc action { interrupts $* }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -