c - How to make sure interrupt can not be generated between specific Code Snippet? -


i have 1 question timing of interrupt generation between code snippets...

@ "example" code

1. ... 2. assign value global variable  // 0/1 means invalid/valid 3. set h/w register via memory-mapped io method  // 0 means completed 

@ "example" isr code

a. ... b. if(global value valid && h/w register "0") count++; 
  • one thing note: after h/w register set, value 0 when "completion" !

my question is: if interrupt generated between 2 , 3, count increased 1 because step 3 not done yet(value 0)... , if exchange 2 , 3, possible count not increased 1 because hw register 0(after time, completed) global variable 0 !

my first idea is: possible 2 , 3 can "tied together" in way , interrupt not allowed generated until 3 done ?

  • i use watcom c , test in dos...

you can use either inline assembly, or call external function written in assembler, invoke x86 cli , sti instructions disabling , enabling interrupts.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -