On Wed, Jun 4, 2008 at 10:26 AM, 贾鹏 <[EMAIL PROTECTED]> wrote: > Hi there, > I'm scrutinizing the CTP protocol now, especially the CTPForwardingEngine. > I' little confused with the three data structures: queue, pool and cache. > > It seems that once we want to send a packet by the radio, we first dequeue > the packet and put it back to the message pool and look up the cache. > > the pool seems sth like malloc in C, but why we need to put the message back > to the pool when we want to send the message, where this space is allocated > once we use pool, queue, cache, is the buffer(RAM) on the RF chip or > somewhere else.
These buffer spaces are abstractions on top of RAM that is in the CPU. > Could anyone explain how to use these three interface? Pool has a certain number of message buffers. When you want to enqueue a packet, you grab a buffer space from the pool and put your packet content into that space and put a pointer to that buffer into the queue. When you are done with the packet (eg. senddone was called), you want to return that buffer to the pool so that it can be used in the future. So, this is like doing malloc and then dealloc. As you note CtpForwardingEngineP.nc is one place where you can look for an example on how to use these data structures. Another place is apps/tests/TestNetwork/TestNetworkC.nc - om_p _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
