X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Fchips%2Frf2xx%2Frf230%2FRF230PacketP.nc;h=de875b0240440e0a09773e5fa3c24bf2f8d19ba3;hb=248036f967b45dd8f069bc1de84ee28489ad45ba;hp=45b94bf6d7eee82ae7aa120a05401e98c6818356;hpb=6ffe55d08614a3c92650580514ee29d4a7112e6d;p=tinyos-2.x.git diff --git a/tos/chips/rf2xx/rf230/RF230PacketP.nc b/tos/chips/rf2xx/rf230/RF230PacketP.nc index 45b94bf6..de875b02 100644 --- a/tos/chips/rf2xx/rf230/RF230PacketP.nc +++ b/tos/chips/rf2xx/rf230/RF230PacketP.nc @@ -6,12 +6,12 @@ * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice, the following * two paragraphs and the author appear in all copies of this software. - * + * * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS @@ -24,6 +24,7 @@ #include #include #include +#include module RF230PacketP { @@ -39,6 +40,10 @@ module RF230PacketP interface PacketTimeStamp as PacketTimeStampRadio; interface PacketTimeStamp as PacketTimeStampMilli; + +#ifdef PACKET_LINK + interface PacketData as PacketLinkMetadata; +#endif } uses @@ -54,7 +59,7 @@ implementation { enum { - PACKET_LENGTH_INCREASE = + PACKET_LENGTH_INCREASE = sizeof(rf230packet_header_t) - 1 // the 8-bit length field is not counted + sizeof(ieee154_footer_t), // the CRC is not stored in memory }; @@ -66,19 +71,19 @@ implementation /*----------------- Packet -----------------*/ - command void Packet.clear(message_t* msg) + command void Packet.clear(message_t* msg) { call IEEE154Packet2.createDataFrame(msg); getMeta(msg)->flags = RF230PACKET_CLEAR_METADATA; } - inline command void Packet.setPayloadLength(message_t* msg, uint8_t len) + inline command void Packet.setPayloadLength(message_t* msg, uint8_t len) { call IEEE154Packet2.setLength(msg, len + PACKET_LENGTH_INCREASE); } - inline command uint8_t Packet.payloadLength(message_t* msg) + inline command uint8_t Packet.payloadLength(message_t* msg) { return call IEEE154Packet2.getLength(msg) - PACKET_LENGTH_INCREASE; } @@ -287,4 +292,14 @@ implementation getMeta(msg)->lpl_sleepint = value; #endif } + +/*----------------- PacketLinkMetadata -----------------*/ +#ifdef PACKET_LINK + + async command packet_link_metadata_t* PacketLinkMetadata.getData(message_t* msg) + { + return &(getMeta(msg)->packet_link); + } + +#endif }