⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 app.c

📁 nesC语言实现的串口收发程序,用于传感器网络操作系统tinyos1.X.研究传感器网络的朋友们可以看看,功能比较简单,却是经常要用到的!
💻 C
📖 第 1 页 / 共 3 页
字号:
#line 156   __asm volatile ("cli");  return result;}__inline void  __nesc_atomic_end(__nesc_atomic_t oldSreg){  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x3F + 0x20) = oldSreg;}# 116 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/hardware.h"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;}#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 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;}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 156static __inline void TOSH_MAKE_PW7_OUTPUT(void)#line 156{#line 156  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x14 + 0x20) |= 1 << 7;}#line 155static __inline void TOSH_MAKE_PW6_OUTPUT(void)#line 155{#line 155  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x14 + 0x20) |= 1 << 6;}#line 154static __inline void TOSH_MAKE_PW5_OUTPUT(void)#line 154{#line 154  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x14 + 0x20) |= 1 << 5;}#line 153static __inline void TOSH_MAKE_PW4_OUTPUT(void)#line 153{#line 153  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x14 + 0x20) |= 1 << 4;}#line 152static __inline void TOSH_MAKE_PW3_OUTPUT(void)#line 152{#line 152  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x14 + 0x20) |= 1 << 3;}#line 151static __inline void TOSH_MAKE_PW2_OUTPUT(void)#line 151{#line 151  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x14 + 0x20) |= 1 << 2;}#line 150static __inline void TOSH_MAKE_PW1_OUTPUT(void)#line 150{#line 150  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x14 + 0x20) |= 1 << 1;}#line 149static __inline void TOSH_MAKE_PW0_OUTPUT(void)#line 149{#line 149  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x14 + 0x20) |= 1 << 0;}#line 128static __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 126static __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 127static __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 144static __inline void TOSH_MAKE_MISO_INPUT(void)#line 144{#line 144  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x17 + 0x20) &= ~(1 << 3);}#line 145static __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 120static __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 120static __inline void TOSH_CLR_SERIAL_ID_PIN(void)#line 120{#line 120  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) &= ~(1 << 4);}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 133static __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 132static __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 131static __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 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 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 117static __inline void TOSH_SET_GREEN_LED_PIN(void)#line 117{#line 117  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) |= 1 << 1;}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");}# 117 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/hardware.h"static __inline void TOSH_CLR_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_CLR_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_CLR_RED_LED_PIN(void)#line 116{#line 116  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x1B + 0x20) &= ~(1 << 2);}# 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();    }}#line 47static  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 47static  # 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;}static # 171 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/hardware.h"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();}# 78 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Pot.nc"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 78static  # 106 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/PotM.nc"result_t PotM$Pot$init(uint8_t initialSetting)#line 106{  PotM$setPot(initialSetting);  return SUCCESS;}static #line 93void 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;}# 59 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/HPLPot.nc"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 59static  # 57 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLPotC.nc"result_t HPLPotC$Pot$decrease(void)#line 57{  return SUCCESS;}# 67 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/HPLPot.nc"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 67static  # 66 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLPotC.nc"result_t HPLPotC$Pot$increase(void)#line 66{  return SUCCESS;}# 74 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/HPLPot.nc"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 74static  # 75 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLPotC.nc"result_t HPLPotC$Pot$finalise(void)#line 75{  return SUCCESS;}static # 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;}# 63 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/StdControl.nc"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, UartUserM$StdControl$init());#line 63#line 63  return result;#line 63}#line 63static  # 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);}# 96 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Clock.nc"static   result_t TimerM$Clock$setRate(char arg_0xa350c78, char arg_0xa350db8){#line 96  unsigned char result;#line 96#line 96  result = HPLClock$Clock$setRate(arg_0xa350c78, arg_0xa350db8);#line 96#line 96  return result;#line 96}#line 96static   # 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;}static  # 47 "UartUserM.nc"result_t UartUserM$StdControl$init(void)#line 47{  UartUserM$cnt = 0;  UartUserM$HPLUART$init();  return SUCCESS;}# 62 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/HPLUART.nc"static   result_t UartUserM$HPLUART$init(void){#line 62  unsigned char result;#line 62#line 62  result = HPLUART0M$UART$init();#line 62#line 62  return result;#line 62}#line 62static   # 60 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/mica2/HPLUART0M.nc"result_t HPLUART0M$UART$init(void)#line 60{  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)0x90 = 0;  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x09 + 0x20) = 95;  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x0B + 0x20) = 1 << 1;  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)0x95 = (1 << 2) | (1 << 1);  * (volatile unsigned char *)(unsigned int )& * (volatile unsigned char *)(0x0A + 0x20) = (((1 << 7) | (1 << 6)) | (1 << 4)) | (1 << 3);  return SUCCESS;}static # 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;}# 70 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/StdControl.nc"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, UartUserM$StdControl$start());#line 70#line 70  return result;#line 70}#line 70static  # 82 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/system/TimerM.nc"result_t TimerM$StdControl$start(void)#line 82{  return SUCCESS;}static  # 53 "UartUserM.nc"result_t UartUserM$StdControl$start(void)#line 53{  UartUserM$Timer$start(TIMER_REPEAT, 1000);  return SUCCESS;}# 59 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Timer.nc"static  result_t UartUserM$Timer$start(char arg_0xa321950, uint32_t arg_0xa321aa8){#line 59  unsigned char result;#line 59#line 59  result = TimerM$Timer$start(0, arg_0xa321950, arg_0xa321aa8);#line 59#line 59  return result;#line 59}#line 59static  # 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;}# 105 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Clock.nc"static   void TimerM$Clock$setInterval(uint8_t arg_0xa351778){#line 105  HPLClock$Clock$setInterval(arg_0xa351778);#line 105}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -