I am using Keil's RTX implementation of the CMSIS RTOS and need to communicate between an interrupt routine and a thread. I intend to use the osSignalSet() call for this which the documentation says is suitable for use in an interrupt routine. This function takes an osThreadId parameter which I intend to store in a global variable for access by the ISR and will set it from the thread.
My question relates to interrupts that might conceivably occur before the creation of the thread : I need a default value to use for the osThreadId which can never occur as a real thread id. Obviously Keil's RTX comes complete with source and I am pretty sure "NULL" is a suitable value but the CMSIS RTOS documentation states that the implementation of osThreadId is implementation defined so I cannot rely on this being always true. I have looked up and down "cmsis_os.h"but cannot find any #define like GUARANTEED_INVALID_THREAD_ID, so can anyone tell me whether this is an oversight in CMSIS RTOS, or am I missing something ?
Also, while I am here, my use above of a global variable to communicate data between an ISR and a thread is quite common but very ugly. I am new to ARM Cortex and I wondered if there is anything I am missing in terms of alternatives ? I am reminded of the early days of Windows when Windows drivers communicated with DOS counterparts via software interrupts in an arrangement like a kind of multi-level dumb waiter, I can't remember what they called that arrangement but is there anything in the Cortex that would allow a similar scheme to work ?
This post has been edited by MikeDavies: 08 August 2012 - 07:33 AM