(file) Return to AM_emstar.h CVS log (file) Jump to this file's LXR Page (dir) Up to [CENS] / tos-contrib / include

File: [CENS] / tos-contrib / include / AM_emstar.h (download) / (as text)
Revision: 1.13, Thu Dec 14 01:04:27 2006 UTC (2 years, 11 months ago) by girod
Branch: MAIN
CVS Tags: pregeonet, PRE_64BIT, HEAD, CYCLOPS_RELEASE_CANDIDATE_2_0, CYCLOPS_PRERELEASE_STABLE, CENTROUTE_EMSTAR_SOCKETS, AMARSS_JR_DEPLOYMENT_6_05_07
Changes since 1.12: +8 -0 lines
***PROTOCOL CHANGE***

fixes long-standing problem with tosnic that would lock up when a bogus
packet was sent to the mote

Also fixes a problem in which an extra byte was needed on the end of the
receive buffer in framer.  Note, two extra bytes are still needed, for
CRC.

#ifndef AM_EMSTAR_H
#define AM_EMSTAR_H

enum {
  TOS_MSG_TYPE_DEFAULT = 0,
  TOS_MSG_TYPE_CC2420 = 1,
  TOS_MSG_TYPE_EYES = 2
};

/*
  The mother of all TOS_Msg's. This is effectively a union of all fields in the
  default, cc2420, and eyes TOS_Msgs and is designed to be used with emstar
  and EmstarBase. EmstarBase has platform-specific components for translating
  between this structure and the mote-specific structures. Use the TOSMsgTranslate
  interface.
 */
typedef struct TOS_Msg_emstar_hdr {
  uint8_t tosMsgType;            // currently, DEFAULT, CC2420, or EYES           
  uint8_t type;                  // DEFAULT Y u8  , CC2420 Y u8  , EYES Y u8
  uint8_t group;                 // DEFAULT Y u8  , CC2420 Y u8  , EYES Y u8
  uint8_t length;                // DEFAULT Y u8  , CC2420 Y u8  , EYES Y u8
  uint16_t addr;                 // DEFAULT Y u16 , CC2420 Y u16 , EYES Y u16
  //uint16_t s_addr;               //               ,              , EYES Y u16
  uint8_t fcfhi;                 //               , CC2420 Y u8  ,
  uint8_t fcflo;                 //               , CC2420 Y u8  ,
  uint8_t dsn;                   //               , CC2420 Y u8  ,
  uint8_t ack;                   // DEFAULT N u8  , CC2420 N b   , EYES N u8
  uint16_t crc;                  // DEFAULT Y u16 , CC2420 N b   , EYES Y u16
  uint16_t strength;             // DEFAULT N u16 , CC2420 N u8  , EYES N u16
  uint8_t sendSecurityMode;      // DEFAULT N u8  ,              ,
  uint8_t receiveSecurityMode;   // DEFAULT N u8  ,              ,
  uint16_t destpan;              //               , CC2420 Y u16 ,
  uint8_t lqi;                   //               , CC2420 N u8  ,
  uint8_t seq_num;               //               ,              ,  EYES Y u8
  uint16_t time;                 // DEFAULT N u16 , CC2420 Y u16 , 
  //uint32_t time_s;               //               ,              ,  EYES N u32
  //uint32_t time_ms;              //               ,              ,  EYES N u32
  uint8_t retx_req;              // *** control field for emstarbase, causes N retx on ACK fail
  uint8_t reserved;              // for telos alignment
  int8_t data[0];
} __attribute__ ((packed)) TOS_Msg_emstar_hdr_t;

typedef struct TOS_Msg_emstar {
  TOS_Msg_emstar_hdr_t hdr;
  int8_t data[TOSH_DATA_LENGTH];
} __attribute__ ((packed)) TOS_Msg_emstar_t;

enum {
  SEND_DONE_SUCCESS = 0,
  SEND_DONE_FAILED_TRANSMISSION = 0x01,
  SEND_DONE_UNKNOWN_SEQUENCE_NUMBER = 0x02
};

typedef struct send_done_msg_s {
  uint8_t seqno;
  uint8_t result;
} __attribute__ ((packed)) send_done_msg_t;


/*
 *   TOSnic Serial Link headers
 */

struct tosnic_emstar_encap {
  uint8_t emstar_type;
  uint16_t src_if;
  uint8_t data[0];
} __attribute__ ((packed));

struct tosnic_serial_encap {
  uint8_t type;
  uint8_t seqno;
  uint8_t data[0];
} __attribute__ ((packed));

enum serial_priorities {
  TOSNIC_PRIORITY_URGENT,
  TOSNIC_PRIORITY_HIGH,
  TOSNIC_PRIORITY_MEDIUM,
  TOSNIC_PRIORITY_LOW,
  TOSNIC_PRIORITY_NICE
};

enum ack_types {
  TOSNIC_ACK_NACK       = 0,  /* receive failed, please resend */
  TOSNIC_ACK_ACK        = 1,  /* receive OK */
  TOSNIC_ACK_NO_HANDLER = 2   /* receive OK, but no handler present */
};

enum serial_types {
  TOSNIC_ACK_PACKET = 0,
  TOSNIC_DATA_PACKET,
  TOSNIC_SEND_DONE_PACKET,
  TOSNIC_CONF_PACKET,
  TOSNIC_STATUS_PACKET,
  TOSNIC_DEBUG_PACKET,
  TOSNIC_UNKNOWN_PACKET,
  TOSNIC_CYCLOPS_PACKET,
  TOSNIC_SET_LED,
  TOSNIC_ENSBOX_PACKET
};

enum serial_flags {
  TOSNIC_ACK_REQUESTED = 0x10,
  TOSNIC_TYPE_MASK = 0xF,
};

#define TOSNIC_TYPE(type) (type & TOSNIC_TYPE_MASK)
#define TOSNIC_ACK_REQ(type) (type & TOSNIC_ACK_REQUESTED) 

// LOCATIONS OF MOTE-SPECIFIC TOS_Msg DEFINITIONS


// DEFAULT
// ./tos/types/AM.h
// ./beta/I2C/types/AM.h
// ./contrib/prime/tos/system/AM.h


// CC2420
// ./beta/platform/imote2/AM.h
// ./contrib/xbow/beta/tos/platform/micazack/AM.h
// ./tos/platform/micaz/AM.h
// ./tos/platform/telos/AM.h

// EYES
// ./contrib/eyes/platform/eyesIFX/AM.h
// ./contrib/eyes/platform/eyesIFXv2/AM.h


#endif

CENS CVS Mailing List
Powered by
ViewCVS 0.9.2