csl_vcp2Aux.h 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880
  1. /* ============================================================================
  2. * Copyright (c) Texas Instruments Incorporated 2008, 20009
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. *
  11. * Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the
  14. * distribution.
  15. *
  16. * Neither the name of Texas Instruments Incorporated nor the names of
  17. * its contributors may be used to endorse or promote products derived
  18. * from this software without specific prior written permission.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. *
  32. */
  33. /** ===========================================================================
  34. * @file csl_vcp2Aux.h
  35. *
  36. * @brief
  37. * Auxiliary API header for VCP2 CSL-FL
  38. *
  39. * \par
  40. * ============================================================================
  41. * @n (C) Copyright 2008, 2009, Texas Instruments, Inc.
  42. * @n Use of this software is controlled by the terms and conditions found
  43. * @n in the license agreement under which this software has been supplied.
  44. * ===========================================================================
  45. * \par
  46. */
  47. #ifndef CSL_VCP2AUX_H
  48. #define CSL_VCP2AUX_H
  49. #include <ti/csl/csl_vcp2.h>
  50. #ifdef __cplusplus
  51. extern "C" {
  52. #endif
  53. /** @addtogroup CSL_VCP2_FUNCTION
  54. @{ */
  55. /**
  56. * ============================================================================
  57. * @n@b VCP2_ceil
  58. *
  59. * @b Description
  60. * @n This function calculates the ceiling for a given value and a power of 2.
  61. * The arguments follow the formula: ceilVal * 2^pwr2 = ceiling+
  62. * (val, pwr2).
  63. *
  64. * @b Arguments
  65. @verbatim
  66. val Value to be augmented.
  67. pwr2 The power of two by which val must be divisible.
  68. @endverbatim
  69. *
  70. * <b>Return Value </b> Uint32
  71. * @n Value The smallest number which when multiplied by 2^pwr2 is
  72. * greater than val.
  73. *
  74. * <b>Pre Condition </b>
  75. * @n None.
  76. *
  77. * <b>Post Condition </b>
  78. * @n None.
  79. *
  80. * @b Writes
  81. * @n None.
  82. *
  83. * @b Example
  84. * @verbatim
  85. Uint32 numSysPar;
  86. numSysPar = VCP2_ceil ((frameLen * rate), 4);
  87. @endverbatim
  88. * ============================================================================
  89. */
  90. /* for misra warnings*/
  91. static inline
  92. Uint32 VCP2_ceil (
  93. Uint32 val,
  94. Uint32 pwr2
  95. );
  96. static inline
  97. Uint32 VCP2_ceil (
  98. Uint32 val,
  99. Uint32 pwr2
  100. )
  101. {
  102. Uint32 value;
  103. value = ( ((val) - ( ((val) >> (pwr2)) << (pwr2)) ) == 0) ? \
  104. ((val) >> (pwr2)) : (((val) >> (pwr2)) + 1U);
  105. return value;
  106. }
  107. /**
  108. * ============================================================================
  109. * @n@b VCP2_normalCeil
  110. *
  111. * @b Description
  112. * @n Returns the value rounded to the nearest integer greater than or
  113. * equal to (val1/val2)
  114. *
  115. * @b Arguments
  116. @verbatim
  117. val1 Value to be augmented.
  118. val2 Value by which val1 must be divisible.
  119. @endverbatim
  120. *
  121. * <b>Return Value </b> Uint32
  122. *
  123. * <b>Pre Condition </b>
  124. * @n None.
  125. *
  126. * <b>Post Condition </b>
  127. * @n None.
  128. *
  129. * @b Writes
  130. * @n None.
  131. *
  132. * @b Example
  133. * @verbatim
  134. Uint32 framelen = 51200;
  135. Uint32 numSubFrame;
  136. ...
  137. // to calculate the number of sub frames for SP mode
  138. numSubFrame = VCP2_normalCeil (framelen, VCP2_SUB_FRAME_SIZE_MAX);
  139. @endverbatim
  140. * ============================================================================
  141. */
  142. /* for misra warnings*/
  143. static inline
  144. Uint32 VCP2_normalCeil (
  145. Uint32 val1,
  146. Uint32 val2
  147. );
  148. static inline
  149. Uint32 VCP2_normalCeil (
  150. Uint32 val1,
  151. Uint32 val2
  152. )
  153. {
  154. Uint32 value;
  155. value = ( ((val1) % (val2)) != 0U ) ? ( ((val1) / (val2)) + 1U ) : \
  156. ((val1) / (val2));
  157. return value;
  158. }
  159. /**
  160. * ============================================================================
  161. * @n@b VCP2_getPeripheralID
  162. *
  163. * @b Description
  164. * @n This function returns the value programmed into the VCPPID register.
  165. *
  166. * @b Arguments
  167. @verbatim
  168. hVcp2 Handle to VCP2 instance.
  169. hPid Handle to the PID structure that needs to
  170. be populated with PID info retrieved.
  171. @endverbatim
  172. *
  173. * <b>Return Value </b> None
  174. *
  175. * <b>Pre Condition </b>
  176. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  177. * before doing any operations on it.
  178. *
  179. * <b>Post Condition </b> None
  180. *
  181. * @b Reads
  182. * @n VCP2_VCPPID_TYPE,
  183. * VCP2_VCPPID_CLASS,
  184. * VCP2_VCPPID_REV
  185. *
  186. * @b Example
  187. @verbatim
  188. VCP2Handle hVcp2;
  189. VCP2Obj vcp2Obj;
  190. VCP2_PID vcp2Pid;
  191. ...
  192. hVcp2 = VCP2_init(&vcp2Obj, 0, &status);
  193. ...
  194. VCP2_getPeripheralID (hVcp2, &vcp2Pid);
  195. @endverbatim
  196. * ============================================================================
  197. */
  198. /* for misra warnings*/
  199. static inline
  200. void VCP2_getPeripheralID (
  201. VCP2Handle hVcp2,
  202. VCP2_PID* hPid
  203. );
  204. static inline
  205. void VCP2_getPeripheralID (
  206. VCP2Handle hVcp2,
  207. VCP2_PID* hPid
  208. )
  209. {
  210. hPid->pid_class = CSL_FEXT (hVcp2->cfgregs->VCPPID, VCP2_VCPPID_CLASS);
  211. hPid->type = CSL_FEXT (hVcp2->cfgregs->VCPPID, VCP2_VCPPID_TYPE);
  212. hPid->rev = CSL_FEXT (hVcp2->cfgregs->VCPPID, VCP2_VCPPID_REV);
  213. return;
  214. }
  215. /**
  216. * ============================================================================
  217. * @n@b VCP2_getBmEndian
  218. *
  219. * @b Description
  220. * @n This function returns the value programmed into the VCPEND register for
  221. * the branch metrics data for Big Endian mode indicating whether the data
  222. * is in its native 8-bit format ('1') or 32-bit word packed ('0').
  223. *
  224. * @b Arguments
  225. @verbatim
  226. hVcp2 Handle to VCP2 instance.
  227. @endverbatim
  228. *
  229. * <b>Return Value </b> Uint32
  230. * @n Value Branch metric memory format.
  231. *
  232. * <b>Pre Condition </b>
  233. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  234. * before doing any operations on it.
  235. *
  236. * <b>Post Condition </b>
  237. * @n The returned value indicates
  238. * @li 0 - 32-bit word packed.
  239. * @li 1 - Native (8 bits).
  240. *
  241. * @b Reads
  242. * @n VCP2_VCPEND_BM
  243. *
  244. * @b Example
  245. @verbatim
  246. If (VCP2_getBmEndian (hVcp2))
  247. {
  248. ...
  249. } // end if //
  250. @endverbatim
  251. * ============================================================================
  252. */
  253. /* for misra warnings*/
  254. static inline
  255. Uint32 VCP2_getBmEndian (
  256. VCP2Handle hVcp2
  257. );
  258. static inline
  259. Uint32 VCP2_getBmEndian (
  260. VCP2Handle hVcp2
  261. )
  262. {
  263. return CSL_FEXT (hVcp2->cfgregs->VCPEND, VCP2_VCPEND_BM);
  264. }
  265. /**
  266. * ============================================================================
  267. * @n@b VCP2_getIcConfig
  268. *
  269. * @b Description
  270. * @n This function gets the current VCPIC register values and puts them in a
  271. * structure of type VCP2_ConfigIc.
  272. *
  273. * @b Arguments
  274. @verbatim
  275. hVcp2 Handle to VCP2 instance.
  276. pConfigIc Pointer to the structure of type VCP2_ConfigIc to hold
  277. the values of VCPIC registers.
  278. @endverbatim
  279. *
  280. * <b>Return Value </b>
  281. * @n None.
  282. *
  283. * <b>Pre Condition </b>
  284. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  285. * before doing any operations on it.
  286. *
  287. * <b>Post Condition </b>
  288. * @n The structure of type VCP2_ConfigIc passed as arguement contains the
  289. * values of the VCP configuration registers.
  290. *
  291. * @b Reads
  292. * @n VCP2_VCPIC0,
  293. * VCP2_VCPIC1,
  294. * VCP2_VCPIC2,
  295. * VCP2_VCPIC3,
  296. * VCP2_VCPIC4,
  297. * VCP2_VCPIC5
  298. *
  299. * @b Example
  300. * @verbatim
  301. VCP2_ConfigIc configIc;
  302. ...
  303. VCP2_getIcConfig (hVcp2, &configIc);
  304. @endverbatim
  305. * ============================================================================
  306. */
  307. /* for misra warnings*/
  308. static inline
  309. void VCP2_getIcConfig (
  310. VCP2Handle hVcp2,
  311. VCP2_ConfigIc *configIc
  312. );
  313. static inline
  314. void VCP2_getIcConfig (
  315. VCP2Handle hVcp2,
  316. VCP2_ConfigIc *configIc
  317. )
  318. {
  319. register int32_t x0, x1, x2, x3, x4, x5;
  320. x0 = hVcp2->regs->VCPIC0;
  321. x1 = hVcp2->regs->VCPIC1;
  322. x2 = hVcp2->regs->VCPIC2;
  323. x3 = hVcp2->regs->VCPIC3;
  324. x4 = hVcp2->regs->VCPIC4;
  325. x5 = hVcp2->regs->VCPIC5;
  326. configIc->ic0 = x0;
  327. configIc->ic1 = x1;
  328. configIc->ic2 = x2;
  329. configIc->ic3 = x3;
  330. configIc->ic4 = x4;
  331. configIc->ic5 = x5;
  332. }
  333. /**
  334. * ============================================================================
  335. * @n@b VCP2_getNumInFifo
  336. *
  337. * @b Description
  338. * @n This function returns the count, number of symbols currently in the
  339. * input FIFO.
  340. *
  341. * @b Arguments
  342. @verbatim
  343. hVcp2 Handle to VCP2 instance.
  344. @endverbatim
  345. *
  346. * <b>Return Value </b> Value
  347. * @li Value Number of symbols in the branch metric input FIFO
  348. * buffer.
  349. *
  350. * <b>Pre Condition </b>
  351. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  352. * before doing any operations on it.
  353. *
  354. * <b>Post Condition </b>
  355. * @n None.
  356. *
  357. * @b Reads
  358. * @n VCP2_VCPSTAT1_NSYMIF
  359. *
  360. * @b Example
  361. * @verbatim
  362. Uint32 numSym;
  363. numSym = VCP2_getNumInFifo (hVcp2);
  364. @endverbatim
  365. * ============================================================================
  366. */
  367. /* for misra warnings*/
  368. static inline
  369. Uint32 VCP2_getNumInFifo (
  370. VCP2Handle hVcp2
  371. );
  372. static inline
  373. Uint32 VCP2_getNumInFifo (
  374. VCP2Handle hVcp2
  375. )
  376. {
  377. return CSL_FEXT (hVcp2->cfgregs->VCPSTAT1, VCP2_VCPSTAT1_NSYMIF);
  378. }
  379. /**
  380. * ============================================================================
  381. * @n@b VCP2_getNumOutFifo
  382. *
  383. * @b Description
  384. * @n This function returns the count, number of symbols currently in the
  385. * output FIFO.
  386. *
  387. * @b Arguments
  388. @verbatim
  389. hVcp2 Handle to VCP2 instance.
  390. @endverbatim
  391. *
  392. * <b>Return Value </b> Value
  393. * @li Value Number of symbols present in the output FIFO buffer.
  394. *
  395. * <b>Pre Condition </b>
  396. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  397. * before doing any operations on it.
  398. *
  399. * <b>Post Condition </b>
  400. * @n None.
  401. *
  402. * @b Reads
  403. * @n VCP2_VCPSTAT1_NSYMOF
  404. *
  405. * @b Example
  406. * @verbatim
  407. Uint32 numSym;
  408. numSym = VCP2_getNumOutFifo (hVcp2);
  409. @endverbatim
  410. * ============================================================================
  411. */
  412. /* for misra warnings*/
  413. static inline
  414. Uint32 VCP2_getNumOutFifo (
  415. VCP2Handle hVcp2
  416. );
  417. static inline
  418. Uint32 VCP2_getNumOutFifo (
  419. VCP2Handle hVcp2
  420. )
  421. {
  422. return CSL_FEXT (hVcp2->cfgregs->VCPSTAT1, VCP2_VCPSTAT1_NSYMOF);
  423. }
  424. /**
  425. * ============================================================================
  426. * @n@b VCP2_getSdEndian
  427. *
  428. * @b Description
  429. * @n This function returns the value programmed into the VCPEND register for
  430. * the soft decision data for Big Endian mode indicating whether the data
  431. * is in its native 8-bit format ('1') or 32-bit word packed ('0').
  432. *
  433. * @b Arguments
  434. @verbatim
  435. hVcp2 Handle to VCP2 instance.
  436. @endverbatim
  437. *
  438. * <b>Return Value </b> Value
  439. * @li Value Soft decisions memory format.
  440. *
  441. * <b>Pre Condition </b>
  442. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  443. * before doing any operations on it.
  444. *
  445. * <b>Post Condition </b>
  446. * @n The returned value indicates
  447. * @li 0 - 32-bit word packed.
  448. * @li 1 - Native (8 bits).
  449. *
  450. * @b Reads
  451. * @n VCP2_VCPEND_SD
  452. *
  453. * @b Example
  454. * @verbatim
  455. If (VCP2_getSdEndian (hVcp2))
  456. {
  457. ...
  458. } // end if
  459. @endverbatim
  460. * ============================================================================
  461. */
  462. /* for misra warnings*/
  463. static inline
  464. Uint32 VCP2_getSdEndian (
  465. VCP2Handle hVcp2
  466. );
  467. static inline
  468. Uint32 VCP2_getSdEndian (
  469. VCP2Handle hVcp2
  470. )
  471. {
  472. return CSL_FEXT (hVcp2->cfgregs->VCPEND, VCP2_VCPEND_SD);
  473. }
  474. /**
  475. * ============================================================================
  476. * @n@b VCP2_getStateIndex
  477. *
  478. * @b Description
  479. * @n This function returns an index for the final maximum state metric.
  480. *
  481. * @b Arguments
  482. @verbatim
  483. hVcp2 Handle to VCP2 instance.
  484. @endverbatim
  485. *
  486. * <b>Return Value </b> Value
  487. * @li Value Final maximum state metric index.
  488. *
  489. * <b>Pre Condition </b>
  490. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  491. * before doing any operations on it.
  492. *
  493. * <b>Post Condition </b>
  494. * @n None.
  495. *
  496. * @b Reads
  497. * @n VCP2_VCPOUT1_FMAXI
  498. *
  499. * @b Example
  500. * @verbatim
  501. Uint8 index
  502. index = VCP2_getStateIndex(hVcp2);
  503. @endverbatim
  504. * ============================================================================
  505. */
  506. /* for misra warnings*/
  507. static inline
  508. Uint8 VCP2_getStateIndex (
  509. VCP2Handle hVcp2
  510. );
  511. static inline
  512. Uint8 VCP2_getStateIndex (
  513. VCP2Handle hVcp2
  514. )
  515. {
  516. return ((Uint8)CSL_FEXT (hVcp2->regs->VCPOUT1, VCP2_VCPOUT1_FMAXI));
  517. }
  518. /**
  519. * ============================================================================
  520. * @n@b VCP2_getYamBit
  521. *
  522. * @b Description
  523. * @n This function returns the value of the Yamamoto bit after the VCP
  524. * decoding.
  525. *
  526. * @b Arguments
  527. @verbatim
  528. hVcp2 Handle to VCP2 instance.
  529. @endverbatim
  530. *
  531. * <b>Return Value </b> Value
  532. * @li Value Yamamoto bit result. This bit is a quality indicator
  533. * bit and is only used if the Yamamoto logic is enabled.
  534. *
  535. * <b>Pre Condition </b>
  536. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  537. * before doing any operations on it.
  538. *
  539. * <b>Post Condition </b>
  540. * @n The return bit value indicates,
  541. * @li 0 - at least one trellis stage had an absolute difference less than
  542. * the Yamamoto threshold and the decoded frame has poor quality.
  543. * @li 1 - no trellis stage had an absolute difference less than the
  544. * Yamamoto threshold and the frame has good quality.
  545. *
  546. * @b Reads
  547. * @n VCP2_VCPOUT1_YAM
  548. *
  549. * @b Example
  550. * @verbatim
  551. Uint8 yamBit
  552. yamBit = VCP2_getYamBit(hVcp2);
  553. @endverbatim
  554. * ============================================================================
  555. */
  556. /* for misra warnings*/
  557. static inline
  558. Uint8 VCP2_getYamBit (
  559. VCP2Handle hVcp2
  560. );
  561. static inline
  562. Uint8 VCP2_getYamBit (
  563. VCP2Handle hVcp2
  564. )
  565. {
  566. return ((Uint8)CSL_FEXT (hVcp2->regs->VCPOUT1, VCP2_VCPOUT1_YAM));
  567. }
  568. /**
  569. * ============================================================================
  570. * @n@b VCP2_getMaxSm
  571. *
  572. * @b Description
  573. * @n This function returns the final maximum state metric after the VCP has
  574. * completed its decoding.
  575. *
  576. * @b Arguments
  577. @verbatim
  578. hVcp2 Handle to VCP2 instance.
  579. @endverbatim
  580. *
  581. * <b>Return Value </b> Value
  582. * @li Value Maximum state metric value for the final trellis stage.
  583. *
  584. * <b>Pre Condition </b>
  585. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  586. * before doing any operations on it.
  587. *
  588. * <b>Post Condition </b>
  589. * @n None.
  590. *
  591. * @b Reads
  592. * @n VCP2_VCPOUT0_FMAXS
  593. *
  594. * @b Example
  595. * @verbatim
  596. Int16 maxSm
  597. maxSm = VCP2_getMaxSm(hVcp2);
  598. @endverbatim
  599. * ============================================================================
  600. */
  601. /* for misra warnings*/
  602. static inline
  603. Int16 VCP2_getMaxSm (
  604. VCP2Handle hVcp2
  605. );
  606. static inline
  607. Int16 VCP2_getMaxSm (
  608. VCP2Handle hVcp2
  609. )
  610. {
  611. Uint32 temp_var = CSL_FEXT(hVcp2->regs->VCPOUT0, VCP2_VCPOUT0_FMAXS);
  612. return ((Int16)temp_var);
  613. }
  614. /**
  615. * ============================================================================
  616. * @n@b VCP2_getMinSm
  617. *
  618. * @b Description
  619. * @n This function returns the final minimum state metric after the VCP has
  620. * completed its decoding.
  621. *
  622. * @b Arguments
  623. @verbatim
  624. hVcp2 Handle to VCP2 instance.
  625. @endverbatim
  626. *
  627. * <b>Return Value </b> Value
  628. * @li Value Minimum state metric value for the final trellis stage.
  629. *
  630. * <b>Pre Condition </b>
  631. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  632. * before doing any operations on it.
  633. *
  634. * <b>Post Condition </b>
  635. * @n None.
  636. *
  637. * @b Reads
  638. * @n VCP2_VCPOUT0_FMINS
  639. *
  640. * @b Example
  641. * @verbatim
  642. Int16 minSm
  643. minSm = VCP2_getMinSm(hVcp2);
  644. @endverbatim
  645. * ============================================================================
  646. */
  647. /* for misra warnings*/
  648. static inline
  649. Int16 VCP2_getMinSm (
  650. VCP2Handle hVcp2
  651. );
  652. static inline
  653. Int16 VCP2_getMinSm (
  654. VCP2Handle hVcp2
  655. )
  656. {
  657. Uint32 temp_var = CSL_FEXT (hVcp2->regs->VCPOUT0, VCP2_VCPOUT0_FMINS);
  658. return ((Int16)temp_var);
  659. }
  660. /**
  661. * ============================================================================
  662. * @n@b VCP2_icConfig
  663. *
  664. * @b Description
  665. * @n This function programs the VCP input configuration registers with the
  666. * values provided through the VCP2_ConfigIc structure.
  667. *
  668. * @b Arguments
  669. @verbatim
  670. hVcp2 Handle to VCP2 instance.
  671. pVcpConfigIc Pointer to VCP2_ConfigIc structure instance
  672. containing the input configuration register values.
  673. @endverbatim
  674. *
  675. * <b>Return Value </b>
  676. * @n None.
  677. *
  678. * <b>Pre Condition </b>
  679. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  680. * before doing any operations on it.
  681. *
  682. * <b>Post Condition </b>
  683. * @n VCP input configuration registers are configured appropriately.
  684. *
  685. * @b Writes
  686. * @n VCP2_VCPIC0,
  687. * VCP2_VCPIC1,
  688. * VCP2_VCPIC2,
  689. * VCP2_VCPIC3,
  690. * VCP2_VCPIC4,
  691. * VCP2_VCPIC5
  692. *
  693. * @b Example
  694. * @verbatim
  695. VCP2_ConfigIc configIc;
  696. configIc.ic0 = 0xf0b07050;
  697. configIc.ic1 = 0x10320000;
  698. configIc.ic2 = 0x000007fa;
  699. configIc.ic3 = 0x00000054;
  700. configIc.ic4 = 0x00800800;
  701. configIc.ic5 = 0x51f3000c;
  702. ...
  703. VCP2_icConfig (hVcp2, &configIc);
  704. @endverbatim
  705. * ============================================================================
  706. */
  707. /* for misra warnings*/
  708. static inline
  709. void VCP2_icConfig (
  710. VCP2Handle hVcp2,
  711. const VCP2_ConfigIc *vcpConfigIc
  712. );
  713. static inline
  714. void VCP2_icConfig (
  715. VCP2Handle hVcp2,
  716. const VCP2_ConfigIc *vcpConfigIc
  717. )
  718. {
  719. register int32_t x0, x1, x2, x3, x4, x5;
  720. x0 = vcpConfigIc->ic0;
  721. x1 = vcpConfigIc->ic1;
  722. x2 = vcpConfigIc->ic2;
  723. x3 = vcpConfigIc->ic3;
  724. x4 = vcpConfigIc->ic4;
  725. x5 = vcpConfigIc->ic5;
  726. hVcp2->regs->VCPIC0 = x0;
  727. hVcp2->regs->VCPIC1 = x1;
  728. hVcp2->regs->VCPIC2 = x2;
  729. hVcp2->regs->VCPIC3 = x3;
  730. hVcp2->regs->VCPIC4 = x4;
  731. hVcp2->regs->VCPIC5 = x5;
  732. }
  733. /**
  734. * ============================================================================
  735. * @n@b VCP2_icConfigArgs
  736. *
  737. * @b Description
  738. * @n This function programs the VCP input configuration registers with the
  739. * given values.
  740. *
  741. * @b Arguments
  742. @verbatim
  743. hVcp2 Handle to VCP2 instance.
  744. ic0 Value to program input configuration register 0.
  745. ic1 Value to program input configuration register 1.
  746. ic2 Value to program input configuration register 2.
  747. ic3 Value to program input configuration register 3.
  748. ic4 Value to program input configuration register 4.
  749. ic5 Value to program input configuration register 5.
  750. @endverbatim
  751. *
  752. * <b>Return Value </b>
  753. * @n None.
  754. *
  755. * <b>Pre Condition </b>
  756. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  757. * before doing any operations on it.
  758. *
  759. * <b>Post Condition </b>
  760. * @n None.
  761. *
  762. * @b Writes
  763. * @n VCP2_VCPIC0,
  764. * VCP2_VCPIC1,
  765. * VCP2_VCPIC2,
  766. * VCP2_VCPIC3,
  767. * VCP2_VCPIC4,
  768. * VCP2_VCPIC5
  769. *
  770. * @b Example
  771. * @verbatim
  772. Uint32 ic0, ic1, ic2, ic3, ic4, ic5;
  773. ...
  774. ic0 = 0xf0b07050;
  775. ic1 = 0x10320000;
  776. ic2 = 0x000007fa;
  777. ic3 = 0x00000054;
  778. ic4 = 0x00800800;
  779. ic5 = 0x51f3000c;
  780. ...
  781. VCP2_icConfigArgs (hVcp2, ic0, ic1, ic2, ic3, ic4, ic5);
  782. @endverbatim
  783. * ============================================================================
  784. */
  785. /* for misra warnings*/
  786. static inline
  787. void VCP2_icConfigArgs (
  788. VCP2Handle hVcp2,
  789. Uint32 ic0,
  790. Uint32 ic1,
  791. Uint32 ic2,
  792. Uint32 ic3,
  793. Uint32 ic4,
  794. Uint32 ic5
  795. );
  796. static inline
  797. void VCP2_icConfigArgs (
  798. VCP2Handle hVcp2,
  799. Uint32 ic0,
  800. Uint32 ic1,
  801. Uint32 ic2,
  802. Uint32 ic3,
  803. Uint32 ic4,
  804. Uint32 ic5
  805. )
  806. {
  807. hVcp2->regs->VCPIC0 = ic0;
  808. hVcp2->regs->VCPIC1 = ic1;
  809. hVcp2->regs->VCPIC2 = ic2;
  810. hVcp2->regs->VCPIC3 = ic3;
  811. hVcp2->regs->VCPIC4 = ic4;
  812. hVcp2->regs->VCPIC5 = ic5;
  813. }
  814. /**
  815. * ============================================================================
  816. * @n@b VCP2_setBmEndian
  817. *
  818. * @b Description
  819. * @n This function programs the VCP to view the format of the branch metrics
  820. * data as either native 8-bit format ('1') or values packed into 32-bit
  821. * words in little endian format ('0').
  822. *
  823. * @b Arguments
  824. @verbatim
  825. hVcp2 Handle to VCP2 instance.
  826. bmEnd '1' for native 8-bit format and '0' for 32-bit word packed
  827. format
  828. @endverbatim
  829. *
  830. * <b>Return Value </b>
  831. * @n None.
  832. *
  833. * <b>Pre Condition </b>
  834. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  835. * before doing any operations on it.
  836. *
  837. * <b>Post Condition </b>
  838. * @n None.
  839. *
  840. * @b Writes
  841. * @n VCP2_VCPEND_BM
  842. *
  843. * @b Example
  844. * @verbatim
  845. Uint32 bmEnd = VCP2_END_NATIVE;
  846. VCP2_setBmEndian (hVcp2, bmEnd);
  847. @endverbatim
  848. * ============================================================================
  849. */
  850. /* for misra warnings*/
  851. static inline
  852. void VCP2_setBmEndian (
  853. VCP2Handle hVcp2,
  854. Uint32 bmEnd
  855. );
  856. static inline
  857. void VCP2_setBmEndian (
  858. VCP2Handle hVcp2,
  859. Uint32 bmEnd
  860. )
  861. {
  862. CSL_FINS (hVcp2->cfgregs->VCPEND, VCP2_VCPEND_BM, bmEnd);
  863. }
  864. /**
  865. * ============================================================================
  866. * @n@b VCP2_setNativeEndian
  867. *
  868. * @b Description
  869. * @n This function programs the VCP to view the format of all data as native
  870. * 8-bit format.
  871. *
  872. * @b Arguments
  873. @verbatim
  874. hVcp2 Handle to VCP2 instance.
  875. @endverbatim
  876. *
  877. * <b>Return Value </b>
  878. * @n None.
  879. *
  880. * <b>Pre Condition </b>
  881. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  882. * before doing any operations on it.
  883. *
  884. * <b>Post Condition </b>
  885. * @n None.
  886. *
  887. * @b Writes
  888. * @n VCP2_VCPEND_BM=1,
  889. * VCP2_VCPEND_SD=1
  890. *
  891. * @b Example
  892. * @verbatim
  893. VCP2_setNativeEndian (hVcp2);
  894. @endverbatim
  895. * ============================================================================
  896. */
  897. /* for misra warnings*/
  898. static inline
  899. void VCP2_setNativeEndian (
  900. VCP2Handle hVcp2
  901. );
  902. static inline
  903. void VCP2_setNativeEndian (
  904. VCP2Handle hVcp2
  905. )
  906. {
  907. CSL_FINST (hVcp2->cfgregs->VCPEND, VCP2_VCPEND_BM, NATIVE);
  908. CSL_FINST (hVcp2->cfgregs->VCPEND, VCP2_VCPEND_SD, NATIVE);
  909. }
  910. /**
  911. * ============================================================================
  912. * @n@b VCP2_setPacked32Endian
  913. *
  914. * @b Description
  915. * @n This function programs the VCP to view the format of all data as packed
  916. * data in 32-bit words.
  917. *
  918. * @b Arguments
  919. @verbatim
  920. hVcp2 Handle to VCP2 instance.
  921. @endverbatim
  922. *
  923. * <b>Return Value </b>
  924. * @n None.
  925. *
  926. * <b>Pre Condition </b>
  927. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  928. * before doing any operations on it.
  929. *
  930. * <b>Post Condition </b>
  931. * @n None.
  932. *
  933. * @b Writes
  934. * @n VCP2_VCPEND_BM=0,
  935. * VCP2_VCPEND_SD=0
  936. *
  937. * @b Example
  938. * @verbatim
  939. VCP2_setPacked32Endian (hVcp2);
  940. @endverbatim
  941. * ============================================================================
  942. */
  943. /* for misra warnings*/
  944. static inline
  945. void VCP2_setPacked32Endian (
  946. VCP2Handle hVcp2
  947. );
  948. static inline
  949. void VCP2_setPacked32Endian (
  950. VCP2Handle hVcp2
  951. )
  952. {
  953. CSL_FINST (hVcp2->cfgregs->VCPEND, VCP2_VCPEND_BM, 32BIT);
  954. CSL_FINST (hVcp2->cfgregs->VCPEND, VCP2_VCPEND_SD, 32BIT);
  955. }
  956. /**
  957. * ============================================================================
  958. * @n@b VCP2_setSdEndian
  959. *
  960. * @b Description
  961. * @n This function programs the VCP to view the format of the soft decision
  962. * data as either native 8-bit format ('1') or values packed into 32-bit
  963. * words in little endian format ('0').
  964. *
  965. * @b Arguments
  966. @verbatim
  967. hVcp2 Handle to VCP2 instance.
  968. sdEnd '1' for native 8-bit format and '0' for 32-bit word packed
  969. format
  970. @endverbatim
  971. *
  972. * <b>Return Value </b>
  973. * @n None.
  974. *
  975. * <b>Pre Condition </b>
  976. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  977. * before doing any operations on it.
  978. *
  979. * <b>Post Condition </b>
  980. * @n None.
  981. *
  982. * @b Writes
  983. * @n VCP2_VCPEND_SD
  984. *
  985. * @b Example
  986. * @verbatim
  987. Uint32 sdEnd = VCP2_END_NATIVE;
  988. VCP2_setSdEndian (hVcp2, sdEnd);
  989. @endverbatim
  990. * ============================================================================
  991. */
  992. /* for misra warnings*/
  993. static inline
  994. void VCP2_setSdEndian (
  995. VCP2Handle hVcp2,
  996. Uint32 sdEnd
  997. );
  998. static inline
  999. void VCP2_setSdEndian (
  1000. VCP2Handle hVcp2,
  1001. Uint32 sdEnd
  1002. )
  1003. {
  1004. CSL_FINS (hVcp2->cfgregs->VCPEND, VCP2_VCPEND_SD, sdEnd);
  1005. }
  1006. /**
  1007. * ============================================================================
  1008. * @n@b VCP2_addPoly
  1009. *
  1010. * @b Description
  1011. * @n This function is used to add either predefined or user defined
  1012. * Polynomials to the generated VCP2_Params.
  1013. *
  1014. * @b Arguments
  1015. @verbatim
  1016. pPoly Pointer to the structure of type VCP2_Poly containing
  1017. the values of generator polynomials.
  1018. pParams Pointer to the structure of type VCP2_Params containing
  1019. the generated values for input configuration registers.
  1020. @endverbatim
  1021. *
  1022. * <b>Return Value </b>
  1023. * @n None.
  1024. *
  1025. * <b>Pre Condition </b>
  1026. * @n None.
  1027. *
  1028. * <b>Post Condition </b>
  1029. * @n Writes the pParams structure passed as input with the result.
  1030. *
  1031. * @b Writes
  1032. * @n None
  1033. *
  1034. * @b Example
  1035. * @verbatim
  1036. VCP2_Poly poly = {VCP2_GEN_POLY_3, VCP2_GEN_POLY_1,
  1037. VCP2_GEN_POLY_2, VCP2_GEN_POLY_3};
  1038. VCP2_Params params;
  1039. VCP2_Baseparams baseParams;
  1040. ...
  1041. VCP2_genParams (&baseParams, &params);
  1042. VCP2_addPoly (&poly, &params);
  1043. @endverbatim
  1044. * ============================================================================
  1045. */
  1046. /* for misra warnings*/
  1047. static inline
  1048. void VCP2_addPoly (
  1049. const VCP2_Poly *poly,
  1050. VCP2_Params *params
  1051. );
  1052. static inline
  1053. void VCP2_addPoly (
  1054. const VCP2_Poly *poly,
  1055. VCP2_Params *params
  1056. )
  1057. {
  1058. Uint8 x0, x1, x2, x3;
  1059. x0 = poly->poly0;
  1060. x1 = poly->poly1;
  1061. x2 = poly->poly2;
  1062. x3 = poly->poly3;
  1063. params->poly0 = x0;
  1064. params->poly1 = x1;
  1065. params->poly2 = x2;
  1066. params->poly3 = x3;
  1067. }
  1068. /**
  1069. * ============================================================================
  1070. * @n@b VCP2_statError
  1071. *
  1072. * @b Description
  1073. * @n This function returns a Boolean value indicating whether any VCP error
  1074. * has occurred.
  1075. *
  1076. * @b Arguments
  1077. @verbatim
  1078. hVcp2 Handle to VCP2 instance.
  1079. @endverbatim
  1080. *
  1081. * <b>Return Value </b> Boolean value
  1082. * @li bitStatus ERR bit field value of VCP status register 0.
  1083. *
  1084. * <b>Pre Condition </b>
  1085. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  1086. * before doing any operations on it.
  1087. *
  1088. * <b>Post Condition </b>
  1089. * @n The returned value indicates
  1090. * @li FALSE - No error.
  1091. * @li TRUE - VCP paused due to error.
  1092. *
  1093. * @b Reads
  1094. * @n VCP2_VCPSTAT0_ERR
  1095. *
  1096. * @b Example
  1097. * @verbatim
  1098. VCP2_Error error;
  1099. // check whether an error has occurred
  1100. if (VCP2_statError (hVcp2))
  1101. {
  1102. VCP2_getErrors (hVcp2, &error);
  1103. } // end if
  1104. @endverbatim
  1105. * ============================================================================
  1106. */
  1107. /* for misra warnings*/
  1108. static inline
  1109. Bool VCP2_statError (
  1110. VCP2Handle hVcp2
  1111. );
  1112. static inline
  1113. Bool VCP2_statError (
  1114. VCP2Handle hVcp2
  1115. )
  1116. {
  1117. return (Bool) CSL_FEXT (hVcp2->cfgregs->VCPSTAT0, VCP2_VCPSTAT0_ERR);
  1118. }
  1119. /**
  1120. * ============================================================================
  1121. * @n@b VCP2_statInFifo
  1122. *
  1123. * @b Description
  1124. * @n This function returns the input FIFO's empty status flag. A '1'
  1125. * indicates that the input FIFO is empty and a '0' indicates it is not
  1126. * empty.
  1127. *
  1128. * @b Arguments
  1129. @verbatim
  1130. hVcp2 Handle to VCP2 instance.
  1131. @endverbatim
  1132. *
  1133. * <b>Return Value </b> bitStatus
  1134. * @li bitStatus IFEMP bit field value of VCP status register 0.
  1135. *
  1136. * <b>Pre Condition </b>
  1137. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  1138. * before doing any operations on it.
  1139. *
  1140. * <b>Post Condition </b>
  1141. * @n The returned value indicates
  1142. * @li 0 - Input FIFO is not empty.
  1143. * @li 1 - Input FIFO is empty.
  1144. *
  1145. * @b Reads
  1146. * @n VCP2_VCPSTAT0_IFEMP
  1147. *
  1148. * @b Example
  1149. * @verbatim
  1150. If (VCP2_statInFifo (hVcp2))
  1151. {
  1152. ...
  1153. } // end if
  1154. @endverbatim
  1155. * ============================================================================
  1156. */
  1157. /* for misra warnings*/
  1158. static inline
  1159. Uint32 VCP2_statInFifo (
  1160. VCP2Handle hVcp2
  1161. );
  1162. static inline
  1163. Uint32 VCP2_statInFifo (
  1164. VCP2Handle hVcp2
  1165. )
  1166. {
  1167. return CSL_FEXT (hVcp2->cfgregs->VCPSTAT0, VCP2_VCPSTAT0_IFEMP);
  1168. }
  1169. /**
  1170. * ============================================================================
  1171. * @n@b VCP2_statOutFifo
  1172. *
  1173. * @b Description
  1174. * @n This function returns the output FIFO's full status flag. A '1'
  1175. * indicates that the output FIFO is full and a '0' indicates it is not.
  1176. *
  1177. * @b Arguments
  1178. @verbatim
  1179. hVcp2 Handle to VCP2 instance.
  1180. @endverbatim
  1181. *
  1182. * <b>Return Value </b> bitStatus
  1183. * @li bitStatus OFFUL bit field value of VCP status register 0.
  1184. *
  1185. * <b>Pre Condition </b>
  1186. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  1187. * before doing any operations on it.
  1188. *
  1189. * <b>Post Condition </b>
  1190. * @n The returned value indicates
  1191. * @li 0 - Output FIFO is not full.
  1192. * @li 1 - Output FIFO is full.
  1193. *
  1194. * @b Reads
  1195. * @n VCP2_VCPSTAT0_OFFUL
  1196. *
  1197. * @b Example
  1198. * @verbatim
  1199. If (VCP2_statOutFifo (hVcp2))
  1200. {
  1201. ...
  1202. } // end if
  1203. @endverbatim
  1204. * ============================================================================
  1205. */
  1206. /* for misra warnings*/
  1207. static inline
  1208. Uint32 VCP2_statOutFifo (
  1209. VCP2Handle hVcp2
  1210. );
  1211. static inline
  1212. Uint32 VCP2_statOutFifo (
  1213. VCP2Handle hVcp2
  1214. )
  1215. {
  1216. return CSL_FEXT (hVcp2->cfgregs->VCPSTAT0, VCP2_VCPSTAT0_OFFUL);
  1217. }
  1218. /**
  1219. * ============================================================================
  1220. * @n@b VCP2_statPause
  1221. *
  1222. * @b Description
  1223. * @n This function returns the PAUSE bit status indicating whether the VCP is
  1224. * paused or not.
  1225. *
  1226. * @b Arguments
  1227. @verbatim
  1228. hVcp2 Handle to VCP2 instance.
  1229. @endverbatim
  1230. *
  1231. * <b>Return Value </b> bitStatus
  1232. * @li bitStatus PAUSE bit field value of VCP status register 0.
  1233. *
  1234. * <b>Pre Condition </b>
  1235. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  1236. * before doing any operations on it.
  1237. *
  1238. * <b>Post Condition </b>
  1239. * @n The returned value indicates
  1240. * @li 0 - VCP is not paused.
  1241. * @li 1 - VCP is paused.
  1242. *
  1243. * @b Reads
  1244. * @n VCP2_VCPSTAT0_PAUSE
  1245. *
  1246. * @b Example
  1247. * @verbatim
  1248. // Pause the VCP.
  1249. VCP2_pause (hVcp2);
  1250. // Wait for pause to take place
  1251. while (! VCP2_statPause (hVcp2));
  1252. @endverbatim
  1253. * ============================================================================
  1254. */
  1255. /* for misra warnings*/
  1256. static inline
  1257. Uint32 VCP2_statPause (
  1258. VCP2Handle hVcp2
  1259. );
  1260. static inline
  1261. Uint32 VCP2_statPause (
  1262. VCP2Handle hVcp2
  1263. )
  1264. {
  1265. return CSL_FEXT (hVcp2->cfgregs->VCPSTAT0, VCP2_VCPSTAT0_PAUSE);
  1266. }
  1267. /**
  1268. * ============================================================================
  1269. * @n@b VCP2_statRun
  1270. *
  1271. * @b Description
  1272. * @n This function returns the RUN bit status indicating whether the VCP is
  1273. * running or not.
  1274. *
  1275. * @b Arguments
  1276. @verbatim
  1277. hVcp2 Handle to VCP2 instance.
  1278. @endverbatim
  1279. *
  1280. * <b>Return Value </b> bitStatus
  1281. * @li bitStatus RUN bit field value of VCP status register 0.
  1282. *
  1283. * <b>Pre Condition </b>
  1284. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  1285. * before doing any operations on it.
  1286. *
  1287. * <b>Post Condition </b>
  1288. * @n The returned value indicates
  1289. * @li 0 - VCP is not running.
  1290. * @li 1 - VCP is running.
  1291. *
  1292. * @b Reads
  1293. * @n VCP2_VCPSTAT0_RUN
  1294. *
  1295. * @b Example
  1296. * @verbatim
  1297. // start the VCP
  1298. VCP2_start (hVcp2);
  1299. // check that the VCP is running
  1300. while (! VCP2_statRun (hVcp2));
  1301. @endverbatim
  1302. * ============================================================================
  1303. */
  1304. /* for misra warnings*/
  1305. static inline
  1306. Uint32 VCP2_statRun (
  1307. VCP2Handle hVcp2
  1308. );
  1309. static inline
  1310. Uint32 VCP2_statRun (
  1311. VCP2Handle hVcp2
  1312. )
  1313. {
  1314. return CSL_FEXT (hVcp2->cfgregs->VCPSTAT0, VCP2_VCPSTAT0_RUN);
  1315. }
  1316. /**
  1317. * ============================================================================
  1318. * @n@b VCP2_statSymProc
  1319. *
  1320. * @b Description
  1321. * @n This function returns the number of symbols processed, NSYMPROC bitfield
  1322. * of VCP.
  1323. *
  1324. * @b Arguments
  1325. @verbatim
  1326. hVcp2 Handle to VCP2 instance.
  1327. @endverbatim
  1328. *
  1329. * <b>Return Value </b> Value
  1330. * @li Value Number of symbols processed.
  1331. *
  1332. * <b>Pre Condition </b>
  1333. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  1334. * before doing any operations on it.
  1335. *
  1336. * <b>Post Condition </b>
  1337. * @n None.
  1338. *
  1339. * @b Reads
  1340. * @n VCP2_VCPSTAT0_NSYMPROC
  1341. *
  1342. * @b Example
  1343. * @verbatim
  1344. Uint32 numSym;
  1345. ...
  1346. numSym = VCP2_statSymProc (hVcp2);
  1347. @endverbatim
  1348. * ============================================================================
  1349. */
  1350. /* for misra warnings*/
  1351. static inline
  1352. Uint32 VCP2_statSymProc (
  1353. VCP2Handle hVcp2
  1354. );
  1355. static inline
  1356. Uint32 VCP2_statSymProc (
  1357. VCP2Handle hVcp2
  1358. )
  1359. {
  1360. return CSL_FEXT (hVcp2->cfgregs->VCPSTAT0, VCP2_VCPSTAT0_NSYMPROC);
  1361. }
  1362. /**
  1363. * ============================================================================
  1364. * @n@b VCP2_statWaitIc
  1365. *
  1366. * @b Description
  1367. * @n This function returns the WIC bit status indicating whether the VCP is
  1368. * waiting to receive new input configuration values.
  1369. *
  1370. * @b Arguments
  1371. @verbatim
  1372. hVcp2 Handle to VCP2 instance.
  1373. @endverbatim
  1374. *
  1375. * <b>Return Value </b> bitStatus
  1376. * @li bitStatus WIC bit field value of VCP status register 0.
  1377. *
  1378. * <b>Pre Condition </b>
  1379. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  1380. * before doing any operations on it.
  1381. *
  1382. * <b>Post Condition </b>
  1383. * @n The returned value indicates
  1384. * @li 0 - VCP is not waiting for input configuration words.
  1385. * @li 1 - VCP is waiting for input configuration words.
  1386. *
  1387. * @b Reads
  1388. * @n VCP2_VCPSTAT0_WIC
  1389. *
  1390. * @b Example
  1391. * @verbatim
  1392. If (VCP2_statWaitIc (hVcp2))
  1393. {
  1394. ...
  1395. } // end if
  1396. @endverbatim
  1397. * ============================================================================
  1398. */
  1399. /* for misra warnings*/
  1400. static inline
  1401. Uint32 VCP2_statWaitIc (
  1402. VCP2Handle hVcp2
  1403. );
  1404. static inline
  1405. Uint32 VCP2_statWaitIc (
  1406. VCP2Handle hVcp2
  1407. )
  1408. {
  1409. return CSL_FEXT (hVcp2->cfgregs->VCPSTAT0, VCP2_VCPSTAT0_WIC);
  1410. }
  1411. /**
  1412. * ============================================================================
  1413. * @n@b VCP2_start
  1414. *
  1415. * @b Description
  1416. * @n This function starts the VCP by writing a start command to the VCPEXE
  1417. * register.
  1418. *
  1419. * @b Arguments
  1420. @verbatim
  1421. hVcp2 Handle to VCP2 instance.
  1422. @endverbatim
  1423. *
  1424. * <b>Return Value </b>
  1425. * @n None.
  1426. *
  1427. * <b>Pre Condition </b>
  1428. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  1429. * before doing any operations on it.
  1430. *
  1431. * <b>Post Condition </b>
  1432. * @n VCP is started.
  1433. *
  1434. * @b Writes
  1435. * @n VCP2_VCPEXE_COMMAND=1
  1436. *
  1437. * @b Affects
  1438. * @n VCP2_VCPSTAT0_RUN=1
  1439. *
  1440. * @b Example
  1441. * @verbatim
  1442. VCP2_start (hVcp2);
  1443. @endverbatim
  1444. * ============================================================================
  1445. */
  1446. /* for misra warnings*/
  1447. static inline
  1448. void VCP2_start (
  1449. VCP2Handle hVcp2
  1450. );
  1451. static inline
  1452. void VCP2_start (
  1453. VCP2Handle hVcp2
  1454. )
  1455. {
  1456. CSL_FINST (hVcp2->cfgregs->VCPEXE, VCP2_VCPEXE_COMMAND, START);
  1457. }
  1458. /**
  1459. * ============================================================================
  1460. * @n@b VCP2_pause
  1461. *
  1462. * @b Description
  1463. * @n This function pauses the VCP by writing a pause command to the VCPEXE
  1464. * register.
  1465. *
  1466. * @b Arguments
  1467. @verbatim
  1468. hVcp2 Handle to VCP2 instance.
  1469. @endverbatim
  1470. *
  1471. * <b>Return Value </b>
  1472. * @n None.
  1473. *
  1474. * <b>Pre Condition </b>
  1475. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  1476. * before doing any operations on it.The VCP should be operating in
  1477. * debug/emulation mode.
  1478. *
  1479. * <b>Post Condition </b>
  1480. * @n VCP is paused.
  1481. *
  1482. * @b Writes
  1483. * @n VCP2_VCPEXE_COMMAND=2
  1484. *
  1485. * @b Affects
  1486. * @n VCP2_VCPSTAT0_PAUSE=1
  1487. *
  1488. * @b Example
  1489. * @verbatim
  1490. VCP2_pause (hVcp2);
  1491. @endverbatim
  1492. * ============================================================================
  1493. */
  1494. /* for misra warnings*/
  1495. static inline
  1496. void VCP2_pause (
  1497. VCP2Handle hVcp2
  1498. );
  1499. static inline
  1500. void VCP2_pause (
  1501. VCP2Handle hVcp2
  1502. )
  1503. {
  1504. CSL_FINST (hVcp2->cfgregs->VCPEXE, VCP2_VCPEXE_COMMAND, PAUSE);
  1505. }
  1506. /**
  1507. * ============================================================================
  1508. * @n@b VCP2_unpause
  1509. *
  1510. * @b Description
  1511. * @n This function un-pauses the VCP, previously paused by VCP2_pause()
  1512. * function, by writing the un-pause command to the VCPEXE register.
  1513. * This function restarts the VCP at the beginning of current
  1514. * traceback, and VCP will run to normal completion.
  1515. *
  1516. * @b Arguments
  1517. @verbatim
  1518. hVcp2 Handle to VCP2 instance.
  1519. @endverbatim
  1520. *
  1521. * <b>Return Value </b>
  1522. * @n None.
  1523. *
  1524. * <b>Pre Condition </b>
  1525. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  1526. * before doing any operations on it.The VCP should be operating in
  1527. * debug/emulation mode.
  1528. *
  1529. * <b>Post Condition </b>
  1530. * @n VCP is restarted.
  1531. *
  1532. * @b Writes
  1533. * @n VCP2_VCPEXE_COMMAND=4
  1534. *
  1535. * @b Affects
  1536. * @n VCP2_VCPSTAT0_PAUSE=0
  1537. *
  1538. * @b Example
  1539. * @verbatim
  1540. VCP2_unpause (hVcp2);
  1541. @endverbatim
  1542. * ============================================================================
  1543. */
  1544. /* for misra warnings*/
  1545. static inline
  1546. void VCP2_unpause (
  1547. VCP2Handle hVcp2
  1548. );
  1549. static inline
  1550. void VCP2_unpause (
  1551. VCP2Handle hVcp2
  1552. )
  1553. {
  1554. CSL_FINST (hVcp2->cfgregs->VCPEXE, VCP2_VCPEXE_COMMAND, RESTART);
  1555. }
  1556. /**
  1557. * ============================================================================
  1558. * @n@b VCP2_stepTraceback
  1559. *
  1560. * @b Description
  1561. * @n This function un-pauses the VCP, previously paused by VCP2_pause()
  1562. * function, by writing the un-pause command to the VCPEXE register.
  1563. * This function restarts the VCP at the beginning of current
  1564. * traceback and halts at the next traceback (i.e Step Single Traceback).
  1565. *
  1566. * @b Arguments
  1567. @verbatim
  1568. hVcp2 Handle to VCP2 instance.
  1569. @endverbatim
  1570. *
  1571. * <b>Return Value </b>
  1572. * @n None.
  1573. *
  1574. * <b>Pre Condition </b>
  1575. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  1576. * before doing any operations on it. The VCP should be operating in
  1577. * debug/emulation mode.
  1578. *
  1579. * <b>Post Condition </b>
  1580. * @n VCP is restarted.
  1581. *
  1582. * @b Writes
  1583. * @n VCP2_VCPEXE_COMMAND=3
  1584. *
  1585. * @b Example
  1586. * @verbatim
  1587. VCP2_stepTraceback (hVcp2);
  1588. @endverbatim
  1589. * ============================================================================
  1590. */
  1591. /* for misra warnings*/
  1592. static inline
  1593. void VCP2_stepTraceback (
  1594. VCP2Handle hVcp2
  1595. );
  1596. static inline
  1597. void VCP2_stepTraceback (
  1598. VCP2Handle hVcp2
  1599. )
  1600. {
  1601. CSL_FINST (hVcp2->cfgregs->VCPEXE, VCP2_VCPEXE_COMMAND, RESTART_PAUSE);
  1602. }
  1603. /**
  1604. * ============================================================================
  1605. * @n@b VCP2_reset
  1606. *
  1607. * @b Description
  1608. * @n This function sets all the VCP control registers to their default
  1609. * values.
  1610. *
  1611. * @b Arguments
  1612. @verbatim
  1613. hVcp2 Handle to VCP2 instance.
  1614. @endverbatim
  1615. *
  1616. * <b>Return Value </b>
  1617. * @n None.
  1618. *
  1619. * <b>Pre Condition </b>
  1620. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  1621. * before doing any operations on it.
  1622. *
  1623. * <b>Post Condition </b>
  1624. * @n All registers in the VCP are reset except for the execution register,
  1625. * endian register, emulation register and other internal registers.
  1626. *
  1627. * @b Writes
  1628. * @n VCP2_VCPEXE_COMMAND=5
  1629. *
  1630. * @b Example
  1631. * @verbatim
  1632. VCP2_reset (hVcp2);
  1633. @endverbatim
  1634. * ============================================================================
  1635. */
  1636. /* for misra warnings*/
  1637. static inline
  1638. void VCP2_reset (
  1639. VCP2Handle hVcp2
  1640. );
  1641. static inline
  1642. void VCP2_reset (
  1643. VCP2Handle hVcp2
  1644. )
  1645. {
  1646. CSL_FINST (hVcp2->cfgregs->VCPEXE, VCP2_VCPEXE_COMMAND, STOP);
  1647. }
  1648. /**
  1649. * ============================================================================
  1650. * @n@b VCP2_getErrors
  1651. *
  1652. * @b Description
  1653. * @n This function will acquire the VCPERR register values and fill in the
  1654. * fields of VCP2_Error structure and pass it back as the results.
  1655. *
  1656. * @b Arguments
  1657. @verbatim
  1658. hVcp2 Handle to VCP2 instance.
  1659. pVcpErr Pointer to the VCP2_Errors structure instance.
  1660. @endverbatim
  1661. *
  1662. * <b>Return Value </b>
  1663. * @n None.
  1664. *
  1665. * <b>Pre Condition </b>
  1666. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  1667. * before doing any operations on it.
  1668. *
  1669. * <b>Post Condition </b>
  1670. * @n The fields of the VCP2_Errors structure indicate the respective errors if
  1671. * occurred. Writes VCPSTAT0 register, as a side effect. Clears ERR bit.
  1672. *
  1673. * @b Reads
  1674. * @n VCP2_VCPERR_TBNAERR,
  1675. * VCP2_VCPERR_FTLERR,
  1676. * VCP2_VCPERR_FCTLERR,
  1677. * VCP2_VCPERR_MAXMINERR,
  1678. * VCP2_VCPERR_E_SYMX,
  1679. * VCP2_VCPERR_E_SYMR
  1680. *
  1681. * @b Affects
  1682. * @n VCP2_VCPSTAT0_ERR=0
  1683. *
  1684. * @b Example
  1685. @verbatim
  1686. VCP2_Errors error;
  1687. // check whether an error has occurred
  1688. if (VCP2_statError (hVcp2))
  1689. {
  1690. VCP2_getErrors (hVcp2, &error);
  1691. } // end if
  1692. @endverbatim
  1693. * ============================================================================
  1694. */
  1695. /* for misra warnings*/
  1696. static inline
  1697. void VCP2_getErrors (
  1698. VCP2Handle hVcp2,
  1699. VCP2_Errors *pVcpErr
  1700. );
  1701. static inline
  1702. void VCP2_getErrors (
  1703. VCP2Handle hVcp2,
  1704. VCP2_Errors *pVcpErr
  1705. )
  1706. {
  1707. pVcpErr->tbnaErr = (Bool) CSL_FEXT (hVcp2->cfgregs->VCPERR, VCP2_VCPERR_TBNAERR);
  1708. pVcpErr->ftlErr = (Bool) CSL_FEXT (hVcp2->cfgregs->VCPERR, VCP2_VCPERR_FTLERR);
  1709. pVcpErr->fctlErr = (Bool) CSL_FEXT (hVcp2->cfgregs->VCPERR, VCP2_VCPERR_FCTLERR);
  1710. pVcpErr->maxminErr = (Bool) CSL_FEXT (hVcp2->cfgregs->VCPERR, VCP2_VCPERR_MAXMINERR);
  1711. pVcpErr->symxErr = (Bool) CSL_FEXT (hVcp2->cfgregs->VCPERR, VCP2_VCPERR_E_SYMX);
  1712. pVcpErr->symrErr = (Bool) CSL_FEXT (hVcp2->cfgregs->VCPERR, VCP2_VCPERR_E_SYMR);
  1713. }
  1714. /**
  1715. * ============================================================================
  1716. * @n@b VCP2_statEmuHalt
  1717. *
  1718. * @b Description
  1719. * @n This function returns the EMUHALT bit status indicating whether the VCP
  1720. * halt is due to emulation or not.
  1721. *
  1722. * @b Arguments
  1723. @verbatim
  1724. hVcp2 Handle to VCP2 instance.
  1725. @endverbatim
  1726. *
  1727. * <b>Return Value </b> bitStatus
  1728. * @li bitStatus Emuhalt bit field value of VCP status register 0.
  1729. *
  1730. * <b>Pre Condition </b>
  1731. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  1732. * before doing any operations on it.
  1733. *
  1734. * <b>Post Condition </b>
  1735. * @n The returned value indicates
  1736. * @li 0 - Not halt due to emulation.
  1737. * @li 1 - Halt due to emulation.
  1738. *
  1739. * @b Reads
  1740. * @n VCP2_VCPSTAT0_EMUHALT
  1741. *
  1742. * @b Example
  1743. @verbatim
  1744. If (VCP2_statEmuHalt (hVcp2))
  1745. {
  1746. ...
  1747. }// end if
  1748. @endverbatim
  1749. * ============================================================================
  1750. */
  1751. /* for misra warnings*/
  1752. static inline Uint32 VCP2_statEmuHalt (VCP2Handle hVcp2);
  1753. static inline Uint32 VCP2_statEmuHalt (VCP2Handle hVcp2)
  1754. {
  1755. return CSL_FEXT (hVcp2->cfgregs->VCPSTAT0, VCP2_VCPSTAT0_EMUHALT);
  1756. }
  1757. /**
  1758. * ============================================================================
  1759. * @n@b VCP2_emuDisable
  1760. *
  1761. * @b Description
  1762. * @n This function disables the emulation/debug mode of VCP.
  1763. *
  1764. * @b Arguments
  1765. @verbatim
  1766. hVcp2 Handle to VCP2 instance.
  1767. @endverbatim
  1768. *
  1769. * <b>Return Value </b>
  1770. * @n None.
  1771. *
  1772. * <b>Pre Condition </b>
  1773. * @n @a VCP2_init() must be called to initialize the VCP2 peripheral
  1774. * before doing any operations on it.
  1775. *
  1776. * <b>Post Condition </b>
  1777. * @n VCP emulation control register is modified.
  1778. *
  1779. * @b Writes
  1780. * @n VCP2_VCPEMU_FREE=1
  1781. *
  1782. * @b Example
  1783. @verbatim
  1784. VCP2_emuDisable (hVcp2);
  1785. @endverbatim
  1786. * ============================================================================
  1787. */
  1788. /* for misra warnings*/
  1789. static inline void VCP2_emuDisable (VCP2Handle hVcp2);
  1790. static inline void VCP2_emuDisable (VCP2Handle hVcp2)
  1791. {
  1792. CSL_FINST (hVcp2->cfgregs->VCPEMU, VCP2_VCPEMU_FREE, FREE);
  1793. }
  1794. /* @} */
  1795. #ifdef __cplusplus
  1796. }
  1797. #endif
  1798. #endif