<?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: How to get task ID from MQX watchdog failure</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-get-task-ID-from-MQX-watchdog-failure/m-p/756932#M17784</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are welcome and thank you for your update.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Jun 2018 07:01:04 GMT</pubDate>
    <dc:creator>danielchen</dc:creator>
    <dc:date>2018-06-21T07:01:04Z</dc:date>
    <item>
      <title>How to get task ID from MQX watchdog failure</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-get-task-ID-from-MQX-watchdog-failure/m-p/756929#M17781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are using the watchdog of MQX 4.2 to detect crashes or halted tasks but I would like to know what information is available when the watchdog error function is called.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are creating the watchdog using&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;if(_watchdog_create_component(BSP_TIMER_INTERRUPT_VECTOR, handle_watchdog_expiry) != MQX_OK)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; printf("\nError creating watchdog component.");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; _task_block();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;where &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;handle_watchdog_expiry&lt;/SPAN&gt; is defined as &lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;void handle_watchdog_expiry(void* td_ptr)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; printf("Expired task 0x%P\n\r", td_ptr);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Trig the hardware WDT&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;while(1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The declaration follows the function pointer type definition&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new, courier, monospace; font-size: 15px;"&gt;typedef void (_CODE_PTR_&amp;nbsp; WATCHDOG_ERROR_FPTR)(void *);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;used in&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;extern _mqx_uint _watchdog_create_component(_mqx_uint, WATCHDOG_ERROR_FPTR);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I print the parameter given as a void pointer, I cannot find anything into the code to match the task to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to cast the void pointer into some struct from which useful information could be obtained?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not, how can I use the pointer to match to a task?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2018 22:02:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-get-task-ID-from-MQX-watchdog-failure/m-p/756929#M17781</guid>
      <dc:creator>rvigneault</dc:creator>
      <dc:date>2018-06-06T22:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to get task ID from MQX watchdog failure</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-get-task-ID-from-MQX-watchdog-failure/m-p/756930#M17782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A _jive_internal="true" data-content-finding="Community" data-userid="314568" data-username="rvigneault" href="https://community.nxp.com/people/rvigneault"&gt;Rudy&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MQX watchdog component provides a software watchdog for each task. If a single task starves or runs beyond certain timing constraints, the watchdong provides a way to detect the problem. Initially, the task starts its watchdog with a specific time value, and if the task fails to stop or restart the watchdog&amp;nbsp; before that time expires, MQX calls a processor-unique, application-supplied expiry function that can initiate error recovery.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From the td_ptr, it is a pointer to the task descriptor of the task, it contains various information about the state of the task.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;typedef struct&amp;nbsp;&amp;nbsp; td_struct&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; /*!&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * \brief A pointer to the next TD in the queue (for whatever queue this&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * task is currently in).&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * This field MUST be the first field in the TD.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; struct td_struct&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *TD_NEXT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /*!&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * \brief A pointer to the previous TD in the queue (for whatever queue this&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * task is currently in).&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; struct td_struct&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *TD_PREV;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /*! \brief The current state that this task is in. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; _mqx_uint&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; STATE;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /*! \brief The Task id of the task that this task descriptor represents. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; _task_id&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TASK_ID;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /*! \brief The Start of the Stack. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; void&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *STACK_BASE;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /*!&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * \brief If the task is blocked, then this is a pointer to the task's current&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * stack value, otherwise it is a pointer to the task's stack at the time of&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * the last block.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; void&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *STACK_PTR;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /*! \brief The other end of the Stack. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; void&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *STACK_LIMIT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /*! \brief The Ready Queue upon which to place the task, when it is ready to run. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; struct ready_q_struct&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *MY_QUEUE;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can get task id by this function&lt;/P&gt;&lt;P&gt;_task_id&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _task_get_id_from_td(void * td_ptr);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jun 2018 05:24:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-get-task-ID-from-MQX-watchdog-failure/m-p/756930#M17782</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2018-06-12T05:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to get task ID from MQX watchdog failure</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-get-task-ID-from-MQX-watchdog-failure/m-p/756931#M17783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/danielchen@fsl"&gt;danielchen@fsl&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is exactly what I was looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rudy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2018 20:37:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-get-task-ID-from-MQX-watchdog-failure/m-p/756931#M17783</guid>
      <dc:creator>rvigneault</dc:creator>
      <dc:date>2018-06-15T20:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to get task ID from MQX watchdog failure</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-get-task-ID-from-MQX-watchdog-failure/m-p/756932#M17784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are welcome and thank you for your update.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2018 07:01:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-get-task-ID-from-MQX-watchdog-failure/m-p/756932#M17784</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2018-06-21T07:01:04Z</dc:date>
    </item>
  </channel>
</rss>

