<?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>topic Re: generic_list usage? SERIAL_MANAGER_NON_BLOCKING_MODE broken? in MCUXpresso SDK</title>
    <link>https://community.nxp.com/t5/MCUXpresso-SDK/generic-list-usage-SERIAL-MANAGER-NON-BLOCKING-MODE-broken/m-p/1049272#M2351</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually what I think is missing here is something like this: (source is&amp;nbsp; iot_linear_containers.h from amazon freertos)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;/**&lt;BR /&gt; * @brief Calculates the starting address of a containing struct.&lt;BR /&gt; *&lt;BR /&gt; * @param[in] type Type of the containing struct.&lt;BR /&gt; * @param[in] pLink Pointer to a link member.&lt;BR /&gt; * @param[in] linkName Name of the #IotLink_t in the containing struct.&lt;BR /&gt; */&lt;BR /&gt;#define IotLink_Container( type, pLink, linkName ) \&lt;BR /&gt; ( ( type * ) ( void * ) ( ( ( uint8_t * ) ( pLink ) ) - offsetof( type, linkName ) ) )&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Jul 2020 09:23:47 GMT</pubDate>
    <dc:creator>robertoquilez</dc:creator>
    <dc:date>2020-07-01T09:23:47Z</dc:date>
    <item>
      <title>generic_list usage? SERIAL_MANAGER_NON_BLOCKING_MODE broken?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/generic-list-usage-SERIAL-MANAGER-NON-BLOCKING-MODE-broken/m-p/1049271#M2350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having a look to the&amp;nbsp;generic_list.c in order to reuse the code for my own lists.&lt;/P&gt;&lt;P&gt;The serial_manager is using it for the&amp;nbsp;SERIAL_MANAGER_NON_BLOCKING_MODE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nevertheless I can not see how can it work:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When adding elements to the list, we are passing the address of "link", which is type "&lt;SPAN&gt;list_element_t"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;STRONG&gt;static&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;STRONG&gt;void&lt;/STRONG&gt;&lt;/SPAN&gt; SerialManager_AddTail(list_t *queue, serial_manager_write_handle_t *node)&lt;/P&gt;&lt;P class=""&gt;{&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;LIST_AddTail(queue, &amp;amp;node-&amp;gt;link);&lt;/P&gt;&lt;P class=""&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when retrieving the element from the list&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;serial_manager_write_handle_t *writeHandle =&lt;BR /&gt; (serial_manager_write_handle_t *)LIST_GetHead(&amp;amp;handle-&amp;gt;runningWriteHandleHead);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;What we get from the list is a "list_element_t" (the "&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;amp;node-&amp;gt;link" previously added&lt;/SPAN&gt;), the casting to "&lt;SPAN&gt;serial_manager_write_handle_t" does not work.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Am I missing something?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;PS: I am using SDK 2.7.0 on a MK26&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2020 07:05:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/generic-list-usage-SERIAL-MANAGER-NON-BLOCKING-MODE-broken/m-p/1049271#M2350</guid>
      <dc:creator>robertoquilez</dc:creator>
      <dc:date>2020-07-01T07:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: generic_list usage? SERIAL_MANAGER_NON_BLOCKING_MODE broken?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/generic-list-usage-SERIAL-MANAGER-NON-BLOCKING-MODE-broken/m-p/1049272#M2351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually what I think is missing here is something like this: (source is&amp;nbsp; iot_linear_containers.h from amazon freertos)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;/**&lt;BR /&gt; * @brief Calculates the starting address of a containing struct.&lt;BR /&gt; *&lt;BR /&gt; * @param[in] type Type of the containing struct.&lt;BR /&gt; * @param[in] pLink Pointer to a link member.&lt;BR /&gt; * @param[in] linkName Name of the #IotLink_t in the containing struct.&lt;BR /&gt; */&lt;BR /&gt;#define IotLink_Container( type, pLink, linkName ) \&lt;BR /&gt; ( ( type * ) ( void * ) ( ( ( uint8_t * ) ( pLink ) ) - offsetof( type, linkName ) ) )&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2020 09:23:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/generic-list-usage-SERIAL-MANAGER-NON-BLOCKING-MODE-broken/m-p/1049272#M2351</guid>
      <dc:creator>robertoquilez</dc:creator>
      <dc:date>2020-07-01T09:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: generic_list usage? SERIAL_MANAGER_NON_BLOCKING_MODE broken?</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/generic-list-usage-SERIAL-MANAGER-NON-BLOCKING-MODE-broken/m-p/1049273#M2352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Roberto,&lt;/P&gt;&lt;P&gt;This is because&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;list_element_t is a member of&amp;nbsp;serial_manager_write_handle_t. Not only that,&amp;nbsp;&lt;SPAN&gt;list_element_t&lt;/SPAN&gt; is locate at the head of&amp;nbsp;&lt;SPAN&gt;serial_manager_write_handle_t. So, the address of&amp;nbsp;&lt;SPAN&gt;list_element_t is also equal to the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;serial_manager_write_handle_t address.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN&gt;(serial_manager_write_handle_t *)(void *)LIST_GetHead(&amp;amp;handle-&amp;gt;runningWriteHandleHead)&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN style="background-color: #ffffff; "&gt;&lt;SPAN&gt;The type casting can work here.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN style="background-color: #ffffff; "&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN style="background-color: #ffffff; "&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN style="background-color: #ffffff; "&gt;&lt;SPAN&gt;Jing&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2020 08:46:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/generic-list-usage-SERIAL-MANAGER-NON-BLOCKING-MODE-broken/m-p/1049273#M2352</guid>
      <dc:creator>jingpan</dc:creator>
      <dc:date>2020-07-03T08:46:20Z</dc:date>
    </item>
  </channel>
</rss>

