📄 message_8h.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>BlueLab: message.h File Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.8 --><div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div><h1>message.h File Reference</h1>Control message passing. <a href="#_details">More...</a><p><h2>Defines</h2><ul><li>#define <a class="el" href="message_8h.html#a0">D_IMMEDIATE</a> ((<a class="el" href="message___8h.html#a1">Delay</a>) -1)<li>#define <a class="el" href="message_8h.html#a1">D_SEC</a>(s) ((<a class="el" href="message___8h.html#a1">Delay</a>) ((s) * (<a class="el" href="message___8h.html#a1">Delay</a>) 1000))<li>#define <a class="el" href="message_8h.html#a2">D_MIN</a>(m) ((<a class="el" href="message___8h.html#a1">Delay</a>) ((m) * (<a class="el" href="message___8h.html#a1">Delay</a>) 1000 * (<a class="el" href="message___8h.html#a1">Delay</a>) 60))<li>#define <a class="el" href="message_8h.html#a3">D_HOUR</a>(h) ((<a class="el" href="message___8h.html#a1">Delay</a>) ((h) * (<a class="el" href="message___8h.html#a1">Delay</a>) 1000 * (<a class="el" href="message___8h.html#a1">Delay</a>) 60) * (<a class="el" href="message___8h.html#a1">Delay</a>) 60)</ul><h2>Functions</h2><ul><li>void <a class="el" href="message_8h.html#a4">MessageSendLater</a> (<a class="el" href="struct_task_data.html">Task</a> task, <a class="el" href="message___8h.html#a0">MessageId</a> id, void *message, <a class="el" href="csrtypes_8h.html#a3">uint32</a> delay)<dl class="el"><dd class="mdescRight">Send a message to the corresponding task after the given delay in ms. The message will be passed to free after delivery. <a href="#a4"></a><br></dl><li><a class="el" href="csrtypes_8h.html#a9">bool</a> <a class="el" href="message_8h.html#a5">MessageCancelFirst</a> (<a class="el" href="struct_task_data.html">Task</a> task, <a class="el" href="message___8h.html#a0">MessageId</a> id)<dl class="el"><dd class="mdescRight">Cancel the first queued message with the given task and message id. Returns TRUE if such a message was found and cancelled. <a href="#a5"></a><br></dl><li>void <a class="el" href="message_8h.html#a6">MessageWait</a> (void *m)<dl class="el"><dd class="mdescRight">Block waiting for the next message. <a href="#a6"></a><br></dl><li>void <a class="el" href="message_8h.html#a7">MessageSendConditionally</a> (<a class="el" href="struct_task_data.html">Task</a> t, <a class="el" href="message___8h.html#a0">MessageId</a> id, <a class="el" href="message___8h.html#a2">Message</a> m, const <a class="el" href="csrtypes_8h.html#a4">uint16</a> *c)<dl class="el"><dd class="mdescRight">Send a message to be be delivered when the corresponding uint16 is zero. <a href="#a7"></a><br></dl><li>void <a class="el" href="message_8h.html#a8">MessageFree</a> (<a class="el" href="message___8h.html#a0">MessageId</a> id, <a class="el" href="message___8h.html#a2">Message</a> data)<dl class="el"><dd class="mdescRight">Frees the memory pointer to by data. <a href="#a8"></a><br></dl><li><a class="el" href="struct_task_data.html">Task</a> <a class="el" href="message_8h.html#a9">MessagePioTask</a> (<a class="el" href="struct_task_data.html">Task</a> task)<dl class="el"><dd class="mdescRight">Register a task to handle PIO changes; returns the old task (or zero). <a href="#a9"></a><br></dl><li><a class="el" href="csrtypes_8h.html#a4">uint16</a> <a class="el" href="message_8h.html#a10">MessageFlushTask</a> (<a class="el" href="struct_task_data.html">Task</a> task)<dl class="el"><dd class="mdescRight">Cancel all queued messages (independent of id) for the given task. Normally used as part of the process of freeing a task. <a href="#a10"></a><br></dl><li><a class="el" href="struct_task_data.html">Task</a> <a class="el" href="message_8h.html#a11">MessageHostCommsTask</a> (<a class="el" href="struct_task_data.html">Task</a> task)<dl class="el"><dd class="mdescRight">Register a task to handle HostComms primitives; returns the old task (or zero). <a href="#a11"></a><br></dl><li><a class="el" href="struct_task_data.html">Task</a> <a class="el" href="message_8h.html#a12">MessageSinkTask</a> (<a class="el" href="sink___8h.html#a0">Sink</a> sink, <a class="el" href="struct_task_data.html">Task</a> task)<dl class="el"><dd class="mdescRight">Associate a Task with a Sink (and the corresponding source). <a href="#a12"></a><br></dl><li><a class="el" href="struct_task_data.html">Task</a> <a class="el" href="message_8h.html#a13">MessageSinkGetTask</a> (<a class="el" href="sink___8h.html#a0">Sink</a> sink)<dl class="el"><dd class="mdescRight">Get the Task currently associated with a sink. <a href="#a13"></a><br></dl><li><a class="el" href="struct_task_data.html">Task</a> <a class="el" href="message_8h.html#a14">MessageBlueStackTask</a> (<a class="el" href="struct_task_data.html">Task</a> task)<dl class="el"><dd class="mdescRight">Register a task to handle BlueStack primitives; returns the old task (or zero). <a href="#a14"></a><br></dl><li><a class="el" href="struct_task_data.html">Task</a> <a class="el" href="message_8h.html#a15">MessageKalimbaTask</a> (<a class="el" href="struct_task_data.html">Task</a> task)<dl class="el"><dd class="mdescRight">Register a task to handle Messages; returns the old task (or zero). <a href="#a15"></a><br></dl><li><a class="el" href="struct_task_data.html">Task</a> <a class="el" href="message_8h.html#a16">MessageStatusTask</a> (<a class="el" href="struct_task_data.html">Task</a> task, <a class="el" href="csrtypes_8h.html#a4">uint16</a> count, const <a class="el" href="status__if_8h.html#a23">status_field</a> *fields)<dl class="el"><dd class="mdescRight">Register a task to receive a message when status values change. <a href="#a16"></a><br></dl><li><a class="el" href="struct_task_data.html">Task</a> <a class="el" href="message_8h.html#a17">MessageLongKalimbaTask</a> (<a class="el" href="struct_task_data.html">Task</a>)<dl class="el"><dd class="mdescRight">Register a task to handle long messages from Kalimba; returns the old task (or zero). <a href="#a17"></a><br></dl><li><a class="el" href="struct_task_data.html">Task</a> <a class="el" href="message_8h.html#a18">MessageSystemTask</a> (<a class="el" href="struct_task_data.html">Task</a> task)<dl class="el"><dd class="mdescRight">Register a task to handle system-wide messages; returns the old task (or zero). <a href="#a18"></a><br></dl><li><a class="el" href="struct_task_data.html">Task</a> <a class="el" href="message_8h.html#a19">MessageChargerTask</a> (<a class="el" href="struct_task_data.html">Task</a> task)<dl class="el"><dd class="mdescRight">Register a task to handle messages from the onchip battery charger and power system hardware; return the old task (or zero). <a href="#a19"></a><br></dl><li>void <a class="el" href="message_8h.html#a20">MessageSend</a> (<a class="el" href="struct_task_data.html">Task</a> task, <a class="el" href="message___8h.html#a0">MessageId</a> id, void *message)<dl class="el"><dd class="mdescRight">Send a message to the corresponding task immediately. The message will be passed to free after delivery. <a href="#a20"></a><br></dl><li><a class="el" href="csrtypes_8h.html#a4">uint16</a> <a class="el" href="message_8h.html#a21">MessageCancelAll</a> (<a class="el" href="struct_task_data.html">Task</a> task, <a class="el" href="message___8h.html#a0">MessageId</a> id)<dl class="el"><dd class="mdescRight">Cancel all queued messages with the given task and message id. Returns a count of how many such messages were cancelled. <a href="#a21"></a><br></dl><li>void <a class="el" href="message_8h.html#a22">MessageLoop</a> (void)<dl class="el"><dd class="mdescRight">The main scheduler loop; it waits until the next message is due and then sends it to the corresponding task. Never returns. <a href="#a22"></a><br></dl><li>void <a class="el" href="message_8h.html#a23">MessageSendConditionallyOnTask</a> (<a class="el" href="struct_task_data.html">Task</a> t, <a class="el" href="message___8h.html#a0">MessageId</a> id, <a class="el" href="message___8h.html#a2">Message</a> m, const <a class="el" href="struct_task_data.html">Task</a> *c)<dl class="el"><dd class="mdescRight">Send a message to be be delivered when the corresponding Task is zero. <a href="#a23"></a><br></dl></ul><hr><a name="_details"></a><h2>Detailed Description</h2>Control message passing. <p><dl compact><dt><b>Tasks and Message Queues</b></dt><dd></dd></dl>The messaging functions provide a mechanism for asynchronously posting messages between tasks. Messages are posted to MessageQueues which are owned by Tasks. A Task which owns a non-empty MessageQueue will be run by the scheduler.<p><dl compact><dt><b>Creating and Destroying Messages</b></dt><dd></dd></dl>Messages are dynamically allocated which means that they come out of a very limited dynamic-block budget. It is therefore important to ensure that messages are consumed as soon as possible after being produces. Put another way, messages are intended to be a signalling mechanism rather than a data-buffering mechanism.<p>All messages have an identifier property, and some may also contain a payload.<hr><h2>Define Documentation</h2><a class="anchor" name="a0" doxytag="message.h::D_IMMEDIATE" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> #define D_IMMEDIATE ((<a class="el" href="message___8h.html#a1">Delay</a>) -1) </td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>No delay, perform immediately. </td> </tr></table><a class="anchor" name="a1" doxytag="message.h::D_SEC" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> #define D_SEC </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">s </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap> ((<a class="el" href="message___8h.html#a1">Delay</a>) ((s) * (<a class="el" href="message___8h.html#a1">Delay</a>) 1000))</td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Number of seconds to delay for. </td> </tr></table><a class="anchor" name="a2" doxytag="message.h::D_MIN" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> #define D_MIN </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">m </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap> ((<a class="el" href="message___8h.html#a1">Delay</a>) ((m) * (<a class="el" href="message___8h.html#a1">Delay</a>) 1000 * (<a class="el" href="message___8h.html#a1">Delay</a>) 60))</td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Number of minutes to delay for. </td> </tr></table><a class="anchor" name="a3" doxytag="message.h::D_HOUR" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> #define D_HOUR </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">h </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap> ((<a class="el" href="message___8h.html#a1">Delay</a>) ((h) * (<a class="el" href="message___8h.html#a1">Delay</a>) 1000 * (<a class="el" href="message___8h.html#a1">Delay</a>) 60) * (<a class="el" href="message___8h.html#a1">Delay</a>) 60)</td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Number of hours to delay for. </td> </tr></table><hr><h2>Function Documentation</h2><a class="anchor" name="a4" doxytag="message.h::MessageSendLater" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> void MessageSendLater </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="struct_task_data.html">Task</a> </td> <td class="mdname" nowrap> <em>task</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap><a class="el" href="message___8h.html#a0">MessageId</a> </td> <td class="mdname" nowrap> <em>id</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>void * </td> <td class="mdname" nowrap> <em>message</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap><a class="el" href="csrtypes_8h.html#a3">uint32</a> </td> <td class="mdname" nowrap> <em>delay</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Send a message to the corresponding task after the given delay in ms. The message will be passed to free after delivery. <p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>task</em> </td><td>The task to deliver the message to. </td></tr> <tr><td></td><td valign=top><em>id</em> </td><td>The message type identifier. </td></tr> <tr><td></td><td valign=top><em>message</em> </td><td>The message data (if any). </td></tr> <tr><td></td><td valign=top><em>delay</em> </td><td>The delay in ms before the message will be sent. </td></tr> </table></dl> </td> </tr></table><a class="anchor" name="a5" doxytag="message.h::MessageCancelFirst" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> <a class="el" href="csrtypes_8h.html#a9">bool</a> MessageCancelFirst </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="struct_task_data.html">Task</a> </td> <td class="mdname" nowrap> <em>task</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap><a class="el" href="message___8h.html#a0">MessageId</a> </td> <td class="mdname" nowrap> <em>id</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Cancel the first queued message with the given task and message id. Returns TRUE if such a message was found and cancelled. <p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>task</em> </td><td>The task whose messages will be searched. </td></tr> <tr><td></td><td valign=top><em>id</em> </td><td>The message identifier to search for. </td></tr> </table></dl> </td> </tr></table><a class="anchor" name="a6" doxytag="message.h::MessageWait" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> void MessageWait </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void * </td> <td class="mdname1" valign="top" nowrap> <em>m</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Block waiting for the next message. <p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>m</em> </td><td>This will be filled out if a message is ready to be delivered.</td></tr> </table></dl>This function will either:<ul><li>Fill out 'm' if a message is ready for delivery.</li><li>Send the VM to sleep until message delivery time if a message exists but is not ready for delivery.</li><li>Send the VM to sleep for the range of a uint32 if no message exists. </li></ul> </td> </tr></table><a class="anchor" name="a7" doxytag="message.h::MessageSendConditionally" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> void MessageSendConditionally </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="struct_task_data.html">Task</a> </td> <td class="mdname" nowrap> <em>t</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap><a class="el" href="message___8h.html#a0">MessageId</a> </td> <td class="mdname" nowrap> <em>id</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap><a class="el" href="message___8h.html#a2">Message</a> </td> <td class="mdname" nowrap> <em>m</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>const <a class="el" href="csrtypes_8h.html#a4">uint16</a> * </td> <td class="mdname" nowrap> <em>c</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -