X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Fchips%2Fcc2420%2FCC2420.h;h=d554f2d92a21aeabdfaa1029ee3a544ab44836d3;hb=815ef3b081a7a86619e82be995eddae5c907b46a;hp=bdaefd6b4c5b6cf92a15ad04c0d8ad54af929556;hpb=d99e9e4b31b1b6459b3811a5257a0c00821ab314;p=tinyos-2.x.git diff --git a/tos/chips/cc2420/CC2420.h b/tos/chips/cc2420/CC2420.h index bdaefd6b..d554f2d9 100644 --- a/tos/chips/cc2420/CC2420.h +++ b/tos/chips/cc2420/CC2420.h @@ -38,10 +38,14 @@ typedef uint8_t cc2420_status_t; -#ifndef TFRAMES_ENABLED +#if !defined(TFRAMES_ENABLED) && !defined(IEEE154FRAMES_ENABLED) #define CC2420_IFRAME_TYPE #endif +#if defined(TFRAMES_ENABLED) && defined(IEEE154FRAMES_ENABLED) +#error "Both TFRAMES and IEEE154FRAMES enabled!" +#endif + /** * CC2420 header definition. * @@ -99,20 +103,21 @@ typedef nx_struct cc2420_header_t { nxle_uint16_t destpan; nxle_uint16_t dest; nxle_uint16_t src; - -#ifdef CC2420_HW_SECURITY - security_header_t secHdr; -#endif + /** CC2420 802.15.4 header ends here */ - /** I-Frame 6LowPAN interoperability byte */ #ifdef CC2420_IFRAME_TYPE + /** I-Frame 6LowPAN interoperability byte */ nxle_uint8_t network; #endif -#ifndef TINYOS_IP +#if defined(TFRAMES_ENABLED) || defined(CC2420_IFRAME_TYPE) nxle_uint8_t type; #endif +#ifdef CC2420_HW_SECURITY + security_header_t secHdr; +#endif + } cc2420_header_t; /** @@ -143,7 +148,6 @@ typedef nx_struct cc2420_metadata_t { nx_uint16_t maxRetries; nx_uint16_t retryDelay; #endif - } cc2420_metadata_t; @@ -180,7 +184,6 @@ typedef nx_struct cc2420_packet_t { #define TINYOS_6LOWPAN_NETWORK_ID 0x3f #endif - enum { // size of the header not including the length byte MAC_HEADER_SIZE = sizeof( cc2420_header_t ) - 1, @@ -189,9 +192,20 @@ enum { // MDU MAC_PACKET_SIZE = MAC_HEADER_SIZE + TOSH_DATA_LENGTH + MAC_FOOTER_SIZE, - CC2420_SIZE = MAC_HEADER_SIZE + MAC_FOOTER_SIZE, + AM_OVERHEAD = 0 +#if defined(TFRAMES_ENABLED) || defined(CC2420_IFRAME_TYPE) + + 1 // add one for the AM byte +#if defined(CC2420_IFRAME_TYPE) + + 1 // and one for the network byte +#endif +#endif + , + + CC2420_SIZE = MAC_HEADER_SIZE + MAC_FOOTER_SIZE - AM_OVERHEAD, }; +#define CC2420_PAYLOAD(mbuf) (((uint8_t *)(mbuf)->data) - AM_OVERHEAD) + enum cc2420_enums { CC2420_TIME_ACK_TURNAROUND = 7, // jiffies CC2420_TIME_VREN = 20, // jiffies