📄 app.c
字号:
#line 105static # 87 "C:/tinyos/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;}# 41 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/PowerManagement.nc"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 # 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;}static #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 #line 63uint8_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 # 162 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/sched.c"void TOSH_run_task(void)#line 162{ while (TOSH_run_next_task()) ; TOSH_sleep(); TOSH_wait();}static #line 139bool 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 # 141 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/avrmote/avrhardware.h"void TOSH_sleep(void){ * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x35 + 0x20) |= 1 << 5; __asm volatile ("sleep");}static #line 135void TOSH_wait(void){ __asm volatile ("nop"); __asm volatile ("nop");}# 90 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLUART0M.nc"void __attribute((signal)) __vector_18(void)#line 90{ if (* (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x0B + 0x20) & (1 << 7)) { HPLUART0M$UART$get(* (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)0x9C); }}# 88 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/HPLUART.nc"static result_t HPLUART0M$UART$get(uint8_t arg_0xa2fec00){#line 88 unsigned char result;#line 88#line 88 result = UartUserM$HPLUART$get(arg_0xa2fec00);#line 88#line 88 return result;#line 88}#line 88static # 83 "UartUserM.nc"result_t UartUserM$HPLUART$get(uint8_t data)#line 83{ UartUserM$Leds$greenToggle(); return SUCCESS;}# 106 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Leds.nc"static result_t UartUserM$Leds$greenToggle(void){#line 106 unsigned char result;#line 106#line 106 result = LedsC$Leds$greenToggle();#line 106#line 106 return result;#line 106}#line 106static # 116 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/LedsC.nc"result_t LedsC$Leds$greenToggle(void)#line 116{ result_t rval;#line 118 { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 118 { if (LedsC$ledsOn & LedsC$GREEN_BIT) { rval = LedsC$Leds$greenOff(); } else {#line 122 rval = LedsC$Leds$greenOn(); } }#line 124 __nesc_atomic_end(__nesc_atomic); }#line 124 return rval;}static #line 107result_t LedsC$Leds$greenOff(void)#line 107{ { }#line 108 ; { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 109 { TOSH_SET_GREEN_LED_PIN(); LedsC$ledsOn &= ~LedsC$GREEN_BIT; }#line 112 __nesc_atomic_end(__nesc_atomic); } return SUCCESS;}static #line 98result_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;}# 100 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLUART0M.nc"void __attribute((interrupt)) __vector_20(void)#line 100{ HPLUART0M$UART$putDone();}# 96 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/HPLUART.nc"static result_t HPLUART0M$UART$putDone(void){#line 96 unsigned char result;#line 96#line 96 result = UartUserM$HPLUART$putDone();#line 96#line 96 return result;#line 96}#line 96static # 98 "UartUserM.nc"result_t UartUserM$HPLUART$putDone(void)#line 98{ UartUserM$Leds$yellowToggle(); return SUCCESS;}# 131 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Leds.nc"static result_t UartUserM$Leds$yellowToggle(void){#line 131 unsigned char result;#line 131#line 131 result = LedsC$Leds$yellowToggle();#line 131#line 131 return result;#line 131}#line 131static # 145 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/LedsC.nc"result_t LedsC$Leds$yellowToggle(void)#line 145{ result_t rval;#line 147 { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 147 { if (LedsC$ledsOn & LedsC$YELLOW_BIT) { rval = LedsC$Leds$yellowOff(); } else {#line 151 rval = LedsC$Leds$yellowOn(); } }#line 153 __nesc_atomic_end(__nesc_atomic); }#line 153 return rval;}static #line 136result_t LedsC$Leds$yellowOff(void)#line 136{ { }#line 137 ; { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 138 { TOSH_SET_YELLOW_LED_PIN(); LedsC$ledsOn &= ~LedsC$YELLOW_BIT; }#line 141 __nesc_atomic_end(__nesc_atomic); } return SUCCESS;}static #line 127result_t LedsC$Leds$yellowOn(void)#line 127{ { }#line 128 ; { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 129 { TOSH_CLR_YELLOW_LED_PIN(); LedsC$ledsOn |= LedsC$YELLOW_BIT; }#line 132 __nesc_atomic_end(__nesc_atomic); } return SUCCESS;}# 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();}# 180 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Clock.nc"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 180static # 204 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/TimerM.nc"result_t TimerM$Clock$fire(void)#line 204{ TOS_post(TimerM$HandleFire); return SUCCESS;}static #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 #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 void TimerM$signalOneTimer(void)#line 176{ uint8_t itimer = TimerM$dequeue();#line 178 if (itimer < NUM_TIMERS) { TimerM$Timer$fired(itimer); }}static #line 166uint8_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 #line 154result_t TimerM$Timer$default$fired(uint8_t id)#line 154{ return SUCCESS;}# 73 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Timer.nc"static result_t TimerM$Timer$fired(uint8_t arg_0xa333408){#line 73 unsigned char result;#line 73#line 73 switch (arg_0xa333408) {#line 73 case 0:#line 73 result = UartUserM$Timer$fired();#line 73 break;#line 73 default:#line 73 result = TimerM$Timer$default$fired(arg_0xa333408);#line 73 }#line 73#line 73 return result;#line 73}#line 73static # 63 "UartUserM.nc"result_t UartUserM$Timer$fired(void)#line 63{ UartUserM$HPLUART$put(UartUserM$cnt); UartUserM$S_Cnt = UartUserM$cnt; UartUserM$S_Data = * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20); UartUserM$S_Data &= 0x0f; UartUserM$S_Cnt &= 0x0f; UartUserM$S_Cnt = UartUserM$S_Cnt << 4; UartUserM$S_Data |= UartUserM$S_Cnt; * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) = UartUserM$S_Data; UartUserM$cnt++; if (UartUserM$cnt >= 255) { UartUserM$cnt = 0; } UartUserM$Leds$redToggle(); return SUCCESS;}# 80 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/HPLUART.nc"static result_t UartUserM$HPLUART$put(uint8_t arg_0xa2fe700){#line 80 unsigned char result;#line 80#line 80 result = HPLUART0M$UART$put(arg_0xa2fe700);#line 80#line 80 return result;#line 80}#line 80static # 105 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLUART0M.nc"result_t HPLUART0M$UART$put(uint8_t data)#line 105{ * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x0C + 0x20) = data; * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x0B + 0x20) |= 1 << 6; return SUCCESS;}# 81 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Leds.nc"static result_t UartUserM$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 # 87 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/LedsC.nc"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;}static #line 78result_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 #line 69result_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;}# 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();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -