📄 app.c
字号:
} }#line 112 __nesc_atomic_end(__nesc_atomic); } return SUCCESS;}# 59 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Timer.nc"inline static result_t BlinkM$Timer$start(char arg_0xa30a7d0, uint32_t arg_0xa30a928){#line 59 unsigned char result;#line 59#line 59 result = TimerM$Timer$start(0, arg_0xa30a7d0, arg_0xa30a928);#line 59#line 59 return result;#line 59}#line 59static inline # 78 "BlinkM.nc"result_t BlinkM$StdControl$start(void)#line 78{ return BlinkM$Timer$start(TIMER_REPEAT, 1000);}static inline # 82 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/TimerM.nc"result_t TimerM$StdControl$start(void)#line 82{ return SUCCESS;}# 70 "C:/tinyos/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:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/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 # 176 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/avrmote/avrhardware.h"__inline void __nesc_enable_interrupt(void)#line 176{ __asm volatile ("sei");}static inline #line 135void TOSH_wait(void){ __asm volatile ("nop"); __asm volatile ("nop");}static inline void TOSH_sleep(void){ __asm volatile ("sei"); __asm volatile ("sleep"); TOSH_wait();}#line 171__inline void __nesc_atomic_end(__nesc_atomic_t oldSreg){ * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x3F + 0x20) = oldSreg;}#line 164__inline __nesc_atomic_t __nesc_atomic_start(void ){ __nesc_atomic_t result = * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x3F + 0x20);#line 167 __asm volatile ("cli"); return result;}static inline # 139 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/sched.c"bool TOSH_run_next_task(void)#line 139{ __nesc_atomic_t fInterruptFlags; uint8_t old_full; void (*func)(void ); if (TOSH_sched_full == TOSH_sched_free) { return 0; } else { fInterruptFlags = __nesc_atomic_start(); old_full = TOSH_sched_full; TOSH_sched_full++; TOSH_sched_full &= TOSH_TASK_BITMASK; func = TOSH_queue[(int )old_full].tp; TOSH_queue[(int )old_full].tp = 0; __nesc_atomic_end(fInterruptFlags); func(); return 1; }}static inline void TOSH_run_task(void)#line 162{ while (TOSH_run_next_task()) ; TOSH_sleep(); TOSH_wait();}# 116 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/TimerM.nc"static void TimerM$adjustInterval(void)#line 116{ uint8_t i;#line 117 uint8_t val = TimerM$maxTimerInterval;#line 118 if (TimerM$mState) { for (i = 0; i < NUM_TIMERS; i++) { if (TimerM$mState & (0x1 << i) && TimerM$mTimerList[i].ticksLeft < val) { val = TimerM$mTimerList[i].ticksLeft; } } { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 124 { TimerM$mInterval = val; TimerM$Clock$setInterval(TimerM$mInterval); TimerM$setIntervalFlag = 0; }#line 128 __nesc_atomic_end(__nesc_atomic); } } else { { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 131 { TimerM$mInterval = TimerM$maxTimerInterval; TimerM$Clock$setInterval(TimerM$mInterval); TimerM$setIntervalFlag = 0; }#line 135 __nesc_atomic_end(__nesc_atomic); } } TimerM$PowerManagement$adjustPower();}# 117 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/hardware.h"static __inline void TOSH_CLR_GREEN_LED_PIN(void)#line 117{#line 117 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) &= ~(1 << 1);}static inline # 98 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/LedsC.nc"result_t LedsC$Leds$greenOn(void)#line 98{ { }#line 99 ; { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 100 { TOSH_CLR_GREEN_LED_PIN(); LedsC$ledsOn |= LedsC$GREEN_BIT; }#line 103 __nesc_atomic_end(__nesc_atomic); } return SUCCESS;}# 89 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Leds.nc"inline static result_t BlinkM$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 89static inline # 46 "BlinkM.nc"void BlinkM$test(void)#line 46{ uint32_t i;#line 48 BlinkM$Leds$greenOn(); for (i = 0; i < 0x7a120; i++) { __asm volatile ("nop");} * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x35 + 0x20) |= 1 << 3; * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x35 + 0x20) |= 1 << 4; * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x35 + 0x20) &= ~(1 << 2); * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x35 + 0x20) |= 1 << 5; __asm volatile ("sleep"); * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x35 + 0x20) &= ~(1 << 5);}# 116 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/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 # 69 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/LedsC.nc"result_t LedsC$Leds$redOn(void)#line 69{ { }#line 70 ; { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 71 { TOSH_CLR_RED_LED_PIN(); LedsC$ledsOn |= LedsC$RED_BIT; }#line 74 __nesc_atomic_end(__nesc_atomic); } return SUCCESS;}static inline result_t LedsC$Leds$redOff(void)#line 78{ { }#line 79 ; { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 80 { TOSH_SET_RED_LED_PIN(); LedsC$ledsOn &= ~LedsC$RED_BIT; }#line 83 __nesc_atomic_end(__nesc_atomic); } return SUCCESS;}static inline result_t LedsC$Leds$redToggle(void)#line 87{ result_t rval;#line 89 { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 89 { if (LedsC$ledsOn & LedsC$RED_BIT) { rval = LedsC$Leds$redOff(); } else {#line 93 rval = LedsC$Leds$redOn(); } }#line 95 __nesc_atomic_end(__nesc_atomic); }#line 95 return rval;}# 81 "C:/tinyos/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 # 99 "BlinkM.nc"result_t BlinkM$Timer$fired(void){ BlinkM$Leds$redToggle(); TOS_post(BlinkM$test); return SUCCESS;}static inline # 154 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/TimerM.nc"result_t TimerM$Timer$default$fired(uint8_t id)#line 154{ return SUCCESS;}# 73 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Timer.nc"inline static result_t TimerM$Timer$fired(uint8_t arg_0xa31b660){#line 73 unsigned char result;#line 73#line 73 switch (arg_0xa31b660) {#line 73 case 0:#line 73 result = BlinkM$Timer$fired();#line 73 break;#line 73 default:#line 73 result = TimerM$Timer$default$fired(arg_0xa31b660);#line 73 }#line 73#line 73 return result;#line 73}#line 73static inline # 166 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/TimerM.nc"uint8_t TimerM$dequeue(void)#line 166{ if (TimerM$queue_size == 0) { return NUM_TIMERS; }#line 169 if (TimerM$queue_head == NUM_TIMERS - 1) { TimerM$queue_head = -1; }#line 171 TimerM$queue_head++; TimerM$queue_size--; return TimerM$queue[(uint8_t )TimerM$queue_head];}static inline void TimerM$signalOneTimer(void)#line 176{ uint8_t itimer = TimerM$dequeue();#line 178 if (itimer < NUM_TIMERS) { TimerM$Timer$fired(itimer); }}static inline #line 158void TimerM$enqueue(uint8_t value)#line 158{ if (TimerM$queue_tail == NUM_TIMERS - 1) { TimerM$queue_tail = -1; }#line 161 TimerM$queue_tail++; TimerM$queue_size++; TimerM$queue[(uint8_t )TimerM$queue_tail] = value;}static inline #line 182void TimerM$HandleFire(void)#line 182{ uint8_t i;#line 184 TimerM$setIntervalFlag = 1; if (TimerM$mState) { for (i = 0; i < NUM_TIMERS; i++) { if (TimerM$mState & (0x1 << i)) { TimerM$mTimerList[i].ticksLeft -= TimerM$mInterval + 1; if (TimerM$mTimerList[i].ticksLeft <= 2) { if (TimerM$mTimerList[i].type == TIMER_REPEAT) { TimerM$mTimerList[i].ticksLeft += TimerM$mTimerList[i].ticks; } else #line 192 { TimerM$mState &= ~(0x1 << i); } TimerM$enqueue(i); TOS_post(TimerM$signalOneTimer); } } } } TimerM$adjustInterval();}static inline result_t TimerM$Clock$fire(void)#line 204{ TOS_post(TimerM$HandleFire); return SUCCESS;}# 180 "C:/tinyos/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# 98 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/sched.c"bool TOS_post(void (*tp)(void))#line 98{ __nesc_atomic_t fInterruptFlags; uint8_t tmp; fInterruptFlags = __nesc_atomic_start(); tmp = TOSH_sched_free; TOSH_sched_free++; TOSH_sched_free &= TOSH_TASK_BITMASK; if (TOSH_sched_free != TOSH_sched_full) { __nesc_atomic_end(fInterruptFlags); TOSH_queue[tmp].tp = tp; return TRUE; } else { TOSH_sched_free = tmp; __nesc_atomic_end(fInterruptFlags); return FALSE; }}# 54 "C:/tinyos/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:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/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:/tinyos/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 + -