timers.c.017i.build_ssa_passes 20 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123
  1. vTimerSetTimerNumber (struct tmrTimerControl * xTimer, UBaseType_t uxTimerNumber)
  2. {
  3. <bb 2> :
  4. MEM[(struct Timer_t *)xTimer].uxTimerNumber = uxTimerNumber;
  5. return;
  6. }
  7. uxTimerGetTimerNumber (struct tmrTimerControl * xTimer)
  8. {
  9. UBaseType_t D.6790;
  10. <bb 2> :
  11. D.6790 = MEM[(struct Timer_t *)xTimer].uxTimerNumber;
  12. <bb 3> :
  13. <L0>:
  14. return D.6790;
  15. }
  16. xTimerPendFunctionCall (void (*PendedFunction_t) (void *, uint32_t) xFunctionToPend, void * pvParameter1, uint32_t ulParameter2, TickType_t xTicksToWait)
  17. {
  18. BaseType_t xReturn;
  19. struct DaemonTaskMessage_t xMessage;
  20. BaseType_t D.6787;
  21. <bb 2> :
  22. xTimerQueue.26_1 = xTimerQueue;
  23. if (xTimerQueue.26_1 == 0B)
  24. goto <bb 3>; [INV]
  25. else
  26. goto <bb 5>; [INV]
  27. <bb 3> :
  28. vPortRaiseBASEPRI ();
  29. <bb 4> :
  30. goto <bb 4>; [INV]
  31. <bb 5> :
  32. xMessage.xMessageID = -1;
  33. xMessage.u.xCallbackParameters.pxCallbackFunction = xFunctionToPend;
  34. xMessage.u.xCallbackParameters.pvParameter1 = pvParameter1;
  35. xMessage.u.xCallbackParameters.ulParameter2 = ulParameter2;
  36. xTimerQueue.27_2 = xTimerQueue;
  37. xReturn = xQueueGenericSend (xTimerQueue.27_2, &xMessage, xTicksToWait, 0);
  38. D.6787 = xReturn;
  39. xMessage = {CLOBBER};
  40. <bb 6> :
  41. <L4>:
  42. return D.6787;
  43. }
  44. xTimerPendFunctionCallFromISR (void (*PendedFunction_t) (void *, uint32_t) xFunctionToPend, void * pvParameter1, uint32_t ulParameter2, BaseType_t * pxHigherPriorityTaskWoken)
  45. {
  46. BaseType_t xReturn;
  47. struct DaemonTaskMessage_t xMessage;
  48. BaseType_t D.6782;
  49. <bb 2> :
  50. xMessage.xMessageID = -2;
  51. xMessage.u.xCallbackParameters.pxCallbackFunction = xFunctionToPend;
  52. xMessage.u.xCallbackParameters.pvParameter1 = pvParameter1;
  53. xMessage.u.xCallbackParameters.ulParameter2 = ulParameter2;
  54. xTimerQueue.25_1 = xTimerQueue;
  55. xReturn = xQueueGenericSendFromISR (xTimerQueue.25_1, &xMessage, pxHigherPriorityTaskWoken, 0);
  56. D.6782 = xReturn;
  57. xMessage = {CLOBBER};
  58. <bb 3> :
  59. <L1>:
  60. return D.6782;
  61. }
  62. vTimerSetTimerID (struct tmrTimerControl * xTimer, void * pvNewID)
  63. {
  64. struct Timer_t * const pxTimer;
  65. <bb 2> :
  66. pxTimer = xTimer;
  67. if (xTimer == 0B)
  68. goto <bb 3>; [INV]
  69. else
  70. goto <bb 5>; [INV]
  71. <bb 3> :
  72. vPortRaiseBASEPRI ();
  73. <bb 4> :
  74. goto <bb 4>; [INV]
  75. <bb 5> :
  76. vPortEnterCritical ();
  77. pxTimer->pvTimerID = pvNewID;
  78. vPortExitCritical ();
  79. return;
  80. }
  81. pvTimerGetTimerID (struct tmrTimerControl * const xTimer)
  82. {
  83. void * pvReturn;
  84. struct Timer_t * const pxTimer;
  85. void * D.6778;
  86. <bb 2> :
  87. pxTimer = xTimer;
  88. if (xTimer == 0B)
  89. goto <bb 3>; [INV]
  90. else
  91. goto <bb 5>; [INV]
  92. <bb 3> :
  93. vPortRaiseBASEPRI ();
  94. <bb 4> :
  95. goto <bb 4>; [INV]
  96. <bb 5> :
  97. vPortEnterCritical ();
  98. pvReturn = pxTimer->pvTimerID;
  99. vPortExitCritical ();
  100. D.6778 = pvReturn;
  101. <bb 6> :
  102. <L3>:
  103. return D.6778;
  104. }
  105. xTimerIsTimerActive (struct tmrTimerControl * xTimer)
  106. {
  107. struct Timer_t * pxTimer;
  108. BaseType_t xReturn;
  109. BaseType_t D.6774;
  110. <bb 2> :
  111. pxTimer = xTimer;
  112. if (xTimer == 0B)
  113. goto <bb 3>; [INV]
  114. else
  115. goto <bb 5>; [INV]
  116. <bb 3> :
  117. vPortRaiseBASEPRI ();
  118. <bb 4> :
  119. goto <bb 4>; [INV]
  120. <bb 5> :
  121. vPortEnterCritical ();
  122. _1 = pxTimer->ucStatus;
  123. _2 = (int) _1;
  124. _3 = _2 & 1;
  125. if (_3 == 0)
  126. goto <bb 6>; [INV]
  127. else
  128. goto <bb 7>; [INV]
  129. <bb 6> :
  130. xReturn = 0;
  131. goto <bb 8>; [INV]
  132. <bb 7> :
  133. xReturn = 1;
  134. <bb 8> :
  135. vPortExitCritical ();
  136. D.6774 = xReturn;
  137. <bb 9> :
  138. <L6>:
  139. return D.6774;
  140. }
  141. prvCheckForValidListAndQueue ()
  142. {
  143. <bb 2> :
  144. vPortEnterCritical ();
  145. xTimerQueue.22_1 = xTimerQueue;
  146. if (xTimerQueue.22_1 == 0B)
  147. goto <bb 3>; [INV]
  148. else
  149. goto <bb 5>; [INV]
  150. <bb 3> :
  151. vListInitialise (&xActiveTimerList1);
  152. vListInitialise (&xActiveTimerList2);
  153. pxCurrentTimerList = &xActiveTimerList1;
  154. pxOverflowTimerList = &xActiveTimerList2;
  155. _2 = xQueueGenericCreate (10, 16, 0);
  156. xTimerQueue = _2;
  157. xTimerQueue.23_3 = xTimerQueue;
  158. if (xTimerQueue.23_3 != 0B)
  159. goto <bb 4>; [INV]
  160. else
  161. goto <bb 5>; [INV]
  162. <bb 4> :
  163. xTimerQueue.24_4 = xTimerQueue;
  164. vQueueAddToRegistry (xTimerQueue.24_4, "TmrQ");
  165. <bb 5> :
  166. vPortExitCritical ();
  167. return;
  168. }
  169. prvSwitchTimerLists ()
  170. {
  171. struct List_t * pxTemp;
  172. TickType_t xNextExpireTime;
  173. <bb 2> :
  174. goto <bb 4>; [INV]
  175. <bb 3> :
  176. pxCurrentTimerList.19_1 = pxCurrentTimerList;
  177. _2 = pxCurrentTimerList.19_1->xListEnd.pxNext;
  178. xNextExpireTime = _2->xItemValue;
  179. prvProcessExpiredTimer (xNextExpireTime, 4294967295);
  180. <bb 4> :
  181. pxCurrentTimerList.20_3 = pxCurrentTimerList;
  182. _4 = pxCurrentTimerList.20_3->uxNumberOfItems;
  183. if (_4 != 0)
  184. goto <bb 3>; [INV]
  185. else
  186. goto <bb 5>; [INV]
  187. <bb 5> :
  188. pxTemp = pxCurrentTimerList;
  189. pxOverflowTimerList.21_5 = pxOverflowTimerList;
  190. pxCurrentTimerList = pxOverflowTimerList.21_5;
  191. pxOverflowTimerList = pxTemp;
  192. return;
  193. }
  194. prvProcessReceivedCommands ()
  195. {
  196. const struct CallbackParameters_t * const pxCallback;
  197. TickType_t xTimeNow;
  198. BaseType_t xTimerListsWereSwitched;
  199. struct Timer_t * pxTimer;
  200. struct DaemonTaskMessage_t xMessage;
  201. <bb 2> :
  202. goto <bb 28>; [INV]
  203. <bb 3> :
  204. _1 = xMessage.xMessageID;
  205. if (_1 < 0)
  206. goto <bb 4>; [INV]
  207. else
  208. goto <bb 8>; [INV]
  209. <bb 4> :
  210. pxCallback = &xMessage.u.xCallbackParameters;
  211. if (pxCallback == 0B)
  212. goto <bb 5>; [INV]
  213. else
  214. goto <bb 7>; [INV]
  215. <bb 5> :
  216. vPortRaiseBASEPRI ();
  217. <bb 6> :
  218. goto <bb 6>; [INV]
  219. <bb 7> :
  220. _2 = pxCallback->pxCallbackFunction;
  221. _3 = pxCallback->pvParameter1;
  222. _4 = pxCallback->ulParameter2;
  223. _2 (_3, _4);
  224. <bb 8> :
  225. _5 = xMessage.xMessageID;
  226. if (_5 >= 0)
  227. goto <bb 9>; [INV]
  228. else
  229. goto <bb 28>; [INV]
  230. <bb 9> :
  231. pxTimer = xMessage.u.xTimerParameters.pxTimer;
  232. _6 = pxTimer->xTimerListItem.pvContainer;
  233. if (_6 != 0B)
  234. goto <bb 10>; [INV]
  235. else
  236. goto <bb 11>; [INV]
  237. <bb 10> :
  238. _7 = &pxTimer->xTimerListItem;
  239. uxListRemove (_7);
  240. <bb 11> :
  241. xTimeNow = prvSampleTimeNow (&xTimerListsWereSwitched);
  242. _8 = xMessage.xMessageID;
  243. 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]>
  244. <bb 12> :
  245. <L11>:
  246. _9 = pxTimer->ucStatus;
  247. _10 = _9 | 1;
  248. pxTimer->ucStatus = _10;
  249. _11 = xMessage.u.xTimerParameters.xMessageValue;
  250. _12 = pxTimer->xTimerPeriodInTicks;
  251. _13 = _11 + _12;
  252. _14 = xMessage.u.xTimerParameters.xMessageValue;
  253. _15 = prvInsertTimerInActiveList (pxTimer, _13, xTimeNow, _14);
  254. if (_15 != 0)
  255. goto <bb 13>; [INV]
  256. else
  257. goto <bb 17>; [INV]
  258. <bb 13> :
  259. _16 = pxTimer->ucStatus;
  260. _17 = (int) _16;
  261. _18 = _17 & 4;
  262. if (_18 != 0)
  263. goto <bb 14>; [INV]
  264. else
  265. goto <bb 15>; [INV]
  266. <bb 14> :
  267. _19 = xMessage.u.xTimerParameters.xMessageValue;
  268. _20 = pxTimer->xTimerPeriodInTicks;
  269. _21 = _19 + _20;
  270. prvReloadTimer (pxTimer, _21, xTimeNow);
  271. goto <bb 16>; [INV]
  272. <bb 15> :
  273. _22 = pxTimer->ucStatus;
  274. _23 = _22 & 254;
  275. pxTimer->ucStatus = _23;
  276. <bb 16> :
  277. _24 = pxTimer->pxCallbackFunction;
  278. _24 (pxTimer);
  279. <bb 17> :
  280. goto <bb 28>; [INV]
  281. <bb 18> :
  282. <L21>:
  283. _25 = pxTimer->ucStatus;
  284. _26 = _25 & 254;
  285. pxTimer->ucStatus = _26;
  286. goto <bb 28>; [INV]
  287. <bb 19> :
  288. <L23>:
  289. _27 = pxTimer->ucStatus;
  290. _28 = _27 | 1;
  291. pxTimer->ucStatus = _28;
  292. _29 = xMessage.u.xTimerParameters.xMessageValue;
  293. pxTimer->xTimerPeriodInTicks = _29;
  294. _30 = pxTimer->xTimerPeriodInTicks;
  295. if (_30 == 0)
  296. goto <bb 20>; [INV]
  297. else
  298. goto <bb 22>; [INV]
  299. <bb 20> :
  300. vPortRaiseBASEPRI ();
  301. <bb 21> :
  302. goto <bb 21>; [INV]
  303. <bb 22> :
  304. _31 = pxTimer->xTimerPeriodInTicks;
  305. _32 = xTimeNow + _31;
  306. prvInsertTimerInActiveList (pxTimer, _32, xTimeNow, xTimeNow);
  307. goto <bb 28>; [INV]
  308. <bb 23> :
  309. <L28>:
  310. _33 = pxTimer->ucStatus;
  311. _34 = (int) _33;
  312. _35 = _34 & 2;
  313. if (_35 == 0)
  314. goto <bb 24>; [INV]
  315. else
  316. goto <bb 25>; [INV]
  317. <bb 24> :
  318. vPortFree (pxTimer);
  319. goto <bb 26>; [INV]
  320. <bb 25> :
  321. _36 = pxTimer->ucStatus;
  322. _37 = _36 & 254;
  323. pxTimer->ucStatus = _37;
  324. <bb 26> :
  325. goto <bb 28>; [INV]
  326. <bb 27> :
  327. <L32>:
  328. <bb 28> :
  329. xTimerQueue.18_38 = xTimerQueue;
  330. _39 = xQueueReceive (xTimerQueue.18_38, &xMessage, 0);
  331. if (_39 != 0)
  332. goto <bb 3>; [INV]
  333. else
  334. goto <bb 29>; [INV]
  335. <bb 29> :
  336. xMessage = {CLOBBER};
  337. xTimerListsWereSwitched = {CLOBBER};
  338. return;
  339. }
  340. prvInsertTimerInActiveList (struct Timer_t * const pxTimer, const TickType_t xNextExpiryTime, const TickType_t xTimeNow, const TickType_t xCommandTime)
  341. {
  342. BaseType_t xProcessTimerNow;
  343. BaseType_t D.6740;
  344. <bb 2> :
  345. xProcessTimerNow = 0;
  346. pxTimer->xTimerListItem.xItemValue = xNextExpiryTime;
  347. pxTimer->xTimerListItem.pvOwner = pxTimer;
  348. if (xNextExpiryTime <= xTimeNow)
  349. goto <bb 3>; [INV]
  350. else
  351. goto <bb 6>; [INV]
  352. <bb 3> :
  353. _1 = xTimeNow - xCommandTime;
  354. _2 = pxTimer->xTimerPeriodInTicks;
  355. if (_1 >= _2)
  356. goto <bb 4>; [INV]
  357. else
  358. goto <bb 5>; [INV]
  359. <bb 4> :
  360. xProcessTimerNow = 1;
  361. goto <bb 10>; [INV]
  362. <bb 5> :
  363. pxOverflowTimerList.16_3 = pxOverflowTimerList;
  364. _4 = &pxTimer->xTimerListItem;
  365. vListInsert (pxOverflowTimerList.16_3, _4);
  366. goto <bb 10>; [INV]
  367. <bb 6> :
  368. if (xTimeNow < xCommandTime)
  369. goto <bb 7>; [INV]
  370. else
  371. goto <bb 9>; [INV]
  372. <bb 7> :
  373. if (xNextExpiryTime >= xCommandTime)
  374. goto <bb 8>; [INV]
  375. else
  376. goto <bb 9>; [INV]
  377. <bb 8> :
  378. xProcessTimerNow = 1;
  379. goto <bb 10>; [INV]
  380. <bb 9> :
  381. pxCurrentTimerList.17_5 = pxCurrentTimerList;
  382. _6 = &pxTimer->xTimerListItem;
  383. vListInsert (pxCurrentTimerList.17_5, _6);
  384. <bb 10> :
  385. D.6740 = xProcessTimerNow;
  386. <bb 11> :
  387. <L10>:
  388. return D.6740;
  389. }
  390. prvSampleTimeNow (BaseType_t * const pxTimerListsWereSwitched)
  391. {
  392. static TickType_t xLastTime = 0;
  393. TickType_t xTimeNow;
  394. TickType_t D.6728;
  395. <bb 2> :
  396. xTimeNow = xTaskGetTickCount ();
  397. xLastTime.15_1 = xLastTime;
  398. if (xTimeNow < xLastTime.15_1)
  399. goto <bb 3>; [INV]
  400. else
  401. goto <bb 4>; [INV]
  402. <bb 3> :
  403. prvSwitchTimerLists ();
  404. *pxTimerListsWereSwitched = 1;
  405. goto <bb 5>; [INV]
  406. <bb 4> :
  407. *pxTimerListsWereSwitched = 0;
  408. <bb 5> :
  409. xLastTime = xTimeNow;
  410. D.6728 = xTimeNow;
  411. <bb 6> :
  412. <L3>:
  413. return D.6728;
  414. }
  415. prvGetNextExpireTime (BaseType_t * const pxListWasEmpty)
  416. {
  417. TickType_t xNextExpireTime;
  418. TickType_t D.6723;
  419. long int iftmp.12;
  420. <bb 2> :
  421. pxCurrentTimerList.13_1 = pxCurrentTimerList;
  422. _2 = pxCurrentTimerList.13_1->uxNumberOfItems;
  423. if (_2 == 0)
  424. goto <bb 3>; [INV]
  425. else
  426. goto <bb 4>; [INV]
  427. <bb 3> :
  428. iftmp.12 = 1;
  429. goto <bb 5>; [INV]
  430. <bb 4> :
  431. iftmp.12 = 0;
  432. <bb 5> :
  433. *pxListWasEmpty = iftmp.12;
  434. _3 = *pxListWasEmpty;
  435. if (_3 == 0)
  436. goto <bb 6>; [INV]
  437. else
  438. goto <bb 7>; [INV]
  439. <bb 6> :
  440. pxCurrentTimerList.14_4 = pxCurrentTimerList;
  441. _5 = pxCurrentTimerList.14_4->xListEnd.pxNext;
  442. xNextExpireTime = _5->xItemValue;
  443. goto <bb 8>; [INV]
  444. <bb 7> :
  445. xNextExpireTime = 0;
  446. <bb 8> :
  447. D.6723 = xNextExpireTime;
  448. <bb 9> :
  449. <L6>:
  450. return D.6723;
  451. }
  452. prvProcessTimerOrBlockTask (const TickType_t xNextExpireTime, BaseType_t xListWasEmpty)
  453. {
  454. BaseType_t xTimerListsWereSwitched;
  455. TickType_t xTimeNow;
  456. long int iftmp.9;
  457. <bb 2> :
  458. vTaskSuspendAll ();
  459. xTimeNow = prvSampleTimeNow (&xTimerListsWereSwitched);
  460. xTimerListsWereSwitched.8_1 = xTimerListsWereSwitched;
  461. if (xTimerListsWereSwitched.8_1 == 0)
  462. goto <bb 3>; [INV]
  463. else
  464. goto <bb 14>; [INV]
  465. <bb 3> :
  466. if (xListWasEmpty == 0)
  467. goto <bb 4>; [INV]
  468. else
  469. goto <bb 6>; [INV]
  470. <bb 4> :
  471. if (xNextExpireTime <= xTimeNow)
  472. goto <bb 5>; [INV]
  473. else
  474. goto <bb 6>; [INV]
  475. <bb 5> :
  476. xTaskResumeAll ();
  477. prvProcessExpiredTimer (xNextExpireTime, xTimeNow);
  478. goto <bb 13>; [INV]
  479. <bb 6> :
  480. if (xListWasEmpty != 0)
  481. goto <bb 7>; [INV]
  482. else
  483. goto <bb 11>; [INV]
  484. <bb 7> :
  485. pxOverflowTimerList.10_2 = pxOverflowTimerList;
  486. _3 = pxOverflowTimerList.10_2->uxNumberOfItems;
  487. if (_3 == 0)
  488. goto <bb 8>; [INV]
  489. else
  490. goto <bb 9>; [INV]
  491. <bb 8> :
  492. iftmp.9 = 1;
  493. goto <bb 10>; [INV]
  494. <bb 9> :
  495. iftmp.9 = 0;
  496. <bb 10> :
  497. xListWasEmpty = iftmp.9;
  498. <bb 11> :
  499. xTimerQueue.11_4 = xTimerQueue;
  500. _5 = xNextExpireTime - xTimeNow;
  501. vQueueWaitForMessageRestricted (xTimerQueue.11_4, _5, xListWasEmpty);
  502. _6 = xTaskResumeAll ();
  503. if (_6 == 0)
  504. goto <bb 12>; [INV]
  505. else
  506. goto <bb 13>; [INV]
  507. <bb 12> :
  508. _7 = 3758157060B;
  509. *_7 = 268435456;
  510. __asm__ __volatile__("dsb" : : : "memory");
  511. __asm__ __volatile__("isb");
  512. <bb 13> :
  513. goto <bb 15>; [INV]
  514. <bb 14> :
  515. xTaskResumeAll ();
  516. <bb 15> :
  517. xTimerListsWereSwitched = {CLOBBER};
  518. return;
  519. }
  520. prvTimerTask (void * pvParameters)
  521. {
  522. BaseType_t xListWasEmpty;
  523. TickType_t xNextExpireTime;
  524. <bb 2> :
  525. xNextExpireTime = prvGetNextExpireTime (&xListWasEmpty);
  526. xListWasEmpty.7_1 = xListWasEmpty;
  527. prvProcessTimerOrBlockTask (xNextExpireTime, xListWasEmpty.7_1);
  528. prvProcessReceivedCommands ();
  529. goto <bb 2>; [INV]
  530. }
  531. prvProcessExpiredTimer (const TickType_t xNextExpireTime, const TickType_t xTimeNow)
  532. {
  533. struct Timer_t * const pxTimer;
  534. <bb 2> :
  535. pxCurrentTimerList.6_1 = pxCurrentTimerList;
  536. _2 = pxCurrentTimerList.6_1->xListEnd.pxNext;
  537. pxTimer = _2->pvOwner;
  538. _3 = &pxTimer->xTimerListItem;
  539. uxListRemove (_3);
  540. _4 = pxTimer->ucStatus;
  541. _5 = (int) _4;
  542. _6 = _5 & 4;
  543. if (_6 != 0)
  544. goto <bb 3>; [INV]
  545. else
  546. goto <bb 4>; [INV]
  547. <bb 3> :
  548. prvReloadTimer (pxTimer, xNextExpireTime, xTimeNow);
  549. goto <bb 5>; [INV]
  550. <bb 4> :
  551. _7 = pxTimer->ucStatus;
  552. _8 = _7 & 254;
  553. pxTimer->ucStatus = _8;
  554. <bb 5> :
  555. _9 = pxTimer->pxCallbackFunction;
  556. _9 (pxTimer);
  557. return;
  558. }
  559. prvReloadTimer (struct Timer_t * const pxTimer, TickType_t xExpiredTime, const TickType_t xTimeNow)
  560. {
  561. <bb 2> :
  562. goto <bb 4>; [INV]
  563. <bb 3> :
  564. _1 = pxTimer->xTimerPeriodInTicks;
  565. xExpiredTime = xExpiredTime + _1;
  566. _2 = pxTimer->pxCallbackFunction;
  567. _2 (pxTimer);
  568. <bb 4> :
  569. _3 = pxTimer->xTimerPeriodInTicks;
  570. _4 = xExpiredTime + _3;
  571. _5 = prvInsertTimerInActiveList (pxTimer, _4, xTimeNow, xExpiredTime);
  572. if (_5 != 0)
  573. goto <bb 3>; [INV]
  574. else
  575. goto <bb 5>; [INV]
  576. <bb 5> :
  577. return;
  578. }
  579. pcTimerGetName (struct tmrTimerControl * xTimer)
  580. {
  581. struct Timer_t * pxTimer;
  582. const char * D.6695;
  583. <bb 2> :
  584. pxTimer = xTimer;
  585. if (xTimer == 0B)
  586. goto <bb 3>; [INV]
  587. else
  588. goto <bb 5>; [INV]
  589. <bb 3> :
  590. vPortRaiseBASEPRI ();
  591. <bb 4> :
  592. goto <bb 4>; [INV]
  593. <bb 5> :
  594. D.6695 = pxTimer->pcTimerName;
  595. <bb 6> :
  596. <L3>:
  597. return D.6695;
  598. }
  599. xTimerGetExpiryTime (struct tmrTimerControl * xTimer)
  600. {
  601. TickType_t xReturn;
  602. struct Timer_t * pxTimer;
  603. TickType_t D.6691;
  604. <bb 2> :
  605. pxTimer = xTimer;
  606. if (xTimer == 0B)
  607. goto <bb 3>; [INV]
  608. else
  609. goto <bb 5>; [INV]
  610. <bb 3> :
  611. vPortRaiseBASEPRI ();
  612. <bb 4> :
  613. goto <bb 4>; [INV]
  614. <bb 5> :
  615. xReturn = pxTimer->xTimerListItem.xItemValue;
  616. D.6691 = xReturn;
  617. <bb 6> :
  618. <L3>:
  619. return D.6691;
  620. }
  621. uxTimerGetReloadMode (struct tmrTimerControl * xTimer)
  622. {
  623. UBaseType_t uxReturn;
  624. struct Timer_t * pxTimer;
  625. UBaseType_t D.6687;
  626. <bb 2> :
  627. pxTimer = xTimer;
  628. if (xTimer == 0B)
  629. goto <bb 3>; [INV]
  630. else
  631. goto <bb 5>; [INV]
  632. <bb 3> :
  633. vPortRaiseBASEPRI ();
  634. <bb 4> :
  635. goto <bb 4>; [INV]
  636. <bb 5> :
  637. vPortEnterCritical ();
  638. _1 = pxTimer->ucStatus;
  639. _2 = (int) _1;
  640. _3 = _2 & 4;
  641. if (_3 == 0)
  642. goto <bb 6>; [INV]
  643. else
  644. goto <bb 7>; [INV]
  645. <bb 6> :
  646. uxReturn = 0;
  647. goto <bb 8>; [INV]
  648. <bb 7> :
  649. uxReturn = 1;
  650. <bb 8> :
  651. vPortExitCritical ();
  652. D.6687 = uxReturn;
  653. <bb 9> :
  654. <L6>:
  655. return D.6687;
  656. }
  657. vTimerSetReloadMode (struct tmrTimerControl * xTimer, const UBaseType_t uxAutoReload)
  658. {
  659. struct Timer_t * pxTimer;
  660. <bb 2> :
  661. pxTimer = xTimer;
  662. if (xTimer == 0B)
  663. goto <bb 3>; [INV]
  664. else
  665. goto <bb 5>; [INV]
  666. <bb 3> :
  667. vPortRaiseBASEPRI ();
  668. <bb 4> :
  669. goto <bb 4>; [INV]
  670. <bb 5> :
  671. vPortEnterCritical ();
  672. if (uxAutoReload != 0)
  673. goto <bb 6>; [INV]
  674. else
  675. goto <bb 7>; [INV]
  676. <bb 6> :
  677. _1 = pxTimer->ucStatus;
  678. _2 = _1 | 4;
  679. pxTimer->ucStatus = _2;
  680. goto <bb 8>; [INV]
  681. <bb 7> :
  682. _3 = pxTimer->ucStatus;
  683. _4 = _3 & 251;
  684. pxTimer->ucStatus = _4;
  685. <bb 8> :
  686. vPortExitCritical ();
  687. return;
  688. }
  689. xTimerGetPeriod (struct tmrTimerControl * xTimer)
  690. {
  691. struct Timer_t * pxTimer;
  692. TickType_t D.6675;
  693. <bb 2> :
  694. pxTimer = xTimer;
  695. if (xTimer == 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. D.6675 = pxTimer->xTimerPeriodInTicks;
  705. <bb 6> :
  706. <L3>:
  707. return D.6675;
  708. }
  709. xTimerGetTimerDaemonTaskHandle ()
  710. {
  711. struct tskTaskControlBlock * D.6671;
  712. <bb 2> :
  713. xTimerTaskHandle.5_1 = xTimerTaskHandle;
  714. if (xTimerTaskHandle.5_1 == 0B)
  715. goto <bb 3>; [INV]
  716. else
  717. goto <bb 5>; [INV]
  718. <bb 3> :
  719. vPortRaiseBASEPRI ();
  720. <bb 4> :
  721. goto <bb 4>; [INV]
  722. <bb 5> :
  723. D.6671 = xTimerTaskHandle;
  724. <bb 6> :
  725. <L3>:
  726. return D.6671;
  727. }
  728. xTimerGenericCommand (struct tmrTimerControl * xTimer, const BaseType_t xCommandID, const TickType_t xOptionalValue, BaseType_t * const pxHigherPriorityTaskWoken, const TickType_t xTicksToWait)
  729. {
  730. struct DaemonTaskMessage_t xMessage;
  731. BaseType_t xReturn;
  732. BaseType_t D.6666;
  733. <bb 2> :
  734. xReturn = 0;
  735. if (xTimer == 0B)
  736. goto <bb 3>; [INV]
  737. else
  738. goto <bb 5>; [INV]
  739. <bb 3> :
  740. vPortRaiseBASEPRI ();
  741. <bb 4> :
  742. goto <bb 4>; [INV]
  743. <bb 5> :
  744. xTimerQueue.1_1 = xTimerQueue;
  745. if (xTimerQueue.1_1 != 0B)
  746. goto <bb 6>; [INV]
  747. else
  748. goto <bb 11>; [INV]
  749. <bb 6> :
  750. xMessage.xMessageID = xCommandID;
  751. xMessage.u.xTimerParameters.xMessageValue = xOptionalValue;
  752. xMessage.u.xTimerParameters.pxTimer = xTimer;
  753. if (xCommandID <= 5)
  754. goto <bb 7>; [INV]
  755. else
  756. goto <bb 10>; [INV]
  757. <bb 7> :
  758. _2 = xTaskGetSchedulerState ();
  759. if (_2 == 2)
  760. goto <bb 8>; [INV]
  761. else
  762. goto <bb 9>; [INV]
  763. <bb 8> :
  764. xTimerQueue.2_3 = xTimerQueue;
  765. xReturn = xQueueGenericSend (xTimerQueue.2_3, &xMessage, xTicksToWait, 0);
  766. goto <bb 11>; [INV]
  767. <bb 9> :
  768. xTimerQueue.3_4 = xTimerQueue;
  769. xReturn = xQueueGenericSend (xTimerQueue.3_4, &xMessage, 0, 0);
  770. goto <bb 11>; [INV]
  771. <bb 10> :
  772. xTimerQueue.4_5 = xTimerQueue;
  773. xReturn = xQueueGenericSendFromISR (xTimerQueue.4_5, &xMessage, pxHigherPriorityTaskWoken, 0);
  774. <bb 11> :
  775. D.6666 = xReturn;
  776. xMessage = {CLOBBER};
  777. <bb 12> :
  778. <L13>:
  779. return D.6666;
  780. }
  781. 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)
  782. {
  783. <bb 2> :
  784. if (xTimerPeriodInTicks == 0)
  785. goto <bb 3>; [INV]
  786. else
  787. goto <bb 5>; [INV]
  788. <bb 3> :
  789. vPortRaiseBASEPRI ();
  790. <bb 4> :
  791. goto <bb 4>; [INV]
  792. <bb 5> :
  793. prvCheckForValidListAndQueue ();
  794. pxNewTimer->pcTimerName = pcTimerName;
  795. pxNewTimer->xTimerPeriodInTicks = xTimerPeriodInTicks;
  796. pxNewTimer->pvTimerID = pvTimerID;
  797. pxNewTimer->pxCallbackFunction = pxCallbackFunction;
  798. _1 = &pxNewTimer->xTimerListItem;
  799. vListInitialiseItem (_1);
  800. if (uxAutoReload != 0)
  801. goto <bb 6>; [INV]
  802. else
  803. goto <bb 7>; [INV]
  804. <bb 6> :
  805. _2 = pxNewTimer->ucStatus;
  806. _3 = _2 | 4;
  807. pxNewTimer->ucStatus = _3;
  808. <bb 7> :
  809. return;
  810. }
  811. xTimerCreate (const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, void (*TimerCallbackFunction_t) (struct tmrTimerControl *) pxCallbackFunction)
  812. {
  813. struct Timer_t * pxNewTimer;
  814. struct tmrTimerControl * D.6649;
  815. <bb 2> :
  816. pxNewTimer = pvPortMalloc (44);
  817. if (pxNewTimer != 0B)
  818. goto <bb 3>; [INV]
  819. else
  820. goto <bb 4>; [INV]
  821. <bb 3> :
  822. pxNewTimer->ucStatus = 0;
  823. prvInitialiseNewTimer (pcTimerName, xTimerPeriodInTicks, uxAutoReload, pvTimerID, pxCallbackFunction, pxNewTimer);
  824. <bb 4> :
  825. D.6649 = pxNewTimer;
  826. <bb 5> :
  827. <L2>:
  828. return D.6649;
  829. }
  830. xTimerCreateTimerTask ()
  831. {
  832. BaseType_t xReturn;
  833. BaseType_t D.6645;
  834. <bb 2> :
  835. xReturn = 0;
  836. prvCheckForValidListAndQueue ();
  837. xTimerQueue.0_1 = xTimerQueue;
  838. if (xTimerQueue.0_1 != 0B)
  839. goto <bb 3>; [INV]
  840. else
  841. goto <bb 4>; [INV]
  842. <bb 3> :
  843. xReturn = xTaskCreate (prvTimerTask, "Tmr Svc", 180, 0B, 2, &xTimerTaskHandle);
  844. <bb 4> :
  845. if (xReturn == 0)
  846. goto <bb 5>; [INV]
  847. else
  848. goto <bb 7>; [INV]
  849. <bb 5> :
  850. vPortRaiseBASEPRI ();
  851. <bb 6> :
  852. goto <bb 6>; [INV]
  853. <bb 7> :
  854. D.6645 = xReturn;
  855. <bb 8> :
  856. <L6>:
  857. return D.6645;
  858. }
  859. __attribute__((always_inline))
  860. vPortRaiseBASEPRI ()
  861. {
  862. uint32_t ulNewBASEPRI;
  863. <bb 2> :
  864. __asm__ __volatile__(" mov %0, %1
  865. msr basepri, %0
  866. isb
  867. dsb
  868. " : "=r" ulNewBASEPRI : "i" 16 : "memory");
  869. return;
  870. }