stream_buffer.c.022i.opt_local_passes 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694
  1. ucStreamBufferGetStreamBufferType (struct StreamBufferDef_t * xStreamBuffer)
  2. {
  3. uint8_t D.6587;
  4. unsigned char _1;
  5. uint8_t _4;
  6. <bb 2> :
  7. _1 = xStreamBuffer_3(D)->ucFlags;
  8. _4 = _1 & 1;
  9. <bb 3> :
  10. <L0>:
  11. return _4;
  12. }
  13. vStreamBufferSetStreamBufferNumber (struct StreamBufferDef_t * xStreamBuffer, UBaseType_t uxStreamBufferNumber)
  14. {
  15. <bb 2> :
  16. xStreamBuffer_2(D)->uxStreamBufferNumber = uxStreamBufferNumber_3(D);
  17. return;
  18. }
  19. uxStreamBufferGetStreamBufferNumber (struct StreamBufferDef_t * xStreamBuffer)
  20. {
  21. UBaseType_t D.6585;
  22. UBaseType_t _3;
  23. <bb 2> :
  24. _3 = xStreamBuffer_2(D)->uxStreamBufferNumber;
  25. <bb 3> :
  26. <L0>:
  27. return _3;
  28. }
  29. prvInitialiseNewStreamBuffer (struct StreamBuffer_t * const pxStreamBuffer, uint8_t * const pucBuffer, size_t xBufferSizeBytes, size_t xTriggerLevelBytes, uint8_t ucFlags)
  30. {
  31. const BaseType_t xWriteValue;
  32. void * _1;
  33. <bb 2> :
  34. xWriteValue_2 = 85;
  35. _1 = memset (pucBuffer_4(D), xWriteValue_2, xBufferSizeBytes_5(D));
  36. if (pucBuffer_4(D) != _1)
  37. goto <bb 3>; [INV]
  38. else
  39. goto <bb 5>; [INV]
  40. <bb 3> :
  41. vPortRaiseBASEPRI ();
  42. <bb 4> :
  43. goto <bb 4>; [INV]
  44. <bb 5> :
  45. memset (pxStreamBuffer_7(D), 0, 36);
  46. pxStreamBuffer_7(D)->pucBuffer = pucBuffer_4(D);
  47. pxStreamBuffer_7(D)->xLength = xBufferSizeBytes_5(D);
  48. pxStreamBuffer_7(D)->xTriggerLevelBytes = xTriggerLevelBytes_11(D);
  49. pxStreamBuffer_7(D)->ucFlags = ucFlags_13(D);
  50. return;
  51. }
  52. prvBytesInBuffer (const struct StreamBuffer_t * const pxStreamBuffer)
  53. {
  54. size_t xCount;
  55. size_t D.6581;
  56. unsigned int D.6577;
  57. unsigned int _1;
  58. unsigned int _2;
  59. unsigned int _3;
  60. unsigned int _4;
  61. unsigned int _9;
  62. size_t _12;
  63. <bb 2> :
  64. _1 = pxStreamBuffer_7(D)->xLength;
  65. _2 ={v} pxStreamBuffer_7(D)->xHead;
  66. xCount_8 = _1 + _2;
  67. _9 ={v} pxStreamBuffer_7(D)->xTail;
  68. xCount_10 = xCount_8 - _9;
  69. _3 = pxStreamBuffer_7(D)->xLength;
  70. if (xCount_10 >= _3)
  71. goto <bb 3>; [INV]
  72. else
  73. goto <bb 4>; [INV]
  74. <bb 3> :
  75. _4 = pxStreamBuffer_7(D)->xLength;
  76. xCount_11 = xCount_10 - _4;
  77. <bb 4> :
  78. # xCount_5 = PHI <xCount_10(2), xCount_11(3)>
  79. _12 = xCount_5;
  80. <bb 5> :
  81. <L3>:
  82. return _12;
  83. }
  84. prvReadBytesFromBuffer (struct StreamBuffer_t * pxStreamBuffer, uint8_t * pucData, size_t xCount, size_t xTail)
  85. {
  86. size_t xFirstLength;
  87. size_t D.6575;
  88. unsigned int _1;
  89. unsigned int _2;
  90. unsigned int _3;
  91. unsigned int _4;
  92. uint8_t * _5;
  93. uint8_t * _6;
  94. uint8_t * _7;
  95. uint8_t * _8;
  96. unsigned int _9;
  97. unsigned int _10;
  98. unsigned int _11;
  99. size_t _24;
  100. <bb 2> :
  101. if (xCount_14(D) == 0)
  102. goto <bb 3>; [INV]
  103. else
  104. goto <bb 5>; [INV]
  105. <bb 3> :
  106. vPortRaiseBASEPRI ();
  107. <bb 4> :
  108. goto <bb 4>; [INV]
  109. <bb 5> :
  110. _1 = pxStreamBuffer_16(D)->xLength;
  111. _2 = _1 - xTail_17(D);
  112. xFirstLength_18 = MIN_EXPR <xCount_14(D), _2>;
  113. if (xFirstLength_18 > xCount_14(D))
  114. goto <bb 6>; [INV]
  115. else
  116. goto <bb 8>; [INV]
  117. <bb 6> :
  118. vPortRaiseBASEPRI ();
  119. <bb 7> :
  120. goto <bb 7>; [INV]
  121. <bb 8> :
  122. _3 = xTail_17(D) + xFirstLength_18;
  123. _4 = pxStreamBuffer_16(D)->xLength;
  124. if (_3 > _4)
  125. goto <bb 9>; [INV]
  126. else
  127. goto <bb 11>; [INV]
  128. <bb 9> :
  129. vPortRaiseBASEPRI ();
  130. <bb 10> :
  131. goto <bb 10>; [INV]
  132. <bb 11> :
  133. _5 = pxStreamBuffer_16(D)->pucBuffer;
  134. _6 = _5 + xTail_17(D);
  135. memcpy (pucData_19(D), _6, xFirstLength_18);
  136. if (xCount_14(D) > xFirstLength_18)
  137. goto <bb 12>; [INV]
  138. else
  139. goto <bb 13>; [INV]
  140. <bb 12> :
  141. _7 = pucData_19(D) + xFirstLength_18;
  142. _8 = pxStreamBuffer_16(D)->pucBuffer;
  143. _9 = xCount_14(D) - xFirstLength_18;
  144. memcpy (_7, _8, _9);
  145. <bb 13> :
  146. xTail_22 = xTail_17(D) + xCount_14(D);
  147. _10 = pxStreamBuffer_16(D)->xLength;
  148. if (xTail_22 >= _10)
  149. goto <bb 14>; [INV]
  150. else
  151. goto <bb 15>; [INV]
  152. <bb 14> :
  153. _11 = pxStreamBuffer_16(D)->xLength;
  154. xTail_23 = xTail_22 - _11;
  155. <bb 15> :
  156. # xTail_12 = PHI <xTail_22(13), xTail_23(14)>
  157. _24 = xTail_12;
  158. <bb 16> :
  159. <L14>:
  160. return _24;
  161. }
  162. prvWriteBytesToBuffer (struct StreamBuffer_t * const pxStreamBuffer, const uint8_t * pucData, size_t xCount, size_t xHead)
  163. {
  164. size_t xFirstLength;
  165. size_t D.6562;
  166. unsigned int _1;
  167. unsigned int _2;
  168. unsigned int _3;
  169. unsigned int _4;
  170. uint8_t * _5;
  171. uint8_t * _6;
  172. unsigned int _7;
  173. unsigned int _8;
  174. uint8_t * _9;
  175. const uint8_t * _10;
  176. unsigned int _11;
  177. unsigned int _12;
  178. unsigned int _13;
  179. size_t _27;
  180. <bb 2> :
  181. if (xCount_16(D) == 0)
  182. goto <bb 3>; [INV]
  183. else
  184. goto <bb 5>; [INV]
  185. <bb 3> :
  186. vPortRaiseBASEPRI ();
  187. <bb 4> :
  188. goto <bb 4>; [INV]
  189. <bb 5> :
  190. _1 = pxStreamBuffer_18(D)->xLength;
  191. _2 = _1 - xHead_19(D);
  192. xFirstLength_20 = MIN_EXPR <xCount_16(D), _2>;
  193. _3 = xHead_19(D) + xFirstLength_20;
  194. _4 = pxStreamBuffer_18(D)->xLength;
  195. if (_3 > _4)
  196. goto <bb 6>; [INV]
  197. else
  198. goto <bb 8>; [INV]
  199. <bb 6> :
  200. vPortRaiseBASEPRI ();
  201. <bb 7> :
  202. goto <bb 7>; [INV]
  203. <bb 8> :
  204. _5 = pxStreamBuffer_18(D)->pucBuffer;
  205. _6 = _5 + xHead_19(D);
  206. memcpy (_6, pucData_21(D), xFirstLength_20);
  207. if (xCount_16(D) > xFirstLength_20)
  208. goto <bb 9>; [INV]
  209. else
  210. goto <bb 13>; [INV]
  211. <bb 9> :
  212. _7 = xCount_16(D) - xFirstLength_20;
  213. _8 = pxStreamBuffer_18(D)->xLength;
  214. if (_7 > _8)
  215. goto <bb 10>; [INV]
  216. else
  217. goto <bb 12>; [INV]
  218. <bb 10> :
  219. vPortRaiseBASEPRI ();
  220. <bb 11> :
  221. goto <bb 11>; [INV]
  222. <bb 12> :
  223. _9 = pxStreamBuffer_18(D)->pucBuffer;
  224. _10 = pucData_21(D) + xFirstLength_20;
  225. _11 = xCount_16(D) - xFirstLength_20;
  226. memcpy (_9, _10, _11);
  227. <bb 13> :
  228. xHead_25 = xHead_19(D) + xCount_16(D);
  229. _12 = pxStreamBuffer_18(D)->xLength;
  230. if (xHead_25 >= _12)
  231. goto <bb 14>; [INV]
  232. else
  233. goto <bb 15>; [INV]
  234. <bb 14> :
  235. _13 = pxStreamBuffer_18(D)->xLength;
  236. xHead_26 = xHead_25 - _13;
  237. <bb 15> :
  238. # xHead_14 = PHI <xHead_25(13), xHead_26(14)>
  239. _27 = xHead_14;
  240. <bb 16> :
  241. <L15>:
  242. return _27;
  243. }
  244. xStreamBufferReceiveCompletedFromISR (struct StreamBufferDef_t * xStreamBuffer, BaseType_t * pxHigherPriorityTaskWoken)
  245. {
  246. UBaseType_t uxSavedInterruptStatus;
  247. BaseType_t xReturn;
  248. struct StreamBuffer_t * const pxStreamBuffer;
  249. BaseType_t D.6548;
  250. struct tskTaskControlBlock * _1;
  251. struct tskTaskControlBlock * _2;
  252. BaseType_t _16;
  253. <bb 2> :
  254. pxStreamBuffer_6 = xStreamBuffer_5(D);
  255. if (pxStreamBuffer_6 == 0B)
  256. goto <bb 3>; [INV]
  257. else
  258. goto <bb 5>; [INV]
  259. <bb 3> :
  260. vPortRaiseBASEPRI ();
  261. <bb 4> :
  262. goto <bb 4>; [INV]
  263. <bb 5> :
  264. uxSavedInterruptStatus_9 = ulPortRaiseBASEPRI ();
  265. _1 ={v} pxStreamBuffer_6->xTaskWaitingToSend;
  266. if (_1 != 0B)
  267. goto <bb 6>; [INV]
  268. else
  269. goto <bb 7>; [INV]
  270. <bb 6> :
  271. _2 ={v} pxStreamBuffer_6->xTaskWaitingToSend;
  272. xTaskGenericNotifyFromISR (_2, 0, 0, 0, 0B, pxHigherPriorityTaskWoken_11(D));
  273. pxStreamBuffer_6->xTaskWaitingToSend ={v} 0B;
  274. xReturn_14 = 1;
  275. goto <bb 8>; [INV]
  276. <bb 7> :
  277. xReturn_10 = 0;
  278. <bb 8> :
  279. # xReturn_3 = PHI <xReturn_14(6), xReturn_10(7)>
  280. vPortSetBASEPRI (uxSavedInterruptStatus_9);
  281. _16 = xReturn_3;
  282. <bb 9> :
  283. <L6>:
  284. return _16;
  285. }
  286. xStreamBufferSendCompletedFromISR (struct StreamBufferDef_t * xStreamBuffer, BaseType_t * pxHigherPriorityTaskWoken)
  287. {
  288. UBaseType_t uxSavedInterruptStatus;
  289. BaseType_t xReturn;
  290. struct StreamBuffer_t * const pxStreamBuffer;
  291. BaseType_t D.6541;
  292. struct tskTaskControlBlock * _1;
  293. struct tskTaskControlBlock * _2;
  294. BaseType_t _16;
  295. <bb 2> :
  296. pxStreamBuffer_6 = xStreamBuffer_5(D);
  297. if (pxStreamBuffer_6 == 0B)
  298. goto <bb 3>; [INV]
  299. else
  300. goto <bb 5>; [INV]
  301. <bb 3> :
  302. vPortRaiseBASEPRI ();
  303. <bb 4> :
  304. goto <bb 4>; [INV]
  305. <bb 5> :
  306. uxSavedInterruptStatus_9 = ulPortRaiseBASEPRI ();
  307. _1 ={v} pxStreamBuffer_6->xTaskWaitingToReceive;
  308. if (_1 != 0B)
  309. goto <bb 6>; [INV]
  310. else
  311. goto <bb 7>; [INV]
  312. <bb 6> :
  313. _2 ={v} pxStreamBuffer_6->xTaskWaitingToReceive;
  314. xTaskGenericNotifyFromISR (_2, 0, 0, 0, 0B, pxHigherPriorityTaskWoken_11(D));
  315. pxStreamBuffer_6->xTaskWaitingToReceive ={v} 0B;
  316. xReturn_14 = 1;
  317. goto <bb 8>; [INV]
  318. <bb 7> :
  319. xReturn_10 = 0;
  320. <bb 8> :
  321. # xReturn_3 = PHI <xReturn_14(6), xReturn_10(7)>
  322. vPortSetBASEPRI (uxSavedInterruptStatus_9);
  323. _16 = xReturn_3;
  324. <bb 9> :
  325. <L6>:
  326. return _16;
  327. }
  328. xStreamBufferIsFull (struct StreamBufferDef_t * xStreamBuffer)
  329. {
  330. const struct StreamBuffer_t * const pxStreamBuffer;
  331. size_t xBytesToStoreMessageLength;
  332. BaseType_t xReturn;
  333. BaseType_t D.6534;
  334. unsigned char _1;
  335. int _2;
  336. int _3;
  337. unsigned int _4;
  338. BaseType_t _15;
  339. <bb 2> :
  340. pxStreamBuffer_8 = xStreamBuffer_7(D);
  341. if (pxStreamBuffer_8 == 0B)
  342. goto <bb 3>; [INV]
  343. else
  344. goto <bb 5>; [INV]
  345. <bb 3> :
  346. vPortRaiseBASEPRI ();
  347. <bb 4> :
  348. goto <bb 4>; [INV]
  349. <bb 5> :
  350. _1 = pxStreamBuffer_8->ucFlags;
  351. _2 = (int) _1;
  352. _3 = _2 & 1;
  353. if (_3 != 0)
  354. goto <bb 6>; [INV]
  355. else
  356. goto <bb 7>; [INV]
  357. <bb 6> :
  358. xBytesToStoreMessageLength_11 = 4;
  359. goto <bb 8>; [INV]
  360. <bb 7> :
  361. xBytesToStoreMessageLength_10 = 0;
  362. <bb 8> :
  363. # xBytesToStoreMessageLength_6 = PHI <xBytesToStoreMessageLength_11(6), xBytesToStoreMessageLength_10(7)>
  364. _4 = xStreamBufferSpacesAvailable (xStreamBuffer_7(D));
  365. if (xBytesToStoreMessageLength_6 >= _4)
  366. goto <bb 9>; [INV]
  367. else
  368. goto <bb 10>; [INV]
  369. <bb 9> :
  370. xReturn_14 = 1;
  371. goto <bb 11>; [INV]
  372. <bb 10> :
  373. xReturn_13 = 0;
  374. <bb 11> :
  375. # xReturn_5 = PHI <xReturn_14(9), xReturn_13(10)>
  376. _15 = xReturn_5;
  377. <bb 12> :
  378. <L9>:
  379. return _15;
  380. }
  381. xStreamBufferIsEmpty (struct StreamBufferDef_t * xStreamBuffer)
  382. {
  383. size_t xTail;
  384. BaseType_t xReturn;
  385. const struct StreamBuffer_t * const pxStreamBuffer;
  386. BaseType_t D.6524;
  387. unsigned int _1;
  388. BaseType_t _9;
  389. <bb 2> :
  390. pxStreamBuffer_4 = xStreamBuffer_3(D);
  391. if (pxStreamBuffer_4 == 0B)
  392. goto <bb 3>; [INV]
  393. else
  394. goto <bb 5>; [INV]
  395. <bb 3> :
  396. vPortRaiseBASEPRI ();
  397. <bb 4> :
  398. goto <bb 4>; [INV]
  399. <bb 5> :
  400. xTail_6 ={v} pxStreamBuffer_4->xTail;
  401. _1 ={v} pxStreamBuffer_4->xHead;
  402. if (xTail_6 == _1)
  403. goto <bb 6>; [INV]
  404. else
  405. goto <bb 7>; [INV]
  406. <bb 6> :
  407. xReturn_8 = 1;
  408. goto <bb 8>; [INV]
  409. <bb 7> :
  410. xReturn_7 = 0;
  411. <bb 8> :
  412. # xReturn_2 = PHI <xReturn_8(6), xReturn_7(7)>
  413. _9 = xReturn_2;
  414. <bb 9> :
  415. <L6>:
  416. return _9;
  417. }
  418. prvReadMessageFromBuffer (struct StreamBuffer_t * pxStreamBuffer, void * pvRxData, size_t xBufferLengthBytes, size_t xBytesAvailable)
  419. {
  420. size_t xNextTail;
  421. size_t xTempNextMessageLength;
  422. size_t xNextMessageLength;
  423. size_t xCount;
  424. size_t D.6516;
  425. unsigned char _1;
  426. int _2;
  427. int _3;
  428. unsigned int _4;
  429. size_t _25;
  430. <bb 2> :
  431. xNextTail_12 ={v} pxStreamBuffer_11(D)->xTail;
  432. _1 = pxStreamBuffer_11(D)->ucFlags;
  433. _2 = (int) _1;
  434. _3 = _2 & 1;
  435. if (_3 != 0)
  436. goto <bb 3>; [INV]
  437. else
  438. goto <bb 5>; [INV]
  439. <bb 3> :
  440. xNextTail_17 = prvReadBytesFromBuffer (pxStreamBuffer_11(D), &xTempNextMessageLength, 4, xNextTail_12);
  441. xNextMessageLength_18 = xTempNextMessageLength;
  442. xBytesAvailable_19 = xBytesAvailable_15(D) + 4294967292;
  443. if (xNextMessageLength_18 > xBufferLengthBytes_13(D))
  444. goto <bb 4>; [INV]
  445. else
  446. goto <bb 6>; [INV]
  447. <bb 4> :
  448. xNextMessageLength_20 = 0;
  449. goto <bb 6>; [INV]
  450. <bb 5> :
  451. xNextMessageLength_14 = xBufferLengthBytes_13(D);
  452. <bb 6> :
  453. # xBytesAvailable_5 = PHI <xBytesAvailable_19(4), xBytesAvailable_15(D)(5), xBytesAvailable_19(3)>
  454. # xNextMessageLength_6 = PHI <xNextMessageLength_20(4), xNextMessageLength_14(5), xNextMessageLength_18(3)>
  455. # xNextTail_7 = PHI <xNextTail_17(4), xNextTail_12(5), xNextTail_17(3)>
  456. xCount_21 = MIN_EXPR <xBytesAvailable_5, xNextMessageLength_6>;
  457. if (xCount_21 != 0)
  458. goto <bb 7>; [INV]
  459. else
  460. goto <bb 8>; [INV]
  461. <bb 7> :
  462. _4 = prvReadBytesFromBuffer (pxStreamBuffer_11(D), pvRxData_22(D), xCount_21, xNextTail_7);
  463. pxStreamBuffer_11(D)->xTail ={v} _4;
  464. <bb 8> :
  465. _25 = xCount_21;
  466. xTempNextMessageLength ={v} {CLOBBER};
  467. <bb 9> :
  468. <L9>:
  469. return _25;
  470. }
  471. xStreamBufferReceiveFromISR (struct StreamBufferDef_t * xStreamBuffer, void * pvRxData, size_t xBufferLengthBytes, BaseType_t * const pxHigherPriorityTaskWoken)
  472. {
  473. UBaseType_t uxSavedInterruptStatus;
  474. size_t xBytesToStoreMessageLength;
  475. size_t xBytesAvailable;
  476. size_t xReceivedLength;
  477. struct StreamBuffer_t * const pxStreamBuffer;
  478. size_t D.6506;
  479. unsigned char _1;
  480. int _2;
  481. int _3;
  482. struct tskTaskControlBlock * _4;
  483. struct tskTaskControlBlock * _5;
  484. size_t _28;
  485. <bb 2> :
  486. pxStreamBuffer_11 = xStreamBuffer_10(D);
  487. xReceivedLength_12 = 0;
  488. if (pvRxData_13(D) == 0B)
  489. goto <bb 3>; [INV]
  490. else
  491. goto <bb 5>; [INV]
  492. <bb 3> :
  493. vPortRaiseBASEPRI ();
  494. <bb 4> :
  495. goto <bb 4>; [INV]
  496. <bb 5> :
  497. if (pxStreamBuffer_11 == 0B)
  498. goto <bb 6>; [INV]
  499. else
  500. goto <bb 8>; [INV]
  501. <bb 6> :
  502. vPortRaiseBASEPRI ();
  503. <bb 7> :
  504. goto <bb 7>; [INV]
  505. <bb 8> :
  506. _1 = pxStreamBuffer_11->ucFlags;
  507. _2 = (int) _1;
  508. _3 = _2 & 1;
  509. if (_3 != 0)
  510. goto <bb 9>; [INV]
  511. else
  512. goto <bb 10>; [INV]
  513. <bb 9> :
  514. xBytesToStoreMessageLength_16 = 4;
  515. goto <bb 11>; [INV]
  516. <bb 10> :
  517. xBytesToStoreMessageLength_15 = 0;
  518. <bb 11> :
  519. # xBytesToStoreMessageLength_7 = PHI <xBytesToStoreMessageLength_16(9), xBytesToStoreMessageLength_15(10)>
  520. xBytesAvailable_18 = prvBytesInBuffer (pxStreamBuffer_11);
  521. if (xBytesAvailable_18 > xBytesToStoreMessageLength_7)
  522. goto <bb 12>; [INV]
  523. else
  524. goto <bb 16>; [INV]
  525. <bb 12> :
  526. xReceivedLength_21 = prvReadMessageFromBuffer (pxStreamBuffer_11, pvRxData_13(D), xBufferLengthBytes_19(D), xBytesAvailable_18);
  527. if (xReceivedLength_21 != 0)
  528. goto <bb 13>; [INV]
  529. else
  530. goto <bb 16>; [INV]
  531. <bb 13> :
  532. uxSavedInterruptStatus_23 = ulPortRaiseBASEPRI ();
  533. _4 ={v} pxStreamBuffer_11->xTaskWaitingToSend;
  534. if (_4 != 0B)
  535. goto <bb 14>; [INV]
  536. else
  537. goto <bb 15>; [INV]
  538. <bb 14> :
  539. _5 ={v} pxStreamBuffer_11->xTaskWaitingToSend;
  540. xTaskGenericNotifyFromISR (_5, 0, 0, 0, 0B, pxHigherPriorityTaskWoken_24(D));
  541. pxStreamBuffer_11->xTaskWaitingToSend ={v} 0B;
  542. <bb 15> :
  543. vPortSetBASEPRI (uxSavedInterruptStatus_23);
  544. <bb 16> :
  545. # xReceivedLength_6 = PHI <xReceivedLength_12(11), xReceivedLength_21(15), xReceivedLength_21(12)>
  546. _28 = xReceivedLength_6;
  547. <bb 17> :
  548. <L17>:
  549. return _28;
  550. }
  551. xStreamBufferNextMessageLengthBytes (struct StreamBufferDef_t * xStreamBuffer)
  552. {
  553. size_t xTempReturn;
  554. size_t xBytesAvailable;
  555. size_t xReturn;
  556. struct StreamBuffer_t * const pxStreamBuffer;
  557. size_t D.6488;
  558. unsigned char _1;
  559. int _2;
  560. int _3;
  561. unsigned int _4;
  562. size_t _17;
  563. <bb 2> :
  564. pxStreamBuffer_8 = xStreamBuffer_7(D);
  565. if (pxStreamBuffer_8 == 0B)
  566. goto <bb 3>; [INV]
  567. else
  568. goto <bb 5>; [INV]
  569. <bb 3> :
  570. vPortRaiseBASEPRI ();
  571. <bb 4> :
  572. goto <bb 4>; [INV]
  573. <bb 5> :
  574. _1 = pxStreamBuffer_8->ucFlags;
  575. _2 = (int) _1;
  576. _3 = _2 & 1;
  577. if (_3 != 0)
  578. goto <bb 6>; [INV]
  579. else
  580. goto <bb 12>; [INV]
  581. <bb 6> :
  582. xBytesAvailable_12 = prvBytesInBuffer (pxStreamBuffer_8);
  583. if (xBytesAvailable_12 > 4)
  584. goto <bb 7>; [INV]
  585. else
  586. goto <bb 8>; [INV]
  587. <bb 7> :
  588. _4 ={v} pxStreamBuffer_8->xTail;
  589. prvReadBytesFromBuffer (pxStreamBuffer_8, &xTempReturn, 4, _4);
  590. xReturn_16 = xTempReturn;
  591. goto <bb 13>; [INV]
  592. <bb 8> :
  593. if (xBytesAvailable_12 != 0)
  594. goto <bb 9>; [INV]
  595. else
  596. goto <bb 11>; [INV]
  597. <bb 9> :
  598. vPortRaiseBASEPRI ();
  599. <bb 10> :
  600. goto <bb 10>; [INV]
  601. <bb 11> :
  602. xReturn_13 = 0;
  603. goto <bb 13>; [INV]
  604. <bb 12> :
  605. xReturn_10 = 0;
  606. <bb 13> :
  607. # xReturn_5 = PHI <xReturn_13(11), xReturn_10(12), xReturn_16(7)>
  608. _17 = xReturn_5;
  609. xTempReturn ={v} {CLOBBER};
  610. <bb 14> :
  611. <L13>:
  612. return _17;
  613. }
  614. xStreamBufferReceive (struct StreamBufferDef_t * xStreamBuffer, void * pvRxData, size_t xBufferLengthBytes, TickType_t xTicksToWait)
  615. {
  616. size_t xBytesToStoreMessageLength;
  617. size_t xBytesAvailable;
  618. size_t xReceivedLength;
  619. struct StreamBuffer_t * const pxStreamBuffer;
  620. size_t D.6476;
  621. unsigned char _1;
  622. int _2;
  623. int _3;
  624. struct tskTaskControlBlock * _4;
  625. struct tskTaskControlBlock * _5;
  626. struct tskTaskControlBlock * _6;
  627. struct tskTaskControlBlock * _7;
  628. size_t _44;
  629. <bb 2> :
  630. pxStreamBuffer_16 = xStreamBuffer_15(D);
  631. xReceivedLength_17 = 0;
  632. if (pvRxData_18(D) == 0B)
  633. goto <bb 3>; [INV]
  634. else
  635. goto <bb 5>; [INV]
  636. <bb 3> :
  637. vPortRaiseBASEPRI ();
  638. <bb 4> :
  639. goto <bb 4>; [INV]
  640. <bb 5> :
  641. if (pxStreamBuffer_16 == 0B)
  642. goto <bb 6>; [INV]
  643. else
  644. goto <bb 8>; [INV]
  645. <bb 6> :
  646. vPortRaiseBASEPRI ();
  647. <bb 7> :
  648. goto <bb 7>; [INV]
  649. <bb 8> :
  650. _1 = pxStreamBuffer_16->ucFlags;
  651. _2 = (int) _1;
  652. _3 = _2 & 1;
  653. if (_3 != 0)
  654. goto <bb 9>; [INV]
  655. else
  656. goto <bb 10>; [INV]
  657. <bb 9> :
  658. xBytesToStoreMessageLength_21 = 4;
  659. goto <bb 11>; [INV]
  660. <bb 10> :
  661. xBytesToStoreMessageLength_20 = 0;
  662. <bb 11> :
  663. # xBytesToStoreMessageLength_10 = PHI <xBytesToStoreMessageLength_21(9), xBytesToStoreMessageLength_20(10)>
  664. if (xTicksToWait_22(D) != 0)
  665. goto <bb 12>; [INV]
  666. else
  667. goto <bb 19>; [INV]
  668. <bb 12> :
  669. vPortEnterCritical ();
  670. xBytesAvailable_27 = prvBytesInBuffer (pxStreamBuffer_16);
  671. if (xBytesAvailable_27 <= xBytesToStoreMessageLength_10)
  672. goto <bb 13>; [INV]
  673. else
  674. goto <bb 17>; [INV]
  675. <bb 13> :
  676. xTaskGenericNotifyStateClear (0B, 0);
  677. _4 ={v} pxStreamBuffer_16->xTaskWaitingToReceive;
  678. if (_4 != 0B)
  679. goto <bb 14>; [INV]
  680. else
  681. goto <bb 16>; [INV]
  682. <bb 14> :
  683. vPortRaiseBASEPRI ();
  684. <bb 15> :
  685. goto <bb 15>; [INV]
  686. <bb 16> :
  687. _5 = xTaskGetCurrentTaskHandle ();
  688. pxStreamBuffer_16->xTaskWaitingToReceive ={v} _5;
  689. <bb 17> :
  690. vPortExitCritical ();
  691. if (xBytesAvailable_27 <= xBytesToStoreMessageLength_10)
  692. goto <bb 18>; [INV]
  693. else
  694. goto <bb 20>; [INV]
  695. <bb 18> :
  696. xTaskGenericNotifyWait (0, 0, 0, 0B, xTicksToWait_22(D));
  697. pxStreamBuffer_16->xTaskWaitingToReceive ={v} 0B;
  698. xBytesAvailable_36 = prvBytesInBuffer (pxStreamBuffer_16);
  699. goto <bb 20>; [INV]
  700. <bb 19> :
  701. xBytesAvailable_24 = prvBytesInBuffer (pxStreamBuffer_16);
  702. <bb 20> :
  703. # xBytesAvailable_9 = PHI <xBytesAvailable_36(18), xBytesAvailable_24(19), xBytesAvailable_27(17)>
  704. if (xBytesAvailable_9 > xBytesToStoreMessageLength_10)
  705. goto <bb 21>; [INV]
  706. else
  707. goto <bb 25>; [INV]
  708. <bb 21> :
  709. xReceivedLength_39 = prvReadMessageFromBuffer (pxStreamBuffer_16, pvRxData_18(D), xBufferLengthBytes_37(D), xBytesAvailable_9);
  710. if (xReceivedLength_39 != 0)
  711. goto <bb 22>; [INV]
  712. else
  713. goto <bb 25>; [INV]
  714. <bb 22> :
  715. vTaskSuspendAll ();
  716. _6 ={v} pxStreamBuffer_16->xTaskWaitingToSend;
  717. if (_6 != 0B)
  718. goto <bb 23>; [INV]
  719. else
  720. goto <bb 24>; [INV]
  721. <bb 23> :
  722. _7 ={v} pxStreamBuffer_16->xTaskWaitingToSend;
  723. xTaskGenericNotify (_7, 0, 0, 0, 0B);
  724. pxStreamBuffer_16->xTaskWaitingToSend ={v} 0B;
  725. <bb 24> :
  726. xTaskResumeAll ();
  727. <bb 25> :
  728. # xReceivedLength_8 = PHI <xReceivedLength_17(20), xReceivedLength_39(24), xReceivedLength_39(21)>
  729. _44 = xReceivedLength_8;
  730. <bb 26> :
  731. <L29>:
  732. return _44;
  733. }
  734. prvWriteMessageToBuffer (struct StreamBuffer_t * const pxStreamBuffer, const void * pvTxData, size_t xDataLengthBytes, size_t xSpace, size_t xRequiredSpace)
  735. {
  736. size_t xNextHead;
  737. size_t D.6448;
  738. unsigned char _1;
  739. int _2;
  740. int _3;
  741. unsigned int xDataLengthBytes.2_4;
  742. unsigned int _5;
  743. unsigned int xDataLengthBytes.3_6;
  744. unsigned int xDataLengthBytes.4_7;
  745. unsigned int _8;
  746. size_t _24;
  747. <bb 2> :
  748. xNextHead_14 ={v} pxStreamBuffer_13(D)->xHead;
  749. _1 = pxStreamBuffer_13(D)->ucFlags;
  750. _2 = (int) _1;
  751. _3 = _2 & 1;
  752. if (_3 != 0)
  753. goto <bb 3>; [INV]
  754. else
  755. goto <bb 6>; [INV]
  756. <bb 3> :
  757. if (xSpace_15(D) >= xRequiredSpace_17(D))
  758. goto <bb 4>; [INV]
  759. else
  760. goto <bb 5>; [INV]
  761. <bb 4> :
  762. xNextHead_20 = prvWriteBytesToBuffer (pxStreamBuffer_13(D), &xDataLengthBytes, 4, xNextHead_14);
  763. goto <bb 7>; [INV]
  764. <bb 5> :
  765. xDataLengthBytes = 0;
  766. goto <bb 7>; [INV]
  767. <bb 6> :
  768. xDataLengthBytes.2_4 = xDataLengthBytes;
  769. _5 = MIN_EXPR <xSpace_15(D), xDataLengthBytes.2_4>;
  770. xDataLengthBytes = _5;
  771. <bb 7> :
  772. # xNextHead_9 = PHI <xNextHead_14(5), xNextHead_14(6), xNextHead_20(4)>
  773. xDataLengthBytes.3_6 = xDataLengthBytes;
  774. if (xDataLengthBytes.3_6 != 0)
  775. goto <bb 8>; [INV]
  776. else
  777. goto <bb 9>; [INV]
  778. <bb 8> :
  779. xDataLengthBytes.4_7 = xDataLengthBytes;
  780. _8 = prvWriteBytesToBuffer (pxStreamBuffer_13(D), pvTxData_21(D), xDataLengthBytes.4_7, xNextHead_9);
  781. pxStreamBuffer_13(D)->xHead ={v} _8;
  782. <bb 9> :
  783. _24 = xDataLengthBytes;
  784. <bb 10> :
  785. <L8>:
  786. return _24;
  787. }
  788. xStreamBufferSendFromISR (struct StreamBufferDef_t * xStreamBuffer, const void * pvTxData, size_t xDataLengthBytes, BaseType_t * const pxHigherPriorityTaskWoken)
  789. {
  790. UBaseType_t uxSavedInterruptStatus;
  791. size_t xRequiredSpace;
  792. size_t xSpace;
  793. size_t xReturn;
  794. struct StreamBuffer_t * const pxStreamBuffer;
  795. size_t D.6436;
  796. unsigned char _1;
  797. int _2;
  798. int _3;
  799. unsigned int _4;
  800. unsigned int _5;
  801. struct tskTaskControlBlock * _6;
  802. struct tskTaskControlBlock * _7;
  803. size_t _29;
  804. <bb 2> :
  805. pxStreamBuffer_12 = xStreamBuffer_11(D);
  806. xRequiredSpace_14 = xDataLengthBytes_13(D);
  807. if (pvTxData_15(D) == 0B)
  808. goto <bb 3>; [INV]
  809. else
  810. goto <bb 5>; [INV]
  811. <bb 3> :
  812. vPortRaiseBASEPRI ();
  813. <bb 4> :
  814. goto <bb 4>; [INV]
  815. <bb 5> :
  816. if (pxStreamBuffer_12 == 0B)
  817. goto <bb 6>; [INV]
  818. else
  819. goto <bb 8>; [INV]
  820. <bb 6> :
  821. vPortRaiseBASEPRI ();
  822. <bb 7> :
  823. goto <bb 7>; [INV]
  824. <bb 8> :
  825. _1 = pxStreamBuffer_12->ucFlags;
  826. _2 = (int) _1;
  827. _3 = _2 & 1;
  828. if (_3 != 0)
  829. goto <bb 9>; [INV]
  830. else
  831. goto <bb 10>; [INV]
  832. <bb 9> :
  833. xRequiredSpace_17 = xRequiredSpace_14 + 4;
  834. <bb 10> :
  835. # xRequiredSpace_8 = PHI <xRequiredSpace_14(8), xRequiredSpace_17(9)>
  836. xSpace_19 = xStreamBufferSpacesAvailable (pxStreamBuffer_12);
  837. xReturn_21 = prvWriteMessageToBuffer (pxStreamBuffer_12, pvTxData_15(D), xDataLengthBytes_13(D), xSpace_19, xRequiredSpace_8);
  838. if (xReturn_21 != 0)
  839. goto <bb 11>; [INV]
  840. else
  841. goto <bb 15>; [INV]
  842. <bb 11> :
  843. _4 = prvBytesInBuffer (pxStreamBuffer_12);
  844. _5 = pxStreamBuffer_12->xTriggerLevelBytes;
  845. if (_4 >= _5)
  846. goto <bb 12>; [INV]
  847. else
  848. goto <bb 15>; [INV]
  849. <bb 12> :
  850. uxSavedInterruptStatus_24 = ulPortRaiseBASEPRI ();
  851. _6 ={v} pxStreamBuffer_12->xTaskWaitingToReceive;
  852. if (_6 != 0B)
  853. goto <bb 13>; [INV]
  854. else
  855. goto <bb 14>; [INV]
  856. <bb 13> :
  857. _7 ={v} pxStreamBuffer_12->xTaskWaitingToReceive;
  858. xTaskGenericNotifyFromISR (_7, 0, 0, 0, 0B, pxHigherPriorityTaskWoken_25(D));
  859. pxStreamBuffer_12->xTaskWaitingToReceive ={v} 0B;
  860. <bb 14> :
  861. vPortSetBASEPRI (uxSavedInterruptStatus_24);
  862. <bb 15> :
  863. _29 = xReturn_21;
  864. <bb 16> :
  865. <L17>:
  866. return _29;
  867. }
  868. xStreamBufferSend (struct StreamBufferDef_t * xStreamBuffer, const void * pvTxData, size_t xDataLengthBytes, TickType_t xTicksToWait)
  869. {
  870. size_t xMaxReportedSpace;
  871. struct TimeOut_t xTimeOut;
  872. size_t xRequiredSpace;
  873. size_t xSpace;
  874. size_t xReturn;
  875. struct StreamBuffer_t * const pxStreamBuffer;
  876. size_t D.6418;
  877. unsigned int _1;
  878. unsigned char _2;
  879. int _3;
  880. int _4;
  881. long unsigned int xTicksToWait.0_5;
  882. struct tskTaskControlBlock * _6;
  883. struct tskTaskControlBlock * _7;
  884. long unsigned int xTicksToWait.1_8;
  885. long int _9;
  886. unsigned int _10;
  887. unsigned int _11;
  888. struct tskTaskControlBlock * _12;
  889. struct tskTaskControlBlock * _13;
  890. size_t _59;
  891. <bb 2> :
  892. pxStreamBuffer_25 = xStreamBuffer_24(D);
  893. xSpace_26 = 0;
  894. xRequiredSpace_28 = xDataLengthBytes_27(D);
  895. xMaxReportedSpace_29 = 0;
  896. if (pvTxData_30(D) == 0B)
  897. goto <bb 3>; [INV]
  898. else
  899. goto <bb 5>; [INV]
  900. <bb 3> :
  901. vPortRaiseBASEPRI ();
  902. <bb 4> :
  903. goto <bb 4>; [INV]
  904. <bb 5> :
  905. if (pxStreamBuffer_25 == 0B)
  906. goto <bb 6>; [INV]
  907. else
  908. goto <bb 8>; [INV]
  909. <bb 6> :
  910. vPortRaiseBASEPRI ();
  911. <bb 7> :
  912. goto <bb 7>; [INV]
  913. <bb 8> :
  914. _1 = pxStreamBuffer_25->xLength;
  915. xMaxReportedSpace_32 = _1 + 4294967295;
  916. _2 = pxStreamBuffer_25->ucFlags;
  917. _3 = (int) _2;
  918. _4 = _3 & 1;
  919. if (_4 != 0)
  920. goto <bb 9>; [INV]
  921. else
  922. goto <bb 14>; [INV]
  923. <bb 9> :
  924. xRequiredSpace_34 = xRequiredSpace_28 + 4;
  925. if (xRequiredSpace_34 <= xDataLengthBytes_27(D))
  926. goto <bb 10>; [INV]
  927. else
  928. goto <bb 12>; [INV]
  929. <bb 10> :
  930. vPortRaiseBASEPRI ();
  931. <bb 11> :
  932. goto <bb 11>; [INV]
  933. <bb 12> :
  934. if (xRequiredSpace_34 > xMaxReportedSpace_32)
  935. goto <bb 13>; [INV]
  936. else
  937. goto <bb 16>; [INV]
  938. <bb 13> :
  939. xTicksToWait = 0;
  940. goto <bb 16>; [INV]
  941. <bb 14> :
  942. if (xRequiredSpace_28 > xMaxReportedSpace_32)
  943. goto <bb 15>; [INV]
  944. else
  945. goto <bb 16>; [INV]
  946. <bb 15> :
  947. xRequiredSpace_33 = xMaxReportedSpace_32;
  948. <bb 16> :
  949. # xRequiredSpace_16 = PHI <xRequiredSpace_34(13), xRequiredSpace_28(14), xRequiredSpace_33(15), xRequiredSpace_34(12)>
  950. xTicksToWait.0_5 = xTicksToWait;
  951. if (xTicksToWait.0_5 != 0)
  952. goto <bb 17>; [INV]
  953. else
  954. goto <bb 26>; [INV]
  955. <bb 17> :
  956. vTaskSetTimeOutState (&xTimeOut);
  957. <bb 18> :
  958. vPortEnterCritical ();
  959. xSpace_40 = xStreamBufferSpacesAvailable (pxStreamBuffer_25);
  960. if (xSpace_40 < xRequiredSpace_16)
  961. goto <bb 19>; [INV]
  962. else
  963. goto <bb 23>; [INV]
  964. <bb 19> :
  965. xTaskGenericNotifyStateClear (0B, 0);
  966. _6 ={v} pxStreamBuffer_25->xTaskWaitingToSend;
  967. if (_6 != 0B)
  968. goto <bb 20>; [INV]
  969. else
  970. goto <bb 22>; [INV]
  971. <bb 20> :
  972. vPortRaiseBASEPRI ();
  973. <bb 21> :
  974. goto <bb 21>; [INV]
  975. <bb 22> :
  976. _7 = xTaskGetCurrentTaskHandle ();
  977. pxStreamBuffer_25->xTaskWaitingToSend ={v} _7;
  978. goto <bb 24>; [INV]
  979. <bb 23> :
  980. vPortExitCritical ();
  981. goto <bb 25>; [INV]
  982. <bb 24> :
  983. vPortExitCritical ();
  984. xTicksToWait.1_8 = xTicksToWait;
  985. xTaskGenericNotifyWait (0, 0, 0, 0B, xTicksToWait.1_8);
  986. pxStreamBuffer_25->xTaskWaitingToSend ={v} 0B;
  987. _9 = xTaskCheckForTimeOut (&xTimeOut, &xTicksToWait);
  988. if (_9 == 0)
  989. goto <bb 18>; [INV]
  990. else
  991. goto <bb 25>; [INV]
  992. <bb 25> :
  993. <bb 26> :
  994. # xSpace_14 = PHI <xSpace_26(16), xSpace_40(25)>
  995. if (xSpace_14 == 0)
  996. goto <bb 27>; [INV]
  997. else
  998. goto <bb 28>; [INV]
  999. <bb 27> :
  1000. xSpace_51 = xStreamBufferSpacesAvailable (pxStreamBuffer_25);
  1001. <bb 28> :
  1002. # xSpace_15 = PHI <xSpace_14(26), xSpace_51(27)>
  1003. xReturn_53 = prvWriteMessageToBuffer (pxStreamBuffer_25, pvTxData_30(D), xDataLengthBytes_27(D), xSpace_15, xRequiredSpace_16);
  1004. if (xReturn_53 != 0)
  1005. goto <bb 29>; [INV]
  1006. else
  1007. goto <bb 33>; [INV]
  1008. <bb 29> :
  1009. _10 = prvBytesInBuffer (pxStreamBuffer_25);
  1010. _11 = pxStreamBuffer_25->xTriggerLevelBytes;
  1011. if (_10 >= _11)
  1012. goto <bb 30>; [INV]
  1013. else
  1014. goto <bb 33>; [INV]
  1015. <bb 30> :
  1016. vTaskSuspendAll ();
  1017. _12 ={v} pxStreamBuffer_25->xTaskWaitingToReceive;
  1018. if (_12 != 0B)
  1019. goto <bb 31>; [INV]
  1020. else
  1021. goto <bb 32>; [INV]
  1022. <bb 31> :
  1023. _13 ={v} pxStreamBuffer_25->xTaskWaitingToReceive;
  1024. xTaskGenericNotify (_13, 0, 0, 0, 0B);
  1025. pxStreamBuffer_25->xTaskWaitingToReceive ={v} 0B;
  1026. <bb 32> :
  1027. xTaskResumeAll ();
  1028. <bb 33> :
  1029. _59 = xReturn_53;
  1030. xTimeOut ={v} {CLOBBER};
  1031. <bb 34> :
  1032. <L41>:
  1033. return _59;
  1034. }
  1035. xStreamBufferBytesAvailable (struct StreamBufferDef_t * xStreamBuffer)
  1036. {
  1037. size_t xReturn;
  1038. const struct StreamBuffer_t * const pxStreamBuffer;
  1039. size_t D.6382;
  1040. size_t _6;
  1041. <bb 2> :
  1042. pxStreamBuffer_2 = xStreamBuffer_1(D);
  1043. if (pxStreamBuffer_2 == 0B)
  1044. goto <bb 3>; [INV]
  1045. else
  1046. goto <bb 5>; [INV]
  1047. <bb 3> :
  1048. vPortRaiseBASEPRI ();
  1049. <bb 4> :
  1050. goto <bb 4>; [INV]
  1051. <bb 5> :
  1052. xReturn_5 = prvBytesInBuffer (pxStreamBuffer_2);
  1053. _6 = xReturn_5;
  1054. <bb 6> :
  1055. <L3>:
  1056. return _6;
  1057. }
  1058. xStreamBufferSpacesAvailable (struct StreamBufferDef_t * xStreamBuffer)
  1059. {
  1060. size_t xOriginalTail;
  1061. size_t xSpace;
  1062. const struct StreamBuffer_t * const pxStreamBuffer;
  1063. size_t D.6378;
  1064. unsigned int D.6374;
  1065. unsigned int _1;
  1066. unsigned int _2;
  1067. unsigned int _3;
  1068. unsigned int _4;
  1069. unsigned int _5;
  1070. unsigned int _12;
  1071. size_t _16;
  1072. <bb 2> :
  1073. pxStreamBuffer_8 = xStreamBuffer_7(D);
  1074. if (pxStreamBuffer_8 == 0B)
  1075. goto <bb 3>; [INV]
  1076. else
  1077. goto <bb 5>; [INV]
  1078. <bb 3> :
  1079. vPortRaiseBASEPRI ();
  1080. <bb 4> :
  1081. goto <bb 4>; [INV]
  1082. <bb 5> :
  1083. xOriginalTail_10 ={v} pxStreamBuffer_8->xTail;
  1084. _1 = pxStreamBuffer_8->xLength;
  1085. _2 ={v} pxStreamBuffer_8->xTail;
  1086. xSpace_11 = _1 + _2;
  1087. _12 ={v} pxStreamBuffer_8->xHead;
  1088. xSpace_13 = xSpace_11 - _12;
  1089. _3 ={v} pxStreamBuffer_8->xTail;
  1090. if (xOriginalTail_10 != _3)
  1091. goto <bb 5>; [INV]
  1092. else
  1093. goto <bb 6>; [INV]
  1094. <bb 6> :
  1095. xSpace_14 = xSpace_13 + 4294967295;
  1096. _4 = pxStreamBuffer_8->xLength;
  1097. if (xSpace_14 >= _4)
  1098. goto <bb 7>; [INV]
  1099. else
  1100. goto <bb 8>; [INV]
  1101. <bb 7> :
  1102. _5 = pxStreamBuffer_8->xLength;
  1103. xSpace_15 = xSpace_14 - _5;
  1104. <bb 8> :
  1105. # xSpace_6 = PHI <xSpace_14(6), xSpace_15(7)>
  1106. _16 = xSpace_6;
  1107. <bb 9> :
  1108. <L8>:
  1109. return _16;
  1110. }
  1111. xStreamBufferSetTriggerLevel (struct StreamBufferDef_t * xStreamBuffer, size_t xTriggerLevel)
  1112. {
  1113. BaseType_t xReturn;
  1114. struct StreamBuffer_t * const pxStreamBuffer;
  1115. BaseType_t D.6370;
  1116. unsigned int _1;
  1117. BaseType_t _13;
  1118. <bb 2> :
  1119. pxStreamBuffer_6 = xStreamBuffer_5(D);
  1120. if (pxStreamBuffer_6 == 0B)
  1121. goto <bb 3>; [INV]
  1122. else
  1123. goto <bb 5>; [INV]
  1124. <bb 3> :
  1125. vPortRaiseBASEPRI ();
  1126. <bb 4> :
  1127. goto <bb 4>; [INV]
  1128. <bb 5> :
  1129. if (xTriggerLevel_7(D) == 0)
  1130. goto <bb 6>; [INV]
  1131. else
  1132. goto <bb 7>; [INV]
  1133. <bb 6> :
  1134. xTriggerLevel_8 = 1;
  1135. <bb 7> :
  1136. # xTriggerLevel_2 = PHI <xTriggerLevel_7(D)(5), xTriggerLevel_8(6)>
  1137. _1 = pxStreamBuffer_6->xLength;
  1138. if (xTriggerLevel_2 < _1)
  1139. goto <bb 8>; [INV]
  1140. else
  1141. goto <bb 9>; [INV]
  1142. <bb 8> :
  1143. pxStreamBuffer_6->xTriggerLevelBytes = xTriggerLevel_2;
  1144. xReturn_12 = 1;
  1145. goto <bb 10>; [INV]
  1146. <bb 9> :
  1147. xReturn_10 = 0;
  1148. <bb 10> :
  1149. # xReturn_3 = PHI <xReturn_12(8), xReturn_10(9)>
  1150. _13 = xReturn_3;
  1151. <bb 11> :
  1152. <L8>:
  1153. return _13;
  1154. }
  1155. xStreamBufferReset (struct StreamBufferDef_t * xStreamBuffer)
  1156. {
  1157. UBaseType_t uxStreamBufferNumber;
  1158. BaseType_t xReturn;
  1159. struct StreamBuffer_t * const pxStreamBuffer;
  1160. BaseType_t D.6361;
  1161. struct tskTaskControlBlock * _1;
  1162. struct tskTaskControlBlock * _2;
  1163. uint8_t * _3;
  1164. unsigned int _4;
  1165. unsigned int _5;
  1166. unsigned char _6;
  1167. BaseType_t _19;
  1168. <bb 2> :
  1169. pxStreamBuffer_10 = xStreamBuffer_9(D);
  1170. xReturn_11 = 0;
  1171. if (pxStreamBuffer_10 == 0B)
  1172. goto <bb 3>; [INV]
  1173. else
  1174. goto <bb 5>; [INV]
  1175. <bb 3> :
  1176. vPortRaiseBASEPRI ();
  1177. <bb 4> :
  1178. goto <bb 4>; [INV]
  1179. <bb 5> :
  1180. uxStreamBufferNumber_13 = pxStreamBuffer_10->uxStreamBufferNumber;
  1181. vPortEnterCritical ();
  1182. _1 ={v} pxStreamBuffer_10->xTaskWaitingToReceive;
  1183. if (_1 == 0B)
  1184. goto <bb 6>; [INV]
  1185. else
  1186. goto <bb 8>; [INV]
  1187. <bb 6> :
  1188. _2 ={v} pxStreamBuffer_10->xTaskWaitingToSend;
  1189. if (_2 == 0B)
  1190. goto <bb 7>; [INV]
  1191. else
  1192. goto <bb 8>; [INV]
  1193. <bb 7> :
  1194. _3 = pxStreamBuffer_10->pucBuffer;
  1195. _4 = pxStreamBuffer_10->xLength;
  1196. _5 = pxStreamBuffer_10->xTriggerLevelBytes;
  1197. _6 = pxStreamBuffer_10->ucFlags;
  1198. prvInitialiseNewStreamBuffer (pxStreamBuffer_10, _3, _4, _5, _6);
  1199. xReturn_16 = 1;
  1200. pxStreamBuffer_10->uxStreamBufferNumber = uxStreamBufferNumber_13;
  1201. <bb 8> :
  1202. # xReturn_7 = PHI <xReturn_11(5), xReturn_11(6), xReturn_16(7)>
  1203. vPortExitCritical ();
  1204. _19 = xReturn_7;
  1205. <bb 9> :
  1206. <L7>:
  1207. return _19;
  1208. }
  1209. vStreamBufferDelete (struct StreamBufferDef_t * xStreamBuffer)
  1210. {
  1211. struct StreamBuffer_t * pxStreamBuffer;
  1212. unsigned char _1;
  1213. int _2;
  1214. int _3;
  1215. <bb 2> :
  1216. pxStreamBuffer_6 = xStreamBuffer_5(D);
  1217. if (pxStreamBuffer_6 == 0B)
  1218. goto <bb 3>; [INV]
  1219. else
  1220. goto <bb 5>; [INV]
  1221. <bb 3> :
  1222. vPortRaiseBASEPRI ();
  1223. <bb 4> :
  1224. goto <bb 4>; [INV]
  1225. <bb 5> :
  1226. _1 = pxStreamBuffer_6->ucFlags;
  1227. _2 = (int) _1;
  1228. _3 = _2 & 2;
  1229. if (_3 == 0)
  1230. goto <bb 6>; [INV]
  1231. else
  1232. goto <bb 7>; [INV]
  1233. <bb 6> :
  1234. vPortFree (pxStreamBuffer_6);
  1235. goto <bb 8>; [INV]
  1236. <bb 7> :
  1237. memset (pxStreamBuffer_6, 0, 36);
  1238. <bb 8> :
  1239. return;
  1240. }
  1241. xStreamBufferGenericCreate (size_t xBufferSizeBytes, size_t xTriggerLevelBytes, BaseType_t xIsMessageBuffer)
  1242. {
  1243. uint8_t ucFlags;
  1244. uint8_t * pucAllocatedMemory;
  1245. struct StreamBufferDef_t * D.6348;
  1246. unsigned int _1;
  1247. uint8_t * _2;
  1248. struct StreamBufferDef_t * _23;
  1249. <bb 2> :
  1250. if (xIsMessageBuffer_9(D) == 1)
  1251. goto <bb 3>; [INV]
  1252. else
  1253. goto <bb 6>; [INV]
  1254. <bb 3> :
  1255. ucFlags_14 = 1;
  1256. if (xBufferSizeBytes_11(D) <= 4)
  1257. goto <bb 4>; [INV]
  1258. else
  1259. goto <bb 9>; [INV]
  1260. <bb 4> :
  1261. vPortRaiseBASEPRI ();
  1262. <bb 5> :
  1263. goto <bb 5>; [INV]
  1264. <bb 6> :
  1265. ucFlags_10 = 0;
  1266. if (xBufferSizeBytes_11(D) == 0)
  1267. goto <bb 7>; [INV]
  1268. else
  1269. goto <bb 9>; [INV]
  1270. <bb 7> :
  1271. vPortRaiseBASEPRI ();
  1272. <bb 8> :
  1273. goto <bb 8>; [INV]
  1274. <bb 9> :
  1275. # ucFlags_6 = PHI <ucFlags_14(3), ucFlags_10(6)>
  1276. if (xTriggerLevelBytes_16(D) > xBufferSizeBytes_11(D))
  1277. goto <bb 10>; [INV]
  1278. else
  1279. goto <bb 12>; [INV]
  1280. <bb 10> :
  1281. vPortRaiseBASEPRI ();
  1282. <bb 11> :
  1283. goto <bb 11>; [INV]
  1284. <bb 12> :
  1285. if (xTriggerLevelBytes_16(D) == 0)
  1286. goto <bb 13>; [INV]
  1287. else
  1288. goto <bb 14>; [INV]
  1289. <bb 13> :
  1290. xTriggerLevelBytes_17 = 1;
  1291. <bb 14> :
  1292. # xTriggerLevelBytes_4 = PHI <xTriggerLevelBytes_16(D)(12), xTriggerLevelBytes_17(13)>
  1293. if (xBufferSizeBytes_11(D) <= 4294967258)
  1294. goto <bb 15>; [INV]
  1295. else
  1296. goto <bb 16>; [INV]
  1297. <bb 15> :
  1298. xBufferSizeBytes_19 = xBufferSizeBytes_11(D) + 1;
  1299. _1 = xBufferSizeBytes_19 + 36;
  1300. pucAllocatedMemory_21 = pvPortMalloc (_1);
  1301. goto <bb 17>; [INV]
  1302. <bb 16> :
  1303. pucAllocatedMemory_18 = 0B;
  1304. <bb 17> :
  1305. # xBufferSizeBytes_3 = PHI <xBufferSizeBytes_19(15), xBufferSizeBytes_11(D)(16)>
  1306. # pucAllocatedMemory_5 = PHI <pucAllocatedMemory_21(15), pucAllocatedMemory_18(16)>
  1307. if (pucAllocatedMemory_5 != 0B)
  1308. goto <bb 18>; [INV]
  1309. else
  1310. goto <bb 19>; [INV]
  1311. <bb 18> :
  1312. _2 = pucAllocatedMemory_5 + 36;
  1313. prvInitialiseNewStreamBuffer (pucAllocatedMemory_5, _2, xBufferSizeBytes_3, xTriggerLevelBytes_4, ucFlags_6);
  1314. <bb 19> :
  1315. _23 = pucAllocatedMemory_5;
  1316. <bb 20> :
  1317. <L20>:
  1318. return _23;
  1319. }
  1320. __attribute__((always_inline))
  1321. vPortSetBASEPRI (uint32_t ulNewMaskValue)
  1322. {
  1323. <bb 2> :
  1324. __asm__ __volatile__(" msr basepri, %0 " : : "r" ulNewMaskValue_2(D) : "memory");
  1325. return;
  1326. }
  1327. __attribute__((always_inline))
  1328. ulPortRaiseBASEPRI ()
  1329. {
  1330. uint32_t ulNewBASEPRI;
  1331. uint32_t ulOriginalBASEPRI;
  1332. uint32_t D.6438;
  1333. uint32_t _5;
  1334. <bb 2> :
  1335. __asm__ __volatile__(" mrs %0, basepri
  1336. mov %1, %2
  1337. msr basepri, %1
  1338. isb
  1339. dsb
  1340. " : "=r" ulOriginalBASEPRI_3, "=r" ulNewBASEPRI_4 : "i" 16 : "memory");
  1341. _5 = ulOriginalBASEPRI_3;
  1342. <bb 3> :
  1343. <L0>:
  1344. return _5;
  1345. }
  1346. __attribute__((always_inline))
  1347. vPortRaiseBASEPRI ()
  1348. {
  1349. uint32_t ulNewBASEPRI;
  1350. <bb 2> :
  1351. __asm__ __volatile__(" mov %0, %1
  1352. msr basepri, %0
  1353. isb
  1354. dsb
  1355. " : "=r" ulNewBASEPRI_3 : "i" 16 : "memory");
  1356. return;
  1357. }