⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 app.c

📁 这是在tinyos中用nesC语言编程示例
💻 C
📖 第 1 页 / 共 5 页
字号:
  DBG_USR1 = 1ULL << 27,   DBG_USR2 = 1ULL << 28,   DBG_USR3 = 1ULL << 29,   DBG_TEMP = 1ULL << 30,   DBG_ERROR = 1ULL << 31,   DBG_NONE = 0,   DBG_DEFAULT = DBG_ALL};# 41 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\system\\sched.c"#line 39typedef struct __nesc_unnamed4252 {  void (*tp)(void);} TOSH_sched_entry_T;enum __nesc_unnamed4253 {  TOSH_MAX_TASKS = 32,   TOSH_TASK_BITMASK = TOSH_MAX_TASKS - 1};volatile TOSH_sched_entry_T TOSH_queue[TOSH_MAX_TASKS];uint8_t TOSH_sched_full;volatile uint8_t TOSH_sched_free;static inline void TOSH_sched_init(void );bool TOS_post(void (*tp)(void));#line 82bool TOS_post(void (*tp)(void))  ;#line 116static inline bool TOSH_run_next_task(void);#line 139static inline void TOSH_run_task(void);# 14 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\system\\Ident.h"enum __nesc_unnamed4254 {  IDENT_MAX_PROGRAM_NAME_LENGTH = 17};#line 19typedef struct __nesc_unnamed4255 {  uint32_t unix_time;  uint32_t user_hash;  char program_name[IDENT_MAX_PROGRAM_NAME_LENGTH];} Ident_t;# 17 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\apps\\tutorials\\lesson_4\\sensorboardApp.h"static __inline void TOSH_SET_PHOTO_CTL_PIN(void);#line 17static __inline void TOSH_CLR_PHOTO_CTL_PIN(void);#line 17static __inline void TOSH_MAKE_PHOTO_CTL_OUTPUT(void);static __inline void TOSH_CLR_TEMP_CTL_PIN(void);#line 18static __inline void TOSH_MAKE_TEMP_CTL_INPUT(void);enum __nesc_unnamed4256 {  TOSH_ACTUAL_PHOTO_PORT = 1,   TOSH_ACTUAL_TEMP_PORT = 1};enum __nesc_unnamed4257 {  TOS_ADC_PHOTO_PORT = 1,   TOS_ADC_TEMP_PORT = 2};#line 51#line 38typedef struct XDataMsg {  uint8_t board_id;  uint8_t packet_id;  uint16_t parent;  uint16_t vref;  uint16_t thermistor;  uint16_t light;  uint16_t mic;  uint16_t accelX;  uint16_t accelY;  uint16_t magX;  uint16_t magY;} __attribute((packed))  XDataMsg;enum __nesc_unnamed4258 {  BATT_PORT = 7};enum __nesc_unnamed4259 {  AM_XDEBUG_MSG = 49,   AM_XSENSOR_MSG = 50,   AM_XMULTIHOP_MSG = 51};# 89 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\radio\\rf230\\AM.h"enum __nesc_unnamed4260 {  TOS_BCAST_ADDR = 0xffff,   TOS_UART_ADDR = 0x007e};enum __nesc_unnamed4261 {  TOS_DEFAULT_AM_GROUP = 0x7d};uint8_t TOS_AM_GROUP = TOS_DEFAULT_AM_GROUP;#line 156#line 132typedef struct TOS_Msg {  uint8_t length;  uint8_t fcfhi;  uint8_t fcflo;  uint8_t dsn;  uint16_t destpan;  uint16_t addr;  uint8_t type;  uint8_t group;  int8_t data[29 + 3];  uint8_t strength;  uint8_t lqi;  bool crc;  uint8_t ack;  uint16_t time;} TOS_Msg;#line 158typedef struct TinySec_Msg {  uint8_t invalid;} TinySec_Msg;#line 163typedef struct Ack_Msg {  uint8_t length;  uint8_t fcfhi;  uint8_t fcflo;  uint8_t dsn;  uint8_t fcshi;  uint8_t fcslo;} Ack_Msg;enum __nesc_unnamed4262 {  MSG_HEADER_SIZE = (size_t )& ((struct TOS_Msg *)0)->data - 1,   MSG_FOOTER_SIZE = 2,   MSG_DATA_SIZE = (size_t )& ((struct TOS_Msg *)0)->strength + sizeof(uint16_t ),   DATA_LENGTH = 29,   LENGTH_BYTE_NUMBER = (size_t )& ((struct TOS_Msg *)0)->length + 1,   TOS_HEADER_SIZE = 5};typedef TOS_Msg *TOS_MsgPtr;# 18 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\interfaces\\Timer.h"enum __nesc_unnamed4263 {  TIMER_REPEAT = 0,   TIMER_ONE_SHOT = 1,   NUM_TIMERS = 14U};# 19 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\radio\\rf230\\byteorder.h"static __inline int is_host_lsb(void);static __inline uint16_t toLSB16(uint16_t a);static __inline uint16_t fromLSB16(uint16_t a);# 11 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\platform\\atm1281\\HPLTimer1.h"enum __nesc_unnamed4264 {  TCLK_CPU_OFF = 0,   TCLK_CPU_DIV1 = 1,   TCLK_CPU_DIV8 = 2,   TCLK_CPU_DIV64 = 3,   TCLK_CPU_DIV256 = 4,   TCLK_CPU_DIV1024 = 5};enum __nesc_unnamed4265 {  TIMER1_DEFAULT_SCALE = TCLK_CPU_DIV64,   TIMER1_DEFAULT_INTERVAL = 255};# 13 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\platform\\atm1281\\Clock.h"enum __nesc_unnamed4266 {  TOS_I1000PS = 32, TOS_S1000PS = 1,   TOS_I100PS = 40, TOS_S100PS = 2,   TOS_I10PS = 101, TOS_S10PS = 3,   TOS_I1024PS = 0, TOS_S1024PS = 3,   TOS_I512PS = 1, TOS_S512PS = 3,   TOS_I256PS = 3, TOS_S256PS = 3,   TOS_I128PS = 7, TOS_S128PS = 3,   TOS_I64PS = 15, TOS_S64PS = 3,   TOS_I32PS = 31, TOS_S32PS = 3,   TOS_I16PS = 63, TOS_S16PS = 3,   TOS_I8PS = 127, TOS_S8PS = 3,   TOS_I4PS = 255, TOS_S4PS = 3,   TOS_I2PS = 15, TOS_S2PS = 7,   TOS_I1PS = 31, TOS_S1PS = 7,   TOS_I0PS = 0, TOS_S0PS = 0};enum __nesc_unnamed4267 {  DEFAULT_SCALE = 3, DEFAULT_INTERVAL = 127};# 12 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\platform\\atm1281\\crc.h"uint16_t crcTable[256] __attribute((__progmem__))  = { 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 };static inline uint16_t crcByte(uint16_t oldCrc, uint8_t byte);# 19 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\types\\MultiHop.h"#line 13typedef struct MultihopMsg {  uint16_t sourceaddr;  uint16_t originaddr;  int16_t seqno;  uint8_t socket;  uint8_t data[29 - 7];} __attribute((packed))  TOS_MHopMsg;#line 21typedef struct ACKMsg {  uint16_t source;  uint8_t type;} __attribute((packed))  ACK_Msg;enum __nesc_unnamed4268 {  NBRFLAG_VALID = 0x01,   NBRFLAG_NEW = 0x02,   NBRFLAG_EST_INIT = 0x04,   NBRFLAG_EST_SLEEP = 0x08,   NBRFLAG_EST_HOLD = 0x10};enum __nesc_unnamed4269 {  MODE_UPSTREAM,   MODE_UPSTREAM_ACK,   MODE_DOWNSTREAM,   MODE_DOWNSTREAM_ACK,   MODE_ANY2ANY,   MODE_ONE_HOP_BROADCAST};enum __nesc_unnamed4270 {  RS_RESENT = 0x01,   RS_FORCE_MONITOR = 0x02,   RS_UPDATE_DSCTBL = 0x04,   RS_SEARCH_DSCTBL = 0x08};#line 79enum __nesc_unnamed4271 {  BASE_STATION_ADDRESS = 0,   ROUTE_TABLE_SIZE = 15,   ESTIMATE_TO_ROUTE_RATIO = 5,   ACCEPTABLE_MISSED = -20,   DESCENDANT_TABLE_SIZE = 50,   SWITCH_THRESHOLD = 384,   MAX_ALLOWABLE_LINK_COST = 256 * 6,   LIVELINESS = 2,   MAX_DESCENDANT = 5,   MAX_RETRY = 8};uint8_t NBR_ADVERT_THRESHOLD = 100;uint32_t TOS_ROUTE_UPDATE = 36000u;#line 155enum __nesc_unnamed4272 {  ROUTE_INVALID = 0xff};enum __nesc_unnamed4273 {  FWD_QUEUE_SIZE = 8};enum __nesc_unnamed4274 {  UPSTREAM,   DOWNSTREAM};enum __nesc_unnamed4275 {  HIGHPOWER,   LOWPOWER};enum __nesc_unnamed4276 {  LitPathOff,   LitPathOn,   LitPathOtap};#line 179typedef struct RPEstEntry {  uint16_t id;  uint8_t receiveEst;} __attribute((packed))  RPEstEntry;#line 184typedef struct RoutePacket {  uint16_t parent;  uint16_t cost;  uint8_t estEntries;  RPEstEntry estList[0];} __attribute((packed))  RoutePacket;#line 220#line 207typedef struct TableEntry {  uint16_t id;  uint16_t parent;  uint16_t cost;  uint8_t childLiveliness;  uint16_t missed;  uint16_t received;  int16_t lastSeqno;  uint8_t flags;  uint8_t liveliness;  uint8_t hop;  uint8_t receiveEst;  uint8_t sendEst;} __attribute((packed))  TableEntry;#line 222typedef struct __nesc_unnamed4277 {  uint16_t origin;  uint16_t from;} __attribute((packed))  DescendantTbl;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -