📄 app.c
字号:
unsigned char result;#line 59#line 59 result = HPLPotC$Pot$decrease();#line 59#line 59 return result;#line 59}#line 59static inline # 93 "C:/PROGRA~1/UCB/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:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/Pot.nc"inline static result_t RealMain$Pot$init(uint8_t arg_0xa2e9b58){#line 78 unsigned char result;#line 78#line 78 result = PotM$Pot$init(arg_0xa2e9b58);#line 78#line 78 return result;#line 78}#line 78static inline # 83 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/system/sched.c"void TOSH_sched_init(void ){ int i;#line 86 TOSH_sched_free = 0; TOSH_sched_full = 0; for (i = 0; i < TOSH_MAX_TASKS; i++) TOSH_queue[i].tp = (void *)0;}static inline # 120 "C:/PROGRA~1/UCB/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 result_t rcombine3(result_t r1, result_t r2, result_t r3){ return rcombine(r1, rcombine(r2, r3));}# 117 "C:/PROGRA~1/UCB/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 118static __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 116static __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 117static __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 118static __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 116static __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 # 58 "C:/PROGRA~1/UCB/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_MAKE_RED_LED_OUTPUT(); TOSH_MAKE_YELLOW_LED_OUTPUT(); TOSH_MAKE_GREEN_LED_OUTPUT(); TOSH_SET_RED_LED_PIN(); TOSH_SET_YELLOW_LED_PIN(); TOSH_SET_GREEN_LED_PIN(); }#line 68 __nesc_atomic_end(__nesc_atomic); } return SUCCESS;}# 56 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/Leds.nc"inline static result_t ACBaseM$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# 63 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/StdControl.nc"inline static result_t CC1000RadioIntM$TimerControl$init(void){#line 63 unsigned char result;#line 63#line 63 result = TimerM$StdControl$init();#line 63#line 63 return result;#line 63}#line 63static inline # 59 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/system/RandomLFSR.nc"result_t RandomLFSR$Random$init(void)#line 59{ { }#line 60 ; { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 61 { RandomLFSR$shiftReg = 119 * 119 * (TOS_LOCAL_ADDRESS + 1); RandomLFSR$initSeed = RandomLFSR$shiftReg; RandomLFSR$mask = 137 * 29 * (TOS_LOCAL_ADDRESS + 1); }#line 65 __nesc_atomic_end(__nesc_atomic); } return SUCCESS;}# 57 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/Random.nc"inline static result_t CC1000RadioIntM$Random$init(void){#line 57 unsigned char result;#line 57#line 57 result = RandomLFSR$Random$init();#line 57#line 57 return result;#line 57}#line 57static inline # 90 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLADCM.nc"result_t HPLADCM$ADC$init(void)#line 90{ HPLADCM$init_portmap(); { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 95 { * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x06 + 0x20) = (1 << 3) | (6 << 0); * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x07 + 0x20) = 0; }#line 99 __nesc_atomic_end(__nesc_atomic); } return SUCCESS;}# 54 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/HPLADC.nc"inline static result_t ADCREFM$HPLADC$init(void){#line 54 unsigned char result;#line 54#line 54 result = HPLADCM$ADC$init();#line 54#line 54 return result;#line 54}#line 54static inline # 99 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica2/ADCREFM.nc"result_t ADCREFM$ADCControl$init(void)#line 99{ { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 100 { ADCREFM$ReqPort = 0; ADCREFM$ReqVector = ADCREFM$ContReqMask = ADCREFM$CalReqMask = 0; ADCREFM$RefVal = 381; }#line 104 __nesc_atomic_end(__nesc_atomic); } { }#line 105 ; return ADCREFM$HPLADC$init();}# 77 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica2/ADCControl.nc"inline static result_t CC1000RadioIntM$ADCControl$init(void){#line 77 unsigned char result;#line 77#line 77 result = ADCREFM$ADCControl$init();#line 77#line 77 return result;#line 77}#line 77static inline # 110 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLADCM.nc"result_t HPLADCM$ADC$bindPort(uint8_t port, uint8_t adcPort)#line 110{ if (#line 111 port < TOSH_ADC_PORTMAPSIZE && port != TOS_ADC_BANDGAP_PORT && port != TOS_ADC_GND_PORT) { HPLADCM$init_portmap(); { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 115 HPLADCM$TOSH_adc_portmap[port] = adcPort;#line 115 __nesc_atomic_end(__nesc_atomic); } return SUCCESS; } else { return FAIL; }}# 70 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/HPLADC.nc"inline static result_t ADCREFM$HPLADC$bindPort(uint8_t arg_0xa4aa550, uint8_t arg_0xa4aa698){#line 70 unsigned char result;#line 70#line 70 result = HPLADCM$ADC$bindPort(arg_0xa4aa550, arg_0xa4aa698);#line 70#line 70 return result;#line 70}#line 70static inline # 114 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica2/ADCREFM.nc"result_t ADCREFM$ADCControl$bindPort(uint8_t port, uint8_t adcPort)#line 114{ return ADCREFM$HPLADC$bindPort(port, adcPort);}# 116 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica2/ADCControl.nc"inline static result_t CC1000RadioIntM$ADCControl$bindPort(uint8_t arg_0xa3d29a8, uint8_t arg_0xa3d2af0){#line 116 unsigned char result;#line 116#line 116 result = ADCREFM$ADCControl$bindPort(arg_0xa3d29a8, arg_0xa3d2af0);#line 116#line 116 return result;#line 116}#line 116static inline # 516 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica2/CC1000ControlM.nc"bool CC1000ControlM$CC1000Control$GetLOStatus(void)#line 516{ return CC1000ControlM$gCurrentParameters[0x1e];}# 190 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica2/CC1000Control.nc"inline static bool CC1000RadioIntM$CC1000Control$GetLOStatus(void){#line 190 unsigned char result;#line 190#line 190 result = CC1000ControlM$CC1000Control$GetLOStatus();#line 190#line 190 return result;#line 190}#line 190# 58 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLCC1000.nc"inline static result_t CC1000ControlM$HPLChipcon$write(uint8_t arg_0xa454b00, uint8_t arg_0xa454c48){#line 58 unsigned char result;#line 58#line 58 result = HPLCC1000M$HPLCC1000$write(arg_0xa454b00, arg_0xa454c48);#line 58#line 58 return result;#line 58}#line 58static inline # 504 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica2/CC1000ControlM.nc"result_t CC1000ControlM$CC1000Control$SelectLock(uint8_t Value)#line 504{ CC1000ControlM$gCurrentParameters[0xd] = Value << 4; return CC1000ControlM$HPLChipcon$write(0x0D, Value << 4);}# 170 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica2/CC1000Control.nc"inline static result_t CC1000RadioIntM$CC1000Control$SelectLock(uint8_t arg_0xa399d58){#line 170 unsigned char result;#line 170#line 170 result = CC1000ControlM$CC1000Control$SelectLock(arg_0xa399d58);#line 170#line 170 return result;#line 170}#line 170# 65 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLCC1000.nc"inline static uint8_t CC1000ControlM$HPLChipcon$read(uint8_t arg_0xa4550b8){#line 65 unsigned char result;#line 65#line 65 result = HPLCC1000M$HPLCC1000$read(arg_0xa4550b8);#line 65#line 65 return result;#line 65}#line 65static inline # 131 "C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/mica2/CC1000ControlM.nc"result_t CC1000ControlM$chipcon_cal(void){ CC1000ControlM$HPLChipcon$write(0x0B, 0x00); CC1000ControlM$HPLChipcon$write(0x42, 0x3f); CC1000ControlM$HPLChipcon$write(0x00, ( 1 << 4) | (1 << 0)); CC1000ControlM$HPLChipcon$write(0x0E, (( 1 << 7) | ( 1 << 5)) | (6 << 0)); while ((CC1000ControlM$HPLChipcon$read(0x0E) & (1 << 3)) == 0) ; CC1000ControlM$HPLChipcon$write(0x0E, ( 1 << 5) | (6 << 0)); CC1000ControlM$HPLChipcon$write(0x00, ((( 1 << 7) | (1 << 6)) | (1 << 5)) | ( 1 << 0)); CC1000ControlM$HPLChipcon$write(0x09, CC1000ControlM$gCurrentParameters[29]); CC1000ControlM$HPLChipcon$write(0x0B, 0x00); CC1000ControlM$HPLChipcon$write(0x0E, (( 1 << 7) | ( 1 << 5)) | (6 << 0)); while ((CC1000ControlM$HPLChipcon$read(0x0E) & (1 << 3)) == 0) ; CC1000ControlM$HPLChipcon$write(0x0E, ( 1 << 5) | (6 << 0)); return SUCCESS;}static inline void CC1000ControlM$cc1000SetFreq(void)#line 187{ uint8_t i; for (i = 1; i < 0x0d; i++) { CC1000ControlM$HPLChipcon$write(i, CC1000ControlM$gCurrentParameters[i]); } CC1000ControlM$HPLChipcon$write(0x12, CC1000ControlM$gCurrentParameters[0x12]); CC1000ControlM$chipcon_cal(); return;}static inline #line 230uint32_t CC1000ControlM$cc1000ComputeFreq(uint32_t desiredFreq)#line 230{ uint32_t ActualChannel = 0; uint32_t RXFreq = 0;#line 232 uint32_t TXFreq = 0; int32_t Offset = 0x7fffffff; uint16_t FSep = 0; uint8_t RefDiv = 0; uint8_t i; for (i = 0; i < 9; i++) { uint32_t NRef = desiredFreq + CC1000ControlM$IF; uint32_t FRef = CC1000ControlM$FRefTbl[i]; uint32_t Channel = 0; uint32_t RXCalc = 0;#line 243 uint32_t TXCalc = 0; int32_t diff; NRef = ((desiredFreq + CC1000ControlM$IF) << 2) / FRef; if (NRef & 0x1) { NRef++; } if (NRef & 0x2) { RXCalc = 16384 >> 1; Channel = FRef >> 1; } NRef >>= 2; RXCalc += NRef * 16384 - 8192; if (RXCalc < CC1000ControlM$FREQ_MIN || RXCalc > CC1000ControlM$FREQ_MAX) { continue; } TXCalc = RXCalc - CC1000ControlM$CorTbl[i]; if (TXCalc < CC1000ControlM$FREQ_MIN || TXCalc > CC1000ControlM$FREQ_MAX) { continue; } Channel += NRef * FRef; Channel -= CC1000ControlM$IF; diff = Channel - desiredFreq; if (diff < 0) { diff = 0 - diff; } if (diff < Offset) { RXFreq = RXCalc; TXFreq = TXCalc; ActualChannel = Channel; FSep = CC1000ControlM$FSepTbl[i]; RefDiv = i + 6; Offset = diff; } } if (RefDiv != 0) { CC1000ControlM$gCurrentParameters[
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -