none
[WinCE 6]: How to mask / validate all interrupts ? RRS feed

  • Question

  • Hi all,

    I have to create a driver with very time critical stuff, so I want to mask all interrupt during this part of code and the revalidates them after.

    What is the best way to do this?

    Is there a Windows CE standard way to do this?

    Best regards

    Fabrice

    Tuesday, October 5, 2010 6:54 AM

Answers

  • Hi Paul,

    I know that's not the fine way to do it, but some times it is necessary to do something like that!

    In that case, I have to do some GPIO action with microseconds accuracy. So there is no time spend with interrupt management.

    I finally found a way to do what I want, I've create some assembly code and now it works ;-)

     

    Fabrice

    • Marked as answer by KroMignon Wednesday, October 6, 2010 7:37 PM
    Wednesday, October 6, 2010 7:37 PM

All replies

  • You can use INTERRUPTS_OFF() / INTERRUPTS_ON

    --
    Luca Calligaris (MVP-Windows Embedded)
    lucaDOTcalligarisATeurotechDOTcom
    www.eurotech.com
     
     
    "KroMignon" <=?utf-8?B?S3JvTWlnbm9u?=> ha scritto nel messaggio news:0dae026b-c1ce-42f6-a626-2077cf2d00cf...

    Hi all,

    I have to create a driver with very time critical stuff, so I want to mask all interrupt during this part of code and the revalidates them after.

    What is the best way to do this?

    Is there a Windows CE standard way to do this?

    Best regards

    Fabrice


    Luca Calligaris (MVP-Windows Embedded) lucaDOTcalligarisATeurotechDOTcom www.eurotech.com
    Tuesday, October 5, 2010 8:07 AM
  • Hi Luca,

    Many thanks, I found those routines but I think they are only available at OAL Layer. Are they also available for drivers ?

    Tuesday, October 5, 2010 8:34 AM
  • How time critical?  Disabling all interrupts would be a big hammer for this usually.

    Did you try setting your thread priority in the IST to something higher than all other threads in the system?


    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com
    Tuesday, October 5, 2010 12:39 PM
    Moderator
  • Hi Bruce,

    I have to do some actions with a accuracy of 10 microseconds, so time is very critical.

    I have put the thread to the highest priority, but to be sure I also want to cut off all interrupts because, in that case, they aren't important for me.

    I have tried INTERRUPTS_ON() / INTERRUPTS_OFF(), but they are only available at OAL level, so I think I will have to create a custom KernelIoControl() function to be able to enable/disable the interrupts from my driver.

     

    Tuesday, October 5, 2010 2:11 PM
  • Bad news,

    I have create a custom KernelIoControl() which call INTERRUPTS_ENABLE() to try to enable/disable all interrupts but it seems not to work.

    It seems that interruptions are all reactivated after the KernelIoControl() call.

    Any ideas/suggestion ?

    Wednesday, October 6, 2010 1:18 PM
  • And your driver is designed for a specific Windows CE-based device or it's a general driver designed to run on various devices?  If it's your device and the driver isn't portable, do whatever the processor requires to mask the interrupts directly in your driver and then restore the original mask setting when you're done.

    As previously mentioned by others, this is not a friendly way for the driver to behave and I would not recommend doing it.  You say that you "want" to disable the interrupts.  Whether you NEED to disable them or not should control how you approach this.  If it's not NECESSARY, don't do it.

    Paul T.

    Wednesday, October 6, 2010 4:51 PM
  • Hi Paul,

    I know that's not the fine way to do it, but some times it is necessary to do something like that!

    In that case, I have to do some GPIO action with microseconds accuracy. So there is no time spend with interrupt management.

    I finally found a way to do what I want, I've create some assembly code and now it works ;-)

     

    Fabrice

    • Marked as answer by KroMignon Wednesday, October 6, 2010 7:37 PM
    Wednesday, October 6, 2010 7:37 PM
  • Glad it's working!  I hope you aren't missing critical interrupts while they're disabled...

    Paul T.

    Thursday, October 7, 2010 3:25 PM
  • If micro second level accuracy is needed, unless your system guarantee service ISR less than 1 uS (most system still takes about 3 to 5 uS), mask the interrupts is the only choice.
    Depends on how you mask the interrupts and how the IRQ is triggered (level, edge and etc), if it is masked on the CPU core level (such as "cli" in x86 and that is how these INTERRUPTS_XXX API implemented), you won't miss any interrupts but may increase the interrupt latency.
    Besides to mask interrupts off explicitly, an alternative way is if the platform supports triggering IRQ by software, you can either hook up an installable ISR or have your code in OAL interrupt handler, so when you need to run some time critical code, just trigger the SW IRQ and due to IRQ handler (ISR) is in non-preemptible state,  hence it can run to complete without any interruption.

    Also regardless how the interrupts are masked, I recommend you to run ILTIMING (http://msdn.microsoft.com/en-us/library/ee483144.aspx) to measure the impact of interrupt latency caused by your code.

    Thursday, October 7, 2010 8:39 PM