📄 app.c
字号:
__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:/PROGRA~1/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:/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 # 105 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLUART0M.nc"result_t HPLUART0M$UART$put(uint8_t data)#line 105{ { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 106 { * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x0C + 0x20) = data; * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x0B + 0x20) |= 1 << 6; }#line 109 __nesc_atomic_end(__nesc_atomic); } return SUCCESS;}# 80 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/HPLUART.nc"inline static result_t cc1km$HPLUART$put(uint8_t arg_0xa2df9d0){#line 80 unsigned char result;#line 80#line 80 result = HPLUART0M$UART$put(arg_0xa2df9d0);#line 80#line 80 return result;#line 80}#line 80# 126 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica2/hardware.h"static __inline int TOSH_READ_CC_PDATA_PIN(void)#line 126{#line 126 return (* (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x10 + 0x20) & (1 << 7)) != 0;}#line 126static __inline void TOSH_MAKE_CC_PDATA_INPUT(void)#line 126{#line 126 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x11 + 0x20) &= ~(1 << 7);}static inline # 128 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLCC1000M.nc"uint8_t HPLCC1000M$HPLCC1000$read(uint8_t addr)#line 128{ int cnt; uint8_t din; uint8_t data = 0; addr <<= 1; TOSH_CLR_CC_PALE_PIN(); for (cnt = 0; cnt < 7; cnt++) { if (addr & 0x80) { TOSH_SET_CC_PDATA_PIN(); } else {#line 141 TOSH_CLR_CC_PDATA_PIN(); }#line 142 TOSH_CLR_CC_PCLK_PIN(); TOSH_SET_CC_PCLK_PIN(); addr <<= 1; } TOSH_CLR_CC_PDATA_PIN(); TOSH_CLR_CC_PCLK_PIN(); TOSH_SET_CC_PCLK_PIN(); TOSH_MAKE_CC_PDATA_INPUT(); TOSH_SET_CC_PALE_PIN(); for (cnt = 7; cnt >= 0; cnt--) { TOSH_CLR_CC_PCLK_PIN(); din = TOSH_READ_CC_PDATA_PIN(); if (din) { data = (data << 1) | 0x01; } else {#line 161 data = (data << 1) & 0xfe; }#line 162 TOSH_SET_CC_PCLK_PIN(); } TOSH_SET_CC_PALE_PIN(); TOSH_MAKE_CC_PDATA_OUTPUT(); TOSH_SET_CC_PDATA_PIN(); return data;}# 65 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLCC1000.nc"inline static uint8_t cc1km$HPLCC1000$read(uint8_t arg_0xa2dc5c8){#line 65 unsigned char result;#line 65#line 65 result = HPLCC1000M$HPLCC1000$read(arg_0xa2dc5c8);#line 65#line 65 return result;#line 65}#line 65static inline # 41 "cc1km.nc"result_t cc1km$Timer$fired(void)#line 41{ cc1km$addr++; cc1km$data = cc1km$HPLCC1000$read(cc1km$addr); return cc1km$HPLUART$put(cc1km$data);}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_0xa36dd98){#line 73 unsigned char result;#line 73#line 73 switch (arg_0xa36dd98) {#line 73 case 0:#line 73 result = cc1km$Timer$fired();#line 73 break;#line 73 default:#line 73 result = TimerM$Timer$default$fired(arg_0xa36dd98);#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 # 101 "C:/PROGRA~1/UCB/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:/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 + -