csl_xmcAux.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029
  1. /* ============================================================================
  2. * Copyright (c) Texas Instruments Incorporated 2008, 2009 2016
  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_xmcAux.h
  35. *
  36. * @brief
  37. * API Auxilary header file for XMC CSL. It gives the definitions of the
  38. * status query & control functions.
  39. *
  40. * \par
  41. * ============================================================================
  42. * @n (C) Copyright 2008, 2009, Texas Instruments, Inc.
  43. * @n Use of this software is controlled by the terms and conditions found
  44. * @n in the license agreement under which this software has been supplied.
  45. * ===========================================================================
  46. * \par
  47. */
  48. #ifndef CSL_XMCAUX_H
  49. #define CSL_XMCAUX_H
  50. #ifdef __cplusplus
  51. extern "C" {
  52. #endif
  53. #include <ti/csl/csl_xmc.h>
  54. /** @addtogroup CSL_XMC_FUNCTION
  55. @{ */
  56. /** ============================================================================
  57. * @n@b CSL_XMC_setXMPAXH
  58. *
  59. * @b Description
  60. * @n This function sets the contents of XMPAXH register indicated by the
  61. * index here.
  62. * please see section 7.3 on MPAX unit http://www.ti.com/lit/sprugw0
  63. * for details on the sample arguments and example values to set
  64. * XMPAXH register as provided under table 7-2
  65. *
  66. * @b Arguments
  67. @verbatim
  68. index Index into the set of 16 registers (0-15)
  69. mpaxh CSL_XMC_XMPAXH structure that needs to be set into the
  70. register
  71. @endverbatim
  72. *
  73. * <b> Return Value </b>
  74. * @n None
  75. *
  76. * <b> Pre Condition </b>
  77. * @n None
  78. *
  79. * <b> Post Condition </b>
  80. * @n Corresponding XMPAXH register configured with the value passed.
  81. *
  82. * @b Writes
  83. * @n XMC_XMPAXH_SEGSZ, XMC_XMPAXH_BADDR
  84. *
  85. * @b Example
  86. * @verbatim
  87. Uint32 index = 0;
  88. CSL_XMC_XMPAXH mpaxh;
  89. mpaxh.segSize = 4;
  90. mpaxh.baseAddress = 0x1000;
  91. CSL_XMC_setXMPAXH (index, &mpaxh);
  92. @endverbatim
  93. * =============================================================================
  94. */
  95. static inline void CSL_XMC_setXMPAXH
  96. (
  97. Uint32 index,
  98. const CSL_XMC_XMPAXH* mpaxh
  99. );
  100. static inline void CSL_XMC_setXMPAXH
  101. (
  102. Uint32 index,
  103. const CSL_XMC_XMPAXH* mpaxh
  104. )
  105. {
  106. hXmc->XMPAX[index].XMPAXH = CSL_FMK(XMC_XMPAXH_SEGSZ, mpaxh->segSize) |
  107. CSL_FMK(XMC_XMPAXH_BADDR, mpaxh->bAddr);
  108. }
  109. /** ============================================================================
  110. * @n@b CSL_XMC_setXMPAXL
  111. *
  112. * @b Description
  113. * @n This function sets the contents of XMPAXL register corresponding to the
  114. * index specified.
  115. * please see section 7.3 on MPAX unit http://www.ti.com/lit/sprugw0
  116. * for details on the sample arguments and example values to set
  117. * XMPAXL register as provided under table 7-2
  118. *
  119. * @b Arguments
  120. @verbatim
  121. index Index into the set of 16 registers (0-15)
  122. mpaxl CSL_XMC_XMPAXL structure that needs to be set into the
  123. register
  124. @endverbatim
  125. *
  126. * <b> Return Value </b>
  127. * @n None
  128. *
  129. * <b> Pre Condition </b>
  130. * @n None
  131. *
  132. * <b> Post Condition </b>
  133. * @n Corresponding XMPAXL register configured with the value passed.
  134. *
  135. * @b Writes
  136. * @n XMC_XMPAXL_RADDR,
  137. * XMC_XMPAXL_UX,
  138. * XMC_XMPAXL_UW,
  139. * XMC_XMPAXL_UR,
  140. * XMC_XMPAXL_SX,
  141. * XMC_XMPAXL_SW,
  142. * XMC_XMPAXL_SR
  143. *
  144. * @b Example
  145. * @verbatim
  146. Uint32 index = 0;
  147. CSL_XMC_XMPAXL mpaxl;
  148. mpaxl.ux = 1;
  149. mpaxl.uw = 1;
  150. mpaxl.ur = 1;
  151. mpaxl.sx = 1;
  152. mpaxl.sw = 1;
  153. mpaxl.sr = 1;
  154. mpaxl.rAddr = 0x4000 ;
  155. CSL_XMC_setXMPAXL (index, &mpaxl);
  156. @endverbatim
  157. * =============================================================================
  158. */
  159. static inline void CSL_XMC_setXMPAXL
  160. (
  161. Uint32 index,
  162. const CSL_XMC_XMPAXL* mpaxl
  163. );
  164. static inline void CSL_XMC_setXMPAXL
  165. (
  166. Uint32 index,
  167. const CSL_XMC_XMPAXL* mpaxl
  168. )
  169. {
  170. Uint32 value = 0;
  171. /* Configure the XMPAXL register specified by the index. */
  172. CSL_FINS (value, XMC_XMPAXL_UX, mpaxl->ux);
  173. CSL_FINS (value, XMC_XMPAXL_UW, mpaxl->uw);
  174. CSL_FINS (value, XMC_XMPAXL_UR, mpaxl->ur);
  175. CSL_FINS (value, XMC_XMPAXL_SX, mpaxl->sx);
  176. CSL_FINS (value, XMC_XMPAXL_SW, mpaxl->sw);
  177. CSL_FINS (value, XMC_XMPAXL_SR, mpaxl->sr);
  178. CSL_FINS (value, XMC_XMPAXL_RADDR, mpaxl->rAddr);
  179. hXmc->XMPAX[index].XMPAXL = value;
  180. }
  181. /** ============================================================================
  182. * @n@b CSL_XMC_getXMPAXH
  183. *
  184. * @b Description
  185. * @n This function gets the contents of XMPAXH register.
  186. *
  187. * please see section 7.3 on MPAX unit http://www.ti.com/lit/sprugw0
  188. * for details on the sample arguments and example values to set
  189. * XMPAXH register as provided under table 7-2
  190. *
  191. * @b Arguments
  192. @verbatim
  193. index Index into the set of 16 XMPAXH registers
  194. mpaxh CSL_XMC_XMPAXH structure that needs to be populated with
  195. XMPAXH register contents.
  196. @endverbatim
  197. *
  198. * <b> Return Value </b>
  199. * @n None
  200. *
  201. * <b> Pre Condition </b>
  202. * @n None
  203. *
  204. * <b> Post Condition </b>
  205. * @n None
  206. *
  207. * @b Reads
  208. * @n XMC_XMPAXH_SEGSZ, XMC_XMPAXH_BADDR
  209. *
  210. * @b Example
  211. * @verbatim
  212. Uint32 index = 0;
  213. CSL_XMC_XMPAXH mpaxh;
  214. CSL_XMC_getXMPAXH (index, &mpaxh);
  215. @endverbatim
  216. * =============================================================================
  217. */
  218. static inline void CSL_XMC_getXMPAXH
  219. (
  220. Uint32 index,
  221. CSL_XMC_XMPAXH* mpaxh
  222. );
  223. static inline void CSL_XMC_getXMPAXH
  224. (
  225. Uint32 index,
  226. CSL_XMC_XMPAXH* mpaxh
  227. )
  228. {
  229. Uint32 value = hXmc->XMPAX[index].XMPAXH;
  230. /* Retrieve contents of XMPAXH register specified by the index */
  231. mpaxh->segSize = CSL_FEXT (value, XMC_XMPAXH_SEGSZ);
  232. mpaxh->bAddr = CSL_FEXT (value, XMC_XMPAXH_BADDR);
  233. }
  234. /** ============================================================================
  235. * @n@b CSL_XMC_getXMPAXL
  236. *
  237. * @b Description
  238. * @n This function gets the contents of XMPAXL register.
  239. *
  240. * please see section 7.3 on MPAX unit http://www.ti.com/lit/sprugw0
  241. * for details on the sample arguments and example values to set
  242. * XMPAXL register as provided under table 7-2
  243. *
  244. * @b Arguments
  245. @verbatim
  246. index Index into the set of 16 registers
  247. mpaxl CSL_XMC_XMPAXL structure that needs to be populated with
  248. XMPAXL register contents.
  249. @endverbatim
  250. *
  251. * <b> Return Value </b>
  252. * @n None
  253. *
  254. * <b> Pre Condition </b>
  255. * @n None
  256. *
  257. * <b> Post Condition </b>
  258. * @n None
  259. *
  260. * @b Reads
  261. * @n XMC_XMPAXL_RADDR,
  262. * XMC_XMPAXL_UX,
  263. * XMC_XMPAXL_UW,
  264. * XMC_XMPAXL_UR,
  265. * XMC_XMPAXL_SX,
  266. * XMC_XMPAXL_SW,
  267. * XMC_XMPAXL_SR
  268. *
  269. * @b Example
  270. * @verbatim
  271. Uint32 index = 0;
  272. CSL_XMC_XMPAXL mpaxl;
  273. CSL_XMC_getXMPAXL (index, &mpaxl);
  274. @endverbatim
  275. * =============================================================================
  276. */
  277. static inline void CSL_XMC_getXMPAXL (
  278. Uint32 index,
  279. CSL_XMC_XMPAXL * mpaxl
  280. );
  281. static inline void CSL_XMC_getXMPAXL (
  282. Uint32 index,
  283. CSL_XMC_XMPAXL * mpaxl
  284. )
  285. {
  286. Uint32 value = hXmc->XMPAX[index].XMPAXL;
  287. /* Retrieve contents of XMPAXL register using the index specified */
  288. mpaxl->rAddr = CSL_FEXT (value, XMC_XMPAXL_RADDR);
  289. mpaxl->sr = CSL_FEXT (value, XMC_XMPAXL_SR);
  290. mpaxl->sw = CSL_FEXT (value, XMC_XMPAXL_SW);
  291. mpaxl->sx = CSL_FEXT (value, XMC_XMPAXL_SX);
  292. mpaxl->ur = CSL_FEXT (value, XMC_XMPAXL_UR);
  293. mpaxl->uw = CSL_FEXT (value, XMC_XMPAXL_UW);
  294. mpaxl->ux = CSL_FEXT (value, XMC_XMPAXL_UX);
  295. }
  296. /** ============================================================================
  297. * @n@b CSL_XMC_getFaultAddress
  298. *
  299. * @b Description
  300. * @n This function gets the access address causing the fault.
  301. *
  302. * @b Arguments
  303. * @n None
  304. *
  305. * <b> Return Value </b> Uint32
  306. *
  307. * <b> Pre Condition </b>
  308. * @n None
  309. *
  310. * <b> Post Condition </b>
  311. * @n None
  312. *
  313. * @b Reads
  314. * @n XMC_XMPFAR_FADDR
  315. *
  316. * @b Example
  317. * @verbatim
  318. Uint32 faultAddr;
  319. faultAddr = CSL_XMC_getFaultAddress ();
  320. @endverbatim
  321. * =============================================================================
  322. */
  323. static inline Uint32 CSL_XMC_getFaultAddress (void);
  324. static inline Uint32 CSL_XMC_getFaultAddress (void)
  325. {
  326. return CSL_FEXT (hXmc->XMPFAR, XMC_XMPFAR_FADDR);
  327. }
  328. /** ============================================================================
  329. * @n@b CSL_XMC_clearFault
  330. *
  331. * @b Description
  332. * @n This function clears the fault information.
  333. *
  334. * @b Arguments
  335. * @n None
  336. *
  337. * <b> Return Value </b>
  338. * @n None
  339. *
  340. * <b> Pre Condition </b>
  341. * @n None
  342. *
  343. * <b> Post Condition </b>
  344. * @n XMPFCR register configured with the value passed. Fault
  345. * address and status registers are cleared.
  346. *
  347. * @b Writes
  348. * @n XMC_XMPFCR_MPFCLR=1
  349. *
  350. * @b Affects
  351. * @n XMC_XMPFAR_FADDR=0,
  352. * XMC_XMPFSR_LOCAL=0,
  353. * XMC_XMPFSR_SR=0,
  354. * XMC_XMPFSR_SX=0,
  355. * XMC_XMPFSR_UR=0,
  356. * XMC_XMPFSR_UW=0,
  357. * XMC_XMPFSR_UW=0
  358. *
  359. * @b Example
  360. * @verbatim
  361. CSL_XMC_clearFault ();
  362. @endverbatim
  363. * =============================================================================
  364. */
  365. static inline void CSL_XMC_clearFault (void);
  366. static inline void CSL_XMC_clearFault (void)
  367. {
  368. hXmc->XMPFCR = CSL_FMK(XMC_XMPFCR_MPFCLR, (uint32_t)1U);
  369. }
  370. /** ============================================================================
  371. * @n@b CSL_XMC_getFaultStatus
  372. *
  373. * @b Description
  374. * @n This function gets the contents of Fault Status Register XMPFSR.
  375. *
  376. * @b Arguments
  377. @verbatim
  378. xmpfsr CSL_XMC_MPFSR structure that needs to be filled in from
  379. XMPFSR register
  380. @endverbatim
  381. *
  382. * <b> Return Value </b>
  383. * @n None
  384. *
  385. * <b> Pre Condition </b>
  386. * @n None
  387. *
  388. * <b> Post Condition </b>
  389. * @n None
  390. *
  391. * @b Reads
  392. * @n XMC_XMPFSR_LOCAL,
  393. * XMC_XMPFSR_SR,
  394. * XMC_XMPFSR_SX,
  395. * XMC_XMPFSR_UR,
  396. * XMC_XMPFSR_UW,
  397. * XMC_XMPFSR_UW
  398. *
  399. * @b Example
  400. * @verbatim
  401. CSL_XMC_MPFSR xmpfsr;
  402. CSL_XMC_getFaultStatus (&xmpfsr);
  403. @endverbatim
  404. * =============================================================================
  405. */
  406. static inline void CSL_XMC_getFaultStatus (CSL_XMC_MPFSR * xmpfsr);
  407. static inline void CSL_XMC_getFaultStatus (CSL_XMC_MPFSR * xmpfsr)
  408. {
  409. Uint32 value = hXmc->XMPFSR;
  410. xmpfsr->local = CSL_FEXT (value, XMC_XMPFSR_LOCAL);
  411. xmpfsr->sr = CSL_FEXT (value, XMC_XMPFSR_SR);
  412. xmpfsr->sw = CSL_FEXT (value, XMC_XMPFSR_SW);
  413. xmpfsr->sx = CSL_FEXT (value, XMC_XMPFSR_SX);
  414. xmpfsr->ur = CSL_FEXT (value, XMC_XMPFSR_UR);
  415. xmpfsr->uw = CSL_FEXT (value, XMC_XMPFSR_UW);
  416. xmpfsr->ux = CSL_FEXT (value, XMC_XMPFSR_UX);
  417. }
  418. /** ============================================================================
  419. * @n@b CSL_XMC_invalidatePrefetchBuffer
  420. *
  421. * @b Description
  422. * @n This function when called marks all slots in the data prefetch buffer and program
  423. * prefetch buffer invalid by writing 1 in the XPFCMD register's INV bit.
  424. *
  425. * @b Arguments
  426. * @n None
  427. *
  428. * <b> Return Value </b>
  429. * @n None
  430. *
  431. * <b> Pre Condition </b>
  432. * @n None
  433. *
  434. * <b> Post Condition </b>
  435. * @n CSL_XMC_XPFCMD_INV bit set to 1 and data and program prefetch buffers are
  436. * invalidated.
  437. *
  438. * @b Writes
  439. * @n XMC_XPFCMD_INV=1
  440. *
  441. * @b Affects
  442. * @n XMC_XPFADDR_DVH=0,
  443. * XMC_XPFADDR_DVL=0
  444. *
  445. *
  446. * @b Example
  447. * @verbatim
  448. *
  449. CSL_XMC_invalidatePrefetchBuffer ();
  450. @endverbatim
  451. * =============================================================================
  452. */
  453. static inline void CSL_XMC_invalidatePrefetchBuffer (void); /* for misra warnings */
  454. static inline void CSL_XMC_invalidatePrefetchBuffer (void)
  455. {
  456. hXmc->XPFCMD = CSL_FMK(XMC_XPFCMD_INV, (uint32_t)1U);
  457. }
  458. /** ============================================================================
  459. * @n@b CSL_XMC_loadAnalysisCounterEnable
  460. *
  461. * @b Description
  462. * @n This function when called sets the 'ACENL' bit of the XPFCMD register, thus
  463. * triggering a copy/load of ACEN bits (Analysis counter enable mode) into
  464. * ACEN bits of XPFACS register.
  465. *
  466. * @b Arguments
  467. * @n None
  468. *
  469. * <b> Return Value </b>
  470. * @n None
  471. *
  472. * <b> Pre Condition </b>
  473. * @n None
  474. *
  475. * <b> Post Condition </b>
  476. * @n CSL_XMC_XPFCMD_ACENL bit set to 1 and ACEN bits value is loaded into the
  477. * ACEN bits of XPFACS register.
  478. *
  479. * @b Writes
  480. * @n XMC_XPFCMD_ACENL=1
  481. *
  482. * @b Affects
  483. * @n XMC_XPFACS_ACEN
  484. *
  485. * @b Example
  486. * @verbatim
  487. *
  488. CSL_XMC_loadAnalysisCounterEnable ();
  489. @endverbatim
  490. * =============================================================================
  491. */
  492. static inline void CSL_XMC_loadAnalysisCounterEnable (void);
  493. static inline void CSL_XMC_loadAnalysisCounterEnable (void)
  494. {
  495. hXmc->XPFCMD = CSL_FMK (XMC_XPFCMD_ACENL, (uint32_t)1U);
  496. }
  497. /** ============================================================================
  498. * @n@b CSL_XMC_setAnalysisCounterEnableMode
  499. *
  500. * @b Description
  501. * @n This function when called sets up the Event counting mode by writing to
  502. * the 'ACEN' bits of the XPFCMD register.
  503. *
  504. * @b Arguments
  505. @verbatim
  506. acenMode Analyis counter mode.
  507. @endverbatim
  508. *
  509. * <b> Return Value </b>
  510. * @n None
  511. *
  512. * <b> Pre Condition </b>
  513. * @n None
  514. *
  515. * <b> Post Condition </b>
  516. * @n CSL_XMC_XPFCMD_ACEN bits written with the Analysis counter mode specified.
  517. *
  518. * @b Writes
  519. * @n XMC_XPFCMD_ACEN
  520. *
  521. * @b Example
  522. * @verbatim
  523. // Enable both program and data events
  524. CSL_XMC_setAnalysisCounterEnableMode (CSL_XMC_ACEN_MODE_COUNT_ALL);
  525. @endverbatim
  526. * =============================================================================
  527. */
  528. static inline void CSL_XMC_setAnalysisCounterEnableMode (CSL_XMC_ACEN_MODE acenMode);
  529. static inline void CSL_XMC_setAnalysisCounterEnableMode (CSL_XMC_ACEN_MODE acenMode)
  530. {
  531. uint32_t acen;
  532. acen = CSL_FMK(XMC_XPFCMD_ACEN, acenMode);
  533. acen |= CSL_FMK (XMC_XPFCMD_ACENL, (uint32_t)1U);
  534. /* Set all the information for enabling the ACEN at one shot */
  535. hXmc->XPFCMD = acen;
  536. }
  537. /** ============================================================================
  538. * @n@b CSL_XMC_resetAnalysisCounters
  539. *
  540. * @b Description
  541. * @n This function when called sets the 'ACRST' bit of the XPFCMD register, thus
  542. * triggering a clear/reset operation on the prefetch analysis counter registers.
  543. *
  544. * @b Arguments
  545. * @n None
  546. *
  547. * <b> Return Value </b>
  548. * @n None
  549. *
  550. * <b> Pre Condition </b>
  551. * @n None
  552. *
  553. * <b> Post Condition </b>
  554. * @n CSL_XMC_XPFCMD_ACRST bit set to 1 and prefetch analysis counter registers
  555. * are cleared.
  556. *
  557. * @b Writes
  558. * @n XMC_XPFCMD_ACRST=1
  559. *
  560. * @b Affects
  561. * @n XMC_XPFAC0_SENT=0,
  562. * XMC_XPFAC1_CANCELED=0,
  563. * XMC_XPFAC2_HIT=0,
  564. * XMC_XPFAC3_MISS=0
  565. *
  566. *
  567. * @b Example
  568. * @verbatim
  569. *
  570. CSL_XMC_resetAnalysisCounters ();
  571. @endverbatim
  572. * =============================================================================
  573. */
  574. static inline void CSL_XMC_resetAnalysisCounters (void);
  575. static inline void CSL_XMC_resetAnalysisCounters (void)
  576. {
  577. hXmc->XPFCMD = CSL_FMK(XMC_XPFCMD_ACRST, (uint32_t)1U);
  578. }
  579. /** ============================================================================
  580. * @n@b CSL_XMC_setPrefetchCommand
  581. *
  582. * @b Description
  583. * @n This function sets up the contents of the XPFCMD register based on the
  584. * inputs specified.
  585. *
  586. * @b Arguments
  587. @verbatim
  588. inv Invalidate Prefetch Buffer command flag. When set to 1,
  589. data and program prefetch buffers are invalidated.
  590. acEnLoad Analysis Counter Enable Load flag. When set to 1, the
  591. Analysis Counter Enable mode is loaded into the XPFACS status
  592. register.
  593. acEnMode Analyis counter enable mode. Specifies the event counting mode
  594. for the prefetcher.
  595. acRst Analysis counter Reset flag. When set to 1, resets all
  596. the prefetch event counters.
  597. @endverbatim
  598. *
  599. * <b> Return Value </b>
  600. * @n None
  601. *
  602. * <b> Pre Condition </b>
  603. * @n None
  604. *
  605. * <b> Post Condition </b>
  606. * @n CSL_XMC_XPFCMD written with the settings specified.
  607. *
  608. * @b Writes
  609. * @n XMC_XPFCMD_INV,
  610. * XMC_XPFCMD_ACENL,
  611. * XMC_XPFCMD_ACEN,
  612. * XMC_XPFCMD_ACRST
  613. *
  614. * @b Example
  615. * @verbatim
  616. // Issue the following prefetch commands:
  617. // - Dont invalidate prefetch buffers
  618. // - Enable Analysis Counter Enable load
  619. // - Enable both program and data event counting
  620. // - Dont reset the prefetch counters
  621. CSL_XMC_setPrefetchCommand (0, 1, CSL_XMC_ACEN_MODE_COUNT_ALL, 0);
  622. @endverbatim
  623. * =============================================================================
  624. */
  625. static inline void CSL_XMC_setPrefetchCommand
  626. (
  627. Uint8 inv,
  628. Uint8 acEnLoad,
  629. CSL_XMC_ACEN_MODE acenMode,
  630. Uint8 acRst
  631. );
  632. static inline void CSL_XMC_setPrefetchCommand
  633. (
  634. Uint8 inv,
  635. Uint8 acEnLoad,
  636. CSL_XMC_ACEN_MODE acenMode,
  637. Uint8 acRst
  638. )
  639. {
  640. hXmc->XPFCMD = CSL_FMK (XMC_XPFCMD_INV, (Uint32)inv) |
  641. CSL_FMK (XMC_XPFCMD_ACENL, (Uint32)acEnLoad) |
  642. CSL_FMK (XMC_XPFCMD_ACEN, acenMode) |
  643. CSL_FMK (XMC_XPFCMD_ACRST, (Uint32)acRst);
  644. }
  645. /** ============================================================================
  646. * @n@b CSL_XMC_getAnalysisCounterEnableStatus
  647. *
  648. * @b Description
  649. * @n This function returns the Analysis counter enable mode by reading the
  650. * contents of 'ACEN' bits from the XPFACS register.
  651. *
  652. * @b Arguments
  653. * @n None
  654. *
  655. * <b> Return Value </b> CSL_XMC_ACEN_MODE - Event counting mode
  656. *
  657. * <b> Pre Condition </b>
  658. * @n None
  659. *
  660. * <b> Post Condition </b>
  661. * @n CSL_XMC_XPFACS_ACEN bits read and returned
  662. *
  663. * @b Reads
  664. * @n XMC_XPFACS_ACEN
  665. *
  666. * @b Example
  667. * @verbatim
  668. CSL_XMC_ACEN_MODE acenMode;
  669. // Read ACEN Mode Status
  670. acenMode = CSL_XMC_getAnalysisCounterEnableStatus ();
  671. if (acenMode == CSL_XMC_ACEN_MODE_COUNT_DISABLE)
  672. {
  673. ...
  674. }
  675. @endverbatim
  676. * =============================================================================
  677. */
  678. static inline CSL_XMC_ACEN_MODE CSL_XMC_getAnalysisCounterEnableStatus (void);
  679. static inline CSL_XMC_ACEN_MODE CSL_XMC_getAnalysisCounterEnableStatus (void)
  680. {
  681. return (CSL_XMC_ACEN_MODE) CSL_FEXT (hXmc->XPFACS, XMC_XPFACS_ACEN);
  682. }
  683. /** ============================================================================
  684. * @n@b CSL_XMC_getNumPrefetchSent
  685. *
  686. * @b Description
  687. * @n This function returns the contents of XPFAC0 register, i.e., the number
  688. * of prefetch requests sent into the system.
  689. *
  690. * @b Arguments
  691. * @n None
  692. *
  693. * <b> Return Value </b> Uint32
  694. *
  695. * <b> Pre Condition </b>
  696. * @n None
  697. *
  698. * <b> Post Condition </b>
  699. * @n None
  700. *
  701. * @b Reads
  702. * @n XMC_XPFAC0_SENT
  703. *
  704. * @b Example
  705. * @verbatim
  706. Uint32 numPrefetchSent;
  707. // Read Prefetch request sent count
  708. numPrefetchSent = CSL_XMC_getNumPrefetchSent ();
  709. @endverbatim
  710. * =============================================================================
  711. */
  712. static inline Uint32 CSL_XMC_getNumPrefetchSent (void);
  713. static inline Uint32 CSL_XMC_getNumPrefetchSent (void)
  714. {
  715. return CSL_FEXT (hXmc->XPFAC0, XMC_XPFAC0_SENT);
  716. }
  717. /** ============================================================================
  718. * @n@b CSL_XMC_getNumPrefetchCanceled
  719. *
  720. * @b Description
  721. * @n This function returns the contents of XPFAC1 register, i.e., the number
  722. * of prefetch requests canceled (prefetch requests that returned a non-zero
  723. * rstatus or other error).
  724. *
  725. * @b Arguments
  726. * @n None
  727. *
  728. * <b> Return Value </b> Uint32
  729. *
  730. * <b> Pre Condition </b>
  731. * @n None
  732. *
  733. * <b> Post Condition </b>
  734. * @n None
  735. *
  736. * @b Reads
  737. * @n XMC_XPFAC1_CANCELED
  738. *
  739. * @b Example
  740. * @verbatim
  741. Uint32 numPrefetchCanceled;
  742. // Read Prefetch request canceled
  743. numPrefetchCanceled = CSL_XMC_getNumPrefetchCanceled ();
  744. @endverbatim
  745. * =============================================================================
  746. */
  747. static inline Uint32 CSL_XMC_getNumPrefetchCanceled (void);
  748. static inline Uint32 CSL_XMC_getNumPrefetchCanceled (void)
  749. {
  750. return CSL_FEXT (hXmc->XPFAC1, XMC_XPFAC1_CANCELED);
  751. }
  752. /** ============================================================================
  753. * @n@b CSL_XMC_getNumPrefetchHits
  754. *
  755. * @b Description
  756. * @n This function returns the contents of XPFAC2 register, i.e., the number
  757. * of demand prefetch requests that resulted in a successful prefetch.
  758. *
  759. * @b Arguments
  760. * @n None
  761. *
  762. * <b> Return Value </b> Uint32
  763. *
  764. * <b> Pre Condition </b>
  765. * @n None
  766. *
  767. * <b> Post Condition </b>
  768. * @n None
  769. *
  770. * @b Reads
  771. * @n XMC_XPFAC2_HIT
  772. *
  773. * @b Example
  774. * @verbatim
  775. Uint32 numPrefetchHits;
  776. // Read Number of Prefetch request hits
  777. numPrefetchHits = CSL_XMC_getNumPrefetchHits ();
  778. @endverbatim
  779. * =============================================================================
  780. */
  781. static inline Uint32 CSL_XMC_getNumPrefetchHits (void);
  782. static inline Uint32 CSL_XMC_getNumPrefetchHits (void)
  783. {
  784. return CSL_FEXT (hXmc->XPFAC2, XMC_XPFAC2_HIT);
  785. }
  786. /** ============================================================================
  787. * @n@b CSL_XMC_getNumPrefetchMisses
  788. *
  789. * @b Description
  790. * @n This function returns the contents of XPFAC3 register, i.e., the number
  791. * of prefetch requests that resulted in a miss and had to be submitted as
  792. * a demand prefetch request into the system.
  793. *
  794. * @b Arguments
  795. * @n None
  796. *
  797. * <b> Return Value </b> Uint32
  798. *
  799. * <b> Pre Condition </b>
  800. * @n None
  801. *
  802. * <b> Post Condition </b>
  803. * @n None
  804. *
  805. * @b Reads
  806. * @n XMC_XPFAC3_MISS
  807. *
  808. * @b Example
  809. * @verbatim
  810. Uint32 numPrefetchMisses;
  811. // Read Number of Prefetch request misses
  812. numPrefetchMisses = CSL_XMC_getNumPrefetchMisses ();
  813. @endverbatim
  814. * =============================================================================
  815. */
  816. static inline Uint32 CSL_XMC_getNumPrefetchMisses (void);
  817. static inline Uint32 CSL_XMC_getNumPrefetchMisses (void)
  818. {
  819. return CSL_FEXT (hXmc->XPFAC3, XMC_XPFAC3_MISS);
  820. }
  821. /** ============================================================================
  822. * @n@b CSL_XMC_getPrefetchAddress
  823. *
  824. * @b Description
  825. * @n This function gets the contents of XPFADDR register.
  826. *
  827. * @b Arguments
  828. @verbatim
  829. index Index into the set of 8 registers
  830. xpfaddr CSL_XMC_XPFADDR structure that needs to be filled from
  831. XPFADDR register
  832. @endverbatim
  833. *
  834. * <b> Return Value </b>
  835. * @n None
  836. *
  837. * <b> Pre Condition </b>
  838. * @n None
  839. *
  840. * <b> Post Condition </b>
  841. * @n None
  842. *
  843. * @b Reads
  844. * @n XMC_XPFADDR_ADDR,
  845. * XMC_XPFADDR_DIR,
  846. * XMC_XPFADDR_DPH,
  847. * XMC_XPFADDR_DVH,
  848. * XMC_XPFADDR_AVH,
  849. * XMC_XPFADDR_DPL,
  850. * XMC_XPFADDR_DVL,
  851. * XMC_XPFADDR_AVL
  852. *
  853. * @b Example
  854. * @verbatim
  855. Uint32 index = 0;
  856. CSL_XMC_XPFADDR xpfaddr;
  857. CSL_XMC_getPrefetchAddress (index, &xpfaddr);
  858. @endverbatim
  859. * =============================================================================
  860. */
  861. static inline void CSL_XMC_getPrefetchAddress
  862. (
  863. Uint32 index,
  864. CSL_XMC_XPFADDR* xpfaddr
  865. );
  866. static inline void CSL_XMC_getPrefetchAddress
  867. (
  868. Uint32 index,
  869. CSL_XMC_XPFADDR* xpfaddr
  870. )
  871. {
  872. Uint32 value = hXmc->XPFADDR[index];
  873. xpfaddr->addr = CSL_FEXT (value, XMC_XPFADDR_ADDR);
  874. xpfaddr->dir = CSL_FEXT (value, XMC_XPFADDR_DIR);
  875. xpfaddr->dph = CSL_FEXT (value, XMC_XPFADDR_DPH);
  876. xpfaddr->dvh = CSL_FEXT (value, XMC_XPFADDR_DVH);
  877. xpfaddr->avh = CSL_FEXT (value, XMC_XPFADDR_AVH);
  878. xpfaddr->dpl = CSL_FEXT (value, XMC_XPFADDR_DPL);
  879. xpfaddr->dvl = CSL_FEXT (value, XMC_XPFADDR_DVL);
  880. xpfaddr->avl = CSL_FEXT (value, XMC_XPFADDR_AVL);
  881. }
  882. /** ============================================================================
  883. * @n@b CSL_XMC_setMDMAPriority
  884. *
  885. * @b Description
  886. * @n This function configures the priority of transaction submissions to
  887. * Master DMA (MDMA).
  888. *
  889. * @b Arguments
  890. @verbatim
  891. priority Priority value to set for MDMA transactions.
  892. @endverbatim
  893. *
  894. * <b> Return Value </b>
  895. * @n None
  896. *
  897. * <b> Pre Condition </b>
  898. * @n None
  899. *
  900. * <b> Post Condition </b>
  901. * @n None
  902. *
  903. * @b Writes
  904. * @n XMC_MDMAARBX_PRI
  905. *
  906. * @b Example
  907. * @verbatim
  908. Uint32 priority = 4;
  909. CSL_XMC_setMDMAPriority (priority);
  910. @endverbatim
  911. * =============================================================================
  912. */
  913. static inline void CSL_XMC_setMDMAPriority (Uint32 priority);
  914. static inline void CSL_XMC_setMDMAPriority (Uint32 priority)
  915. {
  916. CSL_FINS (hXmc->MDMAARBX, XMC_MDMAARBX_PRI, priority);
  917. }
  918. /** ============================================================================
  919. * @n@b CSL_XMC_getMDMAPriority
  920. *
  921. * @b Description
  922. * @n This function retrieves the priority of transaction submissions to
  923. * Master DMA (MDMA).
  924. *
  925. * @b Arguments
  926. * @n None
  927. *
  928. * <b> Return Value </b> Uint32
  929. *
  930. * <b> Pre Condition </b>
  931. * @n None
  932. *
  933. * <b> Post Condition </b>
  934. * @n None
  935. *
  936. * @b Reads
  937. * @n XMC_MDMAARBX_PRI
  938. *
  939. * @b Example
  940. * @verbatim
  941. Uint32 priority;
  942. priority = CSL_XMC_getMDMAPriority ();
  943. @endverbatim
  944. * =============================================================================
  945. */
  946. static inline Uint32 CSL_XMC_getMDMAPriority (void);
  947. static inline Uint32 CSL_XMC_getMDMAPriority (void)
  948. {
  949. return CSL_FEXT (hXmc->MDMAARBX, XMC_MDMAARBX_PRI);
  950. }
  951. #ifdef __cplusplus
  952. }
  953. #endif
  954. /* @} */
  955. #endif /* CSL_XMCAUX_H */