We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi everybody, I have a question related to implementation of tsk_lock() for Cortex-M3. The manual says that the function disables the timer interrupt and thus prevents the RTOS from switching. But disabling the interrupt and clearing a pending interrupt flag are sometimes completely different stories. If I call tsk_lock() and immediately after it call tsk_ulock() the other tasks should not suffer, other than experience a few usec delay. What we found is that if the timer interrupt is due to happen between the calls of tsk_lock and tsk_unlock, the interrupt will be lost regardless of how quickly you call tsk_unlock. Which to me is an error - the tsk_lock should only disable the interrupt but keep the pending flag if it comes while the ISR is disabled, so that the ISR is called after tsk_unlock. Otherwise tasks that are waiting on os_dly_wait will miss a sys clock. Which is what we see. Can anybody comment if this is how it was designed? Thanks.
The tsk_lock() and tsk_unlock() are never used in RTX for Cortex-M library. Both functions are there for compatibility reasons with ARM library.
Instead of tsk_lock/tsk_unlock you might consider using __svc functions. They are never interrupted by RTX kernel.