> I grabbed the tf (Task Descriptor structure definition from the PSP mqx_prv.h header and copied it into my example.
Hmm. Yeah, that worked for me too, but it leaves a sinking feeling in my stomach. As soon as that structure is modified, I'm screwed.
I decided to add the directory containing mqx_prv.h to my "include user search paths (-i)" in my project settings, and add an "#include <mqx_prv.h>" to my source. Which was a bit of a pain -- no matter what I try, I always get an "unresolved inclusion" warning; but, it does compile.
To help anyone else that may read this thread, here's what my expiry function looks like...
void handle_watchdog_expiry(TD_STRUCT_PTR td_ptr)
{
_task_id tid = td_ptr->TASK_ID;
if (tid==task1_id) {
_lwevent_set(...);
}
else {
// reset the processor
}
}
In my project only the main_task() is auto started by MQX. When my main task created task1(), it saved the returned _task_id in the task1_id variable. Now my expiry function can tell why it's here, and what it should do in this case.
Obviously, I could save the _task_id of additional tasks created by the main task, then extend my "if..else" to "if..else if" and have a different response to each time out.
By the way, only the main_task needs to call _watchdog_create_component(). All other tasks simply call watchdog_start() as needed.
Thank you David. Without your help, I would still be struggling with this.
I hope a future MQX release will have a watchdog expiry function that returns useful information. A _task_id would be good; but, the task index constant that is used in the TASK_TEMPLATE_STRUCT would be even better! That way I could just create a case statement in my expiry function and be done with it.
Thanks again.
- Audi