📄 app.c
字号:
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# 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 # 79 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/lib/Counters/Counter.nc"result_t Counter$IntOutput$outputComplete(result_t success){ if (success == 0) {#line 81 Counter$state--; }#line 82 return SUCCESS;}# 65 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/IntOutput.nc"inline static result_t IntToLedsM$IntOutput$outputComplete(result_t arg_0xa2ca980){#line 65 unsigned char result;#line 65#line 65 result = Counter$IntOutput$outputComplete(arg_0xa2ca980);#line 65#line 65 return result;#line 65}#line 65static inline # 71 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/lib/Counters/IntToLedsM.nc"void IntToLedsM$outputDone(void){ IntToLedsM$IntOutput$outputComplete(1);}# 58 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica/hardware.h"static __inline void TOSH_CLR_YELLOW_LED_PIN(void)#line 58{#line 58 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) &= ~(1 << 0);}static inline # 130 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/system/LedsC.nc"result_t LedsC$Leds$yellowOn(void)#line 130{ { }#line 131 ; { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 132 { TOSH_CLR_YELLOW_LED_PIN(); LedsC$ledsOn |= LedsC$YELLOW_BIT; }#line 135 __nesc_atomic_end(__nesc_atomic); } return SUCCESS;}# 114 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/Leds.nc"inline static result_t IntToLedsM$Leds$yellowOn(void){#line 114 unsigned char result;#line 114#line 114 result = LedsC$Leds$yellowOn();#line 114#line 114 return result;#line 114}#line 114# 59 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica/hardware.h"static __inline void TOSH_CLR_GREEN_LED_PIN(void)#line 59{#line 59 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) &= ~(1 << 1);}static inline # 101 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/system/LedsC.nc"result_t LedsC$Leds$greenOn(void)#line 101{ { }#line 102 ; { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 103 { TOSH_CLR_GREEN_LED_PIN(); LedsC$ledsOn |= LedsC$GREEN_BIT; }#line 106 __nesc_atomic_end(__nesc_atomic); } return SUCCESS;}# 89 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/Leds.nc"inline static result_t IntToLedsM$Leds$greenOn(void){#line 89 unsigned char result;#line 89#line 89 result = LedsC$Leds$greenOn();#line 89#line 89 return result;#line 89}#line 89# 57 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica/hardware.h"static __inline void TOSH_CLR_RED_LED_PIN(void)#line 57{#line 57 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) &= ~(1 << 2);}static inline # 72 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/system/LedsC.nc"result_t LedsC$Leds$redOn(void)#line 72{ { }#line 73 ; { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 74 { TOSH_CLR_RED_LED_PIN(); LedsC$ledsOn |= LedsC$RED_BIT; }#line 77 __nesc_atomic_end(__nesc_atomic); } return SUCCESS;}# 64 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/Leds.nc"inline static result_t IntToLedsM$Leds$redOn(void){#line 64 unsigned char result;#line 64#line 64 result = LedsC$Leds$redOn();#line 64#line 64 return result;#line 64}#line 64static inline # 76 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/lib/Counters/IntToLedsM.nc"result_t IntToLedsM$IntOutput$output(uint16_t value){ if (value & 1) {#line 78 IntToLedsM$Leds$redOn(); } else {#line 79 IntToLedsM$Leds$redOff(); }#line 80 if (value & 2) {#line 80 IntToLedsM$Leds$greenOn(); } else {#line 81 IntToLedsM$Leds$greenOff(); }#line 82 if (value & 4) {#line 82 IntToLedsM$Leds$yellowOn(); } else {#line 83 IntToLedsM$Leds$yellowOff(); } TOS_post(IntToLedsM$outputDone); return SUCCESS;}# 56 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/IntOutput.nc"inline static result_t Counter$IntOutput$output(uint16_t arg_0xa2ca4f0){#line 56 unsigned char result;#line 56#line 56 result = IntToLedsM$IntOutput$output(arg_0xa2ca4f0);#line 56#line 56 return result;#line 56}#line 56static inline # 72 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/lib/Counters/Counter.nc"result_t Counter$Timer$fired(void){ if (Counter$IntOutput$output(Counter$state)) { Counter$state++; }#line 76 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_0xa308e70){#line 73 unsigned char result;#line 73#line 73 switch (arg_0xa308e70) {#line 73 case 0:#line 73 result = Counter$Timer$fired();#line 73 break;#line 73 default:#line 73 result = TimerM$Timer$default$fired(arg_0xa308e70);#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 ; TimerM$mTimerList[i].ticksLeft = TimerM$mInterval; } } } } } { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 247 int_out = TimerM$interval_outstanding;#line 247 __nesc_atomic_end(__nesc_atomic); } if (int_out == 0) { TimerM$adjustInterval(); }}static inline result_t TimerM$Clock$fire(void)#line 253{ { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 254 { if (TimerM$interval_outstanding == 0) { TOS_post(TimerM$HandleFire); } else { }#line 261 ; TimerM$interval_outstanding += TimerM$Clock$getInterval() + 1; }#line 264 __nesc_atomic_end(__nesc_atomic); } return SUCCESS;}# 180 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/Clock.nc"inline static result_t HPLClock$Clock$fire(void){#line 180 unsigned char result;#line 180#line 180 result = TimerM$Clock$fire();#line 180#line 180 return result;#line 180}#line 180# 106 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/system/sched.c"bool TOS_post(void (*tp)(void))#line 106{ __nesc_atomic_t fInterruptFlags; uint8_t tmp; fInterruptFlags = __nesc_atomic_start(); tmp = TOSH_sched_free; if (TOSH_queue[tmp].tp == (void *)0) { TOSH_sched_free = (tmp + 1) & TOSH_TASK_BITMASK; TOSH_queue[tmp].tp = tp; __nesc_atomic_end(fInterruptFlags); return TRUE; } else { __nesc_atomic_end(fInterruptFlags); return FALSE; }}# 54 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/system/RealMain.nc"int main(void)#line 54{ RealMain$hardwareInit(); RealMain$Pot$init(10); TOSH_sched_init(); RealMain$StdControl$init(); RealMain$StdControl$start(); __nesc_enable_interrupt(); while (1) { TOSH_run_task(); }}static # 103 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica/HPLPowerManagementM.nc"uint8_t HPLPowerManagementM$PowerManagement$adjustPower(void)#line 103{ uint8_t mcu;#line 105 if (!HPLPowerManagementM$disabled) { TOS_post(HPLPowerManagementM$doAdjustment); } else #line 107 { mcu = * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x35 + 0x20); mcu &= 0xe3; mcu |= HPLPowerManagementM$IDLE; * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x35 + 0x20) = mcu; * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x35 + 0x20) |= 1 << 5; } return 0;}# 167 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica/HPLClock.nc"void __attribute((interrupt)) __vector_15(void)#line 167{ { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 168 { if (HPLClock$set_flag) { HPLClock$mscale = HPLClock$nextScale; HPLClock$nextScale |= 0x8; * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x33 + 0x20) = HPLClock$nextScale; * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x31 + 0x20) = HPLClock$minterval; HPLClock$set_flag = 0; } }#line 177 __nesc_atomic_end(__nesc_atomic); } HPLClock$Clock$fire();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -