app.c

来自「tinyos最新版」· C语言 代码 · 共 1,975 行 · 第 1/3 页

C
1,975
字号
result_t LedsC$Leds$redOff(void);static inline   result_t LedsC$Leds$redToggle(void);# 101 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica/hardware.h"static __inline void TOSH_SET_ONE_WIRE_PIN(void)#line 101{#line 101  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x03 + 0x20) |= 1 << 5;}#line 101static __inline void TOSH_MAKE_ONE_WIRE_INPUT(void)#line 101{#line 101  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x02 + 0x20) &= ~(1 << 5);}#line 65static __inline void TOSH_SET_BOOST_ENABLE_PIN(void)#line 65{#line 65  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x03 + 0x20) |= 1 << 4;}#line 65static __inline void TOSH_MAKE_BOOST_ENABLE_OUTPUT(void)#line 65{#line 65  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x02 + 0x20) |= 1 << 4;}#line 67static __inline void TOSH_MAKE_FLASH_SELECT_INPUT(void)#line 67{#line 67  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x17 + 0x20) &= ~(1 << 0);}#line 64static __inline void TOSH_SET_POT_POWER_PIN(void)#line 64{#line 64  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x03 + 0x20) |= 1 << 7;}static __inline void TOSH_MAKE_RFM_TXD_OUTPUT(void)#line 77{#line 77  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x17 + 0x20) |= 1 << 3;}#line 79static __inline void TOSH_MAKE_RFM_CTL1_OUTPUT(void)#line 79{#line 79  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x11 + 0x20) |= 1 << 6;}#line 78static __inline void TOSH_MAKE_RFM_CTL0_OUTPUT(void)#line 78{#line 78  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x11 + 0x20) |= 1 << 7;}static __inline void TOSH_MAKE_PW0_OUTPUT(void)#line 81{#line 81  ;}#line 82static __inline void TOSH_MAKE_PW1_OUTPUT(void)#line 82{#line 82  ;}#line 83static __inline void TOSH_MAKE_PW2_OUTPUT(void)#line 83{#line 83  ;}#line 84static __inline void TOSH_MAKE_PW3_OUTPUT(void)#line 84{#line 84  ;}#line 85static __inline void TOSH_MAKE_PW4_OUTPUT(void)#line 85{#line 85  ;}#line 86static __inline void TOSH_MAKE_PW5_OUTPUT(void)#line 86{#line 86  ;}#line 87static __inline void TOSH_MAKE_PW6_OUTPUT(void)#line 87{#line 87  ;}#line 88static __inline void TOSH_MAKE_PW7_OUTPUT(void)#line 88{#line 88  ;}#line 64static __inline void TOSH_MAKE_POT_POWER_OUTPUT(void)#line 64{#line 64  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x02 + 0x20) |= 1 << 7;}#line 63static __inline void TOSH_MAKE_POT_SELECT_OUTPUT(void)#line 63{#line 63  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x11 + 0x20) |= 1 << 5;}static inline #line 103void TOSH_SET_PIN_DIRECTIONS(void ){  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1A + 0x20) = 0x00;  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x17 + 0x20) = 0x00;  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x11 + 0x20) = 0x00;  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x02 + 0x20) = 0x02;  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x03 + 0x20) = 0x02;  TOSH_MAKE_POT_SELECT_OUTPUT();  TOSH_MAKE_POT_POWER_OUTPUT();  TOSH_MAKE_PW7_OUTPUT();  TOSH_MAKE_PW6_OUTPUT();  TOSH_MAKE_PW5_OUTPUT();  TOSH_MAKE_PW4_OUTPUT();  TOSH_MAKE_PW3_OUTPUT();  TOSH_MAKE_PW2_OUTPUT();  TOSH_MAKE_PW1_OUTPUT();  TOSH_MAKE_PW0_OUTPUT();  TOSH_MAKE_RFM_CTL0_OUTPUT();  TOSH_MAKE_RFM_CTL1_OUTPUT();  TOSH_MAKE_RFM_TXD_OUTPUT();  TOSH_SET_POT_POWER_PIN();  TOSH_MAKE_FLASH_SELECT_INPUT();  TOSH_MAKE_BOOST_ENABLE_OUTPUT();  TOSH_SET_BOOST_ENABLE_PIN();  TOSH_MAKE_ONE_WIRE_INPUT();  TOSH_SET_ONE_WIRE_PIN();}static inline  # 57 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/avrmote/HPLInit.nc"result_t HPLInit$init(void)#line 57{  TOSH_SET_PIN_DIRECTIONS();  return SUCCESS;}# 47 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/system/RealMain.nc"inline static  result_t RealMain$hardwareInit(void){#line 47  unsigned char result;#line 47#line 47  result = HPLInit$init();#line 47#line 47  return result;#line 47}#line 47# 62 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica/hardware.h"static __inline void TOSH_SET_INC_PIN(void)#line 62{#line 62  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) |= 1 << 2;}#line 61static __inline void TOSH_SET_UD_PIN(void)#line 61{#line 61  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) |= 1 << 1;}static inline  # 74 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/avrmote/HPLPotC.nc"result_t HPLPotC$Pot$finalise(void)#line 74{  TOSH_SET_UD_PIN();  TOSH_SET_INC_PIN();  return SUCCESS;}# 74 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/HPLPot.nc"inline static  result_t PotM$HPLPot$finalise(void){#line 74  unsigned char result;#line 74#line 74  result = HPLPotC$Pot$finalise();#line 74#line 74  return result;#line 74}#line 74# 63 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica/hardware.h"static __inline void TOSH_SET_POT_SELECT_PIN(void)#line 63{#line 63  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x12 + 0x20) |= 1 << 5;}#line 62static __inline void TOSH_CLR_INC_PIN(void)#line 62{#line 62  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) &= ~(1 << 2);}#line 63static __inline void TOSH_CLR_POT_SELECT_PIN(void)#line 63{#line 63  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x12 + 0x20) &= ~(1 << 5);}#line 61static __inline void TOSH_CLR_UD_PIN(void)#line 61{#line 61  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) &= ~(1 << 1);}static inline  # 65 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/avrmote/HPLPotC.nc"result_t HPLPotC$Pot$increase(void)#line 65{  TOSH_CLR_UD_PIN();  TOSH_CLR_POT_SELECT_PIN();  TOSH_SET_INC_PIN();  TOSH_CLR_INC_PIN();  TOSH_SET_POT_SELECT_PIN();  return SUCCESS;}# 67 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/HPLPot.nc"inline static  result_t PotM$HPLPot$increase(void){#line 67  unsigned char result;#line 67#line 67  result = HPLPotC$Pot$increase();#line 67#line 67  return result;#line 67}#line 67static inline  # 56 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/avrmote/HPLPotC.nc"result_t HPLPotC$Pot$decrease(void)#line 56{  TOSH_SET_UD_PIN();  TOSH_CLR_POT_SELECT_PIN();  TOSH_SET_INC_PIN();  TOSH_CLR_INC_PIN();  TOSH_SET_POT_SELECT_PIN();  return SUCCESS;}# 59 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/HPLPot.nc"inline static  result_t PotM$HPLPot$decrease(void){#line 59  unsigned char result;#line 59#line 59  result = HPLPotC$Pot$decrease();#line 59#line 59  return result;#line 59}#line 59static inline # 93 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/system/PotM.nc"void PotM$setPot(uint8_t value)#line 93{  uint8_t i;#line 95  for (i = 0; i < 151; i++)     PotM$HPLPot$decrease();  for (i = 0; i < value; i++)     PotM$HPLPot$increase();  PotM$HPLPot$finalise();  PotM$potSetting = value;}static inline  result_t PotM$Pot$init(uint8_t initialSetting)#line 106{  PotM$setPot(initialSetting);  return SUCCESS;}# 78 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/Pot.nc"inline static  result_t RealMain$Pot$init(uint8_t arg_0xa27f4f0){#line 78  unsigned char result;#line 78#line 78  result = PotM$Pot$init(arg_0xa27f4f0);#line 78#line 78  return result;#line 78}#line 78static inline # 83 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/system/sched.c"void TOSH_sched_init(void ){  int i;#line 86  TOSH_sched_free = 0;  TOSH_sched_full = 0;  for (i = 0; i < TOSH_MAX_TASKS; i++)     TOSH_queue[i].tp = (void *)0;}static inline # 120 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/system/tos.h"result_t rcombine(result_t r1, result_t r2){  return r1 == FAIL ? FAIL : r2;}# 59 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica/hardware.h"static __inline void TOSH_SET_GREEN_LED_PIN(void)#line 59{#line 59  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) |= 1 << 1;}#line 58static __inline void TOSH_SET_YELLOW_LED_PIN(void)#line 58{#line 58  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) |= 1 << 0;}#line 57static __inline void TOSH_SET_RED_LED_PIN(void)#line 57{#line 57  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) |= 1 << 2;}#line 59static __inline void TOSH_MAKE_GREEN_LED_OUTPUT(void)#line 59{#line 59  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1A + 0x20) |= 1 << 1;}#line 58static __inline void TOSH_MAKE_YELLOW_LED_OUTPUT(void)#line 58{#line 58  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1A + 0x20) |= 1 << 0;}#line 57static __inline void TOSH_MAKE_RED_LED_OUTPUT(void)#line 57{#line 57  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1A + 0x20) |= 1 << 2;}static inline   # 58 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/system/LedsC.nc"result_t LedsC$Leds$init(void)#line 58{  { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 59    {      LedsC$ledsOn = 0;      {      }#line 61      ;      TOSH_MAKE_RED_LED_OUTPUT();      TOSH_MAKE_YELLOW_LED_OUTPUT();      TOSH_MAKE_GREEN_LED_OUTPUT();      TOSH_SET_RED_LED_PIN();      TOSH_SET_YELLOW_LED_PIN();      TOSH_SET_GREEN_LED_PIN();    }#line 68    __nesc_atomic_end(__nesc_atomic); }  return SUCCESS;}# 56 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/Leds.nc"inline static   result_t BlinkM$Leds$init(void){#line 56  unsigned char result;#line 56#line 56  result = LedsC$Leds$init();#line 56#line 56  return result;#line 56}#line 56static inline  # 52 "BlinkM.nc"result_t BlinkM$StdControl$init(void)#line 52{  BlinkM$Leds$init();  return SUCCESS;}static inline   # 149 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica/HPLClock.nc"result_t HPLClock$Clock$setRate(char interval, char scale)#line 149{  scale &= 0x7;  scale |= 0x8;  { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 152    {      * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x37 + 0x20) &= ~(1 << 0);      * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x37 + 0x20) &= ~(1 << 1);      * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x30 + 0x20) |= 1 << 3;      * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x33 + 0x20) = scale;      * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x32 + 0x20) = 0;      * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x31 + 0x20) = interval;      * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x37 + 0x20) |= 1 << 1;    }#line 162    __nesc_atomic_end(__nesc_atomic); }  return SUCCESS;}# 96 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/Clock.nc"inline static   result_t TimerM$Clock$setRate(char arg_0xa2fc3d0, char arg_0xa2fc510){#line 96  unsigned char result;#line 96#line 96  result = HPLClock$Clock$setRate(arg_0xa2fc3d0, arg_0xa2fc510);#line 96#line 96  return result;#line 96}#line 96static inline  # 77 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/system/TimerM.nc"result_t TimerM$StdControl$init(void)#line 77{  TimerM$mState = 0;  TimerM$setIntervalFlag = 0;  TimerM$queue_head = TimerM$queue_tail = -1;  TimerM$queue_size = 0;  TimerM$mScale = 3;  TimerM$mInterval = TimerM$maxTimerInterval;  return TimerM$Clock$setRate(TimerM$mInterval, TimerM$mScale);}# 63 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/StdControl.nc"inline static  result_t RealMain$StdControl$init(void){#line 63  unsigned char result;#line 63#line 63  result = TimerM$StdControl$init();#line 63  result = rcombine(result, BlinkM$StdControl$init());#line 63#line 63  return result;#line 63}#line 63# 41 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/PowerManagement.nc"inline static   uint8_t TimerM$PowerManagement$adjustPower(void){#line 41  unsigned char result;#line 41#line 41  result = HPLPowerManagementM$PowerManagement$adjustPower();#line 41#line 41  return result;#line 41}#line 41static inline   # 87 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica/HPLClock.nc"void HPLClock$Clock$setInterval(uint8_t value)#line 87{  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x31 + 0x20) = value;}# 105 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/Clock.nc"inline static   void TimerM$Clock$setInterval(uint8_t arg_0xa2fced0){#line 105  HPLClock$Clock$setInterval(arg_0xa2fced0);#line 105}#line 105static inline   # 134 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica/HPLClock.nc"uint8_t HPLClock$Clock$readCounter(void)#line 134{  return * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x32 + 0x20);}# 153 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/Clock.nc"inline static   uint8_t TimerM$Clock$readCounter(void){#line 153  unsigned char result;#line 153#line 153  result = HPLClock$Clock$readCounter();#line 153#line 153  return result;#line 153}#line 153static inline  # 98 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/system/TimerM.nc"result_t TimerM$Timer$start(uint8_t id, char type, uint32_t interval)#line 99{  uint8_t diff;#line 101  if (id >= NUM_TIMERS) {#line 101    return FAIL;

⌨️ 快捷键说明

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