Context:
I am implementing a module which can be used for intercore communication/synchronization. I decided to implement my own module and not using the provided "Notify" module because I need to meet certain requirements:
- We need to support an active waiting mode (polling) and sleeping mode (inactive SYS/BIOS task)
- The algorithm needs to remember all interrupts which have been invoked (even if they haven't been served)
- Performance is crucial
- The performance requirement led us to implement a non-interruptive algorithm (Interrupts are only served if a SYS/BIOS task is inactive)
Implementation:
Our implementation is based on the IPCGR and IPCAR registers. The IPCGR registers are used to invoke a hardware interrupt, and their source bits are used for counting the interrupts. The IPCAR registers are used for the acknowledgement. Hardware interrupts are only enabled when a task is put to sleep. A task is put to sleep when no interrupt has occurred so far. To do so, we use the following code snippet:
The interrupt service routine for waking up the task again works as follows:
Our approach comes along with some drawbacks. For instance, we can't remember an arbitrary number of interrupts, only 8 tasks distributed equally over the individual cores can communicate with each other, the IPCGR registers can not be used for something else and so forth. However, right now the module does what it is expected to do and all tests are passing without failure. However, I've got one question I haven't been able to answer so far: