]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - doc/html/tep111.html
Update tos-bsl for win32 python
[tinyos-2.x.git] / doc / html / tep111.html
index b6f9fc9dcef62d1b2d3bbb4415411bd318ad4e25..d8cd6fe65b7f3c4b7868dad128e5b731da9c6e91 100644 (file)
@@ -41,11 +41,6 @@ blockquote.epigraph {
 dd {
   margin-bottom: 0.5em }
 
-/* Uncomment (& remove this text!) to get bold-faced definition list terms
-dt {
-  font-weight: bold }
-*/
-
 div.abstract {
   margin: 2em 5em }
 
@@ -296,19 +291,11 @@ ul.auto-toc {
 <tr class="field"><th class="docinfo-name">Type:</th><td class="field-body">Documentary</td>
 </tr>
 <tr><th class="docinfo-name">Status:</th>
-<td>Draft</td></tr>
+<td>Final</td></tr>
 <tr class="field"><th class="docinfo-name">TinyOS-Version:</th><td class="field-body">2.x</td>
 </tr>
 <tr><th class="docinfo-name">Author:</th>
 <td>Philip Levis</td></tr>
-<tr class="field"><th class="docinfo-name">Draft-Created:</th><td class="field-body">11-Jul-2005</td>
-</tr>
-<tr class="field"><th class="docinfo-name">Draft-Version:</th><td class="field-body">1.5</td>
-</tr>
-<tr class="field"><th class="docinfo-name">Draft-Modified:</th><td class="field-body">2006-12-12</td>
-</tr>
-<tr class="field"><th class="docinfo-name">Draft-Discuss:</th><td class="field-body">TinyOS Developer List &lt;tinyos-devel at mail.millennium.berkeley.edu&gt;</td>
-</tr>
 </tbody>
 </table>
 <div class="note">
@@ -322,7 +309,9 @@ TEP 1.</p>
 <h1><a id="abstract" name="abstract">Abstract</a></h1>
 <p>This memo covers the TinyOS 2.x message buffer abstraction, <tt class="docutils literal"><span class="pre">message_t</span></tt>.
 It describes the message buffer design considerations, how and where
-<tt class="docutils literal"><span class="pre">message_t</span></tt> is specified, and how data link layers should access it.</p>
+<tt class="docutils literal"><span class="pre">message_t</span></tt> is specified, and how data link layers should access it.
+The major goal of <tt class="docutils literal"><span class="pre">message_t</span></tt> is to allow datagrams to be passed between
+different link layers as a contiguous region of memory with zero copies.</p>
 </div>
 <div class="section">
 <h1><a id="introduction" name="introduction">1. Introduction</a></h1>
@@ -368,7 +357,7 @@ typedef struct TOS_Msg {
   uint8_t receiveSecurityMode;
 } TOS_Msg;
 </pre>
-<p>while on a mote with a CC420 radio (e.g., micaZ), <tt class="docutils literal"><span class="pre">TOS_Msg</span></tt> is defined as:</p>
+<p>while on a mote with a CC2420 radio (e.g., micaZ), <tt class="docutils literal"><span class="pre">TOS_Msg</span></tt> is defined as:</p>
 <pre class="literal-block">
 typedef struct TOS_Msg {
   // The following fields are transmitted/received on the radio.
@@ -411,7 +400,8 @@ then a <tt class="docutils literal"><span class="pre">TOS_Msg</span></tt> needs
 of their headers while allowing implementations to directly access
 header fields. This is very difficult to do in C.</p>
 <p>The <tt class="docutils literal"><span class="pre">data</span></tt> payload is especially problematic. Many
-components refer to this field, so it must be at a fixed offset.
+components refer to this field, so it must be at a fixed offset
+from the beginning of the structure.
 Depending on the underlying link layer, the header fields
 preceding it might have different lengths, and packet-level radios
 often require packets to be contiguous memory regions. Overall, these
@@ -433,7 +423,7 @@ typedef nx_struct message_t {
   nx_uint8_t metadata[sizeof(message_metadata_t)];
 } message_t;
 </pre>
-<p>This format keeps data at a fixed but platform dependent offset, which
+<p>This format keeps data at a fixed offset on a platform, which
 is important when
 passing a message buffer between two different link layers. If the
 data payload were at different offsets for different link layers, then
@@ -450,10 +440,12 @@ greater depth.</p>
 <p>Every link layer defines its header, footer, and metadata
 structures. These structures MUST be external structs (<tt class="docutils literal"><span class="pre">nx_struct</span></tt>),
 and all of their fields MUST be external types (<tt class="docutils literal"><span class="pre">nx_*</span></tt>), for two
-reasons. First, external types ensure cross-platform compatibility.
+reasons. First, external types ensure cross-platform compatibility <a class="footnote-reference" href="#id5" id="id2" name="id2">[1]</a>.
 Second, it forces structures to be aligned on byte boundaries,
 circumventing issues with the
-alignment of packet buffers and field offsets within them.
+alignment of packet buffers and field offsets within them. Metadata fields
+must be nx_structs for when complete packets are forwarded to the serial
+port in order to log traffic.
 For example, the CC1000 radio implementation defines
 its structures in <tt class="docutils literal"><span class="pre">CC1000Msg.h</span></tt>:</p>
 <pre class="literal-block">
@@ -483,7 +475,7 @@ multiple link layers, and so only it can resolve which structures are
 needed. These definitions MUST be in a file in a platform directory
 named <tt class="docutils literal"><span class="pre">platform_message.h</span></tt>. The mica2 platform, for example, has
 two data link layers: the CC1000 radio and the TinyOS serial
-stack <a class="footnote-reference" href="#id4" id="id2" name="id2">[1]</a>. The serial packet format does not have a footer
+stack <a class="footnote-reference" href="#id6" id="id3" name="id3">[2]</a>. The serial packet format does not have a footer
 or metadata section. The <tt class="docutils literal"><span class="pre">platform_message.h</span></tt> of the mica2
 looks like this:</p>
 <pre class="literal-block">
@@ -535,14 +527,16 @@ optimizations.</p>
 <p>Components above the basic data-link layer MUST always access
 packet fields through interfaces.  A component that introduces
 new packet fields SHOULD provide an interface to those that
-are of interest to other components.
-For example, active messages have an interface named <tt class="docutils literal"><span class="pre">AMPacket</span></tt>
+are of interest to other components. These interfaces SHOULD take
+the form of get/set operations that take and return values, rather
+than offsts into the structure.</p>
+<p>For example, active messages have an interface named <tt class="docutils literal"><span class="pre">AMPacket</span></tt>
 which provides access commands to AM fields. In TinyOS 1.x, a
 component would directly access <tt class="docutils literal"><span class="pre">TOS_Msg.addr</span></tt>; in TinyOS 2.x,
 a component calls <tt class="docutils literal"><span class="pre">AMPacket.getAddress(msg)</span></tt>.
 The most basic of these interfaces is Packet, which provides
 access to a packet payload. TEP 116 describes common TinyOS
-packet ADT interfaces <a class="footnote-reference" href="#id5" id="id3" name="id3">[2]</a>.</p>
+packet ADT interfaces <a class="footnote-reference" href="#id7" id="id4" name="id4">[3]</a>.</p>
 <p>Link layer components MAY access packet fields differently than other
 components, as they are aware of the actual packet format. They can
 therefore implement the interfaces that provide access to the fields
@@ -634,7 +628,10 @@ with a command-line option to ncc: <tt class="docutils literal"><span class="pre
 Because this value can be reconfigured, it is possible that two
 different versions of an application can have different MTU sizes.
 If a packet layer receives a packet whose payload size is
-longer than TOSH_DATA_LENGTH, it MUST discard the packet.</p>
+longer than TOSH_DATA_LENGTH, it MUST discard the packet. As
+headers are right justified to the beginning of the data payload,
+the data payloads of all link layers on a platform start
+at the same fixed offset from the beginning of the message buffer.</p>
 </div>
 <div class="section">
 <h2><a id="footer" name="footer">3.3 Footer</a></h2>
@@ -723,16 +720,22 @@ the telos family packet format can be found in
 </div>
 <div class="section">
 <h1><a id="citations" name="citations">6. Citations</a></h1>
-<table class="docutils footnote" frame="void" id="id4" rules="none">
+<table class="docutils footnote" frame="void" id="id5" rules="none">
 <colgroup><col class="label" /><col /></colgroup>
 <tbody valign="top">
-<tr><td class="label"><a class="fn-backref" href="#id2" name="id4">[1]</a></td><td>TEP 113: Serial Communication.</td></tr>
+<tr><td class="label"><a class="fn-backref" href="#id2" name="id5">[1]</a></td><td><a class="reference" href="http://nescc.sourceforge.net">nesC: A Programming Language for Deeply Embedded Networks.</a></td></tr>
 </tbody>
 </table>
-<table class="docutils footnote" frame="void" id="id5" rules="none">
+<table class="docutils footnote" frame="void" id="id6" rules="none">
+<colgroup><col class="label" /><col /></colgroup>
+<tbody valign="top">
+<tr><td class="label"><a class="fn-backref" href="#id3" name="id6">[2]</a></td><td>TEP 113: Serial Communication.</td></tr>
+</tbody>
+</table>
+<table class="docutils footnote" frame="void" id="id7" rules="none">
 <colgroup><col class="label" /><col /></colgroup>
 <tbody valign="top">
-<tr><td class="label"><a class="fn-backref" href="#id3" name="id5">[2]</a></td><td>TEP 116: Packet Protocols.</td></tr>
+<tr><td class="label"><a class="fn-backref" href="#id4" name="id7">[3]</a></td><td>TEP 116: Packet Protocols.</td></tr>
 </tbody>
 </table>
 </div>