📄 app.c
字号:
#line 153 result = HPLClock$Clock$readCounter();#line 153#line 153 return result;#line 153}#line 153static inline # 98 "C:/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; }#line 102 if (type > TIMER_ONE_SHOT) {#line 102 return FAIL; } if (type == TIMER_REPEAT && interval <= 2) {#line 109 return FAIL; } TimerM$mTimerList[id].ticks = interval; TimerM$mTimerList[id].type = type; { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 114 { diff = TimerM$Clock$readCounter(); interval += diff; TimerM$mTimerList[id].ticksLeft = interval; TimerM$mState |= 0x1L << id; if (interval < TimerM$mInterval) { TimerM$mInterval = interval; TimerM$Clock$setInterval(TimerM$mInterval); TimerM$setIntervalFlag = 0; TimerM$PowerManagement$adjustPower(); } }#line 125 __nesc_atomic_end(__nesc_atomic); } return SUCCESS;}# 59 "C:/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/Timer.nc"inline static result_t BlinkM$Timer$start(char arg_0xaeef40, uint32_t arg_0xaef098){#line 59 unsigned char result;#line 59#line 59 result = TimerM$Timer$start(0, arg_0xaeef40, arg_0xaef098);#line 59#line 59 return result;#line 59}#line 59static inline # 63 "BlinkM.nc"result_t BlinkM$StdControl$start(void)#line 63{ return BlinkM$Timer$start(TIMER_REPEAT, 1000);}static inline # 87 "C:/UCB/cygwin/opt/tinyos-1.x/tos/system/TimerM.nc"result_t TimerM$StdControl$start(void)#line 87{ return SUCCESS;}# 70 "C:/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 = TimerM$StdControl$start();#line 70 result = rcombine(result, BlinkM$StdControl$start());#line 70#line 70 return result;#line 70}#line 70static inline # 63 "C:/UCB/cygwin/opt/tinyos-1.x/tos/platform/micaz/HPLPowerManagementM.nc"uint8_t HPLPowerManagementM$getPowerLevel(void)#line 63{ uint8_t diff;#line 65 if (* (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x37 + 0x20) & ~((1 << 1) | (1 << 0))) { return HPLPowerManagementM$IDLE; } else {#line 68 if (* (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x0D + 0x20) & (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 74 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$EXT_STANDBY; }#line 78 return HPLPowerManagementM$POWER_SAVE; } else #line 79 { return HPLPowerManagementM$POWER_DOWN; } } } }}static inline #line 84void HPLPowerManagementM$doAdjustment(void)#line 84{ uint8_t foo;#line 85 uint8_t mcu;#line 86 foo = HPLPowerManagementM$getPowerLevel(); mcu = * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x35 + 0x20); mcu &= 0xe3; if (foo == HPLPowerManagementM$EXT_STANDBY || 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 # 172 "C:/UCB/cygwin/opt/tinyos-1.x/tos/platform/avrmote/avrhardware.h"__inline void __nesc_enable_interrupt(void)#line 172{ __asm volatile ("sei");}static inline #line 135void 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:/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:/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:/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:/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;}# 116 "C:/UCB/cygwin/opt/tinyos-1.x/tos/platform/micaz/hardware.h"static __inline void TOSH_CLR_RED_LED_PIN(void)#line 116{#line 116 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) &= ~(1 << 2);}static inline # 72 "C:/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;}static inline result_t LedsC$Leds$redOff(void)#line 81{ { }#line 82 ; { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 83 { TOSH_SET_RED_LED_PIN(); LedsC$ledsOn &= ~LedsC$RED_BIT; }#line 86 __nesc_atomic_end(__nesc_atomic); } return SUCCESS;}static inline result_t LedsC$Leds$redToggle(void)#line 90{ result_t rval;#line 92 { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 92 { if (LedsC$ledsOn & LedsC$RED_BIT) { rval = LedsC$Leds$redOff(); } else {#line 96 rval = LedsC$Leds$redOn(); } }#line 98 __nesc_atomic_end(__nesc_atomic); }#line 98 return rval;}# 81 "C:/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/Leds.nc"inline static result_t BlinkM$Leds$redToggle(void){#line 81 unsigned char result;#line 81#line 81 result = LedsC$Leds$redToggle();#line 81#line 81 return result;#line 81}#line 81static inline # 84 "BlinkM.nc"result_t BlinkM$Timer$fired(void){ BlinkM$Leds$redToggle(); return SUCCESS;}static inline # 182 "C:/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:/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/Timer.nc"inline static result_t TimerM$Timer$fired(uint8_t arg_0xaf96a8){#line 73 unsigned char result;#line 73#line 73 switch (arg_0xaf96a8) {#line 73 case 0:#line 73 result = BlinkM$Timer$fired();#line 73 break;#line 73 default:#line 73 result = TimerM$Timer$default$fired(arg_0xaf96a8);#line 73 }#line 73#line 73 return result;#line 73}#line 73static inline # 194 "C:/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:/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:/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:/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 # 101 "C:/UCB/cygwin/opt/tinyos-1.x/tos/platform/micaz/HPLPowerManagementM.nc"uint8_t HPLPowerManagementM$PowerManagement$adjustPower(void)#line 101{ uint8_t mcu;#line 103 if (!HPLPowerManagementM$disabled) { TOS_post(HPLPowerManagementM$doAdjustment); } else #line 105 { 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:/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 + -