<?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: Lightweight message size in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/Lightweight-message-size/m-p/319332#M10196</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please refer to the macro in lwmsgq.h ,&amp;nbsp; task will be block when LWMSGQ_IS_FULL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Return whether the queue is full */&lt;/P&gt;&lt;P&gt;#define LWMSGQ_IS_FULL(q) \&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; (((LWMSGQ_STRUCT_PTR)(q))-&amp;gt;CURRENT_SIZE &amp;gt;= ((LWMSGQ_STRUCT_PTR)(q))-&amp;gt;MAX_SIZE)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message queue is full if current_size &amp;gt;= max_size.&amp;nbsp;&amp;nbsp;&amp;nbsp; max_size is the number of messages when you use _lwmsgq_init.&amp;nbsp;&amp;nbsp; Current_size will increase by 1 when enqueue and will decrease by 1 when dequeue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 20 Jul 2014 07:24:49 GMT</pubDate>
    <dc:creator>danielchen</dc:creator>
    <dc:date>2014-07-20T07:24:49Z</dc:date>
    <item>
      <title>Lightweight message size</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Lightweight-message-size/m-p/319331#M10195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to understand the message sizing in lightweight messages.&amp;nbsp; I understand that it is in multiples of 32 bits.&amp;nbsp; Let's say I'm trying to pass a structure as a message:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;typedef struct&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned char byte1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned char *ptr1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned char byte2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned char *ptr2;&lt;/P&gt;&lt;P&gt;}messageStruct;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sizeof() for this structure returns 16 bytes.&amp;nbsp; So, if i create a message queue like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint32_t msgQ[sizeof(LWMSGQ_STRUCT)/sizeof(uint32_t) + sizeof(messageStruct)/sizeof(uint32_t)]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I end up with an array of 20 uint32_t, or 80 bytes, which is what I would expect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then initialize the queue with:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;_lwmsq_init(msgQ, 1, 4);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I send this structure, with the LWMSGQ_SEND_BLOCK_ON_FULL, it doesn't block because apparently it's not full.&amp;nbsp; As an experiment, I tried send a single uint32_t integer, but left the message size the same.&amp;nbsp; Again, it did not block.&amp;nbsp; Once I changed the message size to 1, it blocked.&amp;nbsp; Although it only allows 1 message, apparently it's not "full" unless the size of the message is exact.&amp;nbsp; How does one send a structure like this and have it block on full?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On a somewhat related note, if I send a message with the LWMSQ_SEND_BLOCK_ON_SEND flag, it does indeed block, but what unblocks the task?&amp;nbsp; I was able to block one task, receive the structure message by the receiving task, but I could not send a structure back and unblock the requesting task.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jul 2014 14:43:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Lightweight-message-size/m-p/319331#M10195</guid>
      <dc:creator>davidsherman</dc:creator>
      <dc:date>2014-07-11T14:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Lightweight message size</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Lightweight-message-size/m-p/319332#M10196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please refer to the macro in lwmsgq.h ,&amp;nbsp; task will be block when LWMSGQ_IS_FULL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Return whether the queue is full */&lt;/P&gt;&lt;P&gt;#define LWMSGQ_IS_FULL(q) \&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; (((LWMSGQ_STRUCT_PTR)(q))-&amp;gt;CURRENT_SIZE &amp;gt;= ((LWMSGQ_STRUCT_PTR)(q))-&amp;gt;MAX_SIZE)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message queue is full if current_size &amp;gt;= max_size.&amp;nbsp;&amp;nbsp;&amp;nbsp; max_size is the number of messages when you use _lwmsgq_init.&amp;nbsp;&amp;nbsp; Current_size will increase by 1 when enqueue and will decrease by 1 when dequeue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Jul 2014 07:24:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Lightweight-message-size/m-p/319332#M10196</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2014-07-20T07:24:49Z</dc:date>
    </item>
  </channel>
</rss>

