[Tinyos-help] Simple Question on CC2420PacketP Implementation
Ali Shah
caffein at gmail.com
Tue Jan 6 15:21:11 PST 2009
Hi list, CC2420PacketP defines this command:
async command cc2420_header_t * ONE CC2420PacketBody.getHeader( message_t*
ONE msg ) {
return TCAST(cc2420_header_t* ONE, (uint8_t *)msg + offsetof(message_t,
data) - sizeof( cc2420_header_t ));
}
My question is: why use the offsetof() macro when we know where the header
begins as message_t has a field devoted exactly for the message header:
tos/types/message.h:
typedef nx_struct message_t {
nx_uint8_t header[sizeof(message_header_t)];
nx_uint8_t data[TOSH_DATA_LENGTH];
nx_uint8_t footer[sizeof(message_footer_t)];
nx_uint8_t metadata[sizeof(message_metadata_t)];
} message_t;
Thanks,
Ali
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20090106/cd508e40/attachment.htm
More information about the Tinyos-help
mailing list