[Tinyos-devel] Bug in AM.h in T2 release

Philip Levis pal at cs.stanford.edu
Mon Nov 20 16:52:59 PST 2006


On Nov 20, 2006, at 1:20 PM, Joe Polastre wrote:

> Actually, you could put this in ActiveMesssage as an __attribute((C))
> function and then AM.h could simply use the __attribute((C)) name and
> require that any radio that implements ActiveMessageC (or better yet,
> that a Platform needs to specify its primary radio with
> __attribute((C)) function) needs to include the __attribute((C))
> function.
>
> Personally, I'm lazy and don't want to do:
>
> components ActiveMessageC;
> Impl.AMPacket -> ActiveMessageC;
> uses AMPacket;
> if (call AMPacket.address() == 1) { }
>
> when instead I could just say:
>
> TOS_AM_ADDRESS == 1
>
> for my primary radio which applies to 99.9% of the cases out there.
>
> Then again, the problem that is being abstracted here is one that will
> probably only occur once in my lifetime, so I can just make this
> change for my tree...
>

I think you want to use TOS_NODE_ID, then. Since this is a global  
constant that identifies the node, it can be, well, a global  
constant. This is different than a per-interface data-link  
identifier. By default, the AM address for existing AM  
implementations is the same as the TOS_NODE_ID (the set-mote-id  
script changes both). The difference is that you can change the AM  
address at runtime (e.g.. if you wanted dynamic address assignment)  
but you can't change the TOS_NODE_ID.

Phil


More information about the Tinyos-devel mailing list