[Tinyos-devel] Current status of the message buffer discussion
Miklos Maroti
mmaroti at math.u-szeged.hu
Fri May 22 14:43:19 PDT 2009
Dear Eric,
You brought up very good points, and I am very happy that others are
also engaged in the discussion. At this point I am convinced that both
Jan's and my proposals could be made to work. But to really compare
the two approaches we need use cases, very well defined used cases.
Just to start the discussion, let me start with IEEE 802.15.4 link
layer. Here are some options:
------- Option #1 -------
interface Ieee154Send
{
command error_t send64(uint64_t dest, bool ackReq, message_t* msg);
command error_t send16(uint16_t dest, bool ackReq, message_t* msg);
event void sendDone(message_t* msg, error_t error, bool acked);
command void* getPayload(message_t* msg, uint8_t len);
}
interface Ieee154Packet
{
command uint16_t getSource16(message_t* msg);
command uint64_t getSource64(message_t* msg);
command uint16_t getDestination16(message_t* msg);
command uint64_t getDestination64(message_t* msg);
// no set commands as this interface should be used only for
received messages
command void* getPayload(message_t* msg);
command uint8_t getLength(message_t* msg);
}
------- Option #2 -------
enum ieee154_flags
{
IEEE154_ACK_REQ = 1 << 0,
IEEE154_FRAME_PENDING = 1 << 1,
IEEE154_COMPRESS_TO_16BIT = 1 << 2,
};
interface Ieee154Send
{
command error_t send(uint64_t dest, uint8_t flags, message_t* msg,
void* payload, uint8_t length);
event void sendDone(message_t* msg, error_t error, uint8_t flags);
command void* getPayload(message_t* msg, uint8_t len);
command uint8_t getMaxPayload();
}
interface Ieee154Receive
{
event message_t* receive(uint64_t source, message_t* msg, void*
payload, uint8_t length);
}
------- Option #3 -------
#ifdef USE_64BIT_ADDR
typedef uint64_t address_t;
#else
typedef uint16_t address_t;
#endif
interface Ieee154Packet
{
command void format(message_t* msg, uint8_t flags);
command address_t getSource(message_t* msg);
command address_t getDestination(message_t* msg);
command void setSource(message_t* msg, address_t addr);
command void setDestination(message_t* msg, address_t addr);
command void requestAck(message_t* msg, bool ack);
command bool wasAcknowledged(message_t* msg);
command void* payload(message_t* msg);
command uint8_t payloadLength(message_t* msg);
command void setPayloadLength(message_t* msg, uint8_t len);
command uint8_t maxPayloadLength(message_t* msg);
}
interface Send
{
command error_t send(message_t* msg);
event void sendDone(message_t* msg, error_t error);
}
interface Receive
{
event message_t* receive(message_t* msg);
}
Miklos
More information about the Tinyos-devel
mailing list