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

📄 app.c

📁 WSN Sense is an application used in Tinyos
💻 C
📖 第 1 页 / 共 5 页
字号:
  return SUCCESS;}# 70 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/StdControl.nc"inline static  result_t RealMain$StdControl$start(void){#line 70  unsigned char result;#line 70#line 70  result = PhotoTempM$PhotoStdControl$start();#line 70  result = rcombine(result, TimerM$StdControl$start());#line 70  result = rcombine(result, SenseM$StdControl$start());#line 70#line 70  return result;#line 70}#line 70static inline # 62 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica/HPLPowerManagementM.nc"uint8_t HPLPowerManagementM$getPowerLevel(void)#line 62{  uint8_t diff;#line 64  if (* (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x37 + 0x20) & ~((1 << 1) | (1 << 0))) {      return HPLPowerManagementM$IDLE;    }  else {#line 67    if (* (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x0D + 0x20) & (1 << 7)) {        return HPLPowerManagementM$IDLE;      }    else {#line 69      if (* (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x0A + 0x20) & ((1 << 6) | (1 << 7))) {          return HPLPowerManagementM$IDLE;        }      else {        if (* (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x06 + 0x20) & (1 << 7)) {            return HPLPowerManagementM$ADC_NR;          }        else {#line 75          if (* (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x37 + 0x20) & ((1 << 1) | (1 << 0))) {              diff = * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x31 + 0x20) - * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x32 + 0x20);              if (diff < 16) {                return HPLPowerManagementM$IDLE;                }#line 79              return HPLPowerManagementM$POWER_SAVE;            }          else #line 80            {              return HPLPowerManagementM$POWER_DOWN;            }          }        }      }    }}static inline  #line 85void HPLPowerManagementM$doAdjustment(void)#line 85{  uint8_t foo;#line 86  uint8_t mcu;#line 87  foo = HPLPowerManagementM$getPowerLevel();  mcu = * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x35 + 0x20);  mcu &= 0xe3;  if (foo == HPLPowerManagementM$POWER_SAVE) {      mcu |= HPLPowerManagementM$IDLE;      while ((* (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x30 + 0x20) & 0x7) != 0) {           __asm volatile ("nop");}      mcu &= 0xe3;    }  mcu |= foo;  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x35 + 0x20) = mcu;  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x35 + 0x20) |= 1 << 5;}static inline # 135 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/avrmote/avrhardware.h"void TOSH_wait(void){   __asm volatile ("nop");   __asm volatile ("nop");}static inline void TOSH_sleep(void){  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x35 + 0x20) |= 1 << 5;   __asm volatile ("sleep");}#line 165__inline void  __nesc_atomic_end(__nesc_atomic_t oldSreg){  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x3F + 0x20) = oldSreg;}#line 158__inline __nesc_atomic_t  __nesc_atomic_start(void ){  __nesc_atomic_t result = * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x3F + 0x20);#line 161   __asm volatile ("cli");  return result;}static inline # 140 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/system/sched.c"bool TOSH_run_next_task(void){  __nesc_atomic_t fInterruptFlags;  uint8_t old_full;  void (*func)(void );  fInterruptFlags = __nesc_atomic_start();  old_full = TOSH_sched_full;  func = TOSH_queue[old_full].tp;  if (func == (void *)0)     {      __nesc_atomic_end(fInterruptFlags);      return 0;    }  TOSH_queue[old_full].tp = (void *)0;  TOSH_sched_full = (old_full + 1) & TOSH_TASK_BITMASK;  __nesc_atomic_end(fInterruptFlags);  func();  return 1;}static inline void TOSH_run_task(void)#line 163{  while (TOSH_run_next_task())     ;  TOSH_sleep();  TOSH_wait();}static inline   # 97 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica/HPLClock.nc"uint8_t HPLClock$Clock$getInterval(void)#line 97{  return * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x31 + 0x20);}# 121 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/Clock.nc"inline static   uint8_t TimerM$Clock$getInterval(void){#line 121  unsigned char result;#line 121#line 121  result = HPLClock$Clock$getInterval();#line 121#line 121  return result;#line 121}#line 121# 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_0xa31a8c8){#line 105  HPLClock$Clock$setInterval(arg_0xa31a8c8);#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 153# 129 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/system/TimerM.nc"static void TimerM$adjustInterval(void)#line 129{  uint8_t i;#line 130  uint8_t val = TimerM$maxTimerInterval;#line 131  if (TimerM$mState) {      for (i = 0; i < NUM_TIMERS; i++) {          if (TimerM$mState & (0x1L << i) && TimerM$mTimerList[i].ticksLeft < val) {              val = TimerM$mTimerList[i].ticksLeft;            }        }#line 148      { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 148        {          i = TimerM$Clock$readCounter() + 3;          if (val < i) {              val = i;            }          TimerM$mInterval = val;          TimerM$Clock$setInterval(TimerM$mInterval);          TimerM$setIntervalFlag = 0;        }#line 156        __nesc_atomic_end(__nesc_atomic); }    }  else {      { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 159        {          TimerM$mInterval = TimerM$maxTimerInterval;          TimerM$Clock$setInterval(TimerM$mInterval);          TimerM$setIntervalFlag = 0;        }#line 163        __nesc_atomic_end(__nesc_atomic); }    }  TimerM$PowerManagement$adjustPower();}static inline #line 186void TimerM$enqueue(uint8_t value)#line 186{  if (TimerM$queue_tail == NUM_TIMERS - 1) {    TimerM$queue_tail = -1;    }#line 189  TimerM$queue_tail++;  TimerM$queue_size++;  TimerM$queue[(uint8_t )TimerM$queue_tail] = value;}static inline   # 329 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/sensorboards/micasb/PhotoTempM.nc"result_t PhotoTempM$ExternalPhotoADC$getData(void)#line 329{  { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 330    {      PhotoTempM$photoSensor = PhotoTempM$stateReadOnce;    }#line 332    __nesc_atomic_end(__nesc_atomic); }#line 332  ;  TOS_post(PhotoTempM$getSample);  return SUCCESS;}# 52 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/ADC.nc"inline static   result_t SenseM$ADC$getData(void){#line 52  unsigned char result;#line 52#line 52  result = PhotoTempM$ExternalPhotoADC$getData();#line 52#line 52  return result;#line 52}#line 52static inline  # 112 "SenseM.nc"result_t SenseM$Timer$fired(void)#line 112{  return SenseM$ADC$getData();}# 77 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/HPLADC.nc"inline static   result_t ADCM$HPLADC$samplePort(uint8_t arg_0xa3fe3f0){#line 77  unsigned char result;#line 77#line 77  result = HPLADCC$ADC$samplePort(arg_0xa3fe3f0);#line 77#line 77  return result;#line 77}#line 77static # 132 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/system/ADCM.nc"__inline result_t ADCM$startGet(uint8_t newState, uint8_t port)#line 132{  uint16_t PortMask;#line 133  uint16_t oldReqVector;  result_t Result = SUCCESS;  if (port > TOSH_ADC_PORTMAPSIZE) {      return FAIL;    }  PortMask = 1 << port;  { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 142    {      if ((PortMask & ADCM$ReqVector) != 0) {          Result = FAIL;        }      else {          oldReqVector = ADCM$ReqVector;          ADCM$ReqVector |= PortMask;          if (newState == ADCM$CONTINUOUS_CONVERSION) {              ADCM$ContReqMask |= PortMask;            }          if (oldReqVector == 0) {              ADCM$ReqPort = port;              Result = ADCM$HPLADC$samplePort(port);            }        }    }#line 159    __nesc_atomic_end(__nesc_atomic); }  return Result;}static inline   result_t ADCM$ADC$getData(uint8_t port)#line 165{  return ADCM$startGet(ADCM$SINGLE_CONVERSION, port);}# 52 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/ADC.nc"inline static   result_t PhotoTempM$InternalTempADC$getData(void){#line 52  unsigned char result;#line 52#line 52  result = ADCM$ADC$getData(TOS_ADC_TEMP_PORT);#line 52#line 52  return result;#line 52}#line 52# 52 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/ADC.nc"inline static   result_t PhotoTempM$InternalPhotoADC$getData(void){#line 52  unsigned char result;#line 52#line 52  result = ADCM$ADC$getData(TOS_ADC_PHOTO_PORT);#line 52#line 52  return result;#line 52}#line 52static inline  # 291 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/sensorboards/micasb/PhotoTempM.nc"result_t PhotoTempM$PhotoTempTimer$fired(void)#line 291{  switch (PhotoTempM$hardwareStatus) {      case PhotoTempM$sensorIdle:         case PhotoTempM$sensorTempReady:           case PhotoTempM$sensorPhotoReady:             break;      case PhotoTempM$sensorPhotoStarting:         PhotoTempM$hardwareStatus = PhotoTempM$sensorPhotoReady;      if (PhotoTempM$InternalPhotoADC$getData() == SUCCESS) {          return SUCCESS;        }#line 303      ;      break;      case PhotoTempM$sensorTempStarting:         PhotoTempM$hardwareStatus = PhotoTempM$sensorTempReady;      if (PhotoTempM$InternalTempADC$getData() == SUCCESS) {          return SUCCESS;        }#line 310      ;      break;    }#line 312  ;  { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 314    {      PhotoTempM$waitingForSample = FALSE;    }#line 316    __nesc_atomic_end(__nesc_atomic); }#line 316  ;  TOS_post(PhotoTempM$getSample);  return SUCCESS;}static inline   # 182 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/system/TimerM.nc"result_t TimerM$Timer$default$fired(uint8_t id)#line 182{  return SUCCESS;}# 73 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/Timer.nc"inline static  result_t TimerM$Timer$fired(uint8_t arg_0xa301bf0){#line 73  unsigned char result;#line 73#line 73  switch (arg_0xa301bf0) {#line 73    case 0:#line 73      result = SenseM$Timer$fired();#line 73      break;#line 73    case 1:#line 73      result = PhotoTempM$PhotoTempTimer$fired();#line 73      break;#line 73    default:#line 73      result = TimerM$Timer$default$fired(arg_0xa301bf0);#line 73    }#line 73#line 73  return result;#line 73}#line 73static inline # 194 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/system/TimerM.nc"uint8_t TimerM$dequeue(void)#line 194{  if (TimerM$queue_size == 0) {    return NUM_TIMERS;    }#line 197  if (TimerM$queue_head == NUM_TIMERS - 1) {    TimerM$queue_head = -1;    }#line 199  TimerM$queue_head++;  TimerM$queue_size--;  return TimerM$queue[(uint8_t )TimerM$queue_head];}static inline  void TimerM$signalOneTimer(void)#line 204{  uint8_t itimer = TimerM$dequeue();#line 206  if (itimer < NUM_TIMERS) {    TimerM$Timer$fired(itimer);    }}static inline  #line 210void TimerM$HandleFire(void)#line 210{  uint8_t i;  uint16_t int_out;#line 213  TimerM$setIntervalFlag = 1;  { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 216    {      int_out = TimerM$interval_outstanding;      TimerM$interval_outstanding = 0;    }#line 219    __nesc_atomic_end(__nesc_atomic); }  if (TimerM$mState) {      for (i = 0; i < NUM_TIMERS; i++) {          if (TimerM$mState & (0x1L << i)) {              TimerM$mTimerList[i].ticksLeft -= int_out;              if (TimerM$mTimerList[i].ticksLeft <= 2) {                  if (TOS_post(TimerM$signalOneTimer)) {                      if (TimerM$mTimerList[i].type == TIMER_REPEAT) {                          TimerM$mTimerList[i].ticksLeft += TimerM$mTimerList[i].ticks;                        }                      else #line 230                        {                          TimerM$mState &= ~(0x1L << i);                        }                      TimerM$enqueue(i);                    }                  else {                      {                      }#line 236

⌨️ 快捷键说明

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