Passing Data between an ISR and an IST (Windows Embedded CE 6.0)
1/5/2010
There may be times when you want to pass information between an interrupt service routine (ISR) and an interrupt service thread (IST). For example, because calling an IST each time an interrupt request (IRQ) arrives is a time-consuming process, you might want to design an ISR to buffer IRQ data before calling the IST.
The ISR would return SYSINTR_NOP until the buffer was full, and then would return the appropriate SYSINTR identifier when the ISR is ready for the IST to run. Once the IST runs, it can pick up the data that the ISR has been buffering.
To pass data between an ISR and an IST
Reserve physical memory for the ISR in your Config.bib file.
Config.bib contains several examples of reserving physical memory for the serial and debug drivers.
Use the reserved memory in your ISR call.
Because the ISR runs in kernel mode, the ISR can access the reserved memory to buffer data.
Call the MmMapIoSpace function in your IST to map the physical memory to a virtual address.
MMMapIoSpace calls the VirtualAlloc and VirtualCopy functions to map the physical memory to a virtual-memory address that the IST can access.
You can also call VirtualAlloc and VirtualCopy directly. For example, you can allocate memory outside of the virtual memory space of a process by calling VirtualAlloc with its parameters set to the following values:
- dwSize >= 2 MB
- flAllocationType set to MEM_RESERVE
- flProtect set to PAGE_NOACCESS
In Windows Embedded CE, an installable ISR can easily share data with an IST as the memory can be dynamically allocated instead of being reserved in the Config.bib file.
See Also
Tasks
How to Develop an OEM Adaptation Layer