app.c
上传用户:joranyuan
上传日期:2022-06-23
资源大小:3306k
文件大小:323k
源码类别:

网络

开发平台:

Others

  1.   * (volatile uint8_t *)(0x0F + 0x20) = HPLSpiM$OutgoingByte;
  2.   HPLSpiM$SpiByteFifo$dataReady(temp);
  3. }
  4. static inline    
  5. # 1789 "../../tos/platform/mica2/CC1000RadioIntM.nc"
  6. void CC1000RadioIntM$RadioSendCoordinator$default$blockTimer(void)
  7. #line 1789
  8. {
  9. }
  10. # 43 "../../tos/platform/mica2/RadioCoordinator.nc"
  11. inline static   void CC1000RadioIntM$RadioSendCoordinator$blockTimer(void){
  12. #line 43
  13.   CC1000RadioIntM$RadioSendCoordinator$default$blockTimer();
  14. #line 43
  15. }
  16. #line 43
  17. static inline    
  18. # 1794 "../../tos/platform/mica2/CC1000RadioIntM.nc"
  19. void CC1000RadioIntM$RadioReceiveCoordinator$default$blockTimer(void)
  20. #line 1794
  21. {
  22. }
  23. # 43 "../../tos/platform/mica2/RadioCoordinator.nc"
  24. inline static   void CC1000RadioIntM$RadioReceiveCoordinator$blockTimer(void){
  25. #line 43
  26.   CC1000RadioIntM$RadioReceiveCoordinator$default$blockTimer();
  27. #line 43
  28. }
  29. #line 43
  30. static inline    
  31. # 1786 "../../tos/platform/mica2/CC1000RadioIntM.nc"
  32. void CC1000RadioIntM$RadioSendCoordinator$default$startSymbol(uint8_t bitsPerBlock, uint8_t offset, 
  33. TOS_MsgPtr msgBuff)
  34. #line 1787
  35. {
  36. }
  37. # 31 "../../tos/platform/mica2/RadioCoordinator.nc"
  38. inline static   void CC1000RadioIntM$RadioSendCoordinator$startSymbol(uint8_t arg_0x85eba50, uint8_t arg_0x85ebb98, TOS_MsgPtr arg_0x85ebce8){
  39. #line 31
  40.   CC1000RadioIntM$RadioSendCoordinator$default$startSymbol(arg_0x85eba50, arg_0x85ebb98, arg_0x85ebce8);
  41. #line 31
  42. }
  43. #line 31
  44. static inline 
  45. # 264 "../../tos/platform/mica2/CC1000RadioIntM.nc"
  46. void CC1000RadioIntM$AddTime(GTime *C, GTime *A, GTime *B)
  47. #line 264
  48. {
  49.   if (CC1000RadioIntM$MAX_VAL - B->sticks < A->sticks) {
  50.       C->sticks = A->sticks - (CC1000RadioIntM$MAX_VAL - B->sticks);
  51.       C->mticks = A->mticks + B->mticks + 1;
  52.     }
  53.   else {
  54.       C->sticks = A->sticks + B->sticks;
  55.       C->mticks = A->mticks + B->mticks;
  56.     }
  57. }
  58. static inline    
  59. #line 1788
  60. void CC1000RadioIntM$RadioSendCoordinator$default$byte(TOS_MsgPtr msg, uint8_t byteCount)
  61. #line 1788
  62. {
  63. }
  64. # 36 "../../tos/platform/mica2/RadioCoordinator.nc"
  65. inline static   void CC1000RadioIntM$RadioSendCoordinator$byte(TOS_MsgPtr arg_0x85f8180, uint8_t arg_0x85f82d0){
  66. #line 36
  67.   CC1000RadioIntM$RadioSendCoordinator$default$byte(arg_0x85f8180, arg_0x85f82d0);
  68. #line 36
  69. }
  70. #line 36
  71. static inline  
  72. # 239 "/home/testuser/tinyos-1.x/tos/system/AMPromiscuous.nc"
  73. result_t AMPromiscuous$RadioSend$sendDone(TOS_MsgPtr msg, result_t success)
  74. #line 239
  75. {
  76.   return AMPromiscuous$reportSendDone(msg, success);
  77. }
  78. # 67 "/home/testuser/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
  79. inline static  result_t CC1000RadioIntM$Send$sendDone(TOS_MsgPtr arg_0x85bb080, result_t arg_0x85bb1d0){
  80. #line 67
  81.   unsigned char result;
  82. #line 67
  83. #line 67
  84.   result = AMPromiscuous$RadioSend$sendDone(arg_0x85bb080, arg_0x85bb1d0);
  85. #line 67
  86. #line 67
  87.   return result;
  88. #line 67
  89. }
  90. #line 67
  91. static inline  
  92. # 506 "../../tos/platform/mica2/CC1000RadioIntM.nc"
  93. void CC1000RadioIntM$PacketSent(void)
  94. #line 506
  95. {
  96.   TOS_MsgPtr pBuf;
  97. #line 508
  98.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  99. #line 508
  100.     {
  101.       CC1000RadioIntM$txbufptr->time = 0;
  102.       pBuf = CC1000RadioIntM$txbufptr;
  103.     }
  104. #line 511
  105.     __nesc_atomic_end(__nesc_atomic); }
  106.   if (CC1000RadioIntM$txbufptr->type != 222 && CC1000RadioIntM$txbufptr->type != 223) {
  107.       CC1000RadioIntM$Send$sendDone((TOS_MsgPtr )pBuf, SUCCESS);
  108.     }
  109.   else {
  110. #line 517
  111.     if (CC1000RadioIntM$txbufptr->type == 223) {
  112.       }
  113.     else {
  114.       if (CC1000RadioIntM$txbufptr->type == 222) {
  115.         }
  116.       }
  117.     }
  118.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  119. #line 527
  120.     CC1000RadioIntM$bTxBusy = FALSE;
  121. #line 527
  122.     __nesc_atomic_end(__nesc_atomic); }
  123.   if (CC1000RadioIntM$pktsLastSync > 100) {
  124.       { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  125. #line 529
  126.         {
  127.           CC1000RadioIntM$ackOrig = CC1000RadioIntM$bAckEnable;
  128.           CC1000RadioIntM$bAckEnable = FALSE;
  129.         }
  130. #line 532
  131.         __nesc_atomic_end(__nesc_atomic); }
  132.       CC1000RadioIntM$Send$send(&CC1000RadioIntM$syncMsgHdr);
  133.       CC1000RadioIntM$pktsLastSync = 0;
  134.     }
  135.   else {
  136. #line 535
  137.     if (CC1000RadioIntM$currentMAC == CC1000RadioIntM$ZMAC && CC1000RadioIntM$ecnforward == TRUE) {
  138.         { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  139. #line 536
  140.           {
  141.             CC1000RadioIntM$ackOrig = CC1000RadioIntM$bAckEnable;
  142.             CC1000RadioIntM$bAckEnable = FALSE;
  143.           }
  144. #line 539
  145.           __nesc_atomic_end(__nesc_atomic); }
  146.         CC1000RadioIntM$Send$send(&CC1000RadioIntM$ecnForwardMsgHdr);
  147.         { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  148. #line 541
  149.           CC1000RadioIntM$ecnforward = FALSE;
  150. #line 541
  151.           __nesc_atomic_end(__nesc_atomic); }
  152.       }
  153.     else {
  154.       if (CC1000RadioIntM$currentMAC == CC1000RadioIntM$ZMAC && CC1000RadioIntM$ecnPending == TRUE) {
  155.           { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  156. #line 546
  157.             {
  158.               CC1000RadioIntM$ackOrig = CC1000RadioIntM$bAckEnable;
  159.               CC1000RadioIntM$bAckEnable = FALSE;
  160.             }
  161. #line 549
  162.             __nesc_atomic_end(__nesc_atomic); }
  163.           CC1000RadioIntM$Send$send(&CC1000RadioIntM$ecnMsgHdr);
  164.           { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  165. #line 551
  166.             CC1000RadioIntM$ecnPending = FALSE;
  167. #line 551
  168.             __nesc_atomic_end(__nesc_atomic); }
  169.           { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  170. #line 552
  171.             CC1000RadioIntM$slots_since_ecnsend = 0;
  172. #line 552
  173.             __nesc_atomic_end(__nesc_atomic); }
  174.         }
  175.       }
  176.     }
  177. }
  178. static inline 
  179. #line 329
  180. bool CC1000RadioIntM$IsHCL(uint32_t gSlot)
  181. #line 329
  182. {
  183.   uint32_t tempHCL = 0x1;
  184.   bool flag;
  185. #line 332
  186.   tempHCL = tempHCL << gSlot;
  187.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  188. #line 333
  189.     {
  190.       if (tempHCL & CC1000RadioIntM$curHCLlist) {
  191.         flag = TRUE;
  192.         }
  193.       else {
  194. #line 337
  195.         flag = FALSE;
  196.         }
  197.     }
  198. #line 339
  199.     __nesc_atomic_end(__nesc_atomic); }
  200. #line 339
  201.   return flag;
  202. }
  203. # 81 "/home/testuser/tinyos-1.x/tos/interfaces/Leds.nc"
  204. inline static   result_t CC1000RadioIntM$Leds$redToggle(void){
  205. #line 81
  206.   unsigned char result;
  207. #line 81
  208. #line 81
  209.   result = NoLeds$Leds$redToggle();
  210. #line 81
  211. #line 81
  212.   return result;
  213. #line 81
  214. }
  215. #line 81
  216. static inline    
  217. # 1791 "../../tos/platform/mica2/CC1000RadioIntM.nc"
  218. void CC1000RadioIntM$RadioReceiveCoordinator$default$startSymbol(uint8_t bitsPerBlock, uint8_t offset, 
  219. TOS_MsgPtr msgBuff)
  220. #line 1792
  221. {
  222. }
  223. # 31 "../../tos/platform/mica2/RadioCoordinator.nc"
  224. inline static   void CC1000RadioIntM$RadioReceiveCoordinator$startSymbol(uint8_t arg_0x85eba50, uint8_t arg_0x85ebb98, TOS_MsgPtr arg_0x85ebce8){
  225. #line 31
  226.   CC1000RadioIntM$RadioReceiveCoordinator$default$startSymbol(arg_0x85eba50, arg_0x85ebb98, arg_0x85ebce8);
  227. #line 31
  228. }
  229. #line 31
  230. static inline    
  231. # 1793 "../../tos/platform/mica2/CC1000RadioIntM.nc"
  232. void CC1000RadioIntM$RadioReceiveCoordinator$default$byte(TOS_MsgPtr msg, uint8_t byteCount)
  233. #line 1793
  234. {
  235. }
  236. # 36 "../../tos/platform/mica2/RadioCoordinator.nc"
  237. inline static   void CC1000RadioIntM$RadioReceiveCoordinator$byte(TOS_MsgPtr arg_0x85f8180, uint8_t arg_0x85f82d0){
  238. #line 36
  239.   CC1000RadioIntM$RadioReceiveCoordinator$default$byte(arg_0x85f8180, arg_0x85f82d0);
  240. #line 36
  241. }
  242. #line 36
  243. static inline 
  244. # 253 "../../tos/platform/mica2/CC1000RadioIntM.nc"
  245. void CC1000RadioIntM$DivTime2(GTime *B, GTime *A)
  246. #line 253
  247. {
  248.   if (A->mticks % 2 == 1) {
  249.       B->mticks = A->mticks >> 1;
  250.       B->sticks = (A->sticks >> 1) + (CC1000RadioIntM$MAX_VAL >> 1);
  251.     }
  252.   else {
  253.       B->mticks = A->mticks >> 1;
  254.       B->sticks = A->sticks >> 1;
  255.     }
  256. }
  257. static inline 
  258. #line 306
  259. uint8_t CC1000RadioIntM$ModSubTime(GTime *C, GTime *A, GTime *B)
  260. #line 306
  261. {
  262.   uint8_t retval;
  263. #line 308
  264.   if (A->mticks > B->mticks) {
  265.     retval = CC1000RadioIntM$POSITIVE;
  266.     }
  267.   else {
  268. #line 310
  269.     if (A->mticks < B->mticks) {
  270.       retval = CC1000RadioIntM$NEGATIVE;
  271.       }
  272.     else 
  273. #line 312
  274.       {
  275.         if (A->sticks > B->sticks) {
  276.           retval = CC1000RadioIntM$POSITIVE;
  277.           }
  278.         else {
  279. #line 315
  280.           if (A->sticks < B->sticks) {
  281.             retval = CC1000RadioIntM$NEGATIVE;
  282.             }
  283.           else {
  284. #line 318
  285.             retval = CC1000RadioIntM$ZERO;
  286.             }
  287.           }
  288.       }
  289.     }
  290. #line 320
  291.   if (retval == CC1000RadioIntM$POSITIVE) {
  292. #line 320
  293.     CC1000RadioIntM$SubTime(C, A, B);
  294.     }
  295.   else {
  296. #line 321
  297.     if (retval == CC1000RadioIntM$NEGATIVE) {
  298. #line 321
  299.       CC1000RadioIntM$SubTime(C, B, A);
  300.       }
  301.     else 
  302. #line 322
  303.       {
  304.         C->sticks = 0;
  305.         C->mticks = 0;
  306.       }
  307.     }
  308. #line 326
  309.   return retval;
  310. }
  311. # 63 "../../tos/interfaces/SClock.nc"
  312. inline static   void CC1000RadioIntM$SClock$getTime(GTime *arg_0x862b720){
  313. #line 63
  314.   HPLSClock$SClock$getTime(arg_0x862b720);
  315. #line 63
  316. }
  317. #line 63
  318. static inline 
  319. # 387 "../../tos/platform/mica2/CC1000RadioIntM.nc"
  320. void CC1000RadioIntM$getTimeDiff(void)
  321. #line 387
  322. {
  323.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  324. #line 388
  325.     {
  326.       uint16_t i;
  327. #line 389
  328.       uint16_t trust;
  329.       GTime loctime;
  330. #line 390
  331.       GTime timeStamp;
  332.       syncMsgType *syncMsgPtr = (syncMsgType *)CC1000RadioIntM$rxbufptr->data;
  333. #line 392
  334.       timeStamp.mticks = syncMsgPtr->mticks;
  335.       timeStamp.sticks = syncMsgPtr->sticks;
  336.       trust = syncMsgPtr->trust;
  337.       CC1000RadioIntM$currentSender = syncMsgPtr->sender;
  338.       CC1000RadioIntM$SClock$getTime(&loctime);
  339.       CC1000RadioIntM$currentSign = CC1000RadioIntM$ModSubTime(&CC1000RadioIntM$currentDiff, &timeStamp, &loctime);
  340.       if (trust < 1) {
  341.         trust = 1;
  342.         }
  343. #line 401
  344.       if (trust < 8) {
  345.           for (i = 0; i < trust; i++) {
  346.               CC1000RadioIntM$DivTime2(&CC1000RadioIntM$currentDiff, &CC1000RadioIntM$currentDiff);
  347.             }
  348.         }
  349.     }
  350. #line 406
  351.     __nesc_atomic_end(__nesc_atomic); }
  352. }
  353. static inline   
  354. # 107 "../../tos/platform/mica2/HPLSClock.nc"
  355. void HPLSClock$SClock$setTime(uint8_t PosOrNeg, GTime *t)
  356. #line 107
  357. {
  358.   HPLSClock$sign = PosOrNeg;
  359.   HPLSClock$Update.mticks = t->mticks;
  360.   HPLSClock$Update.sticks = t->sticks;
  361.   HPLSClock$needupdate = 1;
  362. }
  363. # 69 "../../tos/interfaces/SClock.nc"
  364. inline static   void CC1000RadioIntM$SClock$setTime(uint8_t arg_0x862bb68, GTime *arg_0x862bcc8){
  365. #line 69
  366.   HPLSClock$SClock$setTime(arg_0x862bb68, arg_0x862bcc8);
  367. #line 69
  368. }
  369. #line 69
  370. static inline  
  371. # 424 "../../tos/platform/mica2/CC1000RadioIntM.nc"
  372. void CC1000RadioIntM$adjustTime(void)
  373. #line 424
  374. {
  375.   CC1000RadioIntM$needTimeSync = TRUE;
  376.   CC1000RadioIntM$SClock$setTime(CC1000RadioIntM$currentSign, &CC1000RadioIntM$currentDiff);
  377. }
  378. static inline  
  379. # 279 "/home/testuser/tinyos-1.x/tos/system/AMPromiscuous.nc"
  380. TOS_MsgPtr AMPromiscuous$RadioReceive$receive(TOS_MsgPtr packet)
  381. #line 279
  382. {
  383.   return prom_received(packet);
  384. }
  385. # 75 "/home/testuser/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
  386. inline static  TOS_MsgPtr CC1000RadioIntM$Receive$receive(TOS_MsgPtr arg_0x85b1db0){
  387. #line 75
  388.   struct TOS_Msg *result;
  389. #line 75
  390. #line 75
  391.   result = AMPromiscuous$RadioReceive$receive(arg_0x85b1db0);
  392. #line 75
  393. #line 75
  394.   return result;
  395. #line 75
  396. }
  397. #line 75
  398. static inline   
  399. # 1806 "../../tos/platform/mica2/CC1000RadioIntM.nc"
  400. result_t CC1000RadioIntM$SClock$syncDone(void)
  401. #line 1806
  402. {
  403.   if (CC1000RadioIntM$needTimeSync) {
  404.       GTime loctime;
  405.       uint32_t globalTimeStamp;
  406. #line 1809
  407.       uint32_t slotOffset;
  408. #line 1810
  409.       CC1000RadioIntM$SClock$getTime(&loctime);
  410.       globalTimeStamp = (uint32_t )(loctime.mticks * 568.889 + loctime.sticks * 0.00868056);
  411.       slotOffset = (uint32_t )(1.024 * (CC1000RadioIntM$slotSize - globalTimeStamp % CC1000RadioIntM$slotSize));
  412.       CC1000RadioIntM$slotNum = (uint32_t )(globalTimeStamp / CC1000RadioIntM$slotSize);
  413.       CC1000RadioIntM$currentSlot = CC1000RadioIntM$slotNum & (CC1000RadioIntM$localFrameLength - 1);
  414.       CC1000RadioIntM$globalSlot = CC1000RadioIntM$slotNum & (CC1000RadioIntM$globalFrameLength - 1);
  415.       if (CC1000RadioIntM$currentMAC == CC1000RadioIntM$ZMAC) {
  416.         CC1000RadioIntM$TDMATimer$start(TIMER_ONE_SHOT, slotOffset);
  417.         }
  418. #line 1819
  419.       CC1000RadioIntM$needTimeSync = FALSE;
  420.     }
  421.   return SUCCESS;
  422. }
  423. # 94 "../../tos/interfaces/SClock.nc"
  424. inline static   result_t HPLSClock$SClock$syncDone(void){
  425. #line 94
  426.   unsigned char result;
  427. #line 94
  428. #line 94
  429.   result = CC1000RadioIntM$SClock$syncDone();
  430. #line 94
  431. #line 94
  432.   return result;
  433. #line 94
  434. }
  435. #line 94
  436. # 66 "/home/testuser/tinyos-1.x/tos/interfaces/ByteComm.nc"
  437. inline static   result_t UARTM$ByteComm$rxByteReady(uint8_t arg_0x88b0c30, bool arg_0x88b0d78, uint16_t arg_0x88b0ed0){
  438. #line 66
  439.   unsigned char result;
  440. #line 66
  441. #line 66
  442.   result = FramerM$ByteComm$rxByteReady(arg_0x88b0c30, arg_0x88b0d78, arg_0x88b0ed0);
  443. #line 66
  444. #line 66
  445.   return result;
  446. #line 66
  447. }
  448. #line 66
  449. static inline   
  450. # 77 "/home/testuser/tinyos-1.x/tos/system/UARTM.nc"
  451. result_t UARTM$HPLUART$get(uint8_t data)
  452. #line 77
  453. {
  454.   UARTM$ByteComm$rxByteReady(data, FALSE, 0);
  455.   {
  456.   }
  457. #line 83
  458.   ;
  459.   return SUCCESS;
  460. }
  461. # 88 "/home/testuser/tinyos-1.x/tos/interfaces/HPLUART.nc"
  462. inline static   result_t HPLUART0M$UART$get(uint8_t arg_0x88d4fc8){
  463. #line 88
  464.   unsigned char result;
  465. #line 88
  466. #line 88
  467.   result = UARTM$HPLUART$get(arg_0x88d4fc8);
  468. #line 88
  469. #line 88
  470.   return result;
  471. #line 88
  472. }
  473. #line 88
  474. # 90 "../../tos/platform/mica2/HPLUART0M.nc"
  475. void __attribute((signal))   __vector_18(void)
  476. #line 90
  477. {
  478.   if (* (volatile uint8_t *)(0x0B + 0x20) & (1 << 7)) {
  479.     HPLUART0M$UART$get(* (volatile uint8_t *)(0x0C + 0x20));
  480.     }
  481. }
  482. static inline  
  483. # 202 "/home/testuser/tinyos-1.x/tos/system/FramerM.nc"
  484. void FramerM$PacketUnknown(void)
  485. #line 202
  486. {
  487.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  488. #line 203
  489.     {
  490.       FramerM$gFlags |= FramerM$FLAGS_UNKNOWN;
  491.     }
  492. #line 205
  493.     __nesc_atomic_end(__nesc_atomic); }
  494.   FramerM$StartTx();
  495. }
  496. static inline  
  497. # 275 "/home/testuser/tinyos-1.x/tos/system/AMPromiscuous.nc"
  498. TOS_MsgPtr AMPromiscuous$UARTReceive$receive(TOS_MsgPtr packet)
  499. #line 275
  500. {
  501.   packet->group = TOS_AM_GROUP;
  502.   return prom_received(packet);
  503. }
  504. # 75 "/home/testuser/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
  505. inline static  TOS_MsgPtr FramerAckM$ReceiveCombined$receive(TOS_MsgPtr arg_0x85b1db0){
  506. #line 75
  507.   struct TOS_Msg *result;
  508. #line 75
  509. #line 75
  510.   result = AMPromiscuous$UARTReceive$receive(arg_0x85b1db0);
  511. #line 75
  512. #line 75
  513.   return result;
  514. #line 75
  515. }
  516. #line 75
  517. static inline  
  518. # 91 "/home/testuser/tinyos-1.x/tos/system/FramerAckM.nc"
  519. TOS_MsgPtr FramerAckM$ReceiveMsg$receive(TOS_MsgPtr Msg)
  520. #line 91
  521. {
  522.   TOS_MsgPtr pBuf;
  523.   pBuf = FramerAckM$ReceiveCombined$receive(Msg);
  524.   return pBuf;
  525. }
  526. # 75 "/home/testuser/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
  527. inline static  TOS_MsgPtr FramerM$ReceiveMsg$receive(TOS_MsgPtr arg_0x85b1db0){
  528. #line 75
  529.   struct TOS_Msg *result;
  530. #line 75
  531. #line 75
  532.   result = FramerAckM$ReceiveMsg$receive(arg_0x85b1db0);
  533. #line 75
  534. #line 75
  535.   return result;
  536. #line 75
  537. }
  538. #line 75
  539. static inline  
  540. # 328 "/home/testuser/tinyos-1.x/tos/system/FramerM.nc"
  541. result_t FramerM$TokenReceiveMsg$ReflectToken(uint8_t Token)
  542. #line 328
  543. {
  544.   result_t Result = SUCCESS;
  545.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  546. #line 331
  547.     {
  548.       if (!(FramerM$gFlags & FramerM$FLAGS_TOKENPEND)) {
  549.           FramerM$gFlags |= FramerM$FLAGS_TOKENPEND;
  550.           FramerM$gTxTokenBuf = Token;
  551.         }
  552.       else {
  553.           Result = FAIL;
  554.         }
  555.     }
  556. #line 339
  557.     __nesc_atomic_end(__nesc_atomic); }
  558.   if (Result == SUCCESS) {
  559.       Result = FramerM$StartTx();
  560.     }
  561.   return Result;
  562. }
  563. # 88 "/home/testuser/tinyos-1.x/tos/interfaces/TokenReceiveMsg.nc"
  564. inline static  result_t FramerAckM$TokenReceiveMsg$ReflectToken(uint8_t arg_0x88b2a98){
  565. #line 88
  566.   unsigned char result;
  567. #line 88
  568. #line 88
  569.   result = FramerM$TokenReceiveMsg$ReflectToken(arg_0x88b2a98);
  570. #line 88
  571. #line 88
  572.   return result;
  573. #line 88
  574. }
  575. #line 88
  576. static inline  
  577. # 74 "/home/testuser/tinyos-1.x/tos/system/FramerAckM.nc"
  578. void FramerAckM$SendAckTask(void)
  579. #line 74
  580. {
  581.   FramerAckM$TokenReceiveMsg$ReflectToken(FramerAckM$gTokenBuf);
  582. }
  583. static inline  TOS_MsgPtr FramerAckM$TokenReceiveMsg$receive(TOS_MsgPtr Msg, uint8_t token)
  584. #line 79
  585. {
  586.   TOS_MsgPtr pBuf;
  587.   FramerAckM$gTokenBuf = token;
  588.   TOS_post(FramerAckM$SendAckTask);
  589.   pBuf = FramerAckM$ReceiveCombined$receive(Msg);
  590.   return pBuf;
  591. }
  592. # 75 "/home/testuser/tinyos-1.x/tos/interfaces/TokenReceiveMsg.nc"
  593. inline static  TOS_MsgPtr FramerM$TokenReceiveMsg$receive(TOS_MsgPtr arg_0x88b2338, uint8_t arg_0x88b2480){
  594. #line 75
  595.   struct TOS_Msg *result;
  596. #line 75
  597. #line 75
  598.   result = FramerAckM$TokenReceiveMsg$receive(arg_0x88b2338, arg_0x88b2480);
  599. #line 75
  600. #line 75
  601.   return result;
  602. #line 75
  603. }
  604. #line 75
  605. static inline  
  606. # 210 "/home/testuser/tinyos-1.x/tos/system/FramerM.nc"
  607. void FramerM$PacketRcvd(void)
  608. #line 210
  609. {
  610.   FramerM$MsgRcvEntry_t *pRcv = &FramerM$gMsgRcvTbl[FramerM$gRxTailIndex];
  611.   TOS_MsgPtr pBuf = pRcv->pMsg;
  612.   if (pRcv->Length >= (size_t )& ((TOS_Msg *)0)->data) {
  613.       switch (pRcv->Proto) {
  614.           case FramerM$PROTO_ACK: 
  615.             break;
  616.           case FramerM$PROTO_PACKET_ACK: 
  617.             pBuf->crc = 1;
  618.           pBuf = FramerM$TokenReceiveMsg$receive(pBuf, pRcv->Token);
  619.           break;
  620.           case FramerM$PROTO_PACKET_NOACK: 
  621.             pBuf->crc = 1;
  622.           pBuf = FramerM$ReceiveMsg$receive(pBuf);
  623.           break;
  624.           default: 
  625.             FramerM$gTxUnknownBuf = pRcv->Proto;
  626.           TOS_post(FramerM$PacketUnknown);
  627.           break;
  628.         }
  629.     }
  630.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  631. #line 235
  632.     {
  633.       if (pBuf) {
  634.           pRcv->pMsg = pBuf;
  635.         }
  636.       pRcv->Length = 0;
  637.       pRcv->Token = 0;
  638.       FramerM$gRxTailIndex++;
  639.       FramerM$gRxTailIndex %= FramerM$HDLC_QUEUESIZE;
  640.     }
  641. #line 243
  642.     __nesc_atomic_end(__nesc_atomic); }
  643. }
  644. # 96 "/home/testuser/tinyos-1.x/tos/interfaces/HPLUART.nc"
  645. inline static   result_t HPLUART0M$UART$putDone(void){
  646. #line 96
  647.   unsigned char result;
  648. #line 96
  649. #line 96
  650.   result = UARTM$HPLUART$putDone();
  651. #line 96
  652. #line 96
  653.   return result;
  654. #line 96
  655. }
  656. #line 96
  657. # 100 "../../tos/platform/mica2/HPLUART0M.nc"
  658. void __attribute((interrupt))   __vector_20(void)
  659. #line 100
  660. {
  661.   HPLUART0M$UART$putDone();
  662. }
  663. static inline   
  664. # 552 "/home/testuser/tinyos-1.x/tos/system/FramerM.nc"
  665. result_t FramerM$ByteComm$txDone(void)
  666. #line 552
  667. {
  668.   if (FramerM$gTxState == FramerM$TXSTATE_FINISH) {
  669.       FramerM$gTxState = FramerM$TXSTATE_IDLE;
  670.       TOS_post(FramerM$PacketSent);
  671.     }
  672.   return SUCCESS;
  673. }
  674. # 83 "/home/testuser/tinyos-1.x/tos/interfaces/ByteComm.nc"
  675. inline static   result_t UARTM$ByteComm$txDone(void){
  676. #line 83
  677.   unsigned char result;
  678. #line 83
  679. #line 83
  680.   result = FramerM$ByteComm$txDone();
  681. #line 83
  682. #line 83
  683.   return result;
  684. #line 83
  685. }
  686. #line 83
  687. #line 55
  688. inline static   result_t FramerM$ByteComm$txByte(uint8_t arg_0x88b07a0){
  689. #line 55
  690.   unsigned char result;
  691. #line 55
  692. #line 55
  693.   result = UARTM$ByteComm$txByte(arg_0x88b07a0);
  694. #line 55
  695. #line 55
  696.   return result;
  697. #line 55
  698. }
  699. #line 55
  700. static inline 
  701. # 66 "/home/testuser/tinyos-1.x/tos/platform/avrmote/crc.h"
  702. uint16_t crcByte(uint16_t oldCrc, uint8_t byte)
  703. {
  704.   uint16_t *table = crcTable;
  705.   uint16_t newCrc;
  706.    __asm ("eor %1,%B3n"
  707.   "tlsl %1n"
  708.   "tadc %B2, __zero_reg__n"
  709.   "tadd %A2, %1n"
  710.   "tadc %B2, __zero_reg__n"
  711.   "tlpmn"
  712.   "tmov %B0, %A3n"
  713.   "tmov %A0, r0n"
  714.   "tadiw r30,1n"
  715.   "tlpmn"
  716.   "teor %B0, r0" : 
  717.   "=r"(newCrc), "+r"(byte), "+z"(table) : "r"(oldCrc));
  718.   return newCrc;
  719. }
  720. static inline   
  721. # 482 "/home/testuser/tinyos-1.x/tos/system/FramerM.nc"
  722. result_t FramerM$ByteComm$txByteReady(bool LastByteSuccess)
  723. #line 482
  724. {
  725.   result_t TxResult = SUCCESS;
  726.   uint8_t nextByte;
  727.   if (LastByteSuccess != TRUE) {
  728.       { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  729. #line 487
  730.         FramerM$gTxState = FramerM$TXSTATE_ERROR;
  731. #line 487
  732.         __nesc_atomic_end(__nesc_atomic); }
  733.       TOS_post(FramerM$PacketSent);
  734.       return SUCCESS;
  735.     }
  736.   switch (FramerM$gTxState) {
  737.       case FramerM$TXSTATE_PROTO: 
  738.         FramerM$gTxState = FramerM$TXSTATE_INFO;
  739.       FramerM$gTxRunningCRC = crcByte(FramerM$gTxRunningCRC, (uint8_t )(FramerM$gTxProto & 0x0FF));
  740.       TxResult = FramerM$ByteComm$txByte((uint8_t )(FramerM$gTxProto & 0x0FF));
  741.       break;
  742.       case FramerM$TXSTATE_INFO: 
  743.         nextByte = FramerM$gpTxBuf[FramerM$gTxByteCnt];
  744.       FramerM$gTxRunningCRC = crcByte(FramerM$gTxRunningCRC, nextByte);
  745.       FramerM$gTxByteCnt++;
  746.       if (FramerM$gTxByteCnt >= FramerM$gTxLength) {
  747.           FramerM$gTxState = FramerM$TXSTATE_FCS1;
  748.         }
  749.       TxResult = FramerM$TxArbitraryByte(nextByte);
  750.       break;
  751.       case FramerM$TXSTATE_ESC: 
  752.         TxResult = FramerM$ByteComm$txByte(FramerM$gTxEscByte ^ 0x20);
  753.       FramerM$gTxState = FramerM$gPrevTxState;
  754.       break;
  755.       case FramerM$TXSTATE_FCS1: 
  756.         nextByte = (uint8_t )(FramerM$gTxRunningCRC & 0xff);
  757.       FramerM$gTxState = FramerM$TXSTATE_FCS2;
  758.       TxResult = FramerM$TxArbitraryByte(nextByte);
  759.       break;
  760.       case FramerM$TXSTATE_FCS2: 
  761.         nextByte = (uint8_t )((FramerM$gTxRunningCRC >> 8) & 0xff);
  762.       FramerM$gTxState = FramerM$TXSTATE_ENDFLAG;
  763.       TxResult = FramerM$TxArbitraryByte(nextByte);
  764.       break;
  765.       case FramerM$TXSTATE_ENDFLAG: 
  766.         FramerM$gTxState = FramerM$TXSTATE_FINISH;
  767.       TxResult = FramerM$ByteComm$txByte(FramerM$HDLC_FLAG_BYTE);
  768.       break;
  769.       case FramerM$TXSTATE_FINISH: 
  770.         case FramerM$TXSTATE_ERROR: 
  771.           default: 
  772.             break;
  773.     }
  774.   if (TxResult != SUCCESS) {
  775.       FramerM$gTxState = FramerM$TXSTATE_ERROR;
  776.       TOS_post(FramerM$PacketSent);
  777.     }
  778.   return SUCCESS;
  779. }
  780. # 75 "/home/testuser/tinyos-1.x/tos/interfaces/ByteComm.nc"
  781. inline static   result_t UARTM$ByteComm$txByteReady(bool arg_0x88b1400){
  782. #line 75
  783.   unsigned char result;
  784. #line 75
  785. #line 75
  786.   result = FramerM$ByteComm$txByteReady(arg_0x88b1400);
  787. #line 75
  788. #line 75
  789.   return result;
  790. #line 75
  791. }
  792. #line 75
  793. # 102 "/home/testuser/tinyos-1.x/tos/system/sched.c"
  794. bool  TOS_post(void (*tp)(void))
  795. #line 102
  796. {
  797.   __nesc_atomic_t fInterruptFlags;
  798.   uint8_t tmp;
  799.   fInterruptFlags = __nesc_atomic_start();
  800.   tmp = TOSH_sched_free;
  801.   if (TOSH_queue[tmp].tp == (void *)0) {
  802.       TOSH_sched_free = (tmp + 1) & TOSH_TASK_BITMASK;
  803.       TOSH_queue[tmp].tp = tp;
  804.       __nesc_atomic_end(fInterruptFlags);
  805.       return TRUE;
  806.     }
  807.   else {
  808.       __nesc_atomic_end(fInterruptFlags);
  809.       return FALSE;
  810.     }
  811. }
  812. # 54 "/home/testuser/tinyos-1.x/tos/system/RealMain.nc"
  813. int   main(void)
  814. #line 54
  815. {
  816.   RealMain$hardwareInit();
  817.   RealMain$Pot$init(10);
  818.   TOSH_sched_init();
  819.   RealMain$StdControl$init();
  820.   RealMain$StdControl$start();
  821.   __nesc_enable_interrupt();
  822.   while (1) {
  823.       TOSH_run_task();
  824.     }
  825. }
  826. static  
  827. # 77 "/home/testuser/tinyos-1.x/tos/system/TimerM.nc"
  828. result_t TimerM$StdControl$init(void)
  829. #line 77
  830. {
  831.   TimerM$mState = 0;
  832.   TimerM$setIntervalFlag = 0;
  833.   TimerM$queue_head = TimerM$queue_tail = -1;
  834.   TimerM$queue_size = 0;
  835.   TimerM$mScale = 3;
  836.   TimerM$mInterval = TimerM$maxTimerInterval;
  837.   return TimerM$Clock$setRate(TimerM$mInterval, TimerM$mScale);
  838. }
  839. static 
  840. # 268 "/home/testuser/tinyos-1.x/tos/system/FramerM.nc"
  841. void FramerM$HDLCInitialize(void)
  842. #line 268
  843. {
  844.   int i;
  845. #line 270
  846.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  847. #line 270
  848.     {
  849.       for (i = 0; i < FramerM$HDLC_QUEUESIZE; i++) {
  850.           FramerM$gMsgRcvTbl[i].pMsg = &FramerM$gMsgRcvBuf[i];
  851.           FramerM$gMsgRcvTbl[i].Length = 0;
  852.           FramerM$gMsgRcvTbl[i].Token = 0;
  853.         }
  854.       FramerM$gTxState = FramerM$TXSTATE_IDLE;
  855.       FramerM$gTxByteCnt = 0;
  856.       FramerM$gTxLength = 0;
  857.       FramerM$gTxRunningCRC = 0;
  858.       FramerM$gpTxMsg = (void *)0;
  859.       FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
  860.       FramerM$gRxHeadIndex = 0;
  861.       FramerM$gRxTailIndex = 0;
  862.       FramerM$gRxByteCnt = 0;
  863.       FramerM$gRxRunningCRC = 0;
  864.       FramerM$gpRxBuf = (uint8_t *)FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].pMsg;
  865.     }
  866. #line 288
  867.     __nesc_atomic_end(__nesc_atomic); }
  868. }
  869. static   
  870. # 75 "../../tos/platform/mica2/HPLCC1000M.nc"
  871. result_t HPLCC1000M$HPLCC1000$write(uint8_t addr, uint8_t data)
  872. #line 75
  873. {
  874.   char cnt = 0;
  875.   addr <<= 1;
  876.   TOSH_CLR_CC_PALE_PIN();
  877.   for (cnt = 0; cnt < 7; cnt++) 
  878.     {
  879.       if (addr & 0x80) {
  880.         TOSH_SET_CC_PDATA_PIN();
  881.         }
  882.       else {
  883. #line 86
  884.         TOSH_CLR_CC_PDATA_PIN();
  885.         }
  886. #line 87
  887.       TOSH_CLR_CC_PCLK_PIN();
  888.       TOSH_SET_CC_PCLK_PIN();
  889.       addr <<= 1;
  890.     }
  891.   TOSH_SET_CC_PDATA_PIN();
  892.   TOSH_CLR_CC_PCLK_PIN();
  893.   TOSH_SET_CC_PCLK_PIN();
  894.   TOSH_SET_CC_PALE_PIN();
  895.   for (cnt = 0; cnt < 8; cnt++) 
  896.     {
  897.       if (data & 0x80) {
  898.         TOSH_SET_CC_PDATA_PIN();
  899.         }
  900.       else {
  901. #line 103
  902.         TOSH_CLR_CC_PDATA_PIN();
  903.         }
  904. #line 104
  905.       TOSH_CLR_CC_PCLK_PIN();
  906.       TOSH_SET_CC_PCLK_PIN();
  907.       data <<= 1;
  908.     }
  909.   TOSH_SET_CC_PALE_PIN();
  910.   TOSH_SET_CC_PDATA_PIN();
  911.   TOSH_SET_CC_PCLK_PIN();
  912.   return SUCCESS;
  913. }
  914. static   
  915. #line 128
  916. uint8_t HPLCC1000M$HPLCC1000$read(uint8_t addr)
  917. #line 128
  918. {
  919.   int cnt;
  920.   uint8_t din;
  921.   uint8_t data = 0;
  922.   addr <<= 1;
  923.   TOSH_CLR_CC_PALE_PIN();
  924.   for (cnt = 0; cnt < 7; cnt++) 
  925.     {
  926.       if (addr & 0x80) {
  927.         TOSH_SET_CC_PDATA_PIN();
  928.         }
  929.       else {
  930. #line 141
  931.         TOSH_CLR_CC_PDATA_PIN();
  932.         }
  933. #line 142
  934.       TOSH_CLR_CC_PCLK_PIN();
  935.       TOSH_SET_CC_PCLK_PIN();
  936.       addr <<= 1;
  937.     }
  938.   TOSH_CLR_CC_PDATA_PIN();
  939.   TOSH_CLR_CC_PCLK_PIN();
  940.   TOSH_SET_CC_PCLK_PIN();
  941.   TOSH_MAKE_CC_PDATA_INPUT();
  942.   TOSH_SET_CC_PALE_PIN();
  943.   for (cnt = 7; cnt >= 0; cnt--) 
  944.     {
  945.       TOSH_CLR_CC_PCLK_PIN();
  946.       din = TOSH_READ_CC_PDATA_PIN();
  947.       if (din) {
  948.         data = (data << 1) | 0x01;
  949.         }
  950.       else {
  951. #line 161
  952.         data = (data << 1) & 0xfe;
  953.         }
  954. #line 162
  955.       TOSH_SET_CC_PCLK_PIN();
  956.     }
  957.   TOSH_SET_CC_PALE_PIN();
  958.   TOSH_MAKE_CC_PDATA_OUTPUT();
  959.   TOSH_SET_CC_PDATA_PIN();
  960.   return data;
  961. }
  962. static 
  963. # 63 "../../tos/platform/mica2/HPLADCM.nc"
  964. void HPLADCM$init_portmap(void)
  965. #line 63
  966. {
  967.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  968. #line 65
  969.     {
  970.       if (HPLADCM$init_portmap_done == FALSE) {
  971.           int i;
  972. #line 68
  973.           for (i = 0; i < TOSH_ADC_PORTMAPSIZE; i++) 
  974.             HPLADCM$TOSH_adc_portmap[i] = i;
  975.           HPLADCM$TOSH_adc_portmap[TOS_ADC_BANDGAP_PORT] = TOSH_ACTUAL_BANDGAP_PORT;
  976.           HPLADCM$TOSH_adc_portmap[TOS_ADC_GND_PORT] = TOSH_ACTUAL_GND_PORT;
  977.           HPLADCM$init_portmap_done = TRUE;
  978.         }
  979.     }
  980. #line 76
  981.     __nesc_atomic_end(__nesc_atomic); }
  982. }
  983. static   
  984. # 59 "/home/testuser/tinyos-1.x/tos/system/RandomLFSR.nc"
  985. result_t RandomLFSR$Random$init(void)
  986. #line 59
  987. {
  988.   {
  989.   }
  990. #line 60
  991.   ;
  992.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  993. #line 61
  994.     {
  995.       RandomLFSR$shiftReg = 119 * 119 * (TOS_LOCAL_ADDRESS + 1);
  996.       RandomLFSR$initSeed = RandomLFSR$shiftReg;
  997.       RandomLFSR$mask = 137 * 29 * (TOS_LOCAL_ADDRESS + 1);
  998.     }
  999. #line 65
  1000.     __nesc_atomic_end(__nesc_atomic); }
  1001.   return SUCCESS;
  1002. }
  1003. static   
  1004. # 1748 "../../tos/platform/mica2/CC1000RadioIntM.nc"
  1005. result_t CC1000RadioIntM$ResetPower(void)
  1006. #line 1748
  1007. {
  1008.   CC1000RadioIntM$power_sum = 0;
  1009.   CC1000RadioIntM$pulse_check_sum = 0;
  1010.   CC1000RadioIntM$send_sum = 0;
  1011.   CC1000RadioIntM$receive_sum = 0;
  1012.   CC1000RadioIntM$sp_sum = 0;
  1013.   CC1000RadioIntM$tx_sum = 0;
  1014.   CC1000RadioIntM$rx_sum = 0;
  1015.   return SUCCESS;
  1016. }
  1017. static   
  1018. # 435 "../../tos/platform/mica2/CC1000ControlM.nc"
  1019. result_t CC1000ControlM$CC1000Control$RxMode(void)
  1020. #line 435
  1021. {
  1022.   CC1000ControlM$HPLChipcon$write(0x09, CC1000ControlM$gCurrentParameters[0x09]);
  1023.   CC1000ControlM$HPLChipcon$write(0x0B, 0x00);
  1024.   CC1000ControlM$HPLChipcon$write(0x00, (
  1025.   1 << 4) | (1 << 0));
  1026.   TOSH_uwait(125);
  1027.   return SUCCESS;
  1028. }
  1029. static  
  1030. # 98 "/home/testuser/tinyos-1.x/tos/system/TimerM.nc"
  1031. result_t TimerM$Timer$start(uint8_t id, char type, 
  1032. uint32_t interval)
  1033. #line 99
  1034. {
  1035.   uint8_t diff;
  1036. #line 101
  1037.   if (id >= NUM_TIMERS) {
  1038. #line 101
  1039.     return FAIL;
  1040.     }
  1041. #line 102
  1042.   if (type > TIMER_ONE_SHOT) {
  1043. #line 102
  1044.     return FAIL;
  1045.     }
  1046.   if (type == TIMER_REPEAT && interval <= 2) {
  1047. #line 109
  1048.     return FAIL;
  1049.     }
  1050.   TimerM$mTimerList[id].ticks = interval;
  1051.   TimerM$mTimerList[id].type = type;
  1052.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  1053. #line 114
  1054.     {
  1055.       diff = TimerM$Clock$readCounter();
  1056.       interval += diff;
  1057.       TimerM$mTimerList[id].ticksLeft = interval;
  1058.       TimerM$mState |= 0x1L << id;
  1059.       if (interval < TimerM$mInterval) {
  1060.           TimerM$mInterval = interval;
  1061.           TimerM$Clock$setInterval(TimerM$mInterval);
  1062.           TimerM$setIntervalFlag = 0;
  1063.           TimerM$PowerManagement$adjustPower();
  1064.         }
  1065.     }
  1066. #line 125
  1067.     __nesc_atomic_end(__nesc_atomic); }
  1068.   return SUCCESS;
  1069. }
  1070. static   
  1071. # 102 "../../tos/platform/mica2/HPLPowerManagementM.nc"
  1072. uint8_t HPLPowerManagementM$PowerManagement$adjustPower(void)
  1073. #line 102
  1074. {
  1075.   uint8_t mcu;
  1076. #line 104
  1077.   if (HPLPowerManagementM$disableCount <= 0) {
  1078.     TOS_post(HPLPowerManagementM$doAdjustment);
  1079.     }
  1080.   else 
  1081. #line 106
  1082.     {
  1083.       mcu = * (volatile uint8_t *)(0x35 + 0x20);
  1084.       mcu &= 0xe3;
  1085.       mcu |= HPLPowerManagementM$IDLE;
  1086.       * (volatile uint8_t *)(0x35 + 0x20) = mcu;
  1087.       * (volatile uint8_t *)(0x35 + 0x20) |= 1 << 5;
  1088.     }
  1089.   return 0;
  1090. }
  1091. static  
  1092. # 543 "/home/testuser/tinyos-1.x/tos/lib/MintRoute/MultiHopWMEWMA.nc"
  1093. void MultiHopWMEWMA$TimerTask(void)
  1094. #line 543
  1095. {
  1096.   MultiHopWMEWMA$Leds$redToggle();
  1097.   {
  1098.   }
  1099. #line 546
  1100.   ;
  1101.   MultiHopWMEWMA$updateTable();
  1102.   {
  1103.     int i;
  1104. #line 552
  1105.     {
  1106.     }
  1107. #line 552
  1108.     ;
  1109.     for (i = 0; i < MultiHopWMEWMA$ROUTE_TABLE_SIZE; i++) {
  1110.         if (MultiHopWMEWMA$NeighborTbl[i].flags) {
  1111.             {
  1112.             }
  1113. #line 555
  1114.             ;
  1115.           }
  1116.       }
  1117.     if (MultiHopWMEWMA$gpCurrentParent) {
  1118.         {
  1119.         }
  1120. #line 569
  1121.         ;
  1122.       }
  1123.   }
  1124.   MultiHopWMEWMA$chooseParent();
  1125.   MultiHopWMEWMA$ATimer$start(TIMER_ONE_SHOT, 32);
  1126. }
  1127. static 
  1128. #line 256
  1129. uint32_t MultiHopWMEWMA$evaluateCost(uint16_t cost, uint8_t sendEst, uint8_t receiveEst)
  1130. #line 256
  1131. {
  1132.   uint32_t transEst = (uint32_t )sendEst * (uint32_t )receiveEst;
  1133.   uint32_t immed = (uint32_t )1 << 24;
  1134.   if (transEst == 0) {
  1135. #line 260
  1136.     return (uint32_t )1 << (uint32_t )16;
  1137.     }
  1138.   immed = immed / transEst;
  1139.   immed += (uint32_t )cost << 6;
  1140.   return immed;
  1141. }
  1142. static  
  1143. # 150 "/home/testuser/tinyos-1.x/tos/lib/MintRoute/MultiHopEngineM.nc"
  1144. void *MultiHopEngineM$Send$getBuffer(uint8_t id, TOS_MsgPtr pMsg, uint16_t *length)
  1145. #line 150
  1146. {
  1147.   TOS_MHopMsg *pMHMsg = (TOS_MHopMsg *)pMsg->data;
  1148.   *length = 70 - (size_t )& ((TOS_MHopMsg *)0)->data;
  1149.   return &pMHMsg->data[0];
  1150. }
  1151. static   
  1152. # 70 "/home/testuser/tinyos-1.x/tos/system/RandomLFSR.nc"
  1153. uint16_t RandomLFSR$Random$rand(void)
  1154. #line 70
  1155. {
  1156.   bool endbit;
  1157.   uint16_t tmpShiftReg;
  1158. #line 73
  1159.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  1160. #line 73
  1161.     {
  1162.       tmpShiftReg = RandomLFSR$shiftReg;
  1163.       endbit = (tmpShiftReg & 0x8000) != 0;
  1164.       tmpShiftReg <<= 1;
  1165.       if (endbit) {
  1166.         tmpShiftReg ^= 0x100b;
  1167.         }
  1168. #line 79
  1169.       tmpShiftReg++;
  1170.       RandomLFSR$shiftReg = tmpShiftReg;
  1171.       tmpShiftReg = tmpShiftReg ^ RandomLFSR$mask;
  1172.     }
  1173. #line 82
  1174.     __nesc_atomic_end(__nesc_atomic); }
  1175.   return tmpShiftReg;
  1176. }
  1177. # 244 "/home/testuser/tinyos-1.x/tos/system/AMPromiscuous.nc"
  1178. TOS_MsgPtr   prom_received(TOS_MsgPtr packet)
  1179. #line 244
  1180. {
  1181.   AMPromiscuous$counter++;
  1182.   {
  1183.   }
  1184. #line 246
  1185.   ;
  1186.   if (
  1187. #line 248
  1188.   packet->group == TOS_AM_GROUP && ((
  1189.   AMPromiscuous$promiscuous_mode == TRUE || 
  1190.   packet->addr == TOS_BCAST_ADDR) || 
  1191.   packet->addr == TOS_LOCAL_ADDRESS) && (
  1192.   AMPromiscuous$crc_check == FALSE || packet->crc == 1)) 
  1193.     {
  1194.       uint8_t type = packet->type;
  1195.       TOS_MsgPtr tmp;
  1196.       {
  1197.       }
  1198. #line 258
  1199.       ;
  1200.       AMPromiscuous$dbgPacket(packet);
  1201.       {
  1202.       }
  1203. #line 260
  1204.       ;
  1205.       tmp = AMPromiscuous$ReceiveMsg$receive(type, packet);
  1206.       if (tmp) {
  1207.         packet = tmp;
  1208.         }
  1209.     }
  1210. #line 267
  1211.   return packet;
  1212. }
  1213. static 
  1214. # 332 "/home/testuser/tinyos-1.x/tos/lib/MintRoute/MultiHopWMEWMA.nc"
  1215. bool MultiHopWMEWMA$updateNbrCounters(uint16_t saddr, int16_t seqno, uint8_t *NbrIndex)
  1216. #line 332
  1217. {
  1218.   MultiHopWMEWMA$TableEntry *pNbr;
  1219.   int16_t sDelta;
  1220.   uint8_t iNbr;
  1221.   bool Result = FALSE;
  1222.   iNbr = MultiHopWMEWMA$findPreparedIndex(saddr);
  1223.   pNbr = &MultiHopWMEWMA$NeighborTbl[iNbr];
  1224.   sDelta = seqno - MultiHopWMEWMA$NeighborTbl[iNbr].lastSeqno - 1;
  1225.   if (pNbr->flags & MultiHopWMEWMA$NBRFLAG_NEW) {
  1226.       pNbr->received++;
  1227.       pNbr->lastSeqno = seqno;
  1228.       pNbr->flags ^= MultiHopWMEWMA$NBRFLAG_NEW;
  1229.     }
  1230.   else {
  1231. #line 348
  1232.     if (sDelta >= 0) {
  1233.         pNbr->missed += sDelta;
  1234.         pNbr->received++;
  1235.         pNbr->lastSeqno = seqno;
  1236.       }
  1237.     else {
  1238. #line 353
  1239.       if (sDelta < MultiHopWMEWMA$ACCEPTABLE_MISSED) {
  1240.           MultiHopWMEWMA$newEntry(iNbr, saddr);
  1241.           pNbr->received++;
  1242.           pNbr->lastSeqno = seqno;
  1243.           pNbr->flags ^= MultiHopWMEWMA$NBRFLAG_NEW;
  1244.         }
  1245.       else {
  1246.           Result = TRUE;
  1247.         }
  1248.       }
  1249.     }
  1250. #line 364
  1251.   *NbrIndex = iNbr;
  1252.   return Result;
  1253. }
  1254. static 
  1255. #line 156
  1256. uint8_t MultiHopWMEWMA$findEntry(uint16_t id)
  1257. #line 156
  1258. {
  1259.   uint8_t i = 0;
  1260. #line 158
  1261.   for (i = 0; i < MultiHopWMEWMA$ROUTE_TABLE_SIZE; i++) {
  1262.       if (MultiHopWMEWMA$NeighborTbl[i].flags & MultiHopWMEWMA$NBRFLAG_VALID && MultiHopWMEWMA$NeighborTbl[i].id == id) {
  1263.           return i;
  1264.         }
  1265.     }
  1266.   return MultiHopWMEWMA$ROUTE_INVALID;
  1267. }
  1268. static 
  1269. #line 198
  1270. void MultiHopWMEWMA$newEntry(uint8_t indes, uint16_t id)
  1271. #line 198
  1272. {
  1273.   MultiHopWMEWMA$NeighborTbl[indes].id = id;
  1274.   MultiHopWMEWMA$NeighborTbl[indes].flags = MultiHopWMEWMA$NBRFLAG_VALID | MultiHopWMEWMA$NBRFLAG_NEW;
  1275.   MultiHopWMEWMA$NeighborTbl[indes].liveliness = 0;
  1276.   MultiHopWMEWMA$NeighborTbl[indes].parent = MultiHopWMEWMA$ROUTE_INVALID;
  1277.   MultiHopWMEWMA$NeighborTbl[indes].cost = MultiHopWMEWMA$ROUTE_INVALID;
  1278.   MultiHopWMEWMA$NeighborTbl[indes].childLiveliness = 0;
  1279.   MultiHopWMEWMA$NeighborTbl[indes].hop = MultiHopWMEWMA$ROUTE_INVALID;
  1280.   MultiHopWMEWMA$NeighborTbl[indes].missed = 0;
  1281.   MultiHopWMEWMA$NeighborTbl[indes].received = 0;
  1282.   MultiHopWMEWMA$NeighborTbl[indes].receiveEst = 0;
  1283.   MultiHopWMEWMA$NeighborTbl[indes].sendEst = 0;
  1284. }
  1285. static  
  1286. # 182 "/home/testuser/tinyos-1.x/tos/lib/MintRoute/MultiHopEngineM.nc"
  1287. TOS_MsgPtr MultiHopEngineM$ReceiveMsg$receive(uint8_t id, TOS_MsgPtr pMsg)
  1288. #line 182
  1289. {
  1290.   TOS_MHopMsg *pMHMsg = (TOS_MHopMsg *)pMsg->data;
  1291.   uint16_t PayloadLen = pMsg->length - (size_t )& ((TOS_MHopMsg *)0)->data;
  1292.   if (pMsg->addr == TOS_LOCAL_ADDRESS) {
  1293.       if (MultiHopEngineM$Intercept$intercept(id, pMsg, &pMHMsg->data[0], PayloadLen) == SUCCESS) {
  1294.           pMsg = MultiHopEngineM$mForward(pMsg, id);
  1295.         }
  1296.     }
  1297.   else {
  1298.       MultiHopEngineM$Snoop$intercept(id, pMsg, &pMHMsg->data[0], PayloadLen);
  1299.     }
  1300.   return pMsg;
  1301. }
  1302. static  
  1303. # 665 "/home/testuser/tinyos-1.x/tos/lib/MintRoute/MultiHopWMEWMA.nc"
  1304. result_t MultiHopWMEWMA$RouteSelect$selectRoute(TOS_MsgPtr Msg, uint8_t id)
  1305. #line 665
  1306. {
  1307.   TOS_MHopMsg *pMHMsg = (TOS_MHopMsg *)&Msg->data[0];
  1308.   uint8_t iNbr;
  1309.   bool fIsDuplicate;
  1310.   result_t Result = SUCCESS;
  1311.   if (MultiHopWMEWMA$gpCurrentParent == (void *)0) {
  1312.       if (pMHMsg->sourceaddr == TOS_LOCAL_ADDRESS && 
  1313.       pMHMsg->originaddr == TOS_LOCAL_ADDRESS) {
  1314.           pMHMsg->sourceaddr = TOS_LOCAL_ADDRESS;
  1315.           pMHMsg->hopcount = MultiHopWMEWMA$gbCurrentHopCount;
  1316.           pMHMsg->seqno = MultiHopWMEWMA$gCurrentSeqNo++;
  1317.           Msg->addr = TOS_BCAST_ADDR;
  1318.           return SUCCESS;
  1319.         }
  1320.       else {
  1321.           return FAIL;
  1322.         }
  1323.     }
  1324.   if (MultiHopWMEWMA$gbCurrentHopCount >= pMHMsg->hopcount) {
  1325.       return FAIL;
  1326.     }
  1327.   if (pMHMsg->sourceaddr == TOS_LOCAL_ADDRESS && 
  1328.   pMHMsg->originaddr == TOS_LOCAL_ADDRESS) {
  1329.       fIsDuplicate = FALSE;
  1330.     }
  1331.   else {
  1332.       fIsDuplicate = MultiHopWMEWMA$updateNbrCounters(pMHMsg->sourceaddr, pMHMsg->seqno, &iNbr);
  1333.     }
  1334.   if (!fIsDuplicate) {
  1335.       pMHMsg->sourceaddr = TOS_LOCAL_ADDRESS;
  1336.       pMHMsg->hopcount = MultiHopWMEWMA$gbCurrentHopCount;
  1337.       if (MultiHopWMEWMA$gpCurrentParent->id != TOS_UART_ADDR) {
  1338.           pMHMsg->seqno = MultiHopWMEWMA$gCurrentSeqNo++;
  1339.         }
  1340.       Msg->addr = MultiHopWMEWMA$gpCurrentParent->id;
  1341.       if (pMHMsg->originaddr != TOS_LOCAL_ADDRESS) {
  1342.           MultiHopWMEWMA$updateDescendant(pMHMsg->originaddr);
  1343.         }
  1344.     }
  1345.   else {
  1346.       Result = FAIL;
  1347.     }
  1348.   {
  1349.   }
  1350. #line 716
  1351.   ;
  1352.   return Result;
  1353. }
  1354. static  
  1355. # 143 "/home/testuser/tinyos-1.x/tos/lib/Queue/QueuedSendM.nc"
  1356. result_t QueuedSendM$QueueSendMsg$send(uint8_t id, uint16_t address, uint8_t length, TOS_MsgPtr msg)
  1357. #line 143
  1358. {
  1359.   {
  1360.   }
  1361. #line 144
  1362.   ;
  1363.   if ((QueuedSendM$enqueue_next + 1) % QueuedSendM$MESSAGE_QUEUE_SIZE == QueuedSendM$dequeue_next) {
  1364.       {
  1365.       }
  1366. #line 148
  1367.       ;
  1368.       return FAIL;
  1369.     }
  1370.   if (length > 70) {
  1371.       {
  1372.       }
  1373. #line 153
  1374.       ;
  1375.       return FAIL;
  1376.     }
  1377.   if (msg == (void *)0) {
  1378.       {
  1379.       }
  1380. #line 158
  1381.       ;
  1382.       return FAIL;
  1383.     }
  1384.   QueuedSendM$msgqueue[QueuedSendM$enqueue_next].address = address;
  1385.   QueuedSendM$msgqueue[QueuedSendM$enqueue_next].length = length;
  1386.   QueuedSendM$msgqueue[QueuedSendM$enqueue_next].id = id;
  1387.   QueuedSendM$msgqueue[QueuedSendM$enqueue_next].pMsg = msg;
  1388.   QueuedSendM$msgqueue[QueuedSendM$enqueue_next].xmit_count = 0;
  1389.   QueuedSendM$msgqueue[QueuedSendM$enqueue_next].pMsg->ack = 0;
  1390.   QueuedSendM$enqueue_next++;
  1391. #line 169
  1392.   QueuedSendM$enqueue_next %= QueuedSendM$MESSAGE_QUEUE_SIZE;
  1393.   {
  1394.   }
  1395. #line 171
  1396.   ;
  1397.   if (QueuedSendM$fQueueIdle) {
  1398.       QueuedSendM$fQueueIdle = FALSE;
  1399.       TOS_post(QueuedSendM$QueueServiceTask);
  1400.     }
  1401.   return SUCCESS;
  1402. }
  1403. static  
  1404. #line 121
  1405. void QueuedSendM$QueueServiceTask(void)
  1406. #line 121
  1407. {
  1408.   uint8_t id;
  1409.   if (QueuedSendM$msgqueue[QueuedSendM$dequeue_next].pMsg != (void *)0) {
  1410.       QueuedSendM$Leds$greenToggle();
  1411.       {
  1412.       }
  1413. #line 126
  1414.       ;
  1415.       id = QueuedSendM$msgqueue[QueuedSendM$dequeue_next].id;
  1416.       if (!QueuedSendM$SerialSendMsg$send(id, QueuedSendM$msgqueue[QueuedSendM$dequeue_next].address, 
  1417.       QueuedSendM$msgqueue[QueuedSendM$dequeue_next].length, 
  1418.       QueuedSendM$msgqueue[QueuedSendM$dequeue_next].pMsg)) {
  1419.           TOS_post(QueuedSendM$QueueServiceTask);
  1420.           {
  1421.           }
  1422. #line 135
  1423.           ;
  1424.         }
  1425.     }
  1426.   else {
  1427.       QueuedSendM$fQueueIdle = TRUE;
  1428.     }
  1429. }
  1430. static 
  1431. # 158 "/home/testuser/tinyos-1.x/tos/system/FramerM.nc"
  1432. result_t FramerM$StartTx(void)
  1433. #line 158
  1434. {
  1435.   result_t Result = SUCCESS;
  1436.   bool fInitiate = FALSE;
  1437.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  1438. #line 162
  1439.     {
  1440.       if (FramerM$gTxState == FramerM$TXSTATE_IDLE) {
  1441.           if (FramerM$gFlags & FramerM$FLAGS_TOKENPEND) {
  1442.               FramerM$gpTxBuf = (uint8_t *)&FramerM$gTxTokenBuf;
  1443.               FramerM$gTxProto = FramerM$PROTO_ACK;
  1444.               FramerM$gTxLength = sizeof FramerM$gTxTokenBuf;
  1445.               fInitiate = TRUE;
  1446.               FramerM$gTxState = FramerM$TXSTATE_PROTO;
  1447.             }
  1448.           else {
  1449. #line 171
  1450.             if (FramerM$gFlags & FramerM$FLAGS_DATAPEND) {
  1451.                 FramerM$gpTxBuf = (uint8_t *)FramerM$gpTxMsg;
  1452.                 FramerM$gTxProto = FramerM$PROTO_PACKET_NOACK;
  1453.                 FramerM$gTxLength = FramerM$gpTxMsg->length + (MSG_DATA_SIZE - DATA_LENGTH - 2);
  1454.                 fInitiate = TRUE;
  1455.                 FramerM$gTxState = FramerM$TXSTATE_PROTO;
  1456.               }
  1457.             else {
  1458. #line 178
  1459.               if (FramerM$gFlags & FramerM$FLAGS_UNKNOWN) {
  1460.                   FramerM$gpTxBuf = (uint8_t *)&FramerM$gTxUnknownBuf;
  1461.                   FramerM$gTxProto = FramerM$PROTO_UNKNOWN;
  1462.                   FramerM$gTxLength = sizeof FramerM$gTxUnknownBuf;
  1463.                   fInitiate = TRUE;
  1464.                   FramerM$gTxState = FramerM$TXSTATE_PROTO;
  1465.                 }
  1466.               }
  1467.             }
  1468.         }
  1469.     }
  1470. #line 188
  1471.     __nesc_atomic_end(__nesc_atomic); }
  1472. #line 188
  1473.   if (fInitiate) {
  1474.       { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  1475. #line 189
  1476.         {
  1477.           FramerM$gTxRunningCRC = 0;
  1478. #line 190
  1479.           FramerM$gTxByteCnt = 0;
  1480.         }
  1481. #line 191
  1482.         __nesc_atomic_end(__nesc_atomic); }
  1483.       Result = FramerM$ByteComm$txByte(FramerM$HDLC_FLAG_BYTE);
  1484.       if (Result != SUCCESS) {
  1485.           { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  1486. #line 194
  1487.             FramerM$gTxState = FramerM$TXSTATE_ERROR;
  1488. #line 194
  1489.             __nesc_atomic_end(__nesc_atomic); }
  1490.           TOS_post(FramerM$PacketSent);
  1491.         }
  1492.     }
  1493.   return Result;
  1494. }
  1495. static   
  1496. # 110 "/home/testuser/tinyos-1.x/tos/system/UARTM.nc"
  1497. result_t UARTM$ByteComm$txByte(uint8_t data)
  1498. #line 110
  1499. {
  1500.   bool oldState;
  1501.   {
  1502.   }
  1503. #line 113
  1504.   ;
  1505.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  1506. #line 115
  1507.     {
  1508.       oldState = UARTM$state;
  1509.       UARTM$state = TRUE;
  1510.     }
  1511. #line 118
  1512.     __nesc_atomic_end(__nesc_atomic); }
  1513.   if (oldState) {
  1514.     return FAIL;
  1515.     }
  1516.   UARTM$HPLUART$put(data);
  1517.   return SUCCESS;
  1518. }
  1519. static  
  1520. # 246 "/home/testuser/tinyos-1.x/tos/system/FramerM.nc"
  1521. void FramerM$PacketSent(void)
  1522. #line 246
  1523. {
  1524.   result_t TxResult = SUCCESS;
  1525.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  1526. #line 249
  1527.     {
  1528.       if (FramerM$gTxState == FramerM$TXSTATE_ERROR) {
  1529.           TxResult = FAIL;
  1530.           FramerM$gTxState = FramerM$TXSTATE_IDLE;
  1531.         }
  1532.     }
  1533. #line 254
  1534.     __nesc_atomic_end(__nesc_atomic); }
  1535.   if (FramerM$gTxProto == FramerM$PROTO_ACK) {
  1536.       { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  1537. #line 256
  1538.         FramerM$gFlags ^= FramerM$FLAGS_TOKENPEND;
  1539. #line 256
  1540.         __nesc_atomic_end(__nesc_atomic); }
  1541.     }
  1542.   else {
  1543.       { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  1544. #line 259
  1545.         FramerM$gFlags ^= FramerM$FLAGS_DATAPEND;
  1546. #line 259
  1547.         __nesc_atomic_end(__nesc_atomic); }
  1548.       FramerM$BareSendMsg$sendDone((TOS_MsgPtr )FramerM$gpTxMsg, TxResult);
  1549.       { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  1550. #line 261
  1551.         FramerM$gpTxMsg = (void *)0;
  1552. #line 261
  1553.         __nesc_atomic_end(__nesc_atomic); }
  1554.     }
  1555.   FramerM$StartTx();
  1556. }
  1557. static 
  1558. # 170 "/home/testuser/tinyos-1.x/tos/system/AMPromiscuous.nc"
  1559. result_t AMPromiscuous$reportSendDone(TOS_MsgPtr msg, result_t success)
  1560. #line 170
  1561. {
  1562.   {
  1563.   }
  1564. #line 171
  1565.   ;
  1566.   AMPromiscuous$state = FALSE;
  1567.   AMPromiscuous$SendMsg$sendDone(msg->type, msg, success);
  1568.   AMPromiscuous$sendDone();
  1569.   return SUCCESS;
  1570. }
  1571. static  
  1572. # 205 "/home/testuser/tinyos-1.x/tos/lib/MintRoute/MultiHopEngineM.nc"
  1573. result_t MultiHopEngineM$SendMsg$sendDone(uint8_t id, TOS_MsgPtr pMsg, result_t success)
  1574. #line 205
  1575. {
  1576.   if (pMsg == MultiHopEngineM$FwdBufList[MultiHopEngineM$iFwdBufTail]) {
  1577.       MultiHopEngineM$iFwdBufTail++;
  1578. #line 208
  1579.       MultiHopEngineM$iFwdBufTail %= MultiHopEngineM$FWD_QUEUE_SIZE;
  1580.     }
  1581.   else 
  1582. #line 209
  1583.     {
  1584.       MultiHopEngineM$Send$sendDone(id, pMsg, success);
  1585.     }
  1586.   return SUCCESS;
  1587. }
  1588. static  
  1589. # 1102 "../../tos/platform/mica2/CC1000RadioIntM.nc"
  1590. result_t CC1000RadioIntM$Send$send(TOS_MsgPtr pMsg)
  1591. #line 1102
  1592. {
  1593.   result_t Result = SUCCESS;
  1594.   uint8_t currentRadioState = 0;
  1595.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  1596. #line 1106
  1597.     {
  1598.       if (CC1000RadioIntM$bTxBusy) {
  1599.           Result = FAIL;
  1600.         }
  1601.       else 
  1602.         {
  1603.           CC1000RadioIntM$bTxBusy = TRUE;
  1604.           CC1000RadioIntM$txbufptr = pMsg;
  1605.           CC1000RadioIntM$txlength = pMsg->length + (MSG_DATA_SIZE - DATA_LENGTH - 2);
  1606.           if (CC1000RadioIntM$bCCAEnable) {
  1607.               if (CC1000RadioIntM$currentMAC == CC1000RadioIntM$BMAC) {
  1608.                 CC1000RadioIntM$sMacDelay = CC1000RadioIntM$MacBackoff$initialBackoff(pMsg);
  1609.                 }
  1610.               else {
  1611. #line 1121
  1612.                 CC1000RadioIntM$sMacDelay = CC1000RadioIntM$getZMACBackoff(0);
  1613.                 }
  1614.             }
  1615.           else {
  1616. #line 1123
  1617.             CC1000RadioIntM$sMacDelay = 0;
  1618.             }
  1619.           CC1000RadioIntM$bTxPending = TRUE;
  1620.         }
  1621.       currentRadioState = CC1000RadioIntM$RadioState;
  1622.     }
  1623. #line 1131
  1624.     __nesc_atomic_end(__nesc_atomic); }
  1625.   if (Result) {
  1626.       if (currentRadioState == CC1000RadioIntM$POWER_DOWN_STATE) {
  1627.           { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  1628. #line 1135
  1629.             CC1000RadioIntM$RadioState = CC1000RadioIntM$IDLE_STATE;
  1630. #line 1135
  1631.             __nesc_atomic_end(__nesc_atomic); }
  1632.           CC1000RadioIntM$WakeupTimer$stop();
  1633.           CC1000RadioIntM$CC1000StdControl$start();
  1634.           CC1000RadioIntM$CC1000Control$BIASOn();
  1635.           CC1000RadioIntM$CC1000Control$RxMode();
  1636.           CC1000RadioIntM$SpiByteFifo$rxMode();
  1637.           CC1000RadioIntM$SpiByteFifo$enableIntr();
  1638.           if (CC1000RadioIntM$iSquelchCount > 30) {
  1639.             CC1000RadioIntM$SquelchTimer$start(TIMER_REPEAT, 2560);
  1640.             }
  1641.           else {
  1642. #line 1145
  1643.             CC1000RadioIntM$SquelchTimer$start(TIMER_REPEAT, 128);
  1644.             }
  1645. #line 1146
  1646.           CC1000RadioIntM$WakeupTimer$start(TIMER_ONE_SHOT, 16 * 2);
  1647.         }
  1648.     }
  1649.   return Result;
  1650. }
  1651. static 
  1652. #line 286
  1653. uint16_t CC1000RadioIntM$getZMACBackoff(uint16_t residualBackoff)
  1654. #line 286
  1655. {
  1656.   if (residualBackoff > 0) {
  1657.       CC1000RadioIntM$congBackOffs++;
  1658.       if (CC1000RadioIntM$currentSlot == CC1000RadioIntM$ownSlot && residualBackoff >= 8) {
  1659.           return CC1000RadioIntM$getOwnerBackoff();
  1660.         }
  1661.       else {
  1662. #line 291
  1663.         if (CC1000RadioIntM$currentSlot != CC1000RadioIntM$ownSlot && residualBackoff < 8) {
  1664.             if (residualBackoff + 8 < 8 + 32) {
  1665.               return residualBackoff + 8;
  1666.               }
  1667.             else {
  1668. #line 295
  1669.               return CC1000RadioIntM$getNonOwnerBackoff();
  1670.               }
  1671.           }
  1672.         else {
  1673. #line 297
  1674.           return residualBackoff;
  1675.           }
  1676.         }
  1677.     }
  1678.   else 
  1679. #line 298
  1680.     {
  1681.       if (CC1000RadioIntM$currentSlot == CC1000RadioIntM$ownSlot) {
  1682.         return CC1000RadioIntM$getOwnerBackoff();
  1683.         }
  1684.       else {
  1685. #line 302
  1686.         return CC1000RadioIntM$getNonOwnerBackoff();
  1687.         }
  1688.     }
  1689. }
  1690. static  
  1691. # 168 "/home/testuser/tinyos-1.x/tos/system/TimerM.nc"
  1692. result_t TimerM$Timer$stop(uint8_t id)
  1693. #line 168
  1694. {
  1695.   if (id >= NUM_TIMERS) {
  1696. #line 170
  1697.     return FAIL;
  1698.     }
  1699. #line 171
  1700.   if (TimerM$mState & (0x1L << id)) {
  1701.       { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  1702. #line 172
  1703.         TimerM$mState &= ~(0x1L << id);
  1704. #line 172
  1705.         __nesc_atomic_end(__nesc_atomic); }
  1706.       if (!TimerM$mState) {
  1707.           TimerM$setIntervalFlag = 1;
  1708.         }
  1709.       return SUCCESS;
  1710.     }
  1711.   return FAIL;
  1712. }
  1713. # 144 "../../tos/platform/mica2/HPLADCM.nc"
  1714. void __attribute((signal))   __vector_21(void)
  1715. #line 144
  1716. {
  1717.   uint16_t data = * (volatile uint16_t *)& * (volatile uint8_t *)(0x04 + 0x20);
  1718. #line 146
  1719.   data &= 0x3ff;
  1720.   * (volatile uint8_t *)(0x06 + 0x20) |= 1 << 4;
  1721.   * (volatile uint8_t *)(0x06 + 0x20) &= ~(1 << 7);
  1722.   __nesc_enable_interrupt();
  1723.   HPLADCM$ADC$dataReady(data);
  1724. }
  1725. static   
  1726. #line 122
  1727. result_t HPLADCM$ADC$samplePort(uint8_t port)
  1728. #line 122
  1729. {
  1730.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  1731. #line 123
  1732.     {
  1733.       * (volatile uint8_t *)(0x07 + 0x20) = HPLADCM$TOSH_adc_portmap[port] & 0x1F;
  1734.     }
  1735. #line 125
  1736.     __nesc_atomic_end(__nesc_atomic); }
  1737.   * (volatile uint8_t *)(0x06 + 0x20) |= 1 << 7;
  1738.   * (volatile uint8_t *)(0x06 + 0x20) |= 1 << 6;
  1739.   return SUCCESS;
  1740. }
  1741. static  
  1742. # 342 "../../tos/platform/mica2/CC1000RadioIntM.nc"
  1743. void CC1000RadioIntM$adjustSquelch(void)
  1744. #line 342
  1745. {
  1746.   uint16_t tempArray[9];
  1747.   char i;
  1748. #line 344
  1749.   char j;
  1750. #line 344
  1751.   char min;
  1752.   uint16_t min_value;
  1753.   uint32_t tempsquelch;
  1754.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  1755. #line 348
  1756.     {
  1757.       CC1000RadioIntM$usSquelchTable[CC1000RadioIntM$usSquelchIndex] = CC1000RadioIntM$usTempSquelch;
  1758.       CC1000RadioIntM$usSquelchIndex++;
  1759.       if (CC1000RadioIntM$usSquelchIndex >= 9) {
  1760.         CC1000RadioIntM$usSquelchIndex = 0;
  1761.         }
  1762. #line 353
  1763.       if (CC1000RadioIntM$iSquelchCount <= 30) {
  1764.         CC1000RadioIntM$iSquelchCount++;
  1765.         }
  1766.     }
  1767. #line 356
  1768.     __nesc_atomic_end(__nesc_atomic); }
  1769.   for (i = 0; i < 9; i++) {
  1770.       tempArray[(int )i] = CC1000RadioIntM$usSquelchTable[(int )i];
  1771.     }
  1772.   min = 0;
  1773.   for (j = 0; j < 3; j++) {
  1774.       for (i = 1; i < 9; i++) {
  1775.           if (tempArray[(int )i] != 0xFFFF && (
  1776.           tempArray[(int )i] > tempArray[(int )min] || 
  1777.           tempArray[(int )min] == 0xFFFF)) {
  1778.               min = i;
  1779.             }
  1780.         }
  1781.       min_value = tempArray[(int )min];
  1782.       tempArray[(int )min] = 0xFFFF;
  1783.     }
  1784.   tempsquelch = (uint32_t )(CC1000RadioIntM$usSquelchVal << 5) + (uint32_t )(min_value << 1);
  1785.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  1786. #line 376
  1787.     CC1000RadioIntM$usSquelchVal = (uint16_t )(tempsquelch / 34 & 0x0FFFF);
  1788. #line 376
  1789.     __nesc_atomic_end(__nesc_atomic); }
  1790. }
  1791. static   
  1792. # 422 "../../tos/platform/mica2/CC1000ControlM.nc"
  1793. result_t CC1000ControlM$CC1000Control$TxMode(void)
  1794. #line 422
  1795. {
  1796.   CC1000ControlM$HPLChipcon$write(0x00, (((
  1797.   1 << 7) | (1 << 6)) | (1 << 5)) | (
  1798.   1 << 0));
  1799.   CC1000ControlM$HPLChipcon$write(0x09, CC1000ControlM$gCurrentParameters[29]);
  1800.   TOSH_uwait(250);
  1801.   CC1000ControlM$HPLChipcon$write(0x0B, CC1000ControlM$gCurrentParameters[0xb]);
  1802.   TOSH_uwait(20);
  1803.   return SUCCESS;
  1804. }
  1805. static 
  1806. # 198 "../../tos/platform/mica2/ADCREFM.nc"
  1807. result_t ADCREFM$startGet(uint8_t port)
  1808. #line 198
  1809. {
  1810.   uint16_t PortMask;
  1811. #line 199
  1812.   uint16_t oldReqVector = 1;
  1813.   result_t Result = SUCCESS;
  1814.   PortMask = 1 << port;
  1815.   if ((PortMask & ADCREFM$ReqVector) != 0) {
  1816.       Result = FAIL;
  1817.     }
  1818.   else {
  1819.       oldReqVector = ADCREFM$ReqVector;
  1820.       ADCREFM$ReqVector |= PortMask;
  1821.       if (oldReqVector == 0) {
  1822.           if ((Result = ADCREFM$HPLADC$samplePort(port))) {
  1823.               ADCREFM$ReqPort = port;
  1824.             }
  1825.         }
  1826.     }
  1827.   return Result;
  1828. }
  1829. static  
  1830. # 1586 "../../tos/platform/mica2/CC1000RadioIntM.nc"
  1831. void CC1000RadioIntM$IdleTimerTask(void)
  1832. #line 1586
  1833. {
  1834.   if (CC1000RadioIntM$iSquelchCount > 30) {
  1835.     CC1000RadioIntM$SquelchTimer$start(TIMER_REPEAT, 2560);
  1836.     }
  1837.   else {
  1838. #line 1590
  1839.     CC1000RadioIntM$SquelchTimer$start(TIMER_REPEAT, 128);
  1840.     }
  1841. #line 1591
  1842.   CC1000RadioIntM$WakeupTimer$start(TIMER_ONE_SHOT, CC1000RadioIntM$TIME_AFTER_CHECK);
  1843. }
  1844. static   
  1845. # 82 "../../tos/platform/mica2/HPLSpiM.nc"
  1846. result_t HPLSpiM$SpiByteFifo$disableIntr(void)
  1847. #line 82
  1848. {
  1849.   * (volatile uint8_t *)(0x0D + 0x20) &= ~(1 << 7);
  1850.   * (volatile uint8_t *)(0x17 + 0x20) |= 1 << 0;
  1851.   * (volatile uint8_t *)(0x18 + 0x20) &= ~(1 << 0);
  1852.   HPLSpiM$PowerManagement$adjustPower();
  1853.   return SUCCESS;
  1854. }
  1855. # 167 "/home/testuser/tinyos-1.x/tos/platform/mica/HPLClock.nc"
  1856. void __attribute((interrupt))   __vector_15(void)
  1857. #line 167
  1858. {
  1859.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  1860. #line 168
  1861.     {
  1862.       if (HPLClock$set_flag) {
  1863.           HPLClock$mscale = HPLClock$nextScale;
  1864.           HPLClock$nextScale |= 0x8;
  1865.           * (volatile uint8_t *)(0x33 + 0x20) = HPLClock$nextScale;
  1866.           * (volatile uint8_t *)(0x31 + 0x20) = HPLClock$minterval;
  1867.           HPLClock$set_flag = 0;
  1868.         }
  1869.     }
  1870. #line 177
  1871.     __nesc_atomic_end(__nesc_atomic); }
  1872.   HPLClock$Clock$fire();
  1873. }
  1874. static  
  1875. # 563 "../../tos/platform/mica2/CC1000RadioIntM.nc"
  1876. result_t CC1000RadioIntM$SetDrand$Set(nodeInfo *mInfo, uint8_t nHop, nodeInfo *nInfo, uint16_t sSize)
  1877. #line 563
  1878. {
  1879.   uint32_t slotOffset = 0;
  1880. #line 564
  1881.   uint32_t globalTimeStamp = 0;
  1882.   GTime loctime;
  1883.   uint8_t i = 0;
  1884.   CC1000RadioIntM$slotSize = sSize;
  1885.   CC1000RadioIntM$nextHop = nHop;
  1886.   for (i = 0; i < MAX_NBR; i++) {
  1887.       CC1000RadioIntM$nbrInfo[i].nodeID = 0xFF;
  1888.       CC1000RadioIntM$nbrInfo[i].slot = 0xFF;
  1889.       CC1000RadioIntM$nbrInfo[i].frame = 0xFF;
  1890.       CC1000RadioIntM$nbrInfo[i].bitMap = 0x0;
  1891.     }
  1892. # 1 "../../tos/platform/mica2/nbrTable.h"
  1893.   if (TOS_LOCAL_ADDRESS == 2) {
  1894.       CC1000RadioIntM$ownSlot = 4;
  1895.       CC1000RadioIntM$localFrameLength = 16;
  1896.       CC1000RadioIntM$nbrInfo[0].nodeID = 28;
  1897.       CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  1898.       CC1000RadioIntM$nbrInfo[0].frame = 16;
  1899.       CC1000RadioIntM$nbrInfo[0].slot = 3;
  1900.       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  1901.       CC1000RadioIntM$nbrInfo[1].nodeID = 27;
  1902.       CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  1903.       CC1000RadioIntM$nbrInfo[1].frame = 16;
  1904.       CC1000RadioIntM$nbrInfo[1].slot = 5;
  1905.       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  1906.       CC1000RadioIntM$nbrInfo[2].nodeID = 0;
  1907.       CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  1908.       CC1000RadioIntM$nbrInfo[2].frame = 16;
  1909.       CC1000RadioIntM$nbrInfo[2].slot = 9;
  1910.       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  1911.       CC1000RadioIntM$nbrInfo[3].nodeID = 21;
  1912.       CC1000RadioIntM$nbrInfo[3].bitMap = TWO_HOP;
  1913.       CC1000RadioIntM$nbrInfo[3].frame = 16;
  1914.       CC1000RadioIntM$nbrInfo[3].slot = 13;
  1915.       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[3].slot, CC1000RadioIntM$nbrInfo[3].frame);
  1916.     }
  1917.   else {
  1918. #line 24
  1919.     if (TOS_LOCAL_ADDRESS == 3) {
  1920.         CC1000RadioIntM$ownSlot = 14;
  1921.         CC1000RadioIntM$localFrameLength = 16;
  1922.         CC1000RadioIntM$nbrInfo[0].nodeID = 31;
  1923.         CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  1924.         CC1000RadioIntM$nbrInfo[0].frame = 16;
  1925.         CC1000RadioIntM$nbrInfo[0].slot = 5;
  1926.         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  1927.         CC1000RadioIntM$nbrInfo[1].nodeID = 15;
  1928.         CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  1929.         CC1000RadioIntM$nbrInfo[1].frame = 16;
  1930.         CC1000RadioIntM$nbrInfo[1].slot = 6;
  1931.         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  1932.         CC1000RadioIntM$nbrInfo[2].nodeID = 41;
  1933.         CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  1934.         CC1000RadioIntM$nbrInfo[2].frame = 16;
  1935.         CC1000RadioIntM$nbrInfo[2].slot = 12;
  1936.         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  1937.         CC1000RadioIntM$nbrInfo[3].nodeID = 40;
  1938.         CC1000RadioIntM$nbrInfo[3].bitMap = TWO_HOP;
  1939.         CC1000RadioIntM$nbrInfo[3].frame = 16;
  1940.         CC1000RadioIntM$nbrInfo[3].slot = 11;
  1941.         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[3].slot, CC1000RadioIntM$nbrInfo[3].frame);
  1942.         CC1000RadioIntM$nbrInfo[4].nodeID = 32;
  1943.         CC1000RadioIntM$nbrInfo[4].bitMap = TWO_HOP;
  1944.         CC1000RadioIntM$nbrInfo[4].frame = 16;
  1945.         CC1000RadioIntM$nbrInfo[4].slot = 2;
  1946.         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[4].slot, CC1000RadioIntM$nbrInfo[4].frame);
  1947.         CC1000RadioIntM$nbrInfo[5].nodeID = 17;
  1948.         CC1000RadioIntM$nbrInfo[5].bitMap = TWO_HOP;
  1949.         CC1000RadioIntM$nbrInfo[5].frame = 16;
  1950.         CC1000RadioIntM$nbrInfo[5].slot = 4;
  1951.         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[5].slot, CC1000RadioIntM$nbrInfo[5].frame);
  1952.         CC1000RadioIntM$nbrInfo[6].nodeID = 42;
  1953.         CC1000RadioIntM$nbrInfo[6].bitMap = TWO_HOP;
  1954.         CC1000RadioIntM$nbrInfo[6].frame = 16;
  1955.         CC1000RadioIntM$nbrInfo[6].slot = 7;
  1956.         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[6].slot, CC1000RadioIntM$nbrInfo[6].frame);
  1957.         CC1000RadioIntM$nbrInfo[7].nodeID = 27;
  1958.         CC1000RadioIntM$nbrInfo[7].bitMap = TWO_HOP;
  1959.         CC1000RadioIntM$nbrInfo[7].frame = 16;
  1960.         CC1000RadioIntM$nbrInfo[7].slot = 5;
  1961.         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[7].slot, CC1000RadioIntM$nbrInfo[7].frame);
  1962.       }
  1963.     else {
  1964. #line 67
  1965.       if (TOS_LOCAL_ADDRESS == 9) {
  1966.           CC1000RadioIntM$ownSlot = 1;
  1967.           CC1000RadioIntM$localFrameLength = 16;
  1968.           CC1000RadioIntM$nbrInfo[0].nodeID = 21;
  1969.           CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  1970.           CC1000RadioIntM$nbrInfo[0].frame = 16;
  1971.           CC1000RadioIntM$nbrInfo[0].slot = 13;
  1972.           CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  1973.           CC1000RadioIntM$nbrInfo[1].nodeID = 28;
  1974.           CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  1975.           CC1000RadioIntM$nbrInfo[1].frame = 16;
  1976.           CC1000RadioIntM$nbrInfo[1].slot = 3;
  1977.           CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  1978.           CC1000RadioIntM$nbrInfo[2].nodeID = 27;
  1979.           CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  1980.           CC1000RadioIntM$nbrInfo[2].frame = 16;
  1981.           CC1000RadioIntM$nbrInfo[2].slot = 5;
  1982.           CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  1983.           CC1000RadioIntM$nbrInfo[3].nodeID = 0;
  1984.           CC1000RadioIntM$nbrInfo[3].bitMap = TWO_HOP;
  1985.           CC1000RadioIntM$nbrInfo[3].frame = 16;
  1986.           CC1000RadioIntM$nbrInfo[3].slot = 9;
  1987.           CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[3].slot, CC1000RadioIntM$nbrInfo[3].frame);
  1988.         }
  1989.       else {
  1990. #line 90
  1991.         if (TOS_LOCAL_ADDRESS == 39) {
  1992.             CC1000RadioIntM$ownSlot = 2;
  1993.             CC1000RadioIntM$localFrameLength = 16;
  1994.             CC1000RadioIntM$nbrInfo[0].nodeID = 0;
  1995.             CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  1996.             CC1000RadioIntM$nbrInfo[0].frame = 16;
  1997.             CC1000RadioIntM$nbrInfo[0].slot = 9;
  1998.             CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  1999.           }
  2000.         else {
  2001. #line 98
  2002.           if (TOS_LOCAL_ADDRESS == 10) {
  2003.               CC1000RadioIntM$ownSlot = 0;
  2004.               CC1000RadioIntM$localFrameLength = 16;
  2005.               CC1000RadioIntM$nbrInfo[0].nodeID = 21;
  2006.               CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2007.               CC1000RadioIntM$nbrInfo[0].frame = 16;
  2008.               CC1000RadioIntM$nbrInfo[0].slot = 13;
  2009.               CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2010.               CC1000RadioIntM$nbrInfo[1].nodeID = 0;
  2011.               CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  2012.               CC1000RadioIntM$nbrInfo[1].frame = 16;
  2013.               CC1000RadioIntM$nbrInfo[1].slot = 9;
  2014.               CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  2015.               CC1000RadioIntM$nbrInfo[2].nodeID = 28;
  2016.               CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  2017.               CC1000RadioIntM$nbrInfo[2].frame = 16;
  2018.               CC1000RadioIntM$nbrInfo[2].slot = 3;
  2019.               CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  2020.               CC1000RadioIntM$nbrInfo[3].nodeID = 27;
  2021.               CC1000RadioIntM$nbrInfo[3].bitMap = TWO_HOP;
  2022.               CC1000RadioIntM$nbrInfo[3].frame = 16;
  2023.               CC1000RadioIntM$nbrInfo[3].slot = 5;
  2024.               CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[3].slot, CC1000RadioIntM$nbrInfo[3].frame);
  2025.             }
  2026.           else {
  2027. #line 121
  2028.             if (TOS_LOCAL_ADDRESS == 24) {
  2029.                 CC1000RadioIntM$ownSlot = 7;
  2030.                 CC1000RadioIntM$localFrameLength = 16;
  2031.                 CC1000RadioIntM$nbrInfo[0].nodeID = 0;
  2032.                 CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2033.                 CC1000RadioIntM$nbrInfo[0].frame = 16;
  2034.                 CC1000RadioIntM$nbrInfo[0].slot = 9;
  2035.                 CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2036.               }
  2037.             else {
  2038. #line 129
  2039.               if (TOS_LOCAL_ADDRESS == 1) {
  2040.                   CC1000RadioIntM$ownSlot = 6;
  2041.                   CC1000RadioIntM$localFrameLength = 16;
  2042.                   CC1000RadioIntM$nbrInfo[0].nodeID = 21;
  2043.                   CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2044.                   CC1000RadioIntM$nbrInfo[0].frame = 16;
  2045.                   CC1000RadioIntM$nbrInfo[0].slot = 13;
  2046.                   CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2047.                   CC1000RadioIntM$nbrInfo[1].nodeID = 37;
  2048.                   CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  2049.                   CC1000RadioIntM$nbrInfo[1].frame = 16;
  2050.                   CC1000RadioIntM$nbrInfo[1].slot = 10;
  2051.                   CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  2052.                   CC1000RadioIntM$nbrInfo[2].nodeID = 0;
  2053.                   CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  2054.                   CC1000RadioIntM$nbrInfo[2].frame = 16;
  2055.                   CC1000RadioIntM$nbrInfo[2].slot = 9;
  2056.                   CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  2057.                 }
  2058.               else {
  2059. #line 147
  2060.                 if (TOS_LOCAL_ADDRESS == 21) {
  2061.                     CC1000RadioIntM$ownSlot = 13;
  2062.                     CC1000RadioIntM$localFrameLength = 16;
  2063.                     CC1000RadioIntM$nbrInfo[0].nodeID = 28;
  2064.                     CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2065.                     CC1000RadioIntM$nbrInfo[0].frame = 16;
  2066.                     CC1000RadioIntM$nbrInfo[0].slot = 3;
  2067.                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2068.                     CC1000RadioIntM$nbrInfo[1].nodeID = 1;
  2069.                     CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  2070.                     CC1000RadioIntM$nbrInfo[1].frame = 16;
  2071.                     CC1000RadioIntM$nbrInfo[1].slot = 6;
  2072.                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  2073.                     CC1000RadioIntM$nbrInfo[2].nodeID = 9;
  2074.                     CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  2075.                     CC1000RadioIntM$nbrInfo[2].frame = 16;
  2076.                     CC1000RadioIntM$nbrInfo[2].slot = 1;
  2077.                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  2078.                     CC1000RadioIntM$nbrInfo[3].nodeID = 27;
  2079.                     CC1000RadioIntM$nbrInfo[3].bitMap = TWO_HOP;
  2080.                     CC1000RadioIntM$nbrInfo[3].frame = 16;
  2081.                     CC1000RadioIntM$nbrInfo[3].slot = 5;
  2082.                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[3].slot, CC1000RadioIntM$nbrInfo[3].frame);
  2083.                     CC1000RadioIntM$nbrInfo[4].nodeID = 10;
  2084.                     CC1000RadioIntM$nbrInfo[4].bitMap = TWO_HOP;
  2085.                     CC1000RadioIntM$nbrInfo[4].frame = 16;
  2086.                     CC1000RadioIntM$nbrInfo[4].slot = 0;
  2087.                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[4].slot, CC1000RadioIntM$nbrInfo[4].frame);
  2088.                     CC1000RadioIntM$nbrInfo[5].nodeID = 31;
  2089.                     CC1000RadioIntM$nbrInfo[5].bitMap = TWO_HOP;
  2090.                     CC1000RadioIntM$nbrInfo[5].frame = 16;
  2091.                     CC1000RadioIntM$nbrInfo[5].slot = 5;
  2092.                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[5].slot, CC1000RadioIntM$nbrInfo[5].frame);
  2093.                     CC1000RadioIntM$nbrInfo[6].nodeID = 15;
  2094.                     CC1000RadioIntM$nbrInfo[6].bitMap = TWO_HOP;
  2095.                     CC1000RadioIntM$nbrInfo[6].frame = 16;
  2096.                     CC1000RadioIntM$nbrInfo[6].slot = 6;
  2097.                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[6].slot, CC1000RadioIntM$nbrInfo[6].frame);
  2098.                     CC1000RadioIntM$nbrInfo[7].nodeID = 41;
  2099.                     CC1000RadioIntM$nbrInfo[7].bitMap = TWO_HOP;
  2100.                     CC1000RadioIntM$nbrInfo[7].frame = 16;
  2101.                     CC1000RadioIntM$nbrInfo[7].slot = 12;
  2102.                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[7].slot, CC1000RadioIntM$nbrInfo[7].frame);
  2103.                     CC1000RadioIntM$nbrInfo[8].nodeID = 40;
  2104.                     CC1000RadioIntM$nbrInfo[8].bitMap = TWO_HOP;
  2105.                     CC1000RadioIntM$nbrInfo[8].frame = 16;
  2106.                     CC1000RadioIntM$nbrInfo[8].slot = 11;
  2107.                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[8].slot, CC1000RadioIntM$nbrInfo[8].frame);
  2108.                     CC1000RadioIntM$nbrInfo[9].nodeID = 32;
  2109.                     CC1000RadioIntM$nbrInfo[9].bitMap = TWO_HOP;
  2110.                     CC1000RadioIntM$nbrInfo[9].frame = 16;
  2111.                     CC1000RadioIntM$nbrInfo[9].slot = 2;
  2112.                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[9].slot, CC1000RadioIntM$nbrInfo[9].frame);
  2113.                     CC1000RadioIntM$nbrInfo[10].nodeID = 17;
  2114.                     CC1000RadioIntM$nbrInfo[10].bitMap = TWO_HOP;
  2115.                     CC1000RadioIntM$nbrInfo[10].frame = 16;
  2116.                     CC1000RadioIntM$nbrInfo[10].slot = 4;
  2117.                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[10].slot, CC1000RadioIntM$nbrInfo[10].frame);
  2118.                     CC1000RadioIntM$nbrInfo[11].nodeID = 42;
  2119.                     CC1000RadioIntM$nbrInfo[11].bitMap = TWO_HOP;
  2120.                     CC1000RadioIntM$nbrInfo[11].frame = 16;
  2121.                     CC1000RadioIntM$nbrInfo[11].slot = 7;
  2122.                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[11].slot, CC1000RadioIntM$nbrInfo[11].frame);
  2123.                     CC1000RadioIntM$nbrInfo[12].nodeID = 2;
  2124.                     CC1000RadioIntM$nbrInfo[12].bitMap = TWO_HOP;
  2125.                     CC1000RadioIntM$nbrInfo[12].frame = 16;
  2126.                     CC1000RadioIntM$nbrInfo[12].slot = 4;
  2127.                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[12].slot, CC1000RadioIntM$nbrInfo[12].frame);
  2128.                   }
  2129.                 else {
  2130. #line 215
  2131.                   if (TOS_LOCAL_ADDRESS == 37) {
  2132.                       CC1000RadioIntM$ownSlot = 10;
  2133.                       CC1000RadioIntM$localFrameLength = 16;
  2134.                       CC1000RadioIntM$nbrInfo[0].nodeID = 28;
  2135.                       CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2136.                       CC1000RadioIntM$nbrInfo[0].frame = 16;
  2137.                       CC1000RadioIntM$nbrInfo[0].slot = 3;
  2138.                       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2139.                       CC1000RadioIntM$nbrInfo[1].nodeID = 1;
  2140.                       CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  2141.                       CC1000RadioIntM$nbrInfo[1].frame = 16;
  2142.                       CC1000RadioIntM$nbrInfo[1].slot = 6;
  2143.                       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  2144.                       CC1000RadioIntM$nbrInfo[2].nodeID = 27;
  2145.                       CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  2146.                       CC1000RadioIntM$nbrInfo[2].frame = 16;
  2147.                       CC1000RadioIntM$nbrInfo[2].slot = 5;
  2148.                       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  2149.                       CC1000RadioIntM$nbrInfo[3].nodeID = 31;
  2150.                       CC1000RadioIntM$nbrInfo[3].bitMap = TWO_HOP;
  2151.                       CC1000RadioIntM$nbrInfo[3].frame = 16;
  2152.                       CC1000RadioIntM$nbrInfo[3].slot = 5;
  2153.                       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[3].slot, CC1000RadioIntM$nbrInfo[3].frame);
  2154.                       CC1000RadioIntM$nbrInfo[4].nodeID = 15;
  2155.                       CC1000RadioIntM$nbrInfo[4].bitMap = TWO_HOP;
  2156.                       CC1000RadioIntM$nbrInfo[4].frame = 16;
  2157.                       CC1000RadioIntM$nbrInfo[4].slot = 6;
  2158.                       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[4].slot, CC1000RadioIntM$nbrInfo[4].frame);
  2159.                       CC1000RadioIntM$nbrInfo[5].nodeID = 41;
  2160.                       CC1000RadioIntM$nbrInfo[5].bitMap = TWO_HOP;
  2161.                       CC1000RadioIntM$nbrInfo[5].frame = 16;
  2162.                       CC1000RadioIntM$nbrInfo[5].slot = 12;
  2163.                       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[5].slot, CC1000RadioIntM$nbrInfo[5].frame);
  2164.                       CC1000RadioIntM$nbrInfo[6].nodeID = 40;
  2165.                       CC1000RadioIntM$nbrInfo[6].bitMap = TWO_HOP;
  2166.                       CC1000RadioIntM$nbrInfo[6].frame = 16;
  2167.                       CC1000RadioIntM$nbrInfo[6].slot = 11;
  2168.                       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[6].slot, CC1000RadioIntM$nbrInfo[6].frame);
  2169.                       CC1000RadioIntM$nbrInfo[7].nodeID = 32;
  2170.                       CC1000RadioIntM$nbrInfo[7].bitMap = TWO_HOP;
  2171.                       CC1000RadioIntM$nbrInfo[7].frame = 16;
  2172.                       CC1000RadioIntM$nbrInfo[7].slot = 2;
  2173.                       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[7].slot, CC1000RadioIntM$nbrInfo[7].frame);
  2174.                       CC1000RadioIntM$nbrInfo[8].nodeID = 17;
  2175.                       CC1000RadioIntM$nbrInfo[8].bitMap = TWO_HOP;
  2176.                       CC1000RadioIntM$nbrInfo[8].frame = 16;
  2177.                       CC1000RadioIntM$nbrInfo[8].slot = 4;
  2178.                       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[8].slot, CC1000RadioIntM$nbrInfo[8].frame);
  2179.                       CC1000RadioIntM$nbrInfo[9].nodeID = 42;
  2180.                       CC1000RadioIntM$nbrInfo[9].bitMap = TWO_HOP;
  2181.                       CC1000RadioIntM$nbrInfo[9].frame = 16;
  2182.                       CC1000RadioIntM$nbrInfo[9].slot = 7;
  2183.                       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[9].slot, CC1000RadioIntM$nbrInfo[9].frame);
  2184.                     }
  2185.                   else {
  2186. #line 268
  2187.                     if (TOS_LOCAL_ADDRESS == 27) {
  2188.                         CC1000RadioIntM$ownSlot = 5;
  2189.                         CC1000RadioIntM$localFrameLength = 16;
  2190.                         CC1000RadioIntM$nbrInfo[0].nodeID = 21;
  2191.                         CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2192.                         CC1000RadioIntM$nbrInfo[0].frame = 16;
  2193.                         CC1000RadioIntM$nbrInfo[0].slot = 13;
  2194.                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2195.                         CC1000RadioIntM$nbrInfo[1].nodeID = 37;
  2196.                         CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  2197.                         CC1000RadioIntM$nbrInfo[1].frame = 16;
  2198.                         CC1000RadioIntM$nbrInfo[1].slot = 10;
  2199.                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  2200.                         CC1000RadioIntM$nbrInfo[2].nodeID = 9;
  2201.                         CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  2202.                         CC1000RadioIntM$nbrInfo[2].frame = 16;
  2203.                         CC1000RadioIntM$nbrInfo[2].slot = 1;
  2204.                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  2205.                         CC1000RadioIntM$nbrInfo[3].nodeID = 2;
  2206.                         CC1000RadioIntM$nbrInfo[3].bitMap = TWO_HOP;
  2207.                         CC1000RadioIntM$nbrInfo[3].frame = 16;
  2208.                         CC1000RadioIntM$nbrInfo[3].slot = 4;
  2209.                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[3].slot, CC1000RadioIntM$nbrInfo[3].frame);
  2210.                         CC1000RadioIntM$nbrInfo[4].nodeID = 10;
  2211.                         CC1000RadioIntM$nbrInfo[4].bitMap = TWO_HOP;
  2212.                         CC1000RadioIntM$nbrInfo[4].frame = 16;
  2213.                         CC1000RadioIntM$nbrInfo[4].slot = 0;
  2214.                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[4].slot, CC1000RadioIntM$nbrInfo[4].frame);
  2215.                         CC1000RadioIntM$nbrInfo[5].nodeID = 38;
  2216.                         CC1000RadioIntM$nbrInfo[5].bitMap = TWO_HOP;
  2217.                         CC1000RadioIntM$nbrInfo[5].frame = 16;
  2218.                         CC1000RadioIntM$nbrInfo[5].slot = 8;
  2219.                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[5].slot, CC1000RadioIntM$nbrInfo[5].frame);
  2220.                         CC1000RadioIntM$nbrInfo[6].nodeID = 0;
  2221.                         CC1000RadioIntM$nbrInfo[6].bitMap = TWO_HOP;
  2222.                         CC1000RadioIntM$nbrInfo[6].frame = 16;
  2223.                         CC1000RadioIntM$nbrInfo[6].slot = 9;
  2224.                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[6].slot, CC1000RadioIntM$nbrInfo[6].frame);
  2225.                         CC1000RadioIntM$nbrInfo[7].nodeID = 40;
  2226.                         CC1000RadioIntM$nbrInfo[7].bitMap = TWO_HOP;
  2227.                         CC1000RadioIntM$nbrInfo[7].frame = 16;
  2228.                         CC1000RadioIntM$nbrInfo[7].slot = 11;
  2229.                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[7].slot, CC1000RadioIntM$nbrInfo[7].frame);
  2230.                         CC1000RadioIntM$nbrInfo[8].nodeID = 17;
  2231.                         CC1000RadioIntM$nbrInfo[8].bitMap = TWO_HOP;
  2232.                         CC1000RadioIntM$nbrInfo[8].frame = 16;
  2233.                         CC1000RadioIntM$nbrInfo[8].slot = 4;
  2234.                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[8].slot, CC1000RadioIntM$nbrInfo[8].frame);
  2235.                         CC1000RadioIntM$nbrInfo[9].nodeID = 41;
  2236.                         CC1000RadioIntM$nbrInfo[9].bitMap = TWO_HOP;
  2237.                         CC1000RadioIntM$nbrInfo[9].frame = 16;
  2238.                         CC1000RadioIntM$nbrInfo[9].slot = 12;
  2239.                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[9].slot, CC1000RadioIntM$nbrInfo[9].frame);
  2240.                         CC1000RadioIntM$nbrInfo[10].nodeID = 43;
  2241.                         CC1000RadioIntM$nbrInfo[10].bitMap = TWO_HOP;
  2242.                         CC1000RadioIntM$nbrInfo[10].frame = 16;
  2243.                         CC1000RadioIntM$nbrInfo[10].slot = 0;
  2244.                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[10].slot, CC1000RadioIntM$nbrInfo[10].frame);
  2245.                         CC1000RadioIntM$nbrInfo[11].nodeID = 15;
  2246.                         CC1000RadioIntM$nbrInfo[11].bitMap = TWO_HOP;
  2247.                         CC1000RadioIntM$nbrInfo[11].frame = 16;
  2248.                         CC1000RadioIntM$nbrInfo[11].slot = 6;
  2249.                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[11].slot, CC1000RadioIntM$nbrInfo[11].frame);
  2250.                         CC1000RadioIntM$nbrInfo[12].nodeID = 42;
  2251.                         CC1000RadioIntM$nbrInfo[12].bitMap = TWO_HOP;
  2252.                         CC1000RadioIntM$nbrInfo[12].frame = 16;
  2253.                         CC1000RadioIntM$nbrInfo[12].slot = 7;
  2254.                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[12].slot, CC1000RadioIntM$nbrInfo[12].frame);
  2255.                         CC1000RadioIntM$nbrInfo[13].nodeID = 18;
  2256.                         CC1000RadioIntM$nbrInfo[13].bitMap = TWO_HOP;
  2257.                         CC1000RadioIntM$nbrInfo[13].frame = 16;
  2258.                         CC1000RadioIntM$nbrInfo[13].slot = 8;
  2259.                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[13].slot, CC1000RadioIntM$nbrInfo[13].frame);
  2260.                         CC1000RadioIntM$nbrInfo[14].nodeID = 5;
  2261.                         CC1000RadioIntM$nbrInfo[14].bitMap = TWO_HOP;
  2262.                         CC1000RadioIntM$nbrInfo[14].frame = 16;
  2263.                         CC1000RadioIntM$nbrInfo[14].slot = 1;
  2264.                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[14].slot, CC1000RadioIntM$nbrInfo[14].frame);
  2265.                         CC1000RadioIntM$nbrInfo[15].nodeID = 3;
  2266.                         CC1000RadioIntM$nbrInfo[15].bitMap = TWO_HOP;
  2267.                         CC1000RadioIntM$nbrInfo[15].frame = 16;
  2268.                         CC1000RadioIntM$nbrInfo[15].slot = 14;
  2269.                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[15].slot, CC1000RadioIntM$nbrInfo[15].frame);
  2270.                       }
  2271.                     else {
  2272. #line 351
  2273.                       if (TOS_LOCAL_ADDRESS == 38) {
  2274.                           CC1000RadioIntM$ownSlot = 8;
  2275.                           CC1000RadioIntM$localFrameLength = 16;
  2276.                           CC1000RadioIntM$nbrInfo[0].nodeID = 28;
  2277.                           CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2278.                           CC1000RadioIntM$nbrInfo[0].frame = 16;
  2279.                           CC1000RadioIntM$nbrInfo[0].slot = 3;
  2280.                           CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2281.                           CC1000RadioIntM$nbrInfo[1].nodeID = 27;
  2282.                           CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  2283.                           CC1000RadioIntM$nbrInfo[1].frame = 16;
  2284.                           CC1000RadioIntM$nbrInfo[1].slot = 5;
  2285.                           CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  2286.                           CC1000RadioIntM$nbrInfo[2].nodeID = 31;
  2287.                           CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  2288.                           CC1000RadioIntM$nbrInfo[2].frame = 16;
  2289.                           CC1000RadioIntM$nbrInfo[2].slot = 5;
  2290.                           CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  2291.                           CC1000RadioIntM$nbrInfo[3].nodeID = 15;
  2292.                           CC1000RadioIntM$nbrInfo[3].bitMap = TWO_HOP;
  2293.                           CC1000RadioIntM$nbrInfo[3].frame = 16;
  2294.                           CC1000RadioIntM$nbrInfo[3].slot = 6;
  2295.                           CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[3].slot, CC1000RadioIntM$nbrInfo[3].frame);
  2296.                           CC1000RadioIntM$nbrInfo[4].nodeID = 41;
  2297.                           CC1000RadioIntM$nbrInfo[4].bitMap = TWO_HOP;
  2298.                           CC1000RadioIntM$nbrInfo[4].frame = 16;
  2299.                           CC1000RadioIntM$nbrInfo[4].slot = 12;
  2300.                           CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[4].slot, CC1000RadioIntM$nbrInfo[4].frame);
  2301.                           CC1000RadioIntM$nbrInfo[5].nodeID = 40;
  2302.                           CC1000RadioIntM$nbrInfo[5].bitMap = TWO_HOP;
  2303.                           CC1000RadioIntM$nbrInfo[5].frame = 16;
  2304.                           CC1000RadioIntM$nbrInfo[5].slot = 11;
  2305.                           CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[5].slot, CC1000RadioIntM$nbrInfo[5].frame);
  2306.                           CC1000RadioIntM$nbrInfo[6].nodeID = 32;
  2307.                           CC1000RadioIntM$nbrInfo[6].bitMap = TWO_HOP;
  2308.                           CC1000RadioIntM$nbrInfo[6].frame = 16;
  2309.                           CC1000RadioIntM$nbrInfo[6].slot = 2;
  2310.                           CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[6].slot, CC1000RadioIntM$nbrInfo[6].frame);
  2311.                           CC1000RadioIntM$nbrInfo[7].nodeID = 17;
  2312.                           CC1000RadioIntM$nbrInfo[7].bitMap = TWO_HOP;
  2313.                           CC1000RadioIntM$nbrInfo[7].frame = 16;
  2314.                           CC1000RadioIntM$nbrInfo[7].slot = 4;
  2315.                           CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[7].slot, CC1000RadioIntM$nbrInfo[7].frame);
  2316.                           CC1000RadioIntM$nbrInfo[8].nodeID = 42;
  2317.                           CC1000RadioIntM$nbrInfo[8].bitMap = TWO_HOP;
  2318.                           CC1000RadioIntM$nbrInfo[8].frame = 16;
  2319.                           CC1000RadioIntM$nbrInfo[8].slot = 7;
  2320.                           CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[8].slot, CC1000RadioIntM$nbrInfo[8].frame);
  2321.                         }
  2322.                       else {
  2323. #line 399
  2324.                         if (TOS_LOCAL_ADDRESS == 0) {
  2325.                             CC1000RadioIntM$ownSlot = 9;
  2326.                             CC1000RadioIntM$localFrameLength = 16;
  2327.                             CC1000RadioIntM$nbrInfo[0].nodeID = 39;
  2328.                             CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2329.                             CC1000RadioIntM$nbrInfo[0].frame = 16;
  2330.                             CC1000RadioIntM$nbrInfo[0].slot = 2;
  2331.                             CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2332.                             CC1000RadioIntM$nbrInfo[1].nodeID = 24;
  2333.                             CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  2334.                             CC1000RadioIntM$nbrInfo[1].frame = 16;
  2335.                             CC1000RadioIntM$nbrInfo[1].slot = 7;
  2336.                             CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  2337.                             CC1000RadioIntM$nbrInfo[2].nodeID = 9;
  2338.                             CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  2339.                             CC1000RadioIntM$nbrInfo[2].frame = 16;
  2340.                             CC1000RadioIntM$nbrInfo[2].slot = 1;
  2341.                             CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  2342.                             CC1000RadioIntM$nbrInfo[3].nodeID = 10;
  2343.                             CC1000RadioIntM$nbrInfo[3].bitMap = TWO_HOP;
  2344.                             CC1000RadioIntM$nbrInfo[3].frame = 16;
  2345.                             CC1000RadioIntM$nbrInfo[3].slot = 0;
  2346.                             CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[3].slot, CC1000RadioIntM$nbrInfo[3].frame);
  2347.                             CC1000RadioIntM$nbrInfo[4].nodeID = 2;
  2348.                             CC1000RadioIntM$nbrInfo[4].bitMap = TWO_HOP;
  2349.                             CC1000RadioIntM$nbrInfo[4].frame = 16;
  2350.                             CC1000RadioIntM$nbrInfo[4].slot = 4;
  2351.                             CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[4].slot, CC1000RadioIntM$nbrInfo[4].frame);
  2352.                             CC1000RadioIntM$nbrInfo[5].nodeID = 43;
  2353.                             CC1000RadioIntM$nbrInfo[5].bitMap = TWO_HOP;
  2354.                             CC1000RadioIntM$nbrInfo[5].frame = 16;
  2355.                             CC1000RadioIntM$nbrInfo[5].slot = 0;
  2356.                             CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[5].slot, CC1000RadioIntM$nbrInfo[5].frame);
  2357.                             CC1000RadioIntM$nbrInfo[6].nodeID = 5;
  2358.                             CC1000RadioIntM$nbrInfo[6].bitMap = TWO_HOP;
  2359.                             CC1000RadioIntM$nbrInfo[6].frame = 16;
  2360.                             CC1000RadioIntM$nbrInfo[6].slot = 1;
  2361.                             CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[6].slot, CC1000RadioIntM$nbrInfo[6].frame);
  2362.                             CC1000RadioIntM$nbrInfo[7].nodeID = 1;
  2363.                             CC1000RadioIntM$nbrInfo[7].bitMap = TWO_HOP;
  2364.                             CC1000RadioIntM$nbrInfo[7].frame = 16;
  2365.                             CC1000RadioIntM$nbrInfo[7].slot = 6;
  2366.                             CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[7].slot, CC1000RadioIntM$nbrInfo[7].frame);
  2367.                             CC1000RadioIntM$nbrInfo[8].nodeID = 28;
  2368.                             CC1000RadioIntM$nbrInfo[8].bitMap = TWO_HOP;
  2369.                             CC1000RadioIntM$nbrInfo[8].frame = 16;
  2370.                             CC1000RadioIntM$nbrInfo[8].slot = 3;
  2371.                             CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[8].slot, CC1000RadioIntM$nbrInfo[8].frame);
  2372.                             CC1000RadioIntM$nbrInfo[9].nodeID = 14;
  2373.                             CC1000RadioIntM$nbrInfo[9].bitMap = TWO_HOP;
  2374.                             CC1000RadioIntM$nbrInfo[9].frame = 16;
  2375.                             CC1000RadioIntM$nbrInfo[9].slot = 10;
  2376.                             CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[9].slot, CC1000RadioIntM$nbrInfo[9].frame);
  2377.                             CC1000RadioIntM$nbrInfo[10].nodeID = 19;
  2378.                             CC1000RadioIntM$nbrInfo[10].bitMap = TWO_HOP;
  2379.                             CC1000RadioIntM$nbrInfo[10].frame = 16;
  2380.                             CC1000RadioIntM$nbrInfo[10].slot = 3;
  2381.                             CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[10].slot, CC1000RadioIntM$nbrInfo[10].frame);
  2382.                             CC1000RadioIntM$nbrInfo[11].nodeID = 18;
  2383.                             CC1000RadioIntM$nbrInfo[11].bitMap = TWO_HOP;
  2384.                             CC1000RadioIntM$nbrInfo[11].frame = 16;
  2385.                             CC1000RadioIntM$nbrInfo[11].slot = 8;
  2386.                             CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[11].slot, CC1000RadioIntM$nbrInfo[11].frame);
  2387.                           }
  2388.                         else {
  2389. #line 462
  2390.                           if (TOS_LOCAL_ADDRESS == 31) {
  2391.                               CC1000RadioIntM$ownSlot = 5;
  2392.                               CC1000RadioIntM$localFrameLength = 16;
  2393.                               CC1000RadioIntM$nbrInfo[0].nodeID = 38;
  2394.                               CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2395.                               CC1000RadioIntM$nbrInfo[0].frame = 16;
  2396.                               CC1000RadioIntM$nbrInfo[0].slot = 8;
  2397.                               CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2398.                               CC1000RadioIntM$nbrInfo[1].nodeID = 21;
  2399.                               CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  2400.                               CC1000RadioIntM$nbrInfo[1].frame = 16;
  2401.                               CC1000RadioIntM$nbrInfo[1].slot = 13;
  2402.                               CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  2403.                               CC1000RadioIntM$nbrInfo[2].nodeID = 19;
  2404.                               CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  2405.                               CC1000RadioIntM$nbrInfo[2].frame = 16;
  2406.                               CC1000RadioIntM$nbrInfo[2].slot = 3;
  2407.                               CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  2408.                               CC1000RadioIntM$nbrInfo[3].nodeID = 37;
  2409.                               CC1000RadioIntM$nbrInfo[3].bitMap = TWO_HOP;
  2410.                               CC1000RadioIntM$nbrInfo[3].frame = 16;
  2411.                               CC1000RadioIntM$nbrInfo[3].slot = 10;
  2412.                               CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[3].slot, CC1000RadioIntM$nbrInfo[3].frame);
  2413.                               CC1000RadioIntM$nbrInfo[4].nodeID = 3;
  2414.                               CC1000RadioIntM$nbrInfo[4].bitMap = TWO_HOP;
  2415.                               CC1000RadioIntM$nbrInfo[4].frame = 16;
  2416.                               CC1000RadioIntM$nbrInfo[4].slot = 14;
  2417.                               CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[4].slot, CC1000RadioIntM$nbrInfo[4].frame);
  2418.                             }
  2419.                           else {
  2420. #line 490
  2421.                             if (TOS_LOCAL_ADDRESS == 41) {
  2422.                                 CC1000RadioIntM$ownSlot = 12;
  2423.                                 CC1000RadioIntM$localFrameLength = 16;
  2424.                                 CC1000RadioIntM$nbrInfo[0].nodeID = 38;
  2425.                                 CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2426.                                 CC1000RadioIntM$nbrInfo[0].frame = 16;
  2427.                                 CC1000RadioIntM$nbrInfo[0].slot = 8;
  2428.                                 CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2429.                                 CC1000RadioIntM$nbrInfo[1].nodeID = 21;
  2430.                                 CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  2431.                                 CC1000RadioIntM$nbrInfo[1].frame = 16;
  2432.                                 CC1000RadioIntM$nbrInfo[1].slot = 13;
  2433.                                 CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  2434.                                 CC1000RadioIntM$nbrInfo[2].nodeID = 3;
  2435.                                 CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  2436.                                 CC1000RadioIntM$nbrInfo[2].frame = 16;
  2437.                                 CC1000RadioIntM$nbrInfo[2].slot = 14;
  2438.                                 CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  2439.                               }
  2440.                             else {
  2441. #line 508
  2442.                               if (TOS_LOCAL_ADDRESS == 40) {
  2443.                                   CC1000RadioIntM$ownSlot = 11;
  2444.                                   CC1000RadioIntM$localFrameLength = 16;
  2445.                                   CC1000RadioIntM$nbrInfo[0].nodeID = 18;
  2446.                                   CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2447.                                   CC1000RadioIntM$nbrInfo[0].frame = 16;
  2448.                                   CC1000RadioIntM$nbrInfo[0].slot = 8;
  2449.                                   CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2450.                                   CC1000RadioIntM$nbrInfo[1].nodeID = 38;
  2451.                                   CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  2452.                                   CC1000RadioIntM$nbrInfo[1].frame = 16;
  2453.                                   CC1000RadioIntM$nbrInfo[1].slot = 8;
  2454.                                   CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  2455.                                   CC1000RadioIntM$nbrInfo[2].nodeID = 21;
  2456.                                   CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  2457.                                   CC1000RadioIntM$nbrInfo[2].frame = 16;
  2458.                                   CC1000RadioIntM$nbrInfo[2].slot = 13;
  2459.                                   CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  2460.                                   CC1000RadioIntM$nbrInfo[3].nodeID = 3;
  2461.                                   CC1000RadioIntM$nbrInfo[3].bitMap = TWO_HOP;
  2462.                                   CC1000RadioIntM$nbrInfo[3].frame = 16;
  2463.                                   CC1000RadioIntM$nbrInfo[3].slot = 14;
  2464.                                   CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[3].slot, CC1000RadioIntM$nbrInfo[3].frame);
  2465.                                 }
  2466.                               else {
  2467. #line 531
  2468.                                 if (TOS_LOCAL_ADDRESS == 28) {
  2469.                                     CC1000RadioIntM$ownSlot = 3;
  2470.                                     CC1000RadioIntM$localFrameLength = 16;
  2471.                                     CC1000RadioIntM$nbrInfo[0].nodeID = 21;
  2472.                                     CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2473.                                     CC1000RadioIntM$nbrInfo[0].frame = 16;
  2474.                                     CC1000RadioIntM$nbrInfo[0].slot = 13;
  2475.                                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2476.                                     CC1000RadioIntM$nbrInfo[1].nodeID = 37;
  2477.                                     CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  2478.                                     CC1000RadioIntM$nbrInfo[1].frame = 16;
  2479.                                     CC1000RadioIntM$nbrInfo[1].slot = 10;
  2480.                                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  2481.                                     CC1000RadioIntM$nbrInfo[2].nodeID = 9;
  2482.                                     CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  2483.                                     CC1000RadioIntM$nbrInfo[2].frame = 16;
  2484.                                     CC1000RadioIntM$nbrInfo[2].slot = 1;
  2485.                                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  2486.                                     CC1000RadioIntM$nbrInfo[3].nodeID = 2;
  2487.                                     CC1000RadioIntM$nbrInfo[3].bitMap = TWO_HOP;
  2488.                                     CC1000RadioIntM$nbrInfo[3].frame = 16;
  2489.                                     CC1000RadioIntM$nbrInfo[3].slot = 4;
  2490.                                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[3].slot, CC1000RadioIntM$nbrInfo[3].frame);
  2491.                                     CC1000RadioIntM$nbrInfo[4].nodeID = 10;
  2492.                                     CC1000RadioIntM$nbrInfo[4].bitMap = TWO_HOP;
  2493.                                     CC1000RadioIntM$nbrInfo[4].frame = 16;
  2494.                                     CC1000RadioIntM$nbrInfo[4].slot = 0;
  2495.                                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[4].slot, CC1000RadioIntM$nbrInfo[4].frame);
  2496.                                     CC1000RadioIntM$nbrInfo[5].nodeID = 38;
  2497.                                     CC1000RadioIntM$nbrInfo[5].bitMap = TWO_HOP;
  2498.                                     CC1000RadioIntM$nbrInfo[5].frame = 16;
  2499.                                     CC1000RadioIntM$nbrInfo[5].slot = 8;
  2500.                                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[5].slot, CC1000RadioIntM$nbrInfo[5].frame);
  2501.                                     CC1000RadioIntM$nbrInfo[6].nodeID = 0;
  2502.                                     CC1000RadioIntM$nbrInfo[6].bitMap = TWO_HOP;
  2503.                                     CC1000RadioIntM$nbrInfo[6].frame = 16;
  2504.                                     CC1000RadioIntM$nbrInfo[6].slot = 9;
  2505.                                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[6].slot, CC1000RadioIntM$nbrInfo[6].frame);
  2506.                                   }
  2507.                                 else {
  2508. #line 569
  2509.                                   if (TOS_LOCAL_ADDRESS == 15) {
  2510.                                       CC1000RadioIntM$ownSlot = 6;
  2511.                                       CC1000RadioIntM$localFrameLength = 16;
  2512.                                       CC1000RadioIntM$nbrInfo[0].nodeID = 38;
  2513.                                       CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2514.                                       CC1000RadioIntM$nbrInfo[0].frame = 16;
  2515.                                       CC1000RadioIntM$nbrInfo[0].slot = 8;
  2516.                                       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2517.                                       CC1000RadioIntM$nbrInfo[1].nodeID = 21;
  2518.                                       CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  2519.                                       CC1000RadioIntM$nbrInfo[1].frame = 16;
  2520.                                       CC1000RadioIntM$nbrInfo[1].slot = 13;
  2521.                                       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  2522.                                       CC1000RadioIntM$nbrInfo[2].nodeID = 19;
  2523.                                       CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  2524.                                       CC1000RadioIntM$nbrInfo[2].frame = 16;
  2525.                                       CC1000RadioIntM$nbrInfo[2].slot = 3;
  2526.                                       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  2527.                                       CC1000RadioIntM$nbrInfo[3].nodeID = 14;
  2528.                                       CC1000RadioIntM$nbrInfo[3].bitMap = TWO_HOP;
  2529.                                       CC1000RadioIntM$nbrInfo[3].frame = 16;
  2530.                                       CC1000RadioIntM$nbrInfo[3].slot = 10;
  2531.                                       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[3].slot, CC1000RadioIntM$nbrInfo[3].frame);
  2532.                                       CC1000RadioIntM$nbrInfo[4].nodeID = 18;
  2533.                                       CC1000RadioIntM$nbrInfo[4].bitMap = TWO_HOP;
  2534.                                       CC1000RadioIntM$nbrInfo[4].frame = 16;
  2535.                                       CC1000RadioIntM$nbrInfo[4].slot = 8;
  2536.                                       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[4].slot, CC1000RadioIntM$nbrInfo[4].frame);
  2537.                                       CC1000RadioIntM$nbrInfo[5].nodeID = 3;
  2538.                                       CC1000RadioIntM$nbrInfo[5].bitMap = TWO_HOP;
  2539.                                       CC1000RadioIntM$nbrInfo[5].frame = 16;
  2540.                                       CC1000RadioIntM$nbrInfo[5].slot = 14;
  2541.                                       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[5].slot, CC1000RadioIntM$nbrInfo[5].frame);
  2542.                                     }
  2543.                                   else {
  2544. #line 602
  2545.                                     if (TOS_LOCAL_ADDRESS == 17) {
  2546.                                         CC1000RadioIntM$ownSlot = 4;
  2547.                                         CC1000RadioIntM$localFrameLength = 16;
  2548.                                         CC1000RadioIntM$nbrInfo[0].nodeID = 38;
  2549.                                         CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2550.                                         CC1000RadioIntM$nbrInfo[0].frame = 16;
  2551.                                         CC1000RadioIntM$nbrInfo[0].slot = 8;
  2552.                                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2553.                                         CC1000RadioIntM$nbrInfo[1].nodeID = 21;
  2554.                                         CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  2555.                                         CC1000RadioIntM$nbrInfo[1].frame = 16;
  2556.                                         CC1000RadioIntM$nbrInfo[1].slot = 13;
  2557.                                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  2558.                                         CC1000RadioIntM$nbrInfo[2].nodeID = 19;
  2559.                                         CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  2560.                                         CC1000RadioIntM$nbrInfo[2].frame = 16;
  2561.                                         CC1000RadioIntM$nbrInfo[2].slot = 3;
  2562.                                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  2563.                                         CC1000RadioIntM$nbrInfo[3].nodeID = 37;
  2564.                                         CC1000RadioIntM$nbrInfo[3].bitMap = TWO_HOP;
  2565.                                         CC1000RadioIntM$nbrInfo[3].frame = 16;
  2566.                                         CC1000RadioIntM$nbrInfo[3].slot = 10;
  2567.                                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[3].slot, CC1000RadioIntM$nbrInfo[3].frame);
  2568.                                         CC1000RadioIntM$nbrInfo[4].nodeID = 18;
  2569.                                         CC1000RadioIntM$nbrInfo[4].bitMap = TWO_HOP;
  2570.                                         CC1000RadioIntM$nbrInfo[4].frame = 16;
  2571.                                         CC1000RadioIntM$nbrInfo[4].slot = 8;
  2572.                                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[4].slot, CC1000RadioIntM$nbrInfo[4].frame);
  2573.                                         CC1000RadioIntM$nbrInfo[5].nodeID = 3;
  2574.                                         CC1000RadioIntM$nbrInfo[5].bitMap = TWO_HOP;
  2575.                                         CC1000RadioIntM$nbrInfo[5].frame = 16;
  2576.                                         CC1000RadioIntM$nbrInfo[5].slot = 14;
  2577.                                         CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[5].slot, CC1000RadioIntM$nbrInfo[5].frame);
  2578.                                       }
  2579.                                     else {
  2580. #line 635
  2581.                                       if (TOS_LOCAL_ADDRESS == 32) {
  2582.                                           CC1000RadioIntM$ownSlot = 2;
  2583.                                           CC1000RadioIntM$localFrameLength = 16;
  2584.                                           CC1000RadioIntM$nbrInfo[0].nodeID = 38;
  2585.                                           CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2586.                                           CC1000RadioIntM$nbrInfo[0].frame = 16;
  2587.                                           CC1000RadioIntM$nbrInfo[0].slot = 8;
  2588.                                           CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2589.                                           CC1000RadioIntM$nbrInfo[1].nodeID = 21;
  2590.                                           CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  2591.                                           CC1000RadioIntM$nbrInfo[1].frame = 16;
  2592.                                           CC1000RadioIntM$nbrInfo[1].slot = 13;
  2593.                                           CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  2594.                                           CC1000RadioIntM$nbrInfo[2].nodeID = 37;
  2595.                                           CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  2596.                                           CC1000RadioIntM$nbrInfo[2].frame = 16;
  2597.                                           CC1000RadioIntM$nbrInfo[2].slot = 10;
  2598.                                           CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  2599.                                           CC1000RadioIntM$nbrInfo[3].nodeID = 19;
  2600.                                           CC1000RadioIntM$nbrInfo[3].bitMap = TWO_HOP;
  2601.                                           CC1000RadioIntM$nbrInfo[3].frame = 16;
  2602.                                           CC1000RadioIntM$nbrInfo[3].slot = 3;
  2603.                                           CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[3].slot, CC1000RadioIntM$nbrInfo[3].frame);
  2604.                                           CC1000RadioIntM$nbrInfo[4].nodeID = 14;
  2605.                                           CC1000RadioIntM$nbrInfo[4].bitMap = TWO_HOP;
  2606.                                           CC1000RadioIntM$nbrInfo[4].frame = 16;
  2607.                                           CC1000RadioIntM$nbrInfo[4].slot = 10;
  2608.                                           CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[4].slot, CC1000RadioIntM$nbrInfo[4].frame);
  2609.                                           CC1000RadioIntM$nbrInfo[5].nodeID = 3;
  2610.                                           CC1000RadioIntM$nbrInfo[5].bitMap = TWO_HOP;
  2611.                                           CC1000RadioIntM$nbrInfo[5].frame = 16;
  2612.                                           CC1000RadioIntM$nbrInfo[5].slot = 14;
  2613.                                           CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[5].slot, CC1000RadioIntM$nbrInfo[5].frame);
  2614.                                         }
  2615.                                       else {
  2616. #line 668
  2617.                                         if (TOS_LOCAL_ADDRESS == 18) {
  2618.                                             CC1000RadioIntM$ownSlot = 8;
  2619.                                             CC1000RadioIntM$localFrameLength = 16;
  2620.                                             CC1000RadioIntM$nbrInfo[0].nodeID = 43;
  2621.                                             CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2622.                                             CC1000RadioIntM$nbrInfo[0].frame = 16;
  2623.                                             CC1000RadioIntM$nbrInfo[0].slot = 0;
  2624.                                             CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2625.                                             CC1000RadioIntM$nbrInfo[1].nodeID = 17;
  2626.                                             CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  2627.                                             CC1000RadioIntM$nbrInfo[1].frame = 16;
  2628.                                             CC1000RadioIntM$nbrInfo[1].slot = 4;
  2629.                                             CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  2630.                                             CC1000RadioIntM$nbrInfo[2].nodeID = 15;
  2631.                                             CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  2632.                                             CC1000RadioIntM$nbrInfo[2].frame = 16;
  2633.                                             CC1000RadioIntM$nbrInfo[2].slot = 6;
  2634.                                             CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  2635.                                             CC1000RadioIntM$nbrInfo[3].nodeID = 0;
  2636.                                             CC1000RadioIntM$nbrInfo[3].bitMap = TWO_HOP;
  2637.                                             CC1000RadioIntM$nbrInfo[3].frame = 16;
  2638.                                             CC1000RadioIntM$nbrInfo[3].slot = 9;
  2639.                                             CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[3].slot, CC1000RadioIntM$nbrInfo[3].frame);
  2640.                                             CC1000RadioIntM$nbrInfo[4].nodeID = 40;
  2641.                                             CC1000RadioIntM$nbrInfo[4].bitMap = TWO_HOP;
  2642.                                             CC1000RadioIntM$nbrInfo[4].frame = 16;
  2643.                                             CC1000RadioIntM$nbrInfo[4].slot = 11;
  2644.                                             CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[4].slot, CC1000RadioIntM$nbrInfo[4].frame);
  2645.                                           }
  2646.                                         else {
  2647. #line 696
  2648.                                           if (TOS_LOCAL_ADDRESS == 42) {
  2649.                                               CC1000RadioIntM$ownSlot = 7;
  2650.                                               CC1000RadioIntM$localFrameLength = 16;
  2651.                                               CC1000RadioIntM$nbrInfo[0].nodeID = 38;
  2652.                                               CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2653.                                               CC1000RadioIntM$nbrInfo[0].frame = 16;
  2654.                                               CC1000RadioIntM$nbrInfo[0].slot = 8;
  2655.                                               CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2656.                                               CC1000RadioIntM$nbrInfo[1].nodeID = 21;
  2657.                                               CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  2658.                                               CC1000RadioIntM$nbrInfo[1].frame = 16;
  2659.                                               CC1000RadioIntM$nbrInfo[1].slot = 13;
  2660.                                               CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  2661.                                               CC1000RadioIntM$nbrInfo[2].nodeID = 3;
  2662.                                               CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  2663.                                               CC1000RadioIntM$nbrInfo[2].frame = 16;
  2664.                                               CC1000RadioIntM$nbrInfo[2].slot = 14;
  2665.                                               CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  2666.                                             }
  2667.                                           else {
  2668. #line 714
  2669.                                             if (TOS_LOCAL_ADDRESS == 43) {
  2670.                                                 CC1000RadioIntM$ownSlot = 0;
  2671.                                                 CC1000RadioIntM$localFrameLength = 16;
  2672.                                                 CC1000RadioIntM$nbrInfo[0].nodeID = 18;
  2673.                                                 CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2674.                                                 CC1000RadioIntM$nbrInfo[0].frame = 16;
  2675.                                                 CC1000RadioIntM$nbrInfo[0].slot = 8;
  2676.                                                 CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2677.                                                 CC1000RadioIntM$nbrInfo[1].nodeID = 0;
  2678.                                                 CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  2679.                                                 CC1000RadioIntM$nbrInfo[1].frame = 16;
  2680.                                                 CC1000RadioIntM$nbrInfo[1].slot = 9;
  2681.                                                 CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  2682.                                               }
  2683.                                             else {
  2684. #line 727
  2685.                                               if (TOS_LOCAL_ADDRESS == 5) {
  2686.                                                   CC1000RadioIntM$ownSlot = 1;
  2687.                                                   CC1000RadioIntM$localFrameLength = 16;
  2688.                                                   CC1000RadioIntM$nbrInfo[0].nodeID = 0;
  2689.                                                   CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2690.                                                   CC1000RadioIntM$nbrInfo[0].frame = 16;
  2691.                                                   CC1000RadioIntM$nbrInfo[0].slot = 9;
  2692.                                                   CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2693.                                                 }
  2694.                                               else {
  2695. #line 735
  2696.                                                 if (TOS_LOCAL_ADDRESS == 19) {
  2697.                                                     CC1000RadioIntM$ownSlot = 3;
  2698.                                                     CC1000RadioIntM$localFrameLength = 16;
  2699.                                                     CC1000RadioIntM$nbrInfo[0].nodeID = 31;
  2700.                                                     CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2701.                                                     CC1000RadioIntM$nbrInfo[0].frame = 16;
  2702.                                                     CC1000RadioIntM$nbrInfo[0].slot = 5;
  2703.                                                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2704.                                                     CC1000RadioIntM$nbrInfo[1].nodeID = 17;
  2705.                                                     CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  2706.                                                     CC1000RadioIntM$nbrInfo[1].frame = 16;
  2707.                                                     CC1000RadioIntM$nbrInfo[1].slot = 4;
  2708.                                                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  2709.                                                     CC1000RadioIntM$nbrInfo[2].nodeID = 15;
  2710.                                                     CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  2711.                                                     CC1000RadioIntM$nbrInfo[2].frame = 16;
  2712.                                                     CC1000RadioIntM$nbrInfo[2].slot = 6;
  2713.                                                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  2714.                                                     CC1000RadioIntM$nbrInfo[3].nodeID = 32;
  2715.                                                     CC1000RadioIntM$nbrInfo[3].bitMap = TWO_HOP;
  2716.                                                     CC1000RadioIntM$nbrInfo[3].frame = 16;
  2717.                                                     CC1000RadioIntM$nbrInfo[3].slot = 2;
  2718.                                                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[3].slot, CC1000RadioIntM$nbrInfo[3].frame);
  2719.                                                     CC1000RadioIntM$nbrInfo[4].nodeID = 0;
  2720.                                                     CC1000RadioIntM$nbrInfo[4].bitMap = TWO_HOP;
  2721.                                                     CC1000RadioIntM$nbrInfo[4].frame = 16;
  2722.                                                     CC1000RadioIntM$nbrInfo[4].slot = 9;
  2723.                                                     CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[4].slot, CC1000RadioIntM$nbrInfo[4].frame);
  2724.                                                   }
  2725.                                                 else {
  2726. #line 763
  2727.                                                   if (TOS_LOCAL_ADDRESS == 14) {
  2728.                                                       CC1000RadioIntM$ownSlot = 10;
  2729.                                                       CC1000RadioIntM$localFrameLength = 16;
  2730.                                                       CC1000RadioIntM$nbrInfo[0].nodeID = 15;
  2731.                                                       CC1000RadioIntM$nbrInfo[0].bitMap = TWO_HOP;
  2732.                                                       CC1000RadioIntM$nbrInfo[0].frame = 16;
  2733.                                                       CC1000RadioIntM$nbrInfo[0].slot = 6;
  2734.                                                       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[0].slot, CC1000RadioIntM$nbrInfo[0].frame);
  2735.                                                       CC1000RadioIntM$nbrInfo[1].nodeID = 32;
  2736.                                                       CC1000RadioIntM$nbrInfo[1].bitMap = TWO_HOP;
  2737.                                                       CC1000RadioIntM$nbrInfo[1].frame = 16;
  2738.                                                       CC1000RadioIntM$nbrInfo[1].slot = 2;
  2739.                                                       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[1].slot, CC1000RadioIntM$nbrInfo[1].frame);
  2740.                                                       CC1000RadioIntM$nbrInfo[2].nodeID = 0;
  2741.                                                       CC1000RadioIntM$nbrInfo[2].bitMap = TWO_HOP;
  2742.                                                       CC1000RadioIntM$nbrInfo[2].frame = 16;
  2743.                                                       CC1000RadioIntM$nbrInfo[2].slot = 9;
  2744.                                                       CC1000RadioIntM$Blacklist(CC1000RadioIntM$nbrInfo[2].slot, CC1000RadioIntM$nbrInfo[2].frame);
  2745.                                                     }
  2746.                                                   }
  2747.                                                 }
  2748.                                               }
  2749.                                             }
  2750.                                           }
  2751.                                         }
  2752.                                       }
  2753.                                     }
  2754.                                   }
  2755.                                 }
  2756.                               }
  2757.                             }
  2758.                           }
  2759.                         }
  2760.                       }
  2761.                     }
  2762.                   }
  2763.                 }
  2764.               }
  2765.             }
  2766.           }
  2767.         }
  2768.       }
  2769.     }
  2770. # 630 "../../tos/platform/mica2/CC1000RadioIntM.nc"
  2771.   CC1000RadioIntM$localFrameSize = CC1000RadioIntM$localFrameLength * CC1000RadioIntM$slotSize;
  2772.   CC1000RadioIntM$globalFrameSize = CC1000RadioIntM$globalFrameLength * CC1000RadioIntM$slotSize;
  2773.   CC1000RadioIntM$slotMultiplier = (uint16_t )(CC1000RadioIntM$slotSize * 1.024);
  2774.   CC1000RadioIntM$SClock$getTime(&loctime);
  2775.   globalTimeStamp = (uint32_t )(loctime.mticks * 568.889 + loctime.sticks * 0.00868056);
  2776.   slotOffset = (uint32_t )(1.024 * (CC1000RadioIntM$slotSize - globalTimeStamp % CC1000RadioIntM$slotSize));
  2777.   CC1000RadioIntM$slotNum = (uint32_t )(globalTimeStamp / CC1000RadioIntM$slotSize);
  2778.   CC1000RadioIntM$currentSlot = CC1000RadioIntM$slotNum & (CC1000RadioIntM$localFrameLength - 1);
  2779.   CC1000RadioIntM$globalSlot = CC1000RadioIntM$slotNum & (CC1000RadioIntM$globalFrameLength - 1);
  2780.   CC1000RadioIntM$TDMATimer$start(TIMER_ONE_SHOT, slotOffset);
  2781.   return SUCCESS;
  2782. }
  2783. static 
  2784. #line 409
  2785. void CC1000RadioIntM$Blacklist(uint8_t slot, uint8_t fsize)
  2786. #line 409
  2787. {
  2788.   uint8_t black_slot;
  2789. #line 411
  2790.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  2791. #line 411
  2792.     {
  2793.       if (fsize <= CC1000RadioIntM$globalFrameLength) {
  2794.           black_slot = slot;
  2795.           while (black_slot < CC1000RadioIntM$globalFrameLength) {
  2796.               uint32_t tempHCL2 = 0x1;
  2797. #line 416
  2798.               tempHCL2 = tempHCL2 << black_slot;
  2799.               CC1000RadioIntM$curHCLlist = CC1000RadioIntM$curHCLlist | tempHCL2;
  2800.               black_slot = black_slot + fsize;
  2801.             }
  2802.         }
  2803.     }
  2804. #line 421
  2805.     __nesc_atomic_end(__nesc_atomic); }
  2806. }
  2807. static   
  2808. # 95 "../../tos/platform/mica2/HPLSClock.nc"
  2809. void HPLSClock$SClock$getTime(GTime *t)
  2810. #line 95
  2811. {
  2812.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  2813. #line 96
  2814.     {
  2815.       t->sticks = * (volatile uint16_t *)0x88;
  2816.       if (* (volatile uint8_t *)(uint16_t )& * (volatile uint8_t *)0x7C & (1 << 4)) {
  2817.           HPLSClock$MTicks++;
  2818.           * (volatile uint8_t *)0x7C |= 1 << 4;
  2819.           HPLSClock$SClock$fire(HPLSClock$MTicks);
  2820.         }
  2821.       t->mticks = HPLSClock$MTicks;
  2822.     }
  2823. #line 104
  2824.     __nesc_atomic_end(__nesc_atomic); }
  2825. }
  2826. static 
  2827. # 52 "../../tos/interfaces/SODebug.h"
  2828. int MultiHopTtestM$sprintf(uint8_t *buf, const uint8_t *format, ...)
  2829. {
  2830.   uint8_t scratch[64];
  2831.   uint8_t format_flag;
  2832.   uint16_t u_val = 0;
  2833. #line 57
  2834.   uint16_t base;
  2835.   uint8_t *ptr;
  2836.   MultiHopTtestM$va_list ap;
  2837.   bool b_ChkForNegInt = FALSE;
  2838.   __builtin_va_start(ap, format);
  2839.   for (; ; ) {
  2840.       while ((format_flag = * format++) != '%') {
  2841.           if (!format_flag) {
  2842. #line 65
  2843.               __builtin_va_end(ap);
  2844. #line 65
  2845.               return 0;
  2846.             }
  2847. #line 66
  2848.           *buf = format_flag;
  2849. #line 66
  2850.           buf++;
  2851. #line 66
  2852.           *buf = 0;
  2853.         }
  2854.       b_ChkForNegInt = FALSE;
  2855.       switch ((format_flag = * format++)) {
  2856.           case 'c': 
  2857.             format_flag = (__builtin_va_arg(ap, int ));
  2858.           default: 
  2859.             *buf = format_flag;
  2860. #line 74
  2861.           buf++;
  2862. #line 74
  2863.           *buf = 0;
  2864.           continue;
  2865.           case 'S': 
  2866.             case 's': 
  2867.               ptr = (__builtin_va_arg(ap, char *));
  2868.           strcat(buf, ptr);
  2869.           continue;
  2870.           case 'o': 
  2871.             base = 8;
  2872.           *buf = '0';
  2873. #line 83
  2874.           buf++;
  2875. #line 83
  2876.           *buf = 0;
  2877.           goto CONVERSION_LOOP;
  2878.           case 'i': 
  2879.             b_ChkForNegInt = TRUE;
  2880.           case 'u': 
  2881.             base = 10;
  2882.           goto CONVERSION_LOOP;
  2883.           case 'x': 
  2884.             base = 16;
  2885.           CONVERSION_LOOP: 
  2886.             u_val = (__builtin_va_arg(ap, int ));
  2887.           if (b_ChkForNegInt) {
  2888.               if ((int )u_val < 0) {
  2889.                   u_val = -u_val;
  2890.                   *buf = '-';
  2891. #line 103
  2892.                   buf++;
  2893. #line 103
  2894.                   *buf = 0;
  2895.                 }
  2896.             }
  2897.           ptr = scratch + 64;
  2898.           * --ptr = 0;
  2899.           do {
  2900.               char ch = u_val % base + '0';
  2901. #line 111
  2902.               if (ch > '9') {
  2903.                 ch += 'a' - '9' - 1;
  2904.                 }
  2905. #line 113
  2906.               * --ptr = ch;
  2907.               u_val /= base;
  2908.             }
  2909.           while (
  2910. #line 115
  2911.           u_val);
  2912.           strcat(buf, ptr);
  2913.           buf += strlen(ptr);
  2914.         }
  2915.     }
  2916. }
  2917. static 
  2918. #line 42
  2919. void MultiHopTtestM$writedebug(void)
  2920. #line 42
  2921. {
  2922.   int i = 0;
  2923. #line 44
  2924.   MultiHopTtestM$UARTPutChar('n');
  2925.   while (MultiHopTtestM$debugbuf[i] != 'n') 
  2926.     MultiHopTtestM$UARTPutChar(MultiHopTtestM$debugbuf[i++]);
  2927. }
  2928. static 
  2929. #line 35
  2930. void MultiHopTtestM$UARTPutChar(char c)
  2931. #line 35
  2932. {
  2933.   if (c == 'n') {
  2934.     MultiHopTtestM$UARTPutChar('r');
  2935.     }
  2936. #line 38
  2937.   do {
  2938.     }
  2939.   while (
  2940. #line 38
  2941.   !(* (volatile uint8_t *)(uint16_t )& * (volatile uint8_t *)(0x0B + 0x20) & (1 << 5)));
  2942.   * (volatile uint8_t *)(0x0C + 0x20) = c;
  2943. }
  2944. static   
  2945. # 1166 "../../tos/platform/mica2/CC1000RadioIntM.nc"
  2946. result_t CC1000RadioIntM$SpiByteFifo$dataReady(uint8_t data_in)
  2947. #line 1166
  2948. {
  2949.   GTime loctime;
  2950. #line 1168
  2951.   CC1000RadioIntM$RadioSendCoordinator$blockTimer();
  2952.   CC1000RadioIntM$RadioReceiveCoordinator$blockTimer();
  2953.   if (CC1000RadioIntM$bInvertRxData) {
  2954.     data_in = ~data_in;
  2955.     }
  2956.   switch (CC1000RadioIntM$RadioState) {
  2957.       case CC1000RadioIntM$TX_STATE: 
  2958.         {
  2959.           CC1000RadioIntM$SpiByteFifo$writeByte(CC1000RadioIntM$NextTxByte);
  2960.           CC1000RadioIntM$TxByteCnt++;
  2961.           switch (CC1000RadioIntM$RadioTxState) {
  2962.               case CC1000RadioIntM$TXSTATE_PREAMBLE: 
  2963.                 CC1000RadioIntM$send_sum++;
  2964.               if (!(CC1000RadioIntM$TxByteCnt < CC1000RadioIntM$preamblelen) || (
  2965.               CC1000RadioIntM$txbufptr->strength == 0xffff && CC1000RadioIntM$TxByteCnt >= CC1000RadioIntM$PREAMBLE_LENGTH_TO_BASE)) {
  2966.                   CC1000RadioIntM$NextTxByte = CC1000RadioIntM$SYNC_BYTE;
  2967.                   CC1000RadioIntM$RadioTxState = CC1000RadioIntM$TXSTATE_SYNC;
  2968.                 }
  2969.               break;
  2970.               case CC1000RadioIntM$TXSTATE_SYNC: 
  2971.                 CC1000RadioIntM$send_sum++;
  2972.               CC1000RadioIntM$NextTxByte = CC1000RadioIntM$NSYNC_BYTE;
  2973.               CC1000RadioIntM$RadioTxState = CC1000RadioIntM$TXSTATE_DATA;
  2974.               CC1000RadioIntM$TxByteCnt = -1;
  2975.               if (CC1000RadioIntM$txbufptr->type == 223) {
  2976.                   syncMsgType *syncMsgPtr = (syncMsgType *)CC1000RadioIntM$txbufptr->data;
  2977. #line 1204
  2978.                   CC1000RadioIntM$SClock$getTime(&loctime);
  2979.                   syncMsgPtr->mticks = loctime.mticks;
  2980.                   syncMsgPtr->sticks = loctime.sticks;
  2981.                   syncMsgPtr->trust = 1;
  2982.                   syncMsgPtr->sender = TOS_LOCAL_ADDRESS;
  2983.                 }
  2984.               CC1000RadioIntM$RadioSendCoordinator$startSymbol(8, 0, CC1000RadioIntM$txbufptr);
  2985.               break;
  2986.               case CC1000RadioIntM$TXSTATE_DATA: 
  2987.                 CC1000RadioIntM$send_sum++;
  2988.               if ((uint8_t )CC1000RadioIntM$TxByteCnt < CC1000RadioIntM$txlength) {
  2989.                   if (CC1000RadioIntM$txbufptr->type == 223 && CC1000RadioIntM$TxByteCnt == 5) {
  2990.                       syncMsgType *syncMsgPtr = (syncMsgType *)CC1000RadioIntM$txbufptr->data;
  2991. #line 1219
  2992.                       CC1000RadioIntM$SClock$getTime(&loctime);
  2993.                       CC1000RadioIntM$AddTime(&loctime, &loctime, &CC1000RadioIntM$constOffset);
  2994.                       syncMsgPtr->mticks = loctime.mticks;
  2995.                       syncMsgPtr->sticks = loctime.sticks;
  2996.                     }
  2997.                   CC1000RadioIntM$NextTxByte = ((uint8_t *)CC1000RadioIntM$txbufptr)[CC1000RadioIntM$TxByteCnt];
  2998.                   CC1000RadioIntM$usRunningCRC = crcByte(CC1000RadioIntM$usRunningCRC, CC1000RadioIntM$NextTxByte);
  2999.                   CC1000RadioIntM$RadioSendCoordinator$byte(CC1000RadioIntM$txbufptr, (uint8_t )CC1000RadioIntM$TxByteCnt);
  3000.                 }
  3001.               else {
  3002.                   CC1000RadioIntM$NextTxByte = (uint8_t )CC1000RadioIntM$usRunningCRC;
  3003.                   CC1000RadioIntM$RadioTxState = CC1000RadioIntM$TXSTATE_CRC;
  3004.                 }
  3005.               break;
  3006.               case CC1000RadioIntM$TXSTATE_CRC: 
  3007.                 CC1000RadioIntM$send_sum++;
  3008.               CC1000RadioIntM$NextTxByte = (uint8_t )(CC1000RadioIntM$usRunningCRC >> 8);
  3009.               CC1000RadioIntM$RadioTxState = CC1000RadioIntM$TXSTATE_FLUSH;
  3010.               CC1000RadioIntM$TxByteCnt = 0;
  3011.               break;
  3012.               case CC1000RadioIntM$TXSTATE_FLUSH: 
  3013.                 CC1000RadioIntM$send_sum++;
  3014.               if (CC1000RadioIntM$TxByteCnt > 3) {
  3015.                   CC1000RadioIntM$TxByteCnt = 0;
  3016.                   if (CC1000RadioIntM$bAckEnable) {
  3017.                     CC1000RadioIntM$RadioTxState = CC1000RadioIntM$TXSTATE_WAIT_FOR_ACK;
  3018.                     }
  3019.                   else 
  3020. #line 1250
  3021.                     {
  3022.                       CC1000RadioIntM$packetsSent++;
  3023.                       CC1000RadioIntM$SpiByteFifo$rxMode();
  3024.                       CC1000RadioIntM$CC1000Control$RxMode();
  3025.                       CC1000RadioIntM$RadioTxState = CC1000RadioIntM$TXSTATE_DONE;
  3026.                     }
  3027.                 }
  3028.               break;
  3029.               case CC1000RadioIntM$TXSTATE_WAIT_FOR_ACK: 
  3030.                 if (CC1000RadioIntM$TxByteCnt == 1) {
  3031.                     CC1000RadioIntM$send_sum++;
  3032.                     CC1000RadioIntM$SpiByteFifo$rxMode();
  3033.                     CC1000RadioIntM$CC1000Control$RxMode();
  3034.                     break;
  3035.                   }
  3036.               CC1000RadioIntM$receive_sum++;
  3037.               if (CC1000RadioIntM$TxByteCnt > 3) {
  3038.                   CC1000RadioIntM$RadioTxState = CC1000RadioIntM$TXSTATE_READ_ACK;
  3039.                   CC1000RadioIntM$TxByteCnt = 0;
  3040.                   CC1000RadioIntM$search_word = 0;
  3041.                 }
  3042.               break;
  3043.               case CC1000RadioIntM$TXSTATE_READ_ACK: 
  3044.                 {
  3045.                   uint8_t i;
  3046. #line 1280
  3047.                   CC1000RadioIntM$receive_sum++;
  3048.                   for (i = 0; i < 8; i++) {
  3049.                       CC1000RadioIntM$search_word <<= 1;
  3050.                       if (data_in & 0x80) {
  3051. #line 1283
  3052.                         CC1000RadioIntM$search_word |= 0x1;
  3053.                         }
  3054. #line 1284
  3055.                       data_in <<= 1;
  3056.                       if (CC1000RadioIntM$search_word == 0xba83) {
  3057.                           CC1000RadioIntM$txbufptr->ack = 1;
  3058.                           CC1000RadioIntM$RadioTxState = CC1000RadioIntM$TXSTATE_DONE;
  3059.                           return SUCCESS;
  3060.                         }
  3061.                     }
  3062.                 }
  3063.               if (CC1000RadioIntM$TxByteCnt >= CC1000RadioIntM$MAX_ACK_WAIT) {
  3064.                   CC1000RadioIntM$txbufptr->ack = 0;
  3065.                   CC1000RadioIntM$RadioTxState = CC1000RadioIntM$TXSTATE_DONE;
  3066.                 }
  3067.               break;
  3068.               case CC1000RadioIntM$TXSTATE_DONE: 
  3069.                 default: 
  3070.                   CC1000RadioIntM$bTxPending = FALSE;
  3071.               if (CC1000RadioIntM$txbufptr->type == 222 || CC1000RadioIntM$txbufptr->type == 223) {
  3072.                   CC1000RadioIntM$bAckEnable = CC1000RadioIntM$ackOrig;
  3073.                 }
  3074.               if (TOS_post(CC1000RadioIntM$PacketSent)) {
  3075.                   CC1000RadioIntM$RadioState = CC1000RadioIntM$IDLE_STATE;
  3076.                   CC1000RadioIntM$pktsLastSync++;
  3077.                   CC1000RadioIntM$RSSIInitState = CC1000RadioIntM$RadioState;
  3078.                   CC1000RadioIntM$RSSIADC$getData();
  3079.                 }
  3080.               break;
  3081.             }
  3082.         }
  3083.       break;
  3084.       case CC1000RadioIntM$DISABLED_STATE: 
  3085.         break;
  3086.       case CC1000RadioIntM$IDLE_STATE: 
  3087.         {
  3088.           CC1000RadioIntM$receive_sum++;
  3089.           if (data_in == 0xaa || data_in == 0x55) {
  3090.               CC1000RadioIntM$PreambleCount++;
  3091.               if (CC1000RadioIntM$PreambleCount > 2) {
  3092.                   CC1000RadioIntM$PreambleCount = CC1000RadioIntM$SOFCount = 0;
  3093.                   CC1000RadioIntM$RxBitOffset = CC1000RadioIntM$RxByteCnt = 0;
  3094.                   CC1000RadioIntM$usRunningCRC = 0;
  3095.                   CC1000RadioIntM$rxlength = MSG_DATA_SIZE - 2;
  3096.                   CC1000RadioIntM$RadioState = CC1000RadioIntM$SYNC_STATE;
  3097.                 }
  3098.             }
  3099.           else 
  3100. #line 1350
  3101.             {
  3102.               if ((CC1000RadioIntM$currentMAC == CC1000RadioIntM$BMAC || CC1000RadioIntM$enableHCL == FALSE) || !CC1000RadioIntM$IsHCL(CC1000RadioIntM$currentSlot)) {
  3103.                   if (CC1000RadioIntM$bTxPending && --CC1000RadioIntM$sMacDelay <= 0) {
  3104.                       CC1000RadioIntM$RadioState = CC1000RadioIntM$PRETX_STATE;
  3105.                       CC1000RadioIntM$RSSIInitState = CC1000RadioIntM$PRETX_STATE;
  3106.                       CC1000RadioIntM$bRSSIValid = FALSE;
  3107.                       CC1000RadioIntM$iRSSIcount = 0;
  3108.                       CC1000RadioIntM$PreambleCount = 0;
  3109.                       CC1000RadioIntM$RSSIADC$getData();
  3110.                     }
  3111.                 }
  3112.               else 
  3113. #line 1360
  3114.                 {
  3115.                 }
  3116.             }
  3117.         }
  3118.       break;
  3119.       case CC1000RadioIntM$PRETX_STATE: 
  3120.         {
  3121.           CC1000RadioIntM$receive_sum++;
  3122.           if (data_in == 0xaa || data_in == 0x55) {
  3123.               CC1000RadioIntM$sMacDelay = CC1000RadioIntM$MacBackoff$congestionBackoff(CC1000RadioIntM$txbufptr);
  3124.               CC1000RadioIntM$RadioState = CC1000RadioIntM$IDLE_STATE;
  3125.             }
  3126.         }
  3127.       break;
  3128.       case CC1000RadioIntM$SYNC_STATE: 
  3129.         {
  3130.           uint8_t i;
  3131.           CC1000RadioIntM$receive_sum++;
  3132.           if (data_in == 0xaa || data_in == 0x55) {
  3133.               CC1000RadioIntM$RxShiftBuf.MSB = data_in;
  3134.             }
  3135.           else {
  3136.               uint16_t usTmp;
  3137. #line 1405
  3138.               switch (CC1000RadioIntM$SOFCount) {
  3139.                   case 0: 
  3140.                     CC1000RadioIntM$RxShiftBuf.LSB = data_in;
  3141.                   break;
  3142.                   case 1: 
  3143.                     case 2: 
  3144.                       case 3: 
  3145.                         case 4: 
  3146.                           case 5: 
  3147.                             usTmp = CC1000RadioIntM$RxShiftBuf.W;
  3148.                   CC1000RadioIntM$RxShiftBuf.W <<= 8;
  3149.                   CC1000RadioIntM$RxShiftBuf.LSB = data_in;
  3150.                   for (i = 0; i < 8; i++) {
  3151.                       usTmp <<= 1;
  3152.                       if (data_in & 0x80) {
  3153.                         usTmp |= 0x1;
  3154.                         }
  3155. #line 1424
  3156.                       data_in <<= 1;
  3157.                       if (usTmp == CC1000RadioIntM$SYNC_WORD) {
  3158.                           if (CC1000RadioIntM$rxbufptr->length != 0) {
  3159.                               CC1000RadioIntM$Leds$redToggle();
  3160.                               CC1000RadioIntM$RadioState = CC1000RadioIntM$IDLE_STATE;
  3161.                             }
  3162.                           else {
  3163.                               CC1000RadioIntM$RadioState = CC1000RadioIntM$RX_STATE;
  3164.                               CC1000RadioIntM$RSSIInitState = CC1000RadioIntM$RX_STATE;
  3165.                               CC1000RadioIntM$RSSIADC$getData();
  3166.                               CC1000RadioIntM$RxBitOffset = 7 - i;
  3167.                               CC1000RadioIntM$RadioReceiveCoordinator$startSymbol(8, CC1000RadioIntM$RxBitOffset, CC1000RadioIntM$rxbufptr);
  3168.                             }
  3169.                           break;
  3170.                         }
  3171.                     }
  3172.                   break;
  3173.                   default: 
  3174.                     CC1000RadioIntM$RadioState = CC1000RadioIntM$IDLE_STATE;
  3175.                   break;
  3176.                 }
  3177.               CC1000RadioIntM$SOFCount++;
  3178.             }
  3179.         }
  3180.       break;
  3181.       case CC1000RadioIntM$RX_STATE: 
  3182.         {
  3183.           char Byte;
  3184. #line 1462
  3185.           CC1000RadioIntM$receive_sum++;
  3186.           CC1000RadioIntM$RxShiftBuf.W <<= 8;
  3187.           CC1000RadioIntM$RxShiftBuf.LSB = data_in;
  3188.           Byte = CC1000RadioIntM$RxShiftBuf.W >> CC1000RadioIntM$RxBitOffset;
  3189.           ((char *)CC1000RadioIntM$rxbufptr)[(int )CC1000RadioIntM$RxByteCnt] = Byte;
  3190.           CC1000RadioIntM$RxByteCnt++;
  3191.           CC1000RadioIntM$RadioReceiveCoordinator$byte(CC1000RadioIntM$rxbufptr, (uint8_t )CC1000RadioIntM$RxByteCnt);
  3192.           if (CC1000RadioIntM$RxByteCnt < CC1000RadioIntM$rxlength) {
  3193.               CC1000RadioIntM$usRunningCRC = crcByte(CC1000RadioIntM$usRunningCRC, Byte);
  3194.               if (CC1000RadioIntM$RxByteCnt == (size_t )& ((struct TOS_Msg *)0)->length + 
  3195.               sizeof  ((struct TOS_Msg *)0)->length) {
  3196.                   CC1000RadioIntM$rxlength = CC1000RadioIntM$rxbufptr->length;
  3197.                   if (CC1000RadioIntM$rxlength > 70) {
  3198.                       CC1000RadioIntM$rxbufptr->length = 0;
  3199.                       CC1000RadioIntM$RadioState = CC1000RadioIntM$IDLE_STATE;
  3200.                       return SUCCESS;
  3201.                     }
  3202.                   CC1000RadioIntM$rxlength += (size_t )& ((struct TOS_Msg *)0)->data;
  3203.                 }
  3204.             }
  3205.           else {
  3206. #line 1489
  3207.             if (CC1000RadioIntM$RxByteCnt == CC1000RadioIntM$rxlength) {
  3208.                 if (CC1000RadioIntM$rxbufptr->type == 223) {
  3209.                   CC1000RadioIntM$getTimeDiff();
  3210.                   }
  3211. #line 1492
  3212.                 CC1000RadioIntM$usRunningCRC = crcByte(CC1000RadioIntM$usRunningCRC, Byte);
  3213.                 CC1000RadioIntM$RxByteCnt = (size_t )& ((struct TOS_Msg *)0)->crc;
  3214.               }
  3215.             else {
  3216. #line 1496
  3217.               if (CC1000RadioIntM$RxByteCnt >= MSG_DATA_SIZE) {
  3218.                   if (CC1000RadioIntM$rxbufptr->crc == CC1000RadioIntM$usRunningCRC) {
  3219.                       if (CC1000RadioIntM$rxbufptr->type == 223) {
  3220.                         TOS_post(CC1000RadioIntM$adjustTime);
  3221.                         }
  3222. #line 1503
  3223.                       CC1000RadioIntM$rxbufptr->crc = 1;
  3224.                       if (CC1000RadioIntM$bAckEnable && CC1000RadioIntM$rxbufptr->addr == TOS_LOCAL_ADDRESS) {
  3225.                           CC1000RadioIntM$RadioState = CC1000RadioIntM$SENDING_ACK;
  3226.                           CC1000RadioIntM$CC1000Control$TxMode();
  3227.                           CC1000RadioIntM$SpiByteFifo$txMode();
  3228.                           CC1000RadioIntM$SpiByteFifo$writeByte(0xaa);
  3229.                           CC1000RadioIntM$RxByteCnt = 0;
  3230.                           return SUCCESS;
  3231.                         }
  3232.                     }
  3233.                   else {
  3234.                       CC1000RadioIntM$rxbufptr->crc = 0;
  3235.                     }
  3236.                   CC1000RadioIntM$SpiByteFifo$disableIntr();
  3237.                   CC1000RadioIntM$RadioState = CC1000RadioIntM$IDLE_STATE;
  3238.                   if (CC1000RadioIntM$currentMAC == CC1000RadioIntM$ZMAC && CC1000RadioIntM$bTxPending) {
  3239.                       CC1000RadioIntM$sMacDelay = CC1000RadioIntM$getZMACBackoff(CC1000RadioIntM$sMacDelay);
  3240.                     }
  3241.                   CC1000RadioIntM$rxbufptr->strength = CC1000RadioIntM$usRSSIVal;
  3242.                   if (!TOS_post(CC1000RadioIntM$PacketRcvd)) {
  3243.                       CC1000RadioIntM$rxbufptr->length = 0;
  3244.                       CC1000RadioIntM$RadioState = CC1000RadioIntM$IDLE_STATE;
  3245.                       CC1000RadioIntM$SpiByteFifo$enableIntr();
  3246.                     }
  3247.                   CC1000RadioIntM$RSSIInitState = CC1000RadioIntM$RadioState;
  3248.                   CC1000RadioIntM$RSSIADC$getData();
  3249.                 }
  3250.               }
  3251.             }
  3252.         }
  3253. #line 1541
  3254.       break;
  3255.       case CC1000RadioIntM$SENDING_ACK: 
  3256.         {
  3257.           CC1000RadioIntM$send_sum++;
  3258.           CC1000RadioIntM$RxByteCnt++;
  3259.           if (CC1000RadioIntM$RxByteCnt >= CC1000RadioIntM$ACK_LENGTH) {
  3260.               CC1000RadioIntM$CC1000Control$RxMode();
  3261.               CC1000RadioIntM$SpiByteFifo$rxMode();
  3262.               CC1000RadioIntM$SpiByteFifo$disableIntr();
  3263.               CC1000RadioIntM$RadioState = CC1000RadioIntM$IDLE_STATE;
  3264.               CC1000RadioIntM$rxbufptr->strength = CC1000RadioIntM$usRSSIVal;
  3265.               if (!TOS_post(CC1000RadioIntM$PacketRcvd)) {
  3266.                   CC1000RadioIntM$rxbufptr->length = 0;
  3267.                   CC1000RadioIntM$RadioState = CC1000RadioIntM$IDLE_STATE;
  3268.                   CC1000RadioIntM$SpiByteFifo$enableIntr();
  3269.                 }
  3270.             }
  3271.           else {
  3272. #line 1558
  3273.             if (CC1000RadioIntM$RxByteCnt >= CC1000RadioIntM$ACK_LENGTH - sizeof CC1000RadioIntM$ack_code) {
  3274.                 CC1000RadioIntM$SpiByteFifo$writeByte(CC1000RadioIntM$ack_code[CC1000RadioIntM$RxByteCnt + sizeof CC1000RadioIntM$ack_code - CC1000RadioIntM$ACK_LENGTH]);
  3275.               }
  3276.             }
  3277.         }
  3278. #line 1562
  3279.       break;
  3280.       default: 
  3281.         break;
  3282.     }
  3283.   if (CC1000RadioIntM$pulse_check_sum > CC1000RadioIntM$CHECK_MA_COUNT) {
  3284.       CC1000RadioIntM$power_sum++;
  3285.       CC1000RadioIntM$sp_sum++;
  3286.       CC1000RadioIntM$pulse_check_sum -= CC1000RadioIntM$CHECK_MA_COUNT;
  3287.     }
  3288.   if (CC1000RadioIntM$send_sum > CC1000RadioIntM$SEND_MA_COUNT) {
  3289.       CC1000RadioIntM$power_sum++;
  3290.       CC1000RadioIntM$tx_sum++;
  3291.       CC1000RadioIntM$send_sum -= CC1000RadioIntM$SEND_MA_COUNT;
  3292.     }
  3293.   if (CC1000RadioIntM$receive_sum > CC1000RadioIntM$RECEIVE_MA_COUNT) {
  3294.       CC1000RadioIntM$power_sum++;
  3295.       CC1000RadioIntM$rx_sum++;
  3296.       CC1000RadioIntM$receive_sum -= CC1000RadioIntM$RECEIVE_MA_COUNT;
  3297.     }
  3298.   return SUCCESS;
  3299. }
  3300. static 
  3301. #line 275
  3302. void CC1000RadioIntM$SubTime(GTime *C, GTime *A, GTime *B)
  3303. #line 275
  3304. {
  3305.   if (B->sticks > A->sticks) {
  3306.       C->sticks = CC1000RadioIntM$MAX_VAL - (B->sticks - A->sticks);
  3307.       C->mticks = A->mticks - (B->mticks + 1);
  3308.     }
  3309.   else {
  3310.       C->sticks = A->sticks - B->sticks;
  3311.       C->mticks = A->mticks - B->mticks;
  3312.     }
  3313. }
  3314. static  
  3315. #line 432
  3316. void CC1000RadioIntM$PacketRcvd(void)
  3317. #line 432
  3318. {
  3319.   TOS_MsgPtr pBuf;
  3320.   ecnForwardMsgType *recvEcnMsgPtr;
  3321.   ecnForwardMsgType *ecnForwardMsgPtr;
  3322. #line 436
  3323.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  3324. #line 436
  3325.     {
  3326.       if (CC1000RadioIntM$pktsLastSync > 100) {
  3327.           {
  3328.             CC1000RadioIntM$ackOrig = CC1000RadioIntM$bAckEnable;
  3329.             CC1000RadioIntM$bAckEnable = FALSE;
  3330.           }
  3331.           CC1000RadioIntM$Send$send(&CC1000RadioIntM$syncMsgHdr);
  3332.           CC1000RadioIntM$pktsLastSync = 0;
  3333.         }
  3334.       CC1000RadioIntM$pktsLastSync++;
  3335.       CC1000RadioIntM$rxbufptr->time = 0;
  3336.       pBuf = CC1000RadioIntM$rxbufptr;
  3337.       recvEcnMsgPtr = (ecnForwardMsgType *)CC1000RadioIntM$rxbufptr->data;
  3338.       ecnForwardMsgPtr = (ecnForwardMsgType *)CC1000RadioIntM$ecnForwardMsgHdr.data;
  3339.       if (CC1000RadioIntM$currentMAC == CC1000RadioIntM$ZMAC && CC1000RadioIntM$HCLselect && pBuf->type == 222 && pBuf->crc != 0 && 
  3340.       recvEcnMsgPtr->senderAddress != TOS_LOCAL_ADDRESS) {
  3341.           if (recvEcnMsgPtr->hopCount == 0 && recvEcnMsgPtr->nextHop == TOS_LOCAL_ADDRESS) {
  3342.               ecnForwardMsgPtr->hopCount = 1;
  3343.               ecnForwardMsgPtr->nextHop = CC1000RadioIntM$nextHop;
  3344.               ecnForwardMsgPtr->senderAddress = TOS_LOCAL_ADDRESS;
  3345.               if (!CC1000RadioIntM$bTxBusy) {
  3346.                   CC1000RadioIntM$ackOrig = CC1000RadioIntM$bAckEnable;
  3347.                   CC1000RadioIntM$bAckEnable = FALSE;
  3348.                   CC1000RadioIntM$Send$send(&CC1000RadioIntM$ecnForwardMsgHdr);
  3349.                 }
  3350.               else {
  3351.                 CC1000RadioIntM$ecnforward = TRUE;
  3352.                 }
  3353.             }
  3354.           else {
  3355. #line 477
  3356.             if (recvEcnMsgPtr->hopCount == 1) {
  3357.                 CC1000RadioIntM$enableHCL = TRUE;
  3358.                 if (recvEcnMsgPtr->senderAddress == CC1000RadioIntM$nextHop) {
  3359.                     CC1000RadioIntM$ecnPending = FALSE;
  3360.                     CC1000RadioIntM$slots_since_ecnsend = 0;
  3361.                     CC1000RadioIntM$slots_since_ecnrecv = 0;
  3362.                   }
  3363.               }
  3364.             }
  3365.         }
  3366.       else {
  3367. #line 492
  3368.         if (pBuf->type != 223 && pBuf->type != 222) {
  3369.             pBuf = CC1000RadioIntM$Receive$receive((TOS_MsgPtr )pBuf);
  3370.           }
  3371.         }
  3372.       if (pBuf) {
  3373.         CC1000RadioIntM$rxbufptr = pBuf;
  3374.         }
  3375. #line 501
  3376.       CC1000RadioIntM$rxbufptr->length = 0;
  3377.     }
  3378. #line 502
  3379.     __nesc_atomic_end(__nesc_atomic); }
  3380.   CC1000RadioIntM$SpiByteFifo$enableIntr();
  3381. }
  3382. # 124 "../../tos/platform/mica2/HPLSClock.nc"
  3383. void __attribute((interrupt))   __vector_26(void)
  3384. #line 124
  3385. {
  3386.   if (HPLSClock$needupdate) {
  3387.       if (HPLSClock$sign == NEGATIVE) {
  3388.           * (volatile uint16_t *)0x88 = MAX_VAL - HPLSClock$Update.sticks;
  3389.           HPLSClock$MTicks = HPLSClock$MTicks - HPLSClock$Update.mticks;
  3390.         }
  3391.       else {
  3392. #line 130
  3393.         if (HPLSClock$sign == POSITIVE) {
  3394.             * (volatile uint16_t *)0x88 = HPLSClock$Update.sticks;
  3395.             HPLSClock$MTicks = HPLSClock$MTicks + HPLSClock$Update.mticks + 1;
  3396.             HPLSClock$SClock$fire(HPLSClock$MTicks);
  3397.           }
  3398.         }
  3399. #line 135
  3400.       HPLSClock$needupdate = 0;
  3401.       HPLSClock$SClock$syncDone();
  3402.     }
  3403.   else {
  3404.       HPLSClock$MTicks++;
  3405.       HPLSClock$SClock$fire(HPLSClock$MTicks);
  3406.     }
  3407. }
  3408. static   
  3409. # 348 "/home/testuser/tinyos-1.x/tos/system/FramerM.nc"
  3410. result_t FramerM$ByteComm$rxByteReady(uint8_t data, bool error, uint16_t strength)
  3411. #line 348
  3412. {
  3413.   switch (FramerM$gRxState) {
  3414.       case FramerM$RXSTATE_NOSYNC: 
  3415.         if (data == FramerM$HDLC_FLAG_BYTE && FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length == 0) {
  3416.             FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token = 0;
  3417.             FramerM$gRxByteCnt = FramerM$gRxRunningCRC = 0;
  3418.             FramerM$gpRxBuf = (uint8_t *)FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].pMsg;
  3419.             FramerM$gRxState = FramerM$RXSTATE_PROTO;
  3420.           }
  3421.       break;
  3422.       case FramerM$RXSTATE_PROTO: 
  3423.         if (data == FramerM$HDLC_FLAG_BYTE) {
  3424.             break;
  3425.           }
  3426.       FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Proto = data;
  3427.       FramerM$gRxRunningCRC = crcByte(FramerM$gRxRunningCRC, data);
  3428.       switch (data) {
  3429.           case FramerM$PROTO_PACKET_ACK: 
  3430.             FramerM$gRxState = FramerM$RXSTATE_TOKEN;
  3431.           break;
  3432.           case FramerM$PROTO_PACKET_NOACK: 
  3433.             FramerM$gRxState = FramerM$RXSTATE_INFO;
  3434.           break;
  3435.           default: 
  3436.             FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
  3437.           break;
  3438.         }
  3439.       break;
  3440.       case FramerM$RXSTATE_TOKEN: 
  3441.         if (data == FramerM$HDLC_FLAG_BYTE) {
  3442.             FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
  3443.           }
  3444.         else {
  3445. #line 384
  3446.           if (data == FramerM$HDLC_CTLESC_BYTE) {
  3447.               FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token = 0x20;
  3448.             }
  3449.           else {
  3450.               FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token ^= data;
  3451.               FramerM$gRxRunningCRC = crcByte(FramerM$gRxRunningCRC, FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token);
  3452.               FramerM$gRxState = FramerM$RXSTATE_INFO;
  3453.             }
  3454.           }
  3455. #line 392
  3456.       break;
  3457.       case FramerM$RXSTATE_INFO: 
  3458.         if (FramerM$gRxByteCnt > FramerM$HDLC_MTU) {
  3459.             FramerM$gRxByteCnt = FramerM$gRxRunningCRC = 0;
  3460.             FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length = 0;
  3461.             FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token = 0;
  3462.             FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
  3463.           }
  3464.         else {
  3465. #line 402
  3466.           if (data == FramerM$HDLC_CTLESC_BYTE) {
  3467.               FramerM$gRxState = FramerM$RXSTATE_ESC;
  3468.             }
  3469.           else {
  3470. #line 405
  3471.             if (data == FramerM$HDLC_FLAG_BYTE) {
  3472.                 if (FramerM$gRxByteCnt >= 2) {
  3473.                     uint16_t usRcvdCRC = FramerM$gpRxBuf[FramerM$gRxByteCnt - 1] & 0xff;
  3474. #line 408
  3475.                     usRcvdCRC = (usRcvdCRC << 8) | (FramerM$gpRxBuf[FramerM$gRxByteCnt - 2] & 0xff);
  3476.                     if (usRcvdCRC == FramerM$gRxRunningCRC) {
  3477.                         FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length = FramerM$gRxByteCnt - 2;
  3478.                         TOS_post(FramerM$PacketRcvd);
  3479.                         FramerM$gRxHeadIndex++;
  3480. #line 412
  3481.                         FramerM$gRxHeadIndex %= FramerM$HDLC_QUEUESIZE;
  3482.                       }
  3483.                     else {
  3484.                         FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length = 0;
  3485.                         FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token = 0;
  3486.                       }
  3487.                     if (FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length == 0) {
  3488.                         FramerM$gpRxBuf = (uint8_t *)FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].pMsg;
  3489.                         FramerM$gRxState = FramerM$RXSTATE_PROTO;
  3490.                       }
  3491.                     else {
  3492.                         FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
  3493.                       }
  3494.                   }
  3495.                 else {
  3496.                     FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length = 0;
  3497.                     FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token = 0;
  3498.                     FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
  3499.                   }
  3500.                 FramerM$gRxByteCnt = FramerM$gRxRunningCRC = 0;
  3501.               }
  3502.             else {
  3503.                 FramerM$gpRxBuf[FramerM$gRxByteCnt] = data;
  3504.                 if (FramerM$gRxByteCnt >= 2) {
  3505.                     FramerM$gRxRunningCRC = crcByte(FramerM$gRxRunningCRC, FramerM$gpRxBuf[FramerM$gRxByteCnt - 2]);
  3506.                   }
  3507.                 FramerM$gRxByteCnt++;
  3508.               }
  3509.             }
  3510.           }
  3511. #line 440
  3512.       break;
  3513.       case FramerM$RXSTATE_ESC: 
  3514.         if (data == FramerM$HDLC_FLAG_BYTE) {
  3515.             FramerM$gRxByteCnt = FramerM$gRxRunningCRC = 0;
  3516.             FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length = 0;
  3517.             FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token = 0;
  3518.             FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
  3519.           }
  3520.         else {
  3521.             data = data ^ 0x20;
  3522.             FramerM$gpRxBuf[FramerM$gRxByteCnt] = data;
  3523.             if (FramerM$gRxByteCnt >= 2) {
  3524.                 FramerM$gRxRunningCRC = crcByte(FramerM$gRxRunningCRC, FramerM$gpRxBuf[FramerM$gRxByteCnt - 2]);
  3525.               }
  3526.             FramerM$gRxByteCnt++;
  3527.             FramerM$gRxState = FramerM$RXSTATE_INFO;
  3528.           }
  3529.       break;
  3530.       default: 
  3531.         FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
  3532.       break;
  3533.     }
  3534.   return SUCCESS;
  3535. }
  3536. static   
  3537. # 87 "/home/testuser/tinyos-1.x/tos/system/UARTM.nc"
  3538. result_t UARTM$HPLUART$putDone(void)
  3539. #line 87
  3540. {
  3541.   bool oldState;
  3542.   { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  3543. #line 90
  3544.     {
  3545.       {
  3546.       }
  3547. #line 91
  3548.       ;
  3549.       oldState = UARTM$state;
  3550.       UARTM$state = FALSE;
  3551.     }
  3552. #line 94
  3553.     __nesc_atomic_end(__nesc_atomic); }
  3554.   if (oldState) {
  3555.       UARTM$ByteComm$txDone();
  3556.       UARTM$ByteComm$txByteReady(TRUE);
  3557.     }
  3558.   return SUCCESS;
  3559. }
  3560. static 
  3561. # 469 "/home/testuser/tinyos-1.x/tos/system/FramerM.nc"
  3562. result_t FramerM$TxArbitraryByte(uint8_t inByte)
  3563. #line 469
  3564. {
  3565.   if (inByte == FramerM$HDLC_FLAG_BYTE || inByte == FramerM$HDLC_CTLESC_BYTE) {
  3566.       { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
  3567. #line 471
  3568.         {
  3569.           FramerM$gPrevTxState = FramerM$gTxState;
  3570.           FramerM$gTxState = FramerM$TXSTATE_ESC;
  3571.           FramerM$gTxEscByte = inByte;
  3572.         }
  3573. #line 475
  3574.         __nesc_atomic_end(__nesc_atomic); }
  3575.       inByte = FramerM$HDLC_CTLESC_BYTE;
  3576.     }
  3577.   return FramerM$ByteComm$txByte(inByte);
  3578. }