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

📄 app.c

📁 nesC语言实现的串口收发程序,用于传感器网络操作系统tinyos1.X.研究传感器网络的朋友们可以看看,功能比较简单,却是经常要用到的!
💻 C
📖 第 1 页 / 共 3 页
字号:
#define dbg(mode, format, ...) ((void)0)#define dbg_clear(mode, format, ...) ((void)0)#define dbg_active(mode) 0# 60 "/usr/local/avr/include/inttypes.h"typedef signed char int8_t;typedef unsigned char uint8_t;# 83 "/usr/local/avr/include/inttypes.h" 3typedef int int16_t;typedef unsigned int uint16_t;typedef long int32_t;typedef unsigned long uint32_t;#line 117typedef long long int64_t;typedef unsigned long long uint64_t;#line 134typedef int16_t intptr_t;typedef uint16_t uintptr_t;# 213 "/usr/local/lib/gcc-lib/avr/3.3-tinyos/include/stddef.h" 3typedef unsigned int size_t;#line 325typedef int wchar_t;# 60 "/usr/local/avr/include/stdlib.h"typedef struct __nesc_unnamed4242 {  int quot;  int rem;} div_t;typedef struct __nesc_unnamed4243 {  long quot;  long rem;} ldiv_t;typedef int (*__compar_fn_t)(const void *, const void *);# 151 "/usr/local/lib/gcc-lib/avr/3.3-tinyos/include/stddef.h" 3typedef int ptrdiff_t;# 85 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/tos.h"typedef unsigned char bool;enum __nesc_unnamed4244 {  FALSE = 0,   TRUE = 1};enum __nesc_unnamed4245 {  FAIL = 0,   SUCCESS = 1};static uint8_t rcombine(uint8_t r1, uint8_t r2);typedef uint8_t  result_t;static result_t rcombine(result_t r1, result_t r2);#line 128enum __nesc_unnamed4246 {  NULL = 0x0};# 81 "/usr/local/avr/include/avr/pgmspace.h"typedef void __attribute((__progmem__)) prog_void;typedef char __attribute((__progmem__)) prog_char;typedef unsigned char __attribute((__progmem__)) prog_uchar;typedef int __attribute((__progmem__)) prog_int;typedef long __attribute((__progmem__)) prog_long;typedef long long __attribute((__progmem__)) prog_long_long;# 124 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/avrmote/avrhardware.h"enum __nesc_unnamed4247 {  TOSH_period16 = 0x00,   TOSH_period32 = 0x01,   TOSH_period64 = 0x02,   TOSH_period128 = 0x03,   TOSH_period256 = 0x04,   TOSH_period512 = 0x05,   TOSH_period1024 = 0x06,   TOSH_period2048 = 0x07};static void TOSH_wait(void);static void TOSH_sleep(void);typedef uint8_t __nesc_atomic_t;__inline __nesc_atomic_t  __nesc_atomic_start(void );__inline void  __nesc_atomic_end(__nesc_atomic_t oldSreg);static __inline void __nesc_enable_interrupt(void);# 116 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/hardware.h"static __inline void TOSH_SET_RED_LED_PIN(void);#line 116static __inline void TOSH_CLR_RED_LED_PIN(void);#line 116static __inline void TOSH_MAKE_RED_LED_OUTPUT(void);static __inline void TOSH_SET_GREEN_LED_PIN(void);#line 117static __inline void TOSH_CLR_GREEN_LED_PIN(void);#line 117static __inline void TOSH_MAKE_GREEN_LED_OUTPUT(void);static __inline void TOSH_SET_YELLOW_LED_PIN(void);#line 118static __inline void TOSH_CLR_YELLOW_LED_PIN(void);#line 118static __inline void TOSH_MAKE_YELLOW_LED_OUTPUT(void);static __inline void TOSH_CLR_SERIAL_ID_PIN(void);#line 120static __inline void TOSH_MAKE_SERIAL_ID_INPUT(void);static __inline void TOSH_MAKE_CC_CHP_OUT_INPUT(void);static __inline void TOSH_MAKE_CC_PDATA_OUTPUT(void);static __inline void TOSH_MAKE_CC_PCLK_OUTPUT(void);static __inline void TOSH_MAKE_CC_PALE_OUTPUT(void);static __inline void TOSH_SET_FLASH_SELECT_PIN(void);#line 131static __inline void TOSH_MAKE_FLASH_SELECT_OUTPUT(void);static __inline void TOSH_MAKE_FLASH_CLK_OUTPUT(void);static __inline void TOSH_MAKE_FLASH_OUT_OUTPUT(void);static __inline void TOSH_MAKE_MISO_INPUT(void);static __inline void TOSH_MAKE_SPI_OC1C_INPUT(void);static __inline void TOSH_MAKE_PW0_OUTPUT(void);static __inline void TOSH_MAKE_PW1_OUTPUT(void);static __inline void TOSH_MAKE_PW2_OUTPUT(void);static __inline void TOSH_MAKE_PW3_OUTPUT(void);static __inline void TOSH_MAKE_PW4_OUTPUT(void);static __inline void TOSH_MAKE_PW5_OUTPUT(void);static __inline void TOSH_MAKE_PW6_OUTPUT(void);static __inline void TOSH_MAKE_PW7_OUTPUT(void);static #line 171void TOSH_SET_PIN_DIRECTIONS(void );#line 215enum __nesc_unnamed4248 {  TOSH_ADC_PORTMAPSIZE = 12};enum __nesc_unnamed4249 {  TOSH_ACTUAL_CC_RSSI_PORT = 0,   TOSH_ACTUAL_VOLTAGE_PORT = 7,   TOSH_ACTUAL_BANDGAP_PORT = 30,   TOSH_ACTUAL_GND_PORT = 31};enum __nesc_unnamed4250 {  TOS_ADC_CC_RSSI_PORT = 0,   TOS_ADC_VOLTAGE_PORT = 7,   TOS_ADC_BANDGAP_PORT = 10,   TOS_ADC_GND_PORT = 11};# 54 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/types/dbg_modes.h"typedef long long TOS_dbg_mode;enum __nesc_unnamed4251 {  DBG_ALL = ~0ULL,   DBG_BOOT = 1ULL << 0,   DBG_CLOCK = 1ULL << 1,   DBG_TASK = 1ULL << 2,   DBG_SCHED = 1ULL << 3,   DBG_SENSOR = 1ULL << 4,   DBG_LED = 1ULL << 5,   DBG_CRYPTO = 1ULL << 6,   DBG_ROUTE = 1ULL << 7,   DBG_AM = 1ULL << 8,   DBG_CRC = 1ULL << 9,   DBG_PACKET = 1ULL << 10,   DBG_ENCODE = 1ULL << 11,   DBG_RADIO = 1ULL << 12,   DBG_LOG = 1ULL << 13,   DBG_ADC = 1ULL << 14,   DBG_I2C = 1ULL << 15,   DBG_UART = 1ULL << 16,   DBG_PROG = 1ULL << 17,   DBG_SOUNDER = 1ULL << 18,   DBG_TIME = 1ULL << 19,   DBG_SIM = 1ULL << 21,   DBG_QUEUE = 1ULL << 22,   DBG_SIMRADIO = 1ULL << 23,   DBG_HARD = 1ULL << 24,   DBG_MEM = 1ULL << 25,   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};# 59 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/sched.c"typedef struct __nesc_unnamed4252 {  void (*tp)(void);} TOSH_sched_entry_T;enum __nesc_unnamed4253 {  TOSH_MAX_TASKS = 8,   TOSH_TASK_BITMASK = TOSH_MAX_TASKS - 1};TOSH_sched_entry_T TOSH_queue[TOSH_MAX_TASKS];volatile uint8_t TOSH_sched_full;volatile uint8_t TOSH_sched_free;static void TOSH_wait(void );static void TOSH_sleep(void );static void TOSH_sched_init(void );#line 98bool  TOS_post(void (*tp)(void));static #line 139bool TOSH_run_next_task(void);static #line 162void TOSH_run_task(void);# 39 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Timer.h"enum __nesc_unnamed4254 {  TIMER_REPEAT = 0,   TIMER_ONE_SHOT = 1,   NUM_TIMERS = 1};# 33 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica128/Clock.h"enum __nesc_unnamed4255 {  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_unnamed4256 {  DEFAULT_SCALE = 3, DEFAULT_INTERVAL = 127};static  result_t PotM$Pot$init(uint8_t arg_0xa2c6160);static  result_t HPLPotC$Pot$finalise(void);static  result_t HPLPotC$Pot$decrease(void);static  result_t HPLPotC$Pot$increase(void);static  result_t HPLInit$init(void);static   result_t HPLUART0M$UART$init(void);static   result_t HPLUART0M$UART$put(uint8_t arg_0xa2fe700);static   result_t UartUserM$HPLUART$get(uint8_t arg_0xa2fec00);static   result_t UartUserM$HPLUART$putDone(void);static  result_t UartUserM$StdControl$init(void);static  result_t UartUserM$StdControl$start(void);static  result_t UartUserM$Timer$fired(void);static   result_t TimerM$Clock$fire(void);static  result_t TimerM$StdControl$init(void);static  result_t TimerM$StdControl$start(void);static  result_t TimerM$Timer$default$fired(uint8_t arg_0xa333408);static  result_t TimerM$Timer$start(uint8_t arg_0xa333408, char arg_0xa321950, uint32_t arg_0xa321aa8);static   void HPLClock$Clock$setInterval(uint8_t arg_0xa351778);static   result_t HPLClock$Clock$setRate(char arg_0xa350c78, char arg_0xa350db8);static   uint8_t HPLPowerManagementM$PowerManagement$adjustPower(void);static   result_t LedsC$Leds$yellowOff(void);static   result_t LedsC$Leds$yellowOn(void);static   result_t LedsC$Leds$greenOff(void);static   result_t LedsC$Leds$redOff(void);static   result_t LedsC$Leds$greenToggle(void);static   result_t LedsC$Leds$yellowToggle(void);static   result_t LedsC$Leds$redToggle(void);static   result_t LedsC$Leds$redOn(void);static   result_t LedsC$Leds$greenOn(void);static  # 47 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/RealMain.nc"result_t RealMain$hardwareInit(void);static  # 78 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Pot.nc"result_t RealMain$Pot$init(uint8_t arg_0xa2c6160);static  # 63 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/StdControl.nc"result_t RealMain$StdControl$init(void);static  result_t RealMain$StdControl$start(void);# 54 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/RealMain.nc"int   main(void);static  # 74 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/HPLPot.nc"result_t PotM$HPLPot$finalise(void);static  #line 59result_t PotM$HPLPot$decrease(void);static  result_t PotM$HPLPot$increase(void);# 91 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/PotM.nc"uint8_t PotM$potSetting;static void PotM$setPot(uint8_t value);static  #line 106result_t PotM$Pot$init(uint8_t initialSetting);static  # 57 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLPotC.nc"result_t HPLPotC$Pot$decrease(void);static  result_t HPLPotC$Pot$increase(void);static  result_t HPLPotC$Pot$finalise(void);static  # 57 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/avrmote/HPLInit.nc"result_t HPLInit$init(void);static   # 88 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/HPLUART.nc"result_t HPLUART0M$UART$get(uint8_t arg_0xa2fec00);static   result_t HPLUART0M$UART$putDone(void);static   # 60 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLUART0M.nc"result_t HPLUART0M$UART$init(void);#line 90void __attribute((signal))   __vector_18(void);void __attribute((interrupt))   __vector_20(void);static   result_t HPLUART0M$UART$put(uint8_t data);static   # 62 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/HPLUART.nc"result_t UartUserM$HPLUART$init(void);static   #line 80result_t UartUserM$HPLUART$put(uint8_t arg_0xa2fe700);static   # 106 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Leds.nc"result_t UartUserM$Leds$greenToggle(void);static   #line 131result_t UartUserM$Leds$yellowToggle(void);static   #line 81result_t UartUserM$Leds$redToggle(void);static  # 59 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Timer.nc"result_t UartUserM$Timer$start(char arg_0xa321950, uint32_t arg_0xa321aa8);# 42 "UartUserM.nc"uint8_t UartUserM$cnt;uint8_t UartUserM$S_Data;uint8_t UartUserM$S_Cnt;static  result_t UartUserM$StdControl$init(void);static  result_t UartUserM$StdControl$start(void);static  result_t UartUserM$Timer$fired(void);static   #line 83result_t UartUserM$HPLUART$get(uint8_t data);static   #line 98result_t UartUserM$HPLUART$putDone(void);static   # 41 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/PowerManagement.nc"uint8_t TimerM$PowerManagement$adjustPower(void);static   # 105 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Clock.nc"void TimerM$Clock$setInterval(uint8_t arg_0xa351778);static   #line 96result_t TimerM$Clock$setRate(char arg_0xa350c78, char arg_0xa350db8);static  # 73 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Timer.nc"result_t TimerM$Timer$fired(# 45 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/TimerM.nc"uint8_t arg_0xa333408);uint32_t TimerM$mState;uint8_t TimerM$setIntervalFlag;uint8_t TimerM$mScale;#line 57uint8_t TimerM$mInterval;int8_t TimerM$queue_head;int8_t TimerM$queue_tail;uint8_t TimerM$queue_size;uint8_t TimerM$queue[NUM_TIMERS];struct TimerM$timer_s {  uint8_t type;  int32_t ticks;  int32_t ticksLeft;} TimerM$mTimerList[NUM_TIMERS];enum TimerM$__nesc_unnamed4257 {  TimerM$maxTimerInterval = 230};static  result_t TimerM$StdControl$init(void);static  result_t TimerM$StdControl$start(void);static  result_t TimerM$Timer$start(uint8_t id, char type, uint32_t interval);#line 116static void TimerM$adjustInterval(void);static   #line 154result_t TimerM$Timer$default$fired(uint8_t id);static void TimerM$enqueue(uint8_t value);static uint8_t TimerM$dequeue(void);static  void TimerM$signalOneTimer(void);static  void TimerM$HandleFire(void);static   #line 204result_t TimerM$Clock$fire(void);static   # 180 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Clock.nc"result_t HPLClock$Clock$fire(void);# 54 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica/HPLClock.nc"uint8_t HPLClock$set_flag;uint8_t HPLClock$mscale;#line 55uint8_t HPLClock$nextScale;#line 55uint8_t HPLClock$minterval;static   #line 87void HPLClock$Clock$setInterval(uint8_t value);static   #line 149result_t HPLClock$Clock$setRate(char interval, char scale);#line 167void __attribute((interrupt))   __vector_15(void);# 51 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLPowerManagementM.nc"bool HPLPowerManagementM$disabled = TRUE;enum HPLPowerManagementM$__nesc_unnamed4258 {  HPLPowerManagementM$IDLE = 0,   HPLPowerManagementM$ADC_NR = 1 << 3,   HPLPowerManagementM$POWER_DOWN = 1 << 4,   HPLPowerManagementM$POWER_SAVE = (1 << 3) + (1 << 4),   HPLPowerManagementM$STANDBY = (1 << 2) + (1 << 4),   HPLPowerManagementM$EXT_STANDBY = (1 << 3) + (1 << 4) + (1 << 2)};static uint8_t HPLPowerManagementM$getPowerLevel(void);static  #line 84void HPLPowerManagementM$doAdjustment(void);static   #line 101uint8_t HPLPowerManagementM$PowerManagement$adjustPower(void);# 50 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/LedsC.nc"uint8_t LedsC$ledsOn;enum LedsC$__nesc_unnamed4259 {  LedsC$RED_BIT = 1,   LedsC$GREEN_BIT = 2,   LedsC$YELLOW_BIT = 4};static   #line 69result_t LedsC$Leds$redOn(void);static   result_t LedsC$Leds$redOff(void);static   result_t LedsC$Leds$redToggle(void);static   result_t LedsC$Leds$greenOn(void);static   result_t LedsC$Leds$greenOff(void);static   result_t LedsC$Leds$greenToggle(void);static   result_t LedsC$Leds$yellowOn(void);static   result_t LedsC$Leds$yellowOff(void);static   result_t LedsC$Leds$yellowToggle(void);# 153 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/avrmote/avrhardware.h"__inline __nesc_atomic_t  __nesc_atomic_start(void ){  __nesc_atomic_t result = * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x3F + 0x20);

⌨️ 快捷键说明

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