#define dbg(mode, format, ...) ((void)0) #define dbg_clear(mode, format, ...) ((void)0) #define dbg_active(mode) 0 # 60 "/usr/local/avr/include/inttypes.h" typedef signed char int8_t; typedef unsigned char uint8_t; # 83 "/usr/local/avr/include/inttypes.h" 3 typedef int int16_t; typedef unsigned int uint16_t; typedef long int32_t; typedef unsigned long uint32_t; #line 117 typedef long long int64_t; typedef unsigned long long uint64_t; #line 134 typedef int16_t intptr_t; typedef uint16_t uintptr_t; # 213 "/usr/local/lib/gcc-lib/avr/3.3-tinyos/include/stddef.h" 3 typedef unsigned int size_t; #line 325 typedef int wchar_t; # 60 "/usr/local/avr/include/stdlib.h" typedef struct __nesc_unnamed4242 { int quot; int rem; } div_t; typedef struct __nesc_unnamed4243 { long quot; long rem; } ldiv_t; typedef int (*__compar_fn_t)(const void *, const void *); # 151 "/usr/local/lib/gcc-lib/avr/3.3-tinyos/include/stddef.h" 3 typedef int ptrdiff_t; # 85 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/tos.h" typedef unsigned char bool; enum __nesc_unnamed4244 { FALSE = 0, TRUE = 1 }; enum __nesc_unnamed4245 { FAIL = 0, SUCCESS = 1 }; static inline uint8_t rcombine(uint8_t r1, uint8_t r2); typedef uint8_t result_t; static inline result_t rcombine(result_t r1, result_t r2); #line 128 enum __nesc_unnamed4246 { NULL = 0x0 }; # 81 "/usr/local/avr/include/avr/pgmspace.h" typedef void __attribute((__progmem__)) prog_void; typedef char __attribute((__progmem__)) prog_char; typedef unsigned char __attribute((__progmem__)) prog_uchar; typedef int __attribute((__progmem__)) prog_int; typedef long __attribute((__progmem__)) prog_long; typedef long long __attribute((__progmem__)) prog_long_long; # 124 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/avrmote/avrhardware.h" enum __nesc_unnamed4247 { TOSH_period16 = 0x00, TOSH_period32 = 0x01, TOSH_period64 = 0x02, TOSH_period128 = 0x03, TOSH_period256 = 0x04, TOSH_period512 = 0x05, TOSH_period1024 = 0x06, TOSH_period2048 = 0x07 }; static inline void TOSH_wait(void); static inline void TOSH_sleep(void); typedef uint8_t __nesc_atomic_t; __inline __nesc_atomic_t __nesc_atomic_start(void ); __inline void __nesc_atomic_end(__nesc_atomic_t oldSreg); static __inline void __nesc_enable_interrupt(void); # 116 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/hardware.h" static __inline void TOSH_SET_RED_LED_PIN(void); #line 116 static __inline void TOSH_CLR_RED_LED_PIN(void); #line 116 static __inline void TOSH_MAKE_RED_LED_OUTPUT(void); static __inline void TOSH_SET_GREEN_LED_PIN(void); #line 117 static __inline void TOSH_MAKE_GREEN_LED_OUTPUT(void); static __inline void TOSH_SET_YELLOW_LED_PIN(void); #line 118 static __inline void TOSH_MAKE_YELLOW_LED_OUTPUT(void); static __inline void TOSH_CLR_SERIAL_ID_PIN(void); #line 120 static __inline void TOSH_MAKE_SERIAL_ID_INPUT(void); static __inline void TOSH_MAKE_CC_CHP_OUT_INPUT(void); static __inline void TOSH_MAKE_CC_PDATA_OUTPUT(void); static __inline void TOSH_MAKE_CC_PCLK_OUTPUT(void); static __inline void TOSH_MAKE_CC_PALE_OUTPUT(void); static __inline void TOSH_SET_FLASH_SELECT_PIN(void); #line 131 static __inline void TOSH_MAKE_FLASH_SELECT_OUTPUT(void); static __inline void TOSH_MAKE_FLASH_CLK_OUTPUT(void); static __inline void TOSH_MAKE_FLASH_OUT_OUTPUT(void); static __inline void TOSH_MAKE_MISO_INPUT(void); static __inline void TOSH_MAKE_SPI_OC1C_INPUT(void); static __inline void TOSH_MAKE_PW0_OUTPUT(void); static __inline void TOSH_MAKE_PW1_OUTPUT(void); static __inline void TOSH_MAKE_PW2_OUTPUT(void); static __inline void TOSH_MAKE_PW3_OUTPUT(void); static __inline void TOSH_MAKE_PW4_OUTPUT(void); static __inline void TOSH_MAKE_PW5_OUTPUT(void); static __inline void TOSH_MAKE_PW6_OUTPUT(void); static __inline void TOSH_MAKE_PW7_OUTPUT(void); static inline #line 171 void TOSH_SET_PIN_DIRECTIONS(void ); #line 215 enum __nesc_unnamed4248 { TOSH_ADC_PORTMAPSIZE = 12 }; enum __nesc_unnamed4249 { TOSH_ACTUAL_CC_RSSI_PORT = 0, TOSH_ACTUAL_VOLTAGE_PORT = 7, TOSH_ACTUAL_BANDGAP_PORT = 30, TOSH_ACTUAL_GND_PORT = 31 }; enum __nesc_unnamed4250 { TOS_ADC_CC_RSSI_PORT = 0, TOS_ADC_VOLTAGE_PORT = 7, TOS_ADC_BANDGAP_PORT = 10, TOS_ADC_GND_PORT = 11 }; # 54 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/types/dbg_modes.h" typedef long long TOS_dbg_mode; enum __nesc_unnamed4251 { DBG_ALL = ~0ULL, DBG_BOOT = 1ULL << 0, DBG_CLOCK = 1ULL << 1, DBG_TASK = 1ULL << 2, DBG_SCHED = 1ULL << 3, DBG_SENSOR = 1ULL << 4, DBG_LED = 1ULL << 5, DBG_CRYPTO = 1ULL << 6, DBG_ROUTE = 1ULL << 7, DBG_AM = 1ULL << 8, DBG_CRC = 1ULL << 9, DBG_PACKET = 1ULL << 10, DBG_ENCODE = 1ULL << 11, DBG_RADIO = 1ULL << 12, DBG_LOG = 1ULL << 13, DBG_ADC = 1ULL << 14, DBG_I2C = 1ULL << 15, DBG_UART = 1ULL << 16, DBG_PROG = 1ULL << 17, DBG_SOUNDER = 1ULL << 18, DBG_TIME = 1ULL << 19, DBG_SIM = 1ULL << 21, DBG_QUEUE = 1ULL << 22, DBG_SIMRADIO = 1ULL << 23, DBG_HARD = 1ULL << 24, DBG_MEM = 1ULL << 25, DBG_USR1 = 1ULL << 27, DBG_USR2 = 1ULL << 28, DBG_USR3 = 1ULL << 29, DBG_TEMP = 1ULL << 30, DBG_ERROR = 1ULL << 31, DBG_NONE = 0, DBG_DEFAULT = DBG_ALL }; # 59 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/sched.c" typedef struct __nesc_unnamed4252 { void (*tp)(void); } TOSH_sched_entry_T; enum __nesc_unnamed4253 { TOSH_MAX_TASKS = 8, TOSH_TASK_BITMASK = TOSH_MAX_TASKS - 1 }; TOSH_sched_entry_T TOSH_queue[TOSH_MAX_TASKS]; volatile uint8_t TOSH_sched_full; volatile uint8_t TOSH_sched_free; static inline void TOSH_wait(void ); static inline void TOSH_sleep(void ); static inline void TOSH_sched_init(void ); #line 98 bool TOS_post(void (*tp)(void)); static inline #line 139 bool TOSH_run_next_task(void); static inline #line 162 void TOSH_run_task(void); # 39 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Timer.h" enum __nesc_unnamed4254 { TIMER_REPEAT = 0, TIMER_ONE_SHOT = 1, NUM_TIMERS = 1 }; # 33 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica128/Clock.h" enum __nesc_unnamed4255 { TOS_I1000PS = 32, TOS_S1000PS = 1, TOS_I100PS = 40, TOS_S100PS = 2, TOS_I10PS = 101, TOS_S10PS = 3, TOS_I1024PS = 0, TOS_S1024PS = 3, TOS_I512PS = 1, TOS_S512PS = 3, TOS_I256PS = 3, TOS_S256PS = 3, TOS_I128PS = 7, TOS_S128PS = 3, TOS_I64PS = 15, TOS_S64PS = 3, TOS_I32PS = 31, TOS_S32PS = 3, TOS_I16PS = 63, TOS_S16PS = 3, TOS_I8PS = 127, TOS_S8PS = 3, TOS_I4PS = 255, TOS_S4PS = 3, TOS_I2PS = 15, TOS_S2PS = 7, TOS_I1PS = 31, TOS_S1PS = 7, TOS_I0PS = 0, TOS_S0PS = 0 }; enum __nesc_unnamed4256 { DEFAULT_SCALE = 3, DEFAULT_INTERVAL = 127 }; static result_t PotM$Pot$init(uint8_t arg_0xa2c6160); static result_t HPLPotC$Pot$finalise(void); static result_t HPLPotC$Pot$decrease(void); static result_t HPLPotC$Pot$increase(void); static result_t HPLInit$init(void); static result_t CountLedM$StdControl$init(void); static result_t CountLedM$StdControl$start(void); static result_t CountLedM$Timer$fired(void); static result_t TimerM$Clock$fire(void); static result_t TimerM$StdControl$init(void); static result_t TimerM$StdControl$start(void); static result_t TimerM$Timer$default$fired(uint8_t arg_0xa316c68); static result_t TimerM$Timer$start(uint8_t arg_0xa316c68, char arg_0xa2fd420, uint32_t arg_0xa2fd578); static void HPLClock$Clock$setInterval(uint8_t arg_0xa33af60); static result_t HPLClock$Clock$setRate(char arg_0xa33a460, char arg_0xa33a5a0); static uint8_t HPLPowerManagementM$PowerManagement$adjustPower(void); static result_t LedsC$Leds$init(void); static result_t LedsC$Leds$redOff(void); static result_t LedsC$Leds$redToggle(void); static result_t LedsC$Leds$redOn(void); static # 47 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/RealMain.nc" result_t RealMain$hardwareInit(void); static # 78 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Pot.nc" result_t RealMain$Pot$init(uint8_t arg_0xa2c6160); static # 63 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/StdControl.nc" result_t RealMain$StdControl$init(void); static result_t RealMain$StdControl$start(void); # 54 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/RealMain.nc" int main(void); static # 74 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/HPLPot.nc" result_t PotM$HPLPot$finalise(void); static #line 59 result_t PotM$HPLPot$decrease(void); static result_t PotM$HPLPot$increase(void); # 91 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/PotM.nc" uint8_t PotM$potSetting; static inline void PotM$setPot(uint8_t value); static inline #line 106 result_t PotM$Pot$init(uint8_t initialSetting); static inline # 57 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLPotC.nc" result_t HPLPotC$Pot$decrease(void); static inline result_t HPLPotC$Pot$increase(void); static inline result_t HPLPotC$Pot$finalise(void); static inline # 57 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/avrmote/HPLInit.nc" result_t HPLInit$init(void); static # 56 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Leds.nc" result_t CountLedM$Leds$init(void); static #line 81 result_t CountLedM$Leds$redToggle(void); static # 59 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Timer.nc" result_t CountLedM$Timer$start(char arg_0xa2fd420, uint32_t arg_0xa2fd578); # 19 "CountLedM.nc" int CountLedM$s_counter; int CountLedM$s_blinksSoFar; int CountLedM$s_howManyBlinks; static inline result_t CountLedM$StdControl$init(void); static inline result_t CountLedM$StdControl$start(void); static inline #line 63 result_t CountLedM$Timer$fired(void); static # 41 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/PowerManagement.nc" uint8_t TimerM$PowerManagement$adjustPower(void); static # 105 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Clock.nc" void TimerM$Clock$setInterval(uint8_t arg_0xa33af60); static #line 96 result_t TimerM$Clock$setRate(char arg_0xa33a460, char arg_0xa33a5a0); static # 73 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Timer.nc" result_t TimerM$Timer$fired( # 45 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/TimerM.nc" uint8_t arg_0xa316c68); uint32_t TimerM$mState; uint8_t TimerM$setIntervalFlag; uint8_t TimerM$mScale; #line 57 uint8_t TimerM$mInterval; int8_t TimerM$queue_head; int8_t TimerM$queue_tail; uint8_t TimerM$queue_size; uint8_t TimerM$queue[NUM_TIMERS]; struct TimerM$timer_s { uint8_t type; int32_t ticks; int32_t ticksLeft; } TimerM$mTimerList[NUM_TIMERS]; enum TimerM$__nesc_unnamed4257 { TimerM$maxTimerInterval = 230 }; static inline result_t TimerM$StdControl$init(void); static inline result_t TimerM$StdControl$start(void); static result_t TimerM$Timer$start(uint8_t id, char type, uint32_t interval); #line 116 static void TimerM$adjustInterval(void); static inline #line 154 result_t TimerM$Timer$default$fired(uint8_t id); static inline void TimerM$enqueue(uint8_t value); static inline uint8_t TimerM$dequeue(void); static inline void TimerM$signalOneTimer(void); static inline void TimerM$HandleFire(void); static inline #line 204 result_t TimerM$Clock$fire(void); static # 180 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Clock.nc" result_t HPLClock$Clock$fire(void); # 54 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica/HPLClock.nc" uint8_t HPLClock$set_flag; uint8_t HPLClock$mscale; #line 55 uint8_t HPLClock$nextScale; #line 55 uint8_t HPLClock$minterval; static inline #line 87 void HPLClock$Clock$setInterval(uint8_t value); static inline #line 149 result_t HPLClock$Clock$setRate(char interval, char scale); #line 167 void __attribute((interrupt)) __vector_15(void); # 51 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLPowerManagementM.nc" bool HPLPowerManagementM$disabled = TRUE; enum HPLPowerManagementM$__nesc_unnamed4258 { HPLPowerManagementM$IDLE = 0, HPLPowerManagementM$ADC_NR = 1 << 3, HPLPowerManagementM$POWER_DOWN = 1 << 4, HPLPowerManagementM$POWER_SAVE = (1 << 3) + (1 << 4), HPLPowerManagementM$STANDBY = (1 << 2) + (1 << 4), HPLPowerManagementM$EXT_STANDBY = (1 << 3) + (1 << 4) + (1 << 2) }; static inline uint8_t HPLPowerManagementM$getPowerLevel(void); static inline #line 84 void HPLPowerManagementM$doAdjustment(void); static #line 101 uint8_t HPLPowerManagementM$PowerManagement$adjustPower(void); # 50 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/LedsC.nc" uint8_t LedsC$ledsOn; enum LedsC$__nesc_unnamed4259 { LedsC$RED_BIT = 1, LedsC$GREEN_BIT = 2, LedsC$YELLOW_BIT = 4 }; static inline result_t LedsC$Leds$init(void); static inline result_t LedsC$Leds$redOn(void); static inline result_t LedsC$Leds$redOff(void); static inline result_t LedsC$Leds$redToggle(void); # 117 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/hardware.h" static __inline void TOSH_SET_GREEN_LED_PIN(void) #line 117 { #line 117 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) |= 1 << 1; } #line 118 static __inline void TOSH_SET_YELLOW_LED_PIN(void) #line 118 { #line 118 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) |= 1 << 0; } #line 116 static __inline void TOSH_SET_RED_LED_PIN(void) #line 116 { #line 116 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) |= 1 << 2; } #line 131 static __inline void TOSH_SET_FLASH_SELECT_PIN(void) #line 131 { #line 131 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) |= 1 << 3; } #line 132 static __inline void TOSH_MAKE_FLASH_CLK_OUTPUT(void) #line 132 { #line 132 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x11 + 0x20) |= 1 << 5; } #line 133 static __inline void TOSH_MAKE_FLASH_OUT_OUTPUT(void) #line 133 { #line 133 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x11 + 0x20) |= 1 << 3; } #line 131 static __inline void TOSH_MAKE_FLASH_SELECT_OUTPUT(void) #line 131 { #line 131 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1A + 0x20) |= 1 << 3; } #line 120 static __inline void TOSH_CLR_SERIAL_ID_PIN(void) #line 120 { #line 120 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) &= ~(1 << 4); } #line 120 static __inline void TOSH_MAKE_SERIAL_ID_INPUT(void) #line 120 { #line 120 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1A + 0x20) &= ~(1 << 4); } #line 145 static __inline void TOSH_MAKE_SPI_OC1C_INPUT(void) #line 145 { #line 145 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x17 + 0x20) &= ~(1 << 7); } #line 144 static __inline void TOSH_MAKE_MISO_INPUT(void) #line 144 { #line 144 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x17 + 0x20) &= ~(1 << 3); } #line 127 static __inline void TOSH_MAKE_CC_PCLK_OUTPUT(void) #line 127 { #line 127 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x11 + 0x20) |= 1 << 6; } #line 126 static __inline void TOSH_MAKE_CC_PDATA_OUTPUT(void) #line 126 { #line 126 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x11 + 0x20) |= 1 << 7; } #line 128 static __inline void TOSH_MAKE_CC_PALE_OUTPUT(void) #line 128 { #line 128 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x11 + 0x20) |= 1 << 4; } #line 149 static __inline void TOSH_MAKE_PW0_OUTPUT(void) #line 149 { #line 149 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x14 + 0x20) |= 1 << 0; } #line 150 static __inline void TOSH_MAKE_PW1_OUTPUT(void) #line 150 { #line 150 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x14 + 0x20) |= 1 << 1; } #line 151 static __inline void TOSH_MAKE_PW2_OUTPUT(void) #line 151 { #line 151 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x14 + 0x20) |= 1 << 2; } #line 152 static __inline void TOSH_MAKE_PW3_OUTPUT(void) #line 152 { #line 152 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x14 + 0x20) |= 1 << 3; } #line 153 static __inline void TOSH_MAKE_PW4_OUTPUT(void) #line 153 { #line 153 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x14 + 0x20) |= 1 << 4; } #line 154 static __inline void TOSH_MAKE_PW5_OUTPUT(void) #line 154 { #line 154 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x14 + 0x20) |= 1 << 5; } #line 155 static __inline void TOSH_MAKE_PW6_OUTPUT(void) #line 155 { #line 155 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x14 + 0x20) |= 1 << 6; } #line 156 static __inline void TOSH_MAKE_PW7_OUTPUT(void) #line 156 { #line 156 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x14 + 0x20) |= 1 << 7; } #line 125 static __inline void TOSH_MAKE_CC_CHP_OUT_INPUT(void) #line 125 { #line 125 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1A + 0x20) &= ~(1 << 6); } #line 117 static __inline void TOSH_MAKE_GREEN_LED_OUTPUT(void) #line 117 { #line 117 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1A + 0x20) |= 1 << 1; } #line 118 static __inline void TOSH_MAKE_YELLOW_LED_OUTPUT(void) #line 118 { #line 118 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1A + 0x20) |= 1 << 0; } #line 116 static __inline void TOSH_MAKE_RED_LED_OUTPUT(void) #line 116 { #line 116 * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1A + 0x20) |= 1 << 2; } static inline #line 171 void TOSH_SET_PIN_DIRECTIONS(void ) { TOSH_MAKE_RED_LED_OUTPUT(); TOSH_MAKE_YELLOW_LED_OUTPUT(); TOSH_MAKE_GREEN_LED_OUTPUT(); TOSH_MAKE_CC_CHP_OUT_INPUT(); TOSH_MAKE_PW7_OUTPUT(); TOSH_MAKE_PW6_OUTPUT(); TOSH_MAKE_PW5_OUTPUT(); TOSH_MAKE_PW4_OUTPUT(); TOSH_MAKE_PW3_OUTPUT(); TOSH_MAKE_PW2_OUTPUT(); TOSH_MAKE_PW1_OUTPUT(); TOSH_MAKE_PW0_OUTPUT(); TOSH_MAKE_CC_PALE_OUTPUT(); TOSH_MAKE_CC_PDATA_OUTPUT(); TOSH_MAKE_CC_PCLK_OUTPUT(); TOSH_MAKE_MISO_INPUT(); TOSH_MAKE_SPI_OC1C_INPUT(); TOSH_MAKE_SERIAL_ID_INPUT(); TOSH_CLR_SERIAL_ID_PIN(); TOSH_MAKE_FLASH_SELECT_OUTPUT(); TOSH_MAKE_FLASH_OUT_OUTPUT(); TOSH_MAKE_FLASH_CLK_OUTPUT(); TOSH_SET_FLASH_SELECT_PIN(); TOSH_SET_RED_LED_PIN(); TOSH_SET_YELLOW_LED_PIN(); TOSH_SET_GREEN_LED_PIN(); } static inline # 57 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/avrmote/HPLInit.nc" result_t HPLInit$init(void) #line 57 { TOSH_SET_PIN_DIRECTIONS(); return SUCCESS; } # 47 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/RealMain.nc" inline static result_t RealMain$hardwareInit(void){ #line 47 unsigned char result; #line 47 #line 47 result = HPLInit$init(); #line 47 #line 47 return result; #line 47 } #line 47 static inline # 75 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLPotC.nc" result_t HPLPotC$Pot$finalise(void) #line 75 { return SUCCESS; } # 74 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/HPLPot.nc" inline static result_t PotM$HPLPot$finalise(void){ #line 74 unsigned char result; #line 74 #line 74 result = HPLPotC$Pot$finalise(); #line 74 #line 74 return result; #line 74 } #line 74 static inline # 66 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLPotC.nc" result_t HPLPotC$Pot$increase(void) #line 66 { return SUCCESS; } # 67 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/HPLPot.nc" inline static result_t PotM$HPLPot$increase(void){ #line 67 unsigned char result; #line 67 #line 67 result = HPLPotC$Pot$increase(); #line 67 #line 67 return result; #line 67 } #line 67 static inline # 57 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLPotC.nc" result_t HPLPotC$Pot$decrease(void) #line 57 { return SUCCESS; } # 59 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/HPLPot.nc" inline static result_t PotM$HPLPot$decrease(void){ #line 59 unsigned char result; #line 59 #line 59 result = HPLPotC$Pot$decrease(); #line 59 #line 59 return result; #line 59 } #line 59 static inline # 93 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/PotM.nc" void PotM$setPot(uint8_t value) #line 93 { uint8_t i; #line 95 for (i = 0; i < 151; i++) PotM$HPLPot$decrease(); for (i = 0; i < value; i++) PotM$HPLPot$increase(); PotM$HPLPot$finalise(); PotM$potSetting = value; } static inline result_t PotM$Pot$init(uint8_t initialSetting) #line 106 { PotM$setPot(initialSetting); return SUCCESS; } # 78 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Pot.nc" inline static result_t RealMain$Pot$init(uint8_t arg_0xa2c6160){ #line 78 unsigned char result; #line 78 #line 78 result = PotM$Pot$init(arg_0xa2c6160); #line 78 #line 78 return result; #line 78 } #line 78 static inline # 76 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/sched.c" void TOSH_sched_init(void ) { TOSH_sched_free = 0; TOSH_sched_full = 0; } static inline # 108 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/tos.h" result_t rcombine(result_t r1, result_t r2) { return r1 == FAIL ? FAIL : r2; } static inline # 58 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/LedsC.nc" result_t LedsC$Leds$init(void) #line 58 { { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start(); #line 59 { LedsC$ledsOn = 0; { } #line 61 ; TOSH_SET_RED_LED_PIN(); TOSH_SET_YELLOW_LED_PIN(); TOSH_SET_GREEN_LED_PIN(); } #line 65 __nesc_atomic_end(__nesc_atomic); } return SUCCESS; } # 56 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Leds.nc" inline static result_t CountLedM$Leds$init(void){ #line 56 unsigned char result; #line 56 #line 56 result = LedsC$Leds$init(); #line 56 #line 56 return result; #line 56 } #line 56 static inline # 28 "CountLedM.nc" result_t CountLedM$StdControl$init(void) #line 28 { CountLedM$Leds$init(); return SUCCESS; } static inline # 149 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica/HPLClock.nc" result_t HPLClock$Clock$setRate(char interval, char scale) #line 149 { scale &= 0x7; scale |= 0x8; { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start(); #line 152 { * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x37 + 0x20) &= ~(1 << 0); * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x37 + 0x20) &= ~(1 << 1); * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x30 + 0x20) |= 1 << 3; * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x33 + 0x20) = scale; * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x32 + 0x20) = 0; * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x31 + 0x20) = interval; * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x37 + 0x20) |= 1 << 1; } #line 162 __nesc_atomic_end(__nesc_atomic); } return SUCCESS; } # 96 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Clock.nc" inline static result_t TimerM$Clock$setRate(char arg_0xa33a460, char arg_0xa33a5a0){ #line 96 unsigned char result; #line 96 #line 96 result = HPLClock$Clock$setRate(arg_0xa33a460, arg_0xa33a5a0); #line 96 #line 96 return result; #line 96 } #line 96 static inline # 72 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/TimerM.nc" result_t TimerM$StdControl$init(void) #line 72 { TimerM$mState = 0; TimerM$setIntervalFlag = 0; TimerM$queue_head = TimerM$queue_tail = -1; TimerM$queue_size = 0; TimerM$mScale = 3; TimerM$mInterval = TimerM$maxTimerInterval; return TimerM$Clock$setRate(TimerM$mInterval, TimerM$mScale); } # 63 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/StdControl.nc" inline static result_t RealMain$StdControl$init(void){ #line 63 unsigned char result; #line 63 #line 63 result = TimerM$StdControl$init(); #line 63 result = rcombine(result, CountLedM$StdControl$init()); #line 63 #line 63 return result; #line 63 } #line 63 # 59 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Timer.nc" inline static result_t CountLedM$Timer$start(char arg_0xa2fd420, uint32_t arg_0xa2fd578){ #line 59 unsigned char result; #line 59 #line 59 result = TimerM$Timer$start(0, arg_0xa2fd420, arg_0xa2fd578); #line 59 #line 59 return result; #line 59 } #line 59 static inline # 39 "CountLedM.nc" result_t CountLedM$StdControl$start(void) #line 39 { CountLedM$s_counter = 1; CountLedM$s_blinksSoFar = 0; CountLedM$s_howManyBlinks = 0; return CountLedM$Timer$start(TIMER_ONE_SHOT, 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, CountLedM$StdControl$start()); #line 70 #line 70 return result; #line 70 } #line 70 static 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 84 void 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 # 165 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/avrmote/avrhardware.h" __inline void __nesc_enable_interrupt(void) #line 165 { __asm volatile ("sei");} static inline #line 135 void 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 160 __inline void __nesc_atomic_end(__nesc_atomic_t oldSreg) { * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x3F + 0x20) = oldSreg; } #line 153 __inline __nesc_atomic_t __nesc_atomic_start(void ) { __nesc_atomic_t result = * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x3F + 0x20); #line 156 __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(); } # 41 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/PowerManagement.nc" inline 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 41 static inline # 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; } # 105 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Clock.nc" inline static void TimerM$Clock$setInterval(uint8_t arg_0xa33af60){ #line 105 HPLClock$Clock$setInterval(arg_0xa33af60); #line 105 } #line 105 # 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(); } # 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 CountLedM$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 81 static inline # 63 "CountLedM.nc" result_t CountLedM$Timer$fired(void) { if (CountLedM$s_blinksSoFar == 2 * CountLedM$s_counter) { CountLedM$s_blinksSoFar = 0; CountLedM$s_counter++; } if (CountLedM$s_counter == 9) { CountLedM$s_counter = 1; } CountLedM$s_blinksSoFar++; CountLedM$Timer$start(TIMER_ONE_SHOT, 1000 / CountLedM$s_counter); CountLedM$Leds$redToggle(); 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_0xa316c68){ #line 73 unsigned char result; #line 73 #line 73 switch (arg_0xa316c68) { #line 73 case 0: #line 73 result = CountLedM$Timer$fired(); #line 73 break; #line 73 default: #line 73 result = TimerM$Timer$default$fired(arg_0xa316c68); #line 73 } #line 73 #line 73 return result; #line 73 } #line 73 static 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 158 void 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 182 void 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 # 93 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/TimerM.nc" result_t TimerM$Timer$start(uint8_t id, char type, uint32_t interval) #line 94 { uint8_t diff; #line 96 if (id >= NUM_TIMERS) { #line 96 return FAIL; } #line 97 if (type > 1) { #line 97 return FAIL; } #line 98 TimerM$mTimerList[id].ticks = interval; TimerM$mTimerList[id].type = type; { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start(); #line 101 { diff = * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x32 + 0x20); interval += diff; TimerM$mTimerList[id].ticksLeft = interval; TimerM$mState |= 0x1 << id; if (interval < TimerM$mInterval) { TimerM$mInterval = interval; TimerM$Clock$setInterval(TimerM$mInterval); TimerM$setIntervalFlag = 0; TimerM$PowerManagement$adjustPower(); } } #line 112 __nesc_atomic_end(__nesc_atomic); } return SUCCESS; } 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(); }