timers.c.022i.opt_local_passes 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263
  1. vTimerSetTimerNumber (struct tmrTimerControl * xTimer, UBaseType_t uxTimerNumber)
  2. {
  3. <bb 2> :
  4. MEM[(struct Timer_t *)xTimer_2(D)].uxTimerNumber = uxTimerNumber_3(D);
  5. return;
  6. }
  7. uxTimerGetTimerNumber (struct tmrTimerControl * xTimer)
  8. {
  9. UBaseType_t D.6791;
  10. UBaseType_t _3;
  11. <bb 2> :
  12. _3 = MEM[(struct Timer_t *)xTimer_2(D)].uxTimerNumber;
  13. <bb 3> :
  14. <L0>:
  15. return _3;
  16. }
  17. xTimerPendFunctionCall (void (*PendedFunction_t) (void *, uint32_t) xFunctionToPend, void * pvParameter1, uint32_t ulParameter2, TickType_t xTicksToWait)
  18. {
  19. BaseType_t xReturn;
  20. struct DaemonTaskMessage_t xMessage;
  21. BaseType_t D.6788;
  22. struct QueueDefinition * xTimerQueue.26_1;
  23. struct QueueDefinition * xTimerQueue.27_2;
  24. BaseType_t _14;
  25. <bb 2> :
  26. xTimerQueue.26_1 = xTimerQueue;
  27. if (xTimerQueue.26_1 == 0B)
  28. goto <bb 3>; [INV]
  29. else
  30. goto <bb 5>; [INV]
  31. <bb 3> :
  32. vPortRaiseBASEPRI ();
  33. <bb 4> :
  34. goto <bb 4>; [INV]
  35. <bb 5> :
  36. xMessage.xMessageID = -1;
  37. xMessage.u.xCallbackParameters.pxCallbackFunction = xFunctionToPend_5(D);
  38. xMessage.u.xCallbackParameters.pvParameter1 = pvParameter1_7(D);
  39. xMessage.u.xCallbackParameters.ulParameter2 = ulParameter2_9(D);
  40. xTimerQueue.27_2 = xTimerQueue;
  41. xReturn_13 = xQueueGenericSend (xTimerQueue.27_2, &xMessage, xTicksToWait_11(D), 0);
  42. _14 = xReturn_13;
  43. xMessage ={v} {CLOBBER};
  44. <bb 6> :
  45. <L4>:
  46. return _14;
  47. }
  48. xTimerPendFunctionCallFromISR (void (*PendedFunction_t) (void *, uint32_t) xFunctionToPend, void * pvParameter1, uint32_t ulParameter2, BaseType_t * pxHigherPriorityTaskWoken)
  49. {
  50. BaseType_t xReturn;
  51. struct DaemonTaskMessage_t xMessage;
  52. BaseType_t D.6783;
  53. struct QueueDefinition * xTimerQueue.25_1;
  54. BaseType_t _13;
  55. <bb 2> :
  56. xMessage.xMessageID = -2;
  57. xMessage.u.xCallbackParameters.pxCallbackFunction = xFunctionToPend_4(D);
  58. xMessage.u.xCallbackParameters.pvParameter1 = pvParameter1_6(D);
  59. xMessage.u.xCallbackParameters.ulParameter2 = ulParameter2_8(D);
  60. xTimerQueue.25_1 = xTimerQueue;
  61. xReturn_12 = xQueueGenericSendFromISR (xTimerQueue.25_1, &xMessage, pxHigherPriorityTaskWoken_10(D), 0);
  62. _13 = xReturn_12;
  63. xMessage ={v} {CLOBBER};
  64. <bb 3> :
  65. <L1>:
  66. return _13;
  67. }
  68. vTimerSetTimerID (struct tmrTimerControl * xTimer, void * pvNewID)
  69. {
  70. struct Timer_t * const pxTimer;
  71. <bb 2> :
  72. pxTimer_2 = xTimer_1(D);
  73. if (xTimer_1(D) == 0B)
  74. goto <bb 3>; [INV]
  75. else
  76. goto <bb 5>; [INV]
  77. <bb 3> :
  78. vPortRaiseBASEPRI ();
  79. <bb 4> :
  80. goto <bb 4>; [INV]
  81. <bb 5> :
  82. vPortEnterCritical ();
  83. pxTimer_2->pvTimerID = pvNewID_5(D);
  84. vPortExitCritical ();
  85. return;
  86. }
  87. pvTimerGetTimerID (struct tmrTimerControl * const xTimer)
  88. {
  89. void * pvReturn;
  90. struct Timer_t * const pxTimer;
  91. void * D.6779;
  92. void * _7;
  93. <bb 2> :
  94. pxTimer_2 = xTimer_1(D);
  95. if (xTimer_1(D) == 0B)
  96. goto <bb 3>; [INV]
  97. else
  98. goto <bb 5>; [INV]
  99. <bb 3> :
  100. vPortRaiseBASEPRI ();
  101. <bb 4> :
  102. goto <bb 4>; [INV]
  103. <bb 5> :
  104. vPortEnterCritical ();
  105. pvReturn_5 = pxTimer_2->pvTimerID;
  106. vPortExitCritical ();
  107. _7 = pvReturn_5;
  108. <bb 6> :
  109. <L3>:
  110. return _7;
  111. }
  112. xTimerIsTimerActive (struct tmrTimerControl * xTimer)
  113. {
  114. struct Timer_t * pxTimer;
  115. BaseType_t xReturn;
  116. BaseType_t D.6775;
  117. unsigned char _1;
  118. int _2;
  119. int _3;
  120. BaseType_t _12;
  121. <bb 2> :
  122. pxTimer_6 = xTimer_5(D);
  123. if (xTimer_5(D) == 0B)
  124. goto <bb 3>; [INV]
  125. else
  126. goto <bb 5>; [INV]
  127. <bb 3> :
  128. vPortRaiseBASEPRI ();
  129. <bb 4> :
  130. goto <bb 4>; [INV]
  131. <bb 5> :
  132. vPortEnterCritical ();
  133. _1 = pxTimer_6->ucStatus;
  134. _2 = (int) _1;
  135. _3 = _2 & 1;
  136. if (_3 == 0)
  137. goto <bb 6>; [INV]
  138. else
  139. goto <bb 7>; [INV]
  140. <bb 6> :
  141. xReturn_10 = 0;
  142. goto <bb 8>; [INV]
  143. <bb 7> :
  144. xReturn_9 = 1;
  145. <bb 8> :
  146. # xReturn_4 = PHI <xReturn_10(6), xReturn_9(7)>
  147. vPortExitCritical ();
  148. _12 = xReturn_4;
  149. <bb 9> :
  150. <L6>:
  151. return _12;
  152. }
  153. prvCheckForValidListAndQueue ()
  154. {
  155. struct QueueDefinition * xTimerQueue.22_1;
  156. struct QueueDefinition * _2;
  157. struct QueueDefinition * xTimerQueue.23_3;
  158. struct QueueDefinition * xTimerQueue.24_4;
  159. <bb 2> :
  160. vPortEnterCritical ();
  161. xTimerQueue.22_1 = xTimerQueue;
  162. if (xTimerQueue.22_1 == 0B)
  163. goto <bb 3>; [INV]
  164. else
  165. goto <bb 5>; [INV]
  166. <bb 3> :
  167. vListInitialise (&xActiveTimerList1);
  168. vListInitialise (&xActiveTimerList2);
  169. pxCurrentTimerList = &xActiveTimerList1;
  170. pxOverflowTimerList = &xActiveTimerList2;
  171. _2 = xQueueGenericCreate (10, 16, 0);
  172. xTimerQueue = _2;
  173. xTimerQueue.23_3 = xTimerQueue;
  174. if (xTimerQueue.23_3 != 0B)
  175. goto <bb 4>; [INV]
  176. else
  177. goto <bb 5>; [INV]
  178. <bb 4> :
  179. xTimerQueue.24_4 = xTimerQueue;
  180. vQueueAddToRegistry (xTimerQueue.24_4, "TmrQ");
  181. <bb 5> :
  182. vPortExitCritical ();
  183. return;
  184. }
  185. prvSwitchTimerLists ()
  186. {
  187. struct List_t * pxTemp;
  188. TickType_t xNextExpireTime;
  189. struct List_t * pxCurrentTimerList.19_1;
  190. struct xLIST_ITEM * _2;
  191. struct List_t * pxCurrentTimerList.20_3;
  192. long unsigned int _4;
  193. struct List_t * pxOverflowTimerList.21_5;
  194. <bb 2> :
  195. goto <bb 4>; [INV]
  196. <bb 3> :
  197. pxCurrentTimerList.19_1 = pxCurrentTimerList;
  198. _2 = pxCurrentTimerList.19_1->xListEnd.pxNext;
  199. xNextExpireTime_11 = _2->xItemValue;
  200. prvProcessExpiredTimer (xNextExpireTime_11, 4294967295);
  201. <bb 4> :
  202. pxCurrentTimerList.20_3 = pxCurrentTimerList;
  203. _4 ={v} pxCurrentTimerList.20_3->uxNumberOfItems;
  204. if (_4 != 0)
  205. goto <bb 3>; [INV]
  206. else
  207. goto <bb 5>; [INV]
  208. <bb 5> :
  209. pxTemp_8 = pxCurrentTimerList;
  210. pxOverflowTimerList.21_5 = pxOverflowTimerList;
  211. pxCurrentTimerList = pxOverflowTimerList.21_5;
  212. pxOverflowTimerList = pxTemp_8;
  213. return;
  214. }
  215. prvProcessReceivedCommands ()
  216. {
  217. const struct CallbackParameters_t * const pxCallback;
  218. TickType_t xTimeNow;
  219. BaseType_t xTimerListsWereSwitched;
  220. struct Timer_t * pxTimer;
  221. struct DaemonTaskMessage_t xMessage;
  222. long int _1;
  223. void (*<T68e>) (void *, uint32_t) _2;
  224. void * _3;
  225. long unsigned int _4;
  226. long int _5;
  227. struct xLIST * _6;
  228. struct ListItem_t * _7;
  229. long int _8;
  230. unsigned char _9;
  231. unsigned char _10;
  232. long unsigned int _11;
  233. long unsigned int _12;
  234. long unsigned int _13;
  235. long unsigned int _14;
  236. long int _15;
  237. unsigned char _16;
  238. int _17;
  239. int _18;
  240. long unsigned int _19;
  241. long unsigned int _20;
  242. long unsigned int _21;
  243. unsigned char _22;
  244. unsigned char _23;
  245. void (*<T689>) (struct tmrTimerControl *) _24;
  246. unsigned char _25;
  247. unsigned char _26;
  248. unsigned char _27;
  249. unsigned char _28;
  250. long unsigned int _29;
  251. long unsigned int _30;
  252. long unsigned int _31;
  253. long unsigned int _32;
  254. unsigned char _33;
  255. int _34;
  256. int _35;
  257. unsigned char _36;
  258. unsigned char _37;
  259. struct QueueDefinition * xTimerQueue.18_38;
  260. long int _39;
  261. <bb 2> :
  262. goto <bb 28>; [INV]
  263. <bb 3> :
  264. _1 = xMessage.xMessageID;
  265. if (_1 < 0)
  266. goto <bb 4>; [INV]
  267. else
  268. goto <bb 8>; [INV]
  269. <bb 4> :
  270. pxCallback_50 = &xMessage.u.xCallbackParameters;
  271. if (pxCallback_50 == 0B)
  272. goto <bb 5>; [INV]
  273. else
  274. goto <bb 7>; [INV]
  275. <bb 5> :
  276. vPortRaiseBASEPRI ();
  277. <bb 6> :
  278. goto <bb 6>; [INV]
  279. <bb 7> :
  280. _2 = pxCallback_50->pxCallbackFunction;
  281. _3 = pxCallback_50->pvParameter1;
  282. _4 = pxCallback_50->ulParameter2;
  283. _2 (_3, _4);
  284. <bb 8> :
  285. _5 = xMessage.xMessageID;
  286. if (_5 >= 0)
  287. goto <bb 9>; [INV]
  288. else
  289. goto <bb 28>; [INV]
  290. <bb 9> :
  291. pxTimer_53 = xMessage.u.xTimerParameters.pxTimer;
  292. _6 = pxTimer_53->xTimerListItem.pvContainer;
  293. if (_6 != 0B)
  294. goto <bb 10>; [INV]
  295. else
  296. goto <bb 11>; [INV]
  297. <bb 10> :
  298. _7 = &pxTimer_53->xTimerListItem;
  299. uxListRemove (_7);
  300. <bb 11> :
  301. xTimeNow_56 = prvSampleTimeNow (&xTimerListsWereSwitched);
  302. _8 = xMessage.xMessageID;
  303. switch (_8) <default: <L32> [INV], case 1 ... 2: <L11> [INV], case 3: <L21> [INV], case 4: <L23> [INV], case 5: <L28> [INV], case 6 ... 7: <L11> [INV], case 8: <L21> [INV], case 9: <L23> [INV]>
  304. <bb 12> :
  305. <L11>:
  306. _9 = pxTimer_53->ucStatus;
  307. _10 = _9 | 1;
  308. pxTimer_53->ucStatus = _10;
  309. _11 = xMessage.u.xTimerParameters.xMessageValue;
  310. _12 = pxTimer_53->xTimerPeriodInTicks;
  311. _13 = _11 + _12;
  312. _14 = xMessage.u.xTimerParameters.xMessageValue;
  313. _15 = prvInsertTimerInActiveList (pxTimer_53, _13, xTimeNow_56, _14);
  314. if (_15 != 0)
  315. goto <bb 13>; [INV]
  316. else
  317. goto <bb 17>; [INV]
  318. <bb 13> :
  319. _16 = pxTimer_53->ucStatus;
  320. _17 = (int) _16;
  321. _18 = _17 & 4;
  322. if (_18 != 0)
  323. goto <bb 14>; [INV]
  324. else
  325. goto <bb 15>; [INV]
  326. <bb 14> :
  327. _19 = xMessage.u.xTimerParameters.xMessageValue;
  328. _20 = pxTimer_53->xTimerPeriodInTicks;
  329. _21 = _19 + _20;
  330. prvReloadTimer (pxTimer_53, _21, xTimeNow_56);
  331. goto <bb 16>; [INV]
  332. <bb 15> :
  333. _22 = pxTimer_53->ucStatus;
  334. _23 = _22 & 254;
  335. pxTimer_53->ucStatus = _23;
  336. <bb 16> :
  337. _24 = pxTimer_53->pxCallbackFunction;
  338. _24 (pxTimer_53);
  339. <bb 17> :
  340. goto <bb 28>; [INV]
  341. <bb 18> :
  342. <L21>:
  343. _25 = pxTimer_53->ucStatus;
  344. _26 = _25 & 254;
  345. pxTimer_53->ucStatus = _26;
  346. goto <bb 28>; [INV]
  347. <bb 19> :
  348. <L23>:
  349. _27 = pxTimer_53->ucStatus;
  350. _28 = _27 | 1;
  351. pxTimer_53->ucStatus = _28;
  352. _29 = xMessage.u.xTimerParameters.xMessageValue;
  353. pxTimer_53->xTimerPeriodInTicks = _29;
  354. _30 = pxTimer_53->xTimerPeriodInTicks;
  355. if (_30 == 0)
  356. goto <bb 20>; [INV]
  357. else
  358. goto <bb 22>; [INV]
  359. <bb 20> :
  360. vPortRaiseBASEPRI ();
  361. <bb 21> :
  362. goto <bb 21>; [INV]
  363. <bb 22> :
  364. _31 = pxTimer_53->xTimerPeriodInTicks;
  365. _32 = xTimeNow_56 + _31;
  366. prvInsertTimerInActiveList (pxTimer_53, _32, xTimeNow_56, xTimeNow_56);
  367. goto <bb 28>; [INV]
  368. <bb 23> :
  369. <L28>:
  370. _33 = pxTimer_53->ucStatus;
  371. _34 = (int) _33;
  372. _35 = _34 & 2;
  373. if (_35 == 0)
  374. goto <bb 24>; [INV]
  375. else
  376. goto <bb 25>; [INV]
  377. <bb 24> :
  378. vPortFree (pxTimer_53);
  379. goto <bb 26>; [INV]
  380. <bb 25> :
  381. _36 = pxTimer_53->ucStatus;
  382. _37 = _36 & 254;
  383. pxTimer_53->ucStatus = _37;
  384. <bb 26> :
  385. goto <bb 28>; [INV]
  386. <bb 27> :
  387. <L32>:
  388. <bb 28> :
  389. xTimerQueue.18_38 = xTimerQueue;
  390. _39 = xQueueReceive (xTimerQueue.18_38, &xMessage, 0);
  391. if (_39 != 0)
  392. goto <bb 3>; [INV]
  393. else
  394. goto <bb 29>; [INV]
  395. <bb 29> :
  396. xMessage ={v} {CLOBBER};
  397. xTimerListsWereSwitched ={v} {CLOBBER};
  398. return;
  399. }
  400. prvInsertTimerInActiveList (struct Timer_t * const pxTimer, const TickType_t xNextExpiryTime, const TickType_t xTimeNow, const TickType_t xCommandTime)
  401. {
  402. BaseType_t xProcessTimerNow;
  403. BaseType_t D.6741;
  404. long unsigned int _1;
  405. long unsigned int _2;
  406. struct List_t * pxOverflowTimerList.16_3;
  407. struct ListItem_t * _4;
  408. struct List_t * pxCurrentTimerList.17_5;
  409. struct ListItem_t * _6;
  410. BaseType_t _21;
  411. <bb 2> :
  412. xProcessTimerNow_9 = 0;
  413. pxTimer_11(D)->xTimerListItem.xItemValue = xNextExpiryTime_12(D);
  414. pxTimer_11(D)->xTimerListItem.pvOwner = pxTimer_11(D);
  415. if (xNextExpiryTime_12(D) <= xTimeNow_15(D))
  416. goto <bb 3>; [INV]
  417. else
  418. goto <bb 6>; [INV]
  419. <bb 3> :
  420. _1 = xTimeNow_15(D) - xCommandTime_16(D);
  421. _2 = pxTimer_11(D)->xTimerPeriodInTicks;
  422. if (_1 >= _2)
  423. goto <bb 4>; [INV]
  424. else
  425. goto <bb 5>; [INV]
  426. <bb 4> :
  427. xProcessTimerNow_20 = 1;
  428. goto <bb 10>; [INV]
  429. <bb 5> :
  430. pxOverflowTimerList.16_3 = pxOverflowTimerList;
  431. _4 = &pxTimer_11(D)->xTimerListItem;
  432. vListInsert (pxOverflowTimerList.16_3, _4);
  433. goto <bb 10>; [INV]
  434. <bb 6> :
  435. if (xTimeNow_15(D) < xCommandTime_16(D))
  436. goto <bb 7>; [INV]
  437. else
  438. goto <bb 9>; [INV]
  439. <bb 7> :
  440. if (xNextExpiryTime_12(D) >= xCommandTime_16(D))
  441. goto <bb 8>; [INV]
  442. else
  443. goto <bb 9>; [INV]
  444. <bb 8> :
  445. xProcessTimerNow_17 = 1;
  446. goto <bb 10>; [INV]
  447. <bb 9> :
  448. pxCurrentTimerList.17_5 = pxCurrentTimerList;
  449. _6 = &pxTimer_11(D)->xTimerListItem;
  450. vListInsert (pxCurrentTimerList.17_5, _6);
  451. <bb 10> :
  452. # xProcessTimerNow_7 = PHI <xProcessTimerNow_9(5), xProcessTimerNow_17(8), xProcessTimerNow_9(9), xProcessTimerNow_20(4)>
  453. _21 = xProcessTimerNow_7;
  454. <bb 11> :
  455. <L10>:
  456. return _21;
  457. }
  458. prvSampleTimeNow (BaseType_t * const pxTimerListsWereSwitched)
  459. {
  460. static TickType_t xLastTime = 0;
  461. TickType_t xTimeNow;
  462. TickType_t D.6729;
  463. long unsigned int xLastTime.15_1;
  464. TickType_t _11;
  465. <bb 2> :
  466. xTimeNow_5 = xTaskGetTickCount ();
  467. xLastTime.15_1 = xLastTime;
  468. if (xTimeNow_5 < xLastTime.15_1)
  469. goto <bb 3>; [INV]
  470. else
  471. goto <bb 4>; [INV]
  472. <bb 3> :
  473. prvSwitchTimerLists ();
  474. *pxTimerListsWereSwitched_6(D) = 1;
  475. goto <bb 5>; [INV]
  476. <bb 4> :
  477. *pxTimerListsWereSwitched_6(D) = 0;
  478. <bb 5> :
  479. xLastTime = xTimeNow_5;
  480. _11 = xTimeNow_5;
  481. <bb 6> :
  482. <L3>:
  483. return _11;
  484. }
  485. prvGetNextExpireTime (BaseType_t * const pxListWasEmpty)
  486. {
  487. TickType_t xNextExpireTime;
  488. TickType_t D.6724;
  489. long int iftmp.12;
  490. struct List_t * pxCurrentTimerList.13_1;
  491. long unsigned int _2;
  492. long int _3;
  493. struct List_t * pxCurrentTimerList.14_4;
  494. struct xLIST_ITEM * _5;
  495. long int iftmp.12_7;
  496. long int iftmp.12_9;
  497. long int iftmp.12_10;
  498. TickType_t _15;
  499. <bb 2> :
  500. pxCurrentTimerList.13_1 = pxCurrentTimerList;
  501. _2 ={v} pxCurrentTimerList.13_1->uxNumberOfItems;
  502. if (_2 == 0)
  503. goto <bb 3>; [INV]
  504. else
  505. goto <bb 4>; [INV]
  506. <bb 3> :
  507. iftmp.12_10 = 1;
  508. goto <bb 5>; [INV]
  509. <bb 4> :
  510. iftmp.12_9 = 0;
  511. <bb 5> :
  512. # iftmp.12_7 = PHI <iftmp.12_10(3), iftmp.12_9(4)>
  513. *pxListWasEmpty_11(D) = iftmp.12_7;
  514. _3 = *pxListWasEmpty_11(D);
  515. if (_3 == 0)
  516. goto <bb 6>; [INV]
  517. else
  518. goto <bb 7>; [INV]
  519. <bb 6> :
  520. pxCurrentTimerList.14_4 = pxCurrentTimerList;
  521. _5 = pxCurrentTimerList.14_4->xListEnd.pxNext;
  522. xNextExpireTime_14 = _5->xItemValue;
  523. goto <bb 8>; [INV]
  524. <bb 7> :
  525. xNextExpireTime_13 = 0;
  526. <bb 8> :
  527. # xNextExpireTime_6 = PHI <xNextExpireTime_14(6), xNextExpireTime_13(7)>
  528. _15 = xNextExpireTime_6;
  529. <bb 9> :
  530. <L6>:
  531. return _15;
  532. }
  533. prvProcessTimerOrBlockTask (const TickType_t xNextExpireTime, BaseType_t xListWasEmpty)
  534. {
  535. BaseType_t xTimerListsWereSwitched;
  536. TickType_t xTimeNow;
  537. long int iftmp.9;
  538. long int xTimerListsWereSwitched.8_1;
  539. struct List_t * pxOverflowTimerList.10_2;
  540. long unsigned int _3;
  541. struct QueueDefinition * xTimerQueue.11_4;
  542. long unsigned int _5;
  543. long int _6;
  544. volatile uint32_t * _7;
  545. long int iftmp.9_9;
  546. long int iftmp.9_21;
  547. long int iftmp.9_22;
  548. <bb 2> :
  549. vTaskSuspendAll ();
  550. xTimeNow_15 = prvSampleTimeNow (&xTimerListsWereSwitched);
  551. xTimerListsWereSwitched.8_1 = xTimerListsWereSwitched;
  552. if (xTimerListsWereSwitched.8_1 == 0)
  553. goto <bb 3>; [INV]
  554. else
  555. goto <bb 14>; [INV]
  556. <bb 3> :
  557. if (xListWasEmpty_17(D) == 0)
  558. goto <bb 4>; [INV]
  559. else
  560. goto <bb 6>; [INV]
  561. <bb 4> :
  562. if (xNextExpireTime_18(D) <= xTimeNow_15)
  563. goto <bb 5>; [INV]
  564. else
  565. goto <bb 6>; [INV]
  566. <bb 5> :
  567. xTaskResumeAll ();
  568. prvProcessExpiredTimer (xNextExpireTime_18(D), xTimeNow_15);
  569. goto <bb 13>; [INV]
  570. <bb 6> :
  571. if (xListWasEmpty_17(D) != 0)
  572. goto <bb 7>; [INV]
  573. else
  574. goto <bb 11>; [INV]
  575. <bb 7> :
  576. pxOverflowTimerList.10_2 = pxOverflowTimerList;
  577. _3 ={v} pxOverflowTimerList.10_2->uxNumberOfItems;
  578. if (_3 == 0)
  579. goto <bb 8>; [INV]
  580. else
  581. goto <bb 9>; [INV]
  582. <bb 8> :
  583. iftmp.9_22 = 1;
  584. goto <bb 10>; [INV]
  585. <bb 9> :
  586. iftmp.9_21 = 0;
  587. <bb 10> :
  588. # iftmp.9_9 = PHI <iftmp.9_22(8), iftmp.9_21(9)>
  589. xListWasEmpty_23 = iftmp.9_9;
  590. <bb 11> :
  591. # xListWasEmpty_8 = PHI <xListWasEmpty_17(D)(6), xListWasEmpty_23(10)>
  592. xTimerQueue.11_4 = xTimerQueue;
  593. _5 = xNextExpireTime_18(D) - xTimeNow_15;
  594. vQueueWaitForMessageRestricted (xTimerQueue.11_4, _5, xListWasEmpty_8);
  595. _6 = xTaskResumeAll ();
  596. if (_6 == 0)
  597. goto <bb 12>; [INV]
  598. else
  599. goto <bb 13>; [INV]
  600. <bb 12> :
  601. _7 = 3758157060B;
  602. *_7 ={v} 268435456;
  603. __asm__ __volatile__("dsb" : : : "memory");
  604. __asm__ __volatile__("isb");
  605. <bb 13> :
  606. goto <bb 15>; [INV]
  607. <bb 14> :
  608. xTaskResumeAll ();
  609. <bb 15> :
  610. xTimerListsWereSwitched ={v} {CLOBBER};
  611. return;
  612. }
  613. prvTimerTask (void * pvParameters)
  614. {
  615. BaseType_t xListWasEmpty;
  616. TickType_t xNextExpireTime;
  617. long int xListWasEmpty.7_1;
  618. <bb 2> :
  619. xNextExpireTime_5 = prvGetNextExpireTime (&xListWasEmpty);
  620. xListWasEmpty.7_1 = xListWasEmpty;
  621. prvProcessTimerOrBlockTask (xNextExpireTime_5, xListWasEmpty.7_1);
  622. prvProcessReceivedCommands ();
  623. goto <bb 2>; [INV]
  624. }
  625. prvProcessExpiredTimer (const TickType_t xNextExpireTime, const TickType_t xTimeNow)
  626. {
  627. struct Timer_t * const pxTimer;
  628. struct List_t * pxCurrentTimerList.6_1;
  629. struct xLIST_ITEM * _2;
  630. struct ListItem_t * _3;
  631. unsigned char _4;
  632. int _5;
  633. int _6;
  634. unsigned char _7;
  635. unsigned char _8;
  636. void (*<T689>) (struct tmrTimerControl *) _9;
  637. <bb 2> :
  638. pxCurrentTimerList.6_1 = pxCurrentTimerList;
  639. _2 = pxCurrentTimerList.6_1->xListEnd.pxNext;
  640. pxTimer_12 = _2->pvOwner;
  641. _3 = &pxTimer_12->xTimerListItem;
  642. uxListRemove (_3);
  643. _4 = pxTimer_12->ucStatus;
  644. _5 = (int) _4;
  645. _6 = _5 & 4;
  646. if (_6 != 0)
  647. goto <bb 3>; [INV]
  648. else
  649. goto <bb 4>; [INV]
  650. <bb 3> :
  651. prvReloadTimer (pxTimer_12, xNextExpireTime_15(D), xTimeNow_16(D));
  652. goto <bb 5>; [INV]
  653. <bb 4> :
  654. _7 = pxTimer_12->ucStatus;
  655. _8 = _7 & 254;
  656. pxTimer_12->ucStatus = _8;
  657. <bb 5> :
  658. _9 = pxTimer_12->pxCallbackFunction;
  659. _9 (pxTimer_12);
  660. return;
  661. }
  662. prvReloadTimer (struct Timer_t * const pxTimer, TickType_t xExpiredTime, const TickType_t xTimeNow)
  663. {
  664. long unsigned int _1;
  665. void (*<T689>) (struct tmrTimerControl *) _2;
  666. long unsigned int _3;
  667. long unsigned int _4;
  668. long int _5;
  669. <bb 2> :
  670. goto <bb 4>; [INV]
  671. <bb 3> :
  672. _1 = pxTimer_10(D)->xTimerPeriodInTicks;
  673. xExpiredTime_13 = xExpiredTime_6 + _1;
  674. _2 = pxTimer_10(D)->pxCallbackFunction;
  675. _2 (pxTimer_10(D));
  676. <bb 4> :
  677. # xExpiredTime_6 = PHI <xExpiredTime_8(D)(2), xExpiredTime_13(3)>
  678. _3 = pxTimer_10(D)->xTimerPeriodInTicks;
  679. _4 = xExpiredTime_6 + _3;
  680. _5 = prvInsertTimerInActiveList (pxTimer_10(D), _4, xTimeNow_11(D), xExpiredTime_6);
  681. if (_5 != 0)
  682. goto <bb 3>; [INV]
  683. else
  684. goto <bb 5>; [INV]
  685. <bb 5> :
  686. return;
  687. }
  688. pcTimerGetName (struct tmrTimerControl * xTimer)
  689. {
  690. struct Timer_t * pxTimer;
  691. const char * D.6696;
  692. const char * _4;
  693. <bb 2> :
  694. pxTimer_2 = xTimer_1(D);
  695. if (xTimer_1(D) == 0B)
  696. goto <bb 3>; [INV]
  697. else
  698. goto <bb 5>; [INV]
  699. <bb 3> :
  700. vPortRaiseBASEPRI ();
  701. <bb 4> :
  702. goto <bb 4>; [INV]
  703. <bb 5> :
  704. _4 = pxTimer_2->pcTimerName;
  705. <bb 6> :
  706. <L3>:
  707. return _4;
  708. }
  709. xTimerGetExpiryTime (struct tmrTimerControl * xTimer)
  710. {
  711. TickType_t xReturn;
  712. struct Timer_t * pxTimer;
  713. TickType_t D.6692;
  714. TickType_t _5;
  715. <bb 2> :
  716. pxTimer_2 = xTimer_1(D);
  717. if (xTimer_1(D) == 0B)
  718. goto <bb 3>; [INV]
  719. else
  720. goto <bb 5>; [INV]
  721. <bb 3> :
  722. vPortRaiseBASEPRI ();
  723. <bb 4> :
  724. goto <bb 4>; [INV]
  725. <bb 5> :
  726. xReturn_4 = pxTimer_2->xTimerListItem.xItemValue;
  727. _5 = xReturn_4;
  728. <bb 6> :
  729. <L3>:
  730. return _5;
  731. }
  732. uxTimerGetReloadMode (struct tmrTimerControl * xTimer)
  733. {
  734. UBaseType_t uxReturn;
  735. struct Timer_t * pxTimer;
  736. UBaseType_t D.6688;
  737. unsigned char _1;
  738. int _2;
  739. int _3;
  740. UBaseType_t _12;
  741. <bb 2> :
  742. pxTimer_6 = xTimer_5(D);
  743. if (xTimer_5(D) == 0B)
  744. goto <bb 3>; [INV]
  745. else
  746. goto <bb 5>; [INV]
  747. <bb 3> :
  748. vPortRaiseBASEPRI ();
  749. <bb 4> :
  750. goto <bb 4>; [INV]
  751. <bb 5> :
  752. vPortEnterCritical ();
  753. _1 = pxTimer_6->ucStatus;
  754. _2 = (int) _1;
  755. _3 = _2 & 4;
  756. if (_3 == 0)
  757. goto <bb 6>; [INV]
  758. else
  759. goto <bb 7>; [INV]
  760. <bb 6> :
  761. uxReturn_10 = 0;
  762. goto <bb 8>; [INV]
  763. <bb 7> :
  764. uxReturn_9 = 1;
  765. <bb 8> :
  766. # uxReturn_4 = PHI <uxReturn_10(6), uxReturn_9(7)>
  767. vPortExitCritical ();
  768. _12 = uxReturn_4;
  769. <bb 9> :
  770. <L6>:
  771. return _12;
  772. }
  773. vTimerSetReloadMode (struct tmrTimerControl * xTimer, const UBaseType_t uxAutoReload)
  774. {
  775. struct Timer_t * pxTimer;
  776. unsigned char _1;
  777. unsigned char _2;
  778. unsigned char _3;
  779. unsigned char _4;
  780. <bb 2> :
  781. pxTimer_7 = xTimer_6(D);
  782. if (xTimer_6(D) == 0B)
  783. goto <bb 3>; [INV]
  784. else
  785. goto <bb 5>; [INV]
  786. <bb 3> :
  787. vPortRaiseBASEPRI ();
  788. <bb 4> :
  789. goto <bb 4>; [INV]
  790. <bb 5> :
  791. vPortEnterCritical ();
  792. if (uxAutoReload_10(D) != 0)
  793. goto <bb 6>; [INV]
  794. else
  795. goto <bb 7>; [INV]
  796. <bb 6> :
  797. _1 = pxTimer_7->ucStatus;
  798. _2 = _1 | 4;
  799. pxTimer_7->ucStatus = _2;
  800. goto <bb 8>; [INV]
  801. <bb 7> :
  802. _3 = pxTimer_7->ucStatus;
  803. _4 = _3 & 251;
  804. pxTimer_7->ucStatus = _4;
  805. <bb 8> :
  806. vPortExitCritical ();
  807. return;
  808. }
  809. xTimerGetPeriod (struct tmrTimerControl * xTimer)
  810. {
  811. struct Timer_t * pxTimer;
  812. TickType_t D.6676;
  813. TickType_t _4;
  814. <bb 2> :
  815. pxTimer_2 = xTimer_1(D);
  816. if (xTimer_1(D) == 0B)
  817. goto <bb 3>; [INV]
  818. else
  819. goto <bb 5>; [INV]
  820. <bb 3> :
  821. vPortRaiseBASEPRI ();
  822. <bb 4> :
  823. goto <bb 4>; [INV]
  824. <bb 5> :
  825. _4 = pxTimer_2->xTimerPeriodInTicks;
  826. <bb 6> :
  827. <L3>:
  828. return _4;
  829. }
  830. xTimerGetTimerDaemonTaskHandle ()
  831. {
  832. struct tskTaskControlBlock * D.6672;
  833. struct tskTaskControlBlock * xTimerTaskHandle.5_1;
  834. struct tskTaskControlBlock * _3;
  835. <bb 2> :
  836. xTimerTaskHandle.5_1 = xTimerTaskHandle;
  837. if (xTimerTaskHandle.5_1 == 0B)
  838. goto <bb 3>; [INV]
  839. else
  840. goto <bb 5>; [INV]
  841. <bb 3> :
  842. vPortRaiseBASEPRI ();
  843. <bb 4> :
  844. goto <bb 4>; [INV]
  845. <bb 5> :
  846. _3 = xTimerTaskHandle;
  847. <bb 6> :
  848. <L3>:
  849. return _3;
  850. }
  851. xTimerGenericCommand (struct tmrTimerControl * xTimer, const BaseType_t xCommandID, const TickType_t xOptionalValue, BaseType_t * const pxHigherPriorityTaskWoken, const TickType_t xTicksToWait)
  852. {
  853. struct DaemonTaskMessage_t xMessage;
  854. BaseType_t xReturn;
  855. BaseType_t D.6667;
  856. struct QueueDefinition * xTimerQueue.1_1;
  857. long int _2;
  858. struct QueueDefinition * xTimerQueue.2_3;
  859. struct QueueDefinition * xTimerQueue.3_4;
  860. struct QueueDefinition * xTimerQueue.4_5;
  861. BaseType_t _25;
  862. <bb 2> :
  863. xReturn_8 = 0;
  864. if (xTimer_9(D) == 0B)
  865. goto <bb 3>; [INV]
  866. else
  867. goto <bb 5>; [INV]
  868. <bb 3> :
  869. vPortRaiseBASEPRI ();
  870. <bb 4> :
  871. goto <bb 4>; [INV]
  872. <bb 5> :
  873. xTimerQueue.1_1 = xTimerQueue;
  874. if (xTimerQueue.1_1 != 0B)
  875. goto <bb 6>; [INV]
  876. else
  877. goto <bb 11>; [INV]
  878. <bb 6> :
  879. xMessage.xMessageID = xCommandID_11(D);
  880. xMessage.u.xTimerParameters.xMessageValue = xOptionalValue_13(D);
  881. xMessage.u.xTimerParameters.pxTimer = xTimer_9(D);
  882. if (xCommandID_11(D) <= 5)
  883. goto <bb 7>; [INV]
  884. else
  885. goto <bb 10>; [INV]
  886. <bb 7> :
  887. _2 = xTaskGetSchedulerState ();
  888. if (_2 == 2)
  889. goto <bb 8>; [INV]
  890. else
  891. goto <bb 9>; [INV]
  892. <bb 8> :
  893. xTimerQueue.2_3 = xTimerQueue;
  894. xReturn_24 = xQueueGenericSend (xTimerQueue.2_3, &xMessage, xTicksToWait_22(D), 0);
  895. goto <bb 11>; [INV]
  896. <bb 9> :
  897. xTimerQueue.3_4 = xTimerQueue;
  898. xReturn_21 = xQueueGenericSend (xTimerQueue.3_4, &xMessage, 0, 0);
  899. goto <bb 11>; [INV]
  900. <bb 10> :
  901. xTimerQueue.4_5 = xTimerQueue;
  902. xReturn_18 = xQueueGenericSendFromISR (xTimerQueue.4_5, &xMessage, pxHigherPriorityTaskWoken_16(D), 0);
  903. <bb 11> :
  904. # xReturn_6 = PHI <xReturn_8(5), xReturn_18(10), xReturn_21(9), xReturn_24(8)>
  905. _25 = xReturn_6;
  906. xMessage ={v} {CLOBBER};
  907. <bb 12> :
  908. <L13>:
  909. return _25;
  910. }
  911. prvInitialiseNewTimer (const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, void (*TimerCallbackFunction_t) (struct tmrTimerControl *) pxCallbackFunction, struct Timer_t * pxNewTimer)
  912. {
  913. struct ListItem_t * _1;
  914. unsigned char _2;
  915. unsigned char _3;
  916. <bb 2> :
  917. if (xTimerPeriodInTicks_5(D) == 0)
  918. goto <bb 3>; [INV]
  919. else
  920. goto <bb 5>; [INV]
  921. <bb 3> :
  922. vPortRaiseBASEPRI ();
  923. <bb 4> :
  924. goto <bb 4>; [INV]
  925. <bb 5> :
  926. prvCheckForValidListAndQueue ();
  927. pxNewTimer_8(D)->pcTimerName = pcTimerName_9(D);
  928. pxNewTimer_8(D)->xTimerPeriodInTicks = xTimerPeriodInTicks_5(D);
  929. pxNewTimer_8(D)->pvTimerID = pvTimerID_12(D);
  930. pxNewTimer_8(D)->pxCallbackFunction = pxCallbackFunction_14(D);
  931. _1 = &pxNewTimer_8(D)->xTimerListItem;
  932. vListInitialiseItem (_1);
  933. if (uxAutoReload_17(D) != 0)
  934. goto <bb 6>; [INV]
  935. else
  936. goto <bb 7>; [INV]
  937. <bb 6> :
  938. _2 = pxNewTimer_8(D)->ucStatus;
  939. _3 = _2 | 4;
  940. pxNewTimer_8(D)->ucStatus = _3;
  941. <bb 7> :
  942. return;
  943. }
  944. xTimerCreate (const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, void (*TimerCallbackFunction_t) (struct tmrTimerControl *) pxCallbackFunction)
  945. {
  946. struct Timer_t * pxNewTimer;
  947. struct tmrTimerControl * D.6650;
  948. struct tmrTimerControl * _12;
  949. <bb 2> :
  950. pxNewTimer_4 = pvPortMalloc (44);
  951. if (pxNewTimer_4 != 0B)
  952. goto <bb 3>; [INV]
  953. else
  954. goto <bb 4>; [INV]
  955. <bb 3> :
  956. pxNewTimer_4->ucStatus = 0;
  957. prvInitialiseNewTimer (pcTimerName_6(D), xTimerPeriodInTicks_7(D), uxAutoReload_8(D), pvTimerID_9(D), pxCallbackFunction_10(D), pxNewTimer_4);
  958. <bb 4> :
  959. _12 = pxNewTimer_4;
  960. <bb 5> :
  961. <L2>:
  962. return _12;
  963. }
  964. xTimerCreateTimerTask ()
  965. {
  966. BaseType_t xReturn;
  967. BaseType_t D.6646;
  968. struct QueueDefinition * xTimerQueue.0_1;
  969. BaseType_t _9;
  970. <bb 2> :
  971. xReturn_4 = 0;
  972. prvCheckForValidListAndQueue ();
  973. xTimerQueue.0_1 = xTimerQueue;
  974. if (xTimerQueue.0_1 != 0B)
  975. goto <bb 3>; [INV]
  976. else
  977. goto <bb 4>; [INV]
  978. <bb 3> :
  979. xReturn_8 = xTaskCreate (prvTimerTask, "Tmr Svc", 180, 0B, 2, &xTimerTaskHandle);
  980. <bb 4> :
  981. # xReturn_2 = PHI <xReturn_4(2), xReturn_8(3)>
  982. if (xReturn_2 == 0)
  983. goto <bb 5>; [INV]
  984. else
  985. goto <bb 7>; [INV]
  986. <bb 5> :
  987. vPortRaiseBASEPRI ();
  988. <bb 6> :
  989. goto <bb 6>; [INV]
  990. <bb 7> :
  991. _9 = xReturn_2;
  992. <bb 8> :
  993. <L6>:
  994. return _9;
  995. }
  996. __attribute__((always_inline))
  997. vPortRaiseBASEPRI ()
  998. {
  999. uint32_t ulNewBASEPRI;
  1000. <bb 2> :
  1001. __asm__ __volatile__(" mov %0, %1
  1002. msr basepri, %0
  1003. isb
  1004. dsb
  1005. " : "=r" ulNewBASEPRI_3 : "i" 16 : "memory");
  1006. return;
  1007. }