📄 app.c
字号:
}#line 79 if (type > TIMER_ONE_SHOT) {#line 79 return FAIL; } if (type == TIMER_REPEAT && interval <= 2) {#line 86 return FAIL; } TimerM$mTimerList[id].ticks = interval; TimerM$mTimerList[id].type = type; { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 91 { 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 102 __nesc_atomic_end(__nesc_atomic); } return SUCCESS;}# 37 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\interfaces\\Timer.nc"inline static result_t MyAppM$Timer$start(char arg_0x1a584258, uint32_t arg_0x1a5843f0){#line 37 unsigned char result;#line 37#line 37 result = TimerM$Timer$start(0U, arg_0x1a584258, arg_0x1a5843f0);#line 37#line 37 return result;#line 37}#line 37# 39 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\apps\\tutorials\\lesson_1\\MyAppM.nc"static inline result_t MyAppM$StdControl$start(void)#line 39{ return MyAppM$Timer$start(TIMER_REPEAT, 1000);}# 64 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\system\\TimerM.nc"static inline result_t TimerM$StdControl$start(void)#line 64{ return SUCCESS;}# 48 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\interfaces\\StdControl.nc"inline static result_t RealMain$StdControl$start(void){#line 48 unsigned char result;#line 48#line 48 result = TimerM$StdControl$start();#line 48 result = rcombine(result, MyAppM$StdControl$start());#line 48#line 48 return result;#line 48}#line 48# 61 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\platform\\micazc\\HPLPowerManagementM.nc"static inline uint8_t HPLPowerManagementM$getPowerLevel(void)#line 61{ if (* (volatile uint8_t *)(uint16_t )& * (volatile uint8_t *)0x6E & (1 << 1)) { return 0; } else {#line 67 if (* (volatile uint8_t *)(uint16_t )& * (volatile uint8_t *)0x6F & (1 << 5)) { return 0; } else {#line 71 if (* (volatile uint8_t *)(uint16_t )& * (volatile uint8_t *)(0x2C + 0x20) & (1 << 7)) { return 0; } else {#line 90 if (* (volatile uint8_t *)0XC9 & ((((1 << 7) | (1 << 6)) | (1 << 4)) | (1 << 3))) { return 0; } else {#line 94 if (* (volatile uint8_t *)(uint16_t )& * (volatile uint8_t *)0x7A & (1 << 7)) { return 1 << 1; } else {#line 98 if (* (volatile uint8_t *)0x70 & ((1 << 1) | (1 << 0))) { uint8_t diff;#line 101 diff = * (volatile uint8_t *)0xB3 - * (volatile uint8_t *)0xB2; if (diff < 16) {#line 102 return ((1 << 3) | (1 << 2)) | (1 << 1); } else {#line 103 return (1 << 2) | (1 << 1); } } else #line 105 { return 1 << 2; } } } } } }}#line 114static inline void HPLPowerManagementM$doAdjustment(void)#line 114{ uint8_t foo;#line 115 uint8_t mcu;#line 116 foo = HPLPowerManagementM$getPowerLevel(); mcu = * (volatile uint8_t *)(0x33 + 0x20); mcu &= 0xf1; if (foo == (((1 << 3) | (1 << 2)) | (1 << 1)) || foo == ((1 << 2) | (1 << 1))) { mcu |= 0; while ((* (volatile uint8_t *)0xB6 & 0x1f) != 0) { __asm volatile ("nop");} mcu &= 0xf1; } mcu |= foo; * (volatile uint8_t *)(0x33 + 0x20) = mcu; * (volatile uint8_t *)(0x33 + 0x20) |= 1 << 0;}# 166 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\platform\\atm1281\\avrhardware.h"static __inline void __nesc_enable_interrupt(void)#line 166{ __asm volatile ("sei");}#line 151 __inline void __nesc_atomic_end(__nesc_atomic_t oldSreg){ * (volatile uint8_t *)(0x3F + 0x20) = oldSreg;}#line 129static inline void TOSH_wait(void){ __asm volatile ("nop"); __asm volatile ("nop");}#line 158static __inline void __nesc_atomic_sleep(void){ __asm volatile ("sei"); __asm volatile ("sleep"); TOSH_wait();}#line 144 __inline __nesc_atomic_t __nesc_atomic_start(void ){ __nesc_atomic_t result = * (volatile uint8_t *)(0x3F + 0x20);#line 147 __asm volatile ("cli"); return result;}# 116 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\system\\sched.c"static inline 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_sleep(); 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 139{ for (; ; ) TOSH_run_next_task();}# 80 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\platform\\atm1281\\HPLClock.nc"static inline uint8_t HPLClock$Clock$getInterval(void)#line 80{ return * (volatile uint8_t *)0xB3;}# 100 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\interfaces\\Clock.nc"inline static uint8_t TimerM$Clock$getInterval(void){#line 100 unsigned char result;#line 100#line 100 result = HPLClock$Clock$getInterval();#line 100#line 100 return result;#line 100}#line 100# 106 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\system\\TimerM.nc"inline static void TimerM$adjustInterval(void)#line 106{ uint8_t i;#line 107 uint8_t val = TimerM$maxTimerInterval;#line 108 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 125 { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 125 { i = TimerM$Clock$readCounter() + 3; if (val < i) { val = i; } TimerM$mInterval = val; TimerM$Clock$setInterval(TimerM$mInterval); TimerM$setIntervalFlag = 0; }#line 133 __nesc_atomic_end(__nesc_atomic); } } else { { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 136 { TimerM$mInterval = TimerM$maxTimerInterval; TimerM$Clock$setInterval(TimerM$mInterval); TimerM$setIntervalFlag = 0; }#line 140 __nesc_atomic_end(__nesc_atomic); } } TimerM$PowerManagement$adjustPower();}#line 163static inline void TimerM$enqueue(uint8_t value)#line 163{ if (TimerM$queue_tail == NUM_TIMERS - 1) { TimerM$queue_tail = -1; }#line 166 TimerM$queue_tail++; TimerM$queue_size++; TimerM$queue[(uint8_t )TimerM$queue_tail] = value;}# 63 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\platform\\micazc\\hardware.h"static __inline void TOSH_CLR_RED_LED_PIN(void)#line 63{#line 63 * (volatile uint8_t *)(0X02 + 0x20) &= ~(1 << 2);}# 50 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\system\\LedsC.nc"static inline result_t LedsC$Leds$redOn(void)#line 50{ { }#line 51 ; /* atomic removed: atomic calls only */#line 52 { TOSH_CLR_RED_LED_PIN(); LedsC$ledsOn |= LedsC$RED_BIT; } return SUCCESS;}static inline result_t LedsC$Leds$redOff(void)#line 59{ { }#line 60 ; /* atomic removed: atomic calls only */#line 61 { TOSH_SET_RED_LED_PIN(); LedsC$ledsOn &= ~LedsC$RED_BIT; } return SUCCESS;}static inline result_t LedsC$Leds$redToggle(void)#line 68{ result_t rval;#line 70 { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 70 { if (LedsC$ledsOn & LedsC$RED_BIT) { rval = LedsC$Leds$redOff(); } else {#line 74 rval = LedsC$Leds$redOn(); } }#line 76 __nesc_atomic_end(__nesc_atomic); }#line 76 return rval;}# 60 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\interfaces\\Leds.nc"inline static result_t MyAppM$Leds$redToggle(void){#line 60 unsigned char result;#line 60#line 60 result = LedsC$Leds$redToggle();#line 60#line 60 return result;#line 60}#line 60# 59 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\apps\\tutorials\\lesson_1\\MyAppM.nc"static inline result_t MyAppM$Timer$fired(void){ MyAppM$Leds$redToggle(); return SUCCESS;}# 159 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\system\\TimerM.nc"static inline result_t TimerM$Timer$default$fired(uint8_t id)#line 159{ return SUCCESS;}# 51 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\interfaces\\Timer.nc"inline static result_t TimerM$Timer$fired(uint8_t arg_0x1a5b2c68){#line 51 unsigned char result;#line 51#line 51 switch (arg_0x1a5b2c68) {#line 51 case 0U:#line 51 result = MyAppM$Timer$fired();#line 51 break;#line 51 default:#line 51 result = TimerM$Timer$default$fired(arg_0x1a5b2c68);#line 51 break;#line 51 }#line 51#line 51 return result;#line 51}#line 51# 171 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\system\\TimerM.nc"static inline uint8_t TimerM$dequeue(void)#line 171{ if (TimerM$queue_size == 0) { return NUM_TIMERS; }#line 174 if (TimerM$queue_head == NUM_TIMERS - 1) { TimerM$queue_head = -1; }#line 176 TimerM$queue_head++; TimerM$queue_size--; return TimerM$queue[(uint8_t )TimerM$queue_head];}static inline void TimerM$signalOneTimer(void)#line 181{ uint8_t itimer = TimerM$dequeue();#line 183 if (itimer < NUM_TIMERS) { TimerM$Timer$fired(itimer); }}#line 187static inline void TimerM$HandleFire(void)#line 187{ uint8_t i; uint16_t int_out;#line 190 TimerM$setIntervalFlag = 1; { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 193 { int_out = TimerM$interval_outstanding; TimerM$interval_outstanding = 0; }#line 196 __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 207 { TimerM$mState &= ~(0x1L << i); } TimerM$enqueue(i); } else { { }#line 213 ; TimerM$mTimerList[i].ticksLeft = TimerM$mInterval; } } } } } { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 224 int_out = TimerM$interval_outstanding;#line 224 __nesc_atomic_end(__nesc_atomic); } if (int_out == 0) { TimerM$adjustInterval(); }}static inline result_t TimerM$Clock$fire(void)#line 230{ { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 231 { if (TimerM$interval_outstanding == 0) { TOS_post(TimerM$HandleFire); } else { }#line 238 ; TimerM$interval_outstanding += TimerM$Clock$getInterval() + 1; }#line 241 __nesc_atomic_end(__nesc_atomic); } return SUCCESS;}# 159 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\interfaces\\Clock.nc"inline static result_t HPLClock$Clock$fire(void){#line 159 unsigned char result;#line 159#line 159 result = TimerM$Clock$fire();#line 159#line 159 return result;#line 159}#line 159# 170 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\platform\\atm1281\\avrhardware.h"static __inline void __nesc_disable_interrupt(void)#line 170{ __asm volatile ("cli");}# 82 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\system\\sched.c" bool TOS_post(void (*tp)(void))#line 82{ __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; }}# 34 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\system\\RealMain.nc" int main(void)#line 34{ uint8_t local_symbol_ref; local_symbol_ref = TOS_PLATFORM; local_symbol_ref = TOS_BASE_STATION; local_symbol_ref = TOS_DATA_LENGTH; local_symbol_ref = TOS_ROUTE_PROTOCOL; RealMain$hardwareInit(); RealMain$Pot$init(10); TOSH_sched_init(); RealMain$StdControl$init(); RealMain$StdControl$start(); __nesc_enable_interrupt(); while (1) { TOSH_run_task(); }}# 134 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\platform\\micazc\\HPLPowerManagementM.nc"static uint8_t HPLPowerManagementM$PowerManagement$adjustPower(void)#line 134{ uint8_t mcu;#line 136 if (!HPLPowerManagementM$disabled) { TOS_post(HPLPowerManagementM$doAdjustment); } else #line 138 { mcu = * (volatile uint8_t *)(0x33 + 0x20); mcu &= 0xf1; mcu |= 0; * (volatile uint8_t *)(0x33 + 0x20) = mcu; * (volatile uint8_t *)(0x33 + 0x20) |= 1 << 0; } return 0;}# 164 "D:\\Crossbow\\cygwin\\opt\\MoteWorks\\tos\\platform\\atm1281\\HPLClock.nc" __attribute((interrupt)) void __vector_13(void)#line 164{ { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 165 { if (HPLClock$set_flag) { HPLClock$mscale = HPLClock$nextScale; * (volatile uint8_t *)0xB1 = HPLClock$nextScale; * (volatile uint8_t *)0xB3 = HPLClock$minterval; HPLClock$set_flag = 0; } }#line 172 __nesc_atomic_end(__nesc_atomic); } HPLClock$Clock$fire();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -