Other Parts Discussed in Thread: SYSBIOS
Part of my code is running in an ISR (Hwi Thread) and it calls a function pointer that posts an Event using Event_Post . According to the SYSBIOS User Guide, it is safe to call this API from a Hwi Thread.
Before calling the Event_Post function I disable all interrupts using Hwi_disable(). According to the User Guide, this should also disable the Thread Scheduler. (See image below)
When running my application, the Event_Post function called from a Hwi Thread results in a Task_restore call that enables the interrupts, tries to switch the executing Task and following that a failing stack check. (Because of the comparison of wrong stacks)
I read in the User Guide that the mentioned behaviour of the *_Post functions is deliberate when a Task is calling the function:
"There is a situation in which interrupts become re-enabled when you would expect them to remain
disabled. This occurs when a Task thread calls Mailbox_post(), Semaphore_post(), or Event_post()—or
a similar call not including Swi_post()—while hardware interrupts are disabled but the task scheduler is
enabled. All XXX_post() APIs (except Swi_post()) call Task_restore() internally, which in this case ends
by calling Hwi_enable()."
Is this really the correct behaviour if I call the *_Post function from a Hwi Thread?
I suspect that I am doing something wrong here.