<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>MQX Software Solutions中的主题 Re: Multiple Watchdogs for Multiple Tasks</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/Multiple-Watchdogs-for-Multiple-Tasks/m-p/284443#M9001</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi Audi,&lt;/P&gt;&lt;P&gt;Attached is my update.&amp;nbsp; I grabbed the tf (Task Descriptor structure definition from the PSP mqx_prv.h header and copied it into my example.&lt;/P&gt;&lt;P&gt;I'm sure there is a better method to do this but what I have works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;SPAN style="color: #005032; font-size: 10pt;"&gt;TD_STRUCT_PTR&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; des_tsp; &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;//DES&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt; text-decoration: underline;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #2a00ff; font-size: 10pt;"&gt;"\nTask Index = %x"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;, ((&lt;/SPAN&gt;&lt;SPAN style="color: #005032; font-size: 10pt;"&gt;_mqx_uint&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; *)td_ptr)[3]); &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;//DES added increment td_ptr address to point to TASK_ID&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #2a00ff; font-size: 10pt;"&gt;"\nTask Index = 0x%x"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;, des_tsp-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000c0; font-size: 10pt;"&gt;TASK_ID&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;); &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;//DES added the &lt;SPAN style="text-decoration: underline;"&gt;td&lt;/SPAN&gt; structure definition above to get access to this structure.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Mar 2013 19:43:15 GMT</pubDate>
    <dc:creator>DavidS</dc:creator>
    <dc:date>2013-03-06T19:43:15Z</dc:date>
    <item>
      <title>Multiple Watchdogs for Multiple Tasks</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Multiple-Watchdogs-for-Multiple-Tasks/m-p/284440#M8998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The MQX user's guide says that an old-school hardware watchdog "monitors the entire application on a processor; it does not monitor individual tasks."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It then goes on to say that the "MQX watchdog component provides a software watchdog for each task."&amp;nbsp; Unfortunately the example code only monitors one task, and I want multiple watchdogs to monitor multiple tasks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It sounds like there can be only one watchdog component created, which implies only one expiry function.&amp;nbsp; I need to have different responses to different timeouts, so I need to know which task has timed out.&amp;nbsp; The reference manual suggests the expiry function can expect to receive a TD_STRUCT_PTR; however, there is no example of what to do with this thing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone have an example of an expiry function that handles timeouts from multiple tasks?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Mar 2013 22:49:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Multiple-Watchdogs-for-Multiple-Tasks/m-p/284440#M8998</guid>
      <dc:creator>audi_mcavoy</dc:creator>
      <dc:date>2013-03-05T22:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Watchdogs for Multiple Tasks</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Multiple-Watchdogs-for-Multiple-Tasks/m-p/284441#M8999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Audi,&lt;/P&gt;&lt;P&gt;I played around with having a second task running.&amp;nbsp; The attached code might help you to get where you want.&lt;/P&gt;&lt;P&gt;Post back if it does (and I guess if it doesn't :-) ).&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Mar 2013 14:54:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Multiple-Watchdogs-for-Multiple-Tasks/m-p/284441#M8999</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2013-03-06T14:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Watchdogs for Multiple Tasks</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Multiple-Watchdogs-for-Multiple-Tasks/m-p/284442#M9000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've made a small step forward.&amp;nbsp; Here's a clip of your example. . .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void handle_watchdog_expiry(pointer td_ptr) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf("\nWatchdog expired for task: 0x%P", td_ptr);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf("\nTask Index = %x", ((_mqx_uint *)td_ptr)[3]);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can see (by stepping though with a debugger) that ((_mqx_uint *)td_ptr)[3] is the _task_id that was returned when the task was created (which I had squirreled away).&amp;nbsp; But, what does td_ptr actually point to?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would really rather use a "structure-&amp;gt;member" notation to get the _task_id.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Mar 2013 17:51:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Multiple-Watchdogs-for-Multiple-Tasks/m-p/284442#M9000</guid>
      <dc:creator>audi_mcavoy</dc:creator>
      <dc:date>2013-03-06T17:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Watchdogs for Multiple Tasks</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Multiple-Watchdogs-for-Multiple-Tasks/m-p/284443#M9001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi Audi,&lt;/P&gt;&lt;P&gt;Attached is my update.&amp;nbsp; I grabbed the tf (Task Descriptor structure definition from the PSP mqx_prv.h header and copied it into my example.&lt;/P&gt;&lt;P&gt;I'm sure there is a better method to do this but what I have works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;SPAN style="color: #005032; font-size: 10pt;"&gt;TD_STRUCT_PTR&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; des_tsp; &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;//DES&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt; text-decoration: underline;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #2a00ff; font-size: 10pt;"&gt;"\nTask Index = %x"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;, ((&lt;/SPAN&gt;&lt;SPAN style="color: #005032; font-size: 10pt;"&gt;_mqx_uint&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; *)td_ptr)[3]); &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;//DES added increment td_ptr address to point to TASK_ID&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #2a00ff; font-size: 10pt;"&gt;"\nTask Index = 0x%x"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;, des_tsp-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000c0; font-size: 10pt;"&gt;TASK_ID&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;); &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;//DES added the &lt;SPAN style="text-decoration: underline;"&gt;td&lt;/SPAN&gt; structure definition above to get access to this structure.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Mar 2013 19:43:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Multiple-Watchdogs-for-Multiple-Tasks/m-p/284443#M9001</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2013-03-06T19:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Watchdogs for Multiple Tasks</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Multiple-Watchdogs-for-Multiple-Tasks/m-p/284444#M9002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; I grabbed the tf (Task Descriptor structure definition from the PSP mqx_prv.h header and copied it into my example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hmm.&amp;nbsp; Yeah, that worked for me too, but it leaves a sinking feeling in my stomach.&amp;nbsp; As soon as that structure is modified, I'm screwed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &amp;lt;mqx_prv.h&amp;gt;" to my source.&amp;nbsp; Which was a bit of a pain -- no matter what I try, I always get an "unresolved inclusion" warning; but, it does compile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To help anyone else that may read this thread, here's what my expiry function looks like...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;void handle_watchdog_expiry(TD_STRUCT_PTR td_ptr)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _task_id tid = td_ptr-&amp;gt;TASK_ID;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (tid==task1_id) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _lwevent_set(...);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // reset the processor&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my project only the main_task() is auto started by MQX.&amp;nbsp; When my main task created task1(), it saved the returned _task_id in the task1_id variable.&amp;nbsp; Now my expiry function can tell why it's here, and what it should do in this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way, only the main_task needs to call _watchdog_create_component().&amp;nbsp; All other tasks simply call watchdog_start() as needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you David.&amp;nbsp; Without your help, I would still be struggling with this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope a future MQX release will have a watchdog expiry function that returns useful information.&amp;nbsp; A _task_id would be good; but, the task index constant that is used in the TASK_TEMPLATE_STRUCT would be even better!&amp;nbsp; That way I could just create a case statement in my expiry function and be done with it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;P&gt;- Audi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2013 17:18:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Multiple-Watchdogs-for-Multiple-Tasks/m-p/284444#M9002</guid>
      <dc:creator>audi_mcavoy</dc:creator>
      <dc:date>2013-03-07T17:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Watchdogs for Multiple Tasks</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Multiple-Watchdogs-for-Multiple-Tasks/m-p/284445#M9003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;why not just add to init_bsp.c this?&amp;nbsp; No problem with headers that way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint32 _bsp_get_task_id_from_descriptor(TD_STRUCT_PTR td_ptr)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return td_ptr-&amp;gt;TASK_ID;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 May 2013 13:56:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Multiple-Watchdogs-for-Multiple-Tasks/m-p/284445#M9003</guid>
      <dc:creator>msinger</dc:creator>
      <dc:date>2013-05-08T13:56:27Z</dc:date>
    </item>
  </channel>
</rss>

