csl_idmaAux.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. /* ============================================================================
  2. * Copyright (c) Texas Instruments Incorporated 2008, 2009
  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_idmaAux.h
  35. *
  36. * @brief
  37. * API Auxilary header file for IDMA CSL. It gives the definitions of the
  38. * query, status & 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_IDMAAUX_H_
  49. #define CSL_IDMAAUX_H_
  50. #ifdef __cplusplus
  51. extern "C" {
  52. #endif
  53. #include <ti/csl/csl_idma.h>
  54. #include <ti/csl/csl_utils.h>
  55. /** @addtogroup CSL_IDMA_FUNCTION
  56. @{ */
  57. /** ============================================================================
  58. * @n@b CSL_IDMA_chan0TransferData
  59. *
  60. * @b Description
  61. * @n This function configures IMDA Channel 0 to perform a transfer between
  62. * Internal Memory (L1P, L1D, L2) and Configuration Space(CFG) based on the
  63. * inputs to the function. This API initiates a transfer and if needed waits
  64. * till the transfer completes based on the "bWaitToCompletion" flag value passed.
  65. *
  66. * @b Arguments
  67. @verbatim
  68. idmaChan0Config CSL_IDMA_IDMA0CONFIG structure pointer that holds
  69. information relevant to perform a IDMA Channel 0 configuration
  70. space transfer.
  71. bWaitToCompletion Boolean flag that indicates if this function should
  72. wait till the transfer is completed or should
  73. just return after initiating one. When set to 1, this
  74. API waits and returns after requested transfer is
  75. complete. Otherwise, returns immediately after configuring
  76. appropriate registers.
  77. @endverbatim
  78. *
  79. * <b> Return Value </b>
  80. * @n None
  81. *
  82. * <b> Pre Condition </b>
  83. * @n None.
  84. *
  85. * <b> Post Condition </b>
  86. * @n The appropriate IDMA Channel 0 registers are configured to initiate the
  87. * CFG space transfer operation. Furthermore, if bWaitToCompletion argument is set
  88. * to 1, the API polls on the IDMA0 Status register to wait until the
  89. * transfer completes.
  90. *
  91. * @b Writes
  92. * @n CGEM_IDMA0_MASK_MASK,
  93. * CGEM_IDMA0_SOURCE_SOURCEADDR,
  94. * CGEM_IDMA0_DEST_DESTADDR,
  95. * CGEM_IDMA0_COUNT_INT,
  96. * CGEM_IDMA0_COUNT_COUNT
  97. *
  98. * @b Example
  99. * @verbatim
  100. #define MASK 0xFFFFFF0F
  101. // Align various arrays to a word address, in internal L2
  102. #pragma DATA_SECTION(src, "ISRAM");
  103. #pragma CSL_SET_DALIGN(src, 32);
  104. #pragma CSL_SET_DALIGN(dst2, 32);
  105. // Static 128 byte array of data in "src" with known test pattern.
  106. unsigned int src[32] = {
  107. 0xDEADBEEF, 0xFADE0003, 0x5AA51C3A, 0x03036BA3,
  108. 0x0000ABCD, 0x00001234, 0x00005670, 0x00005678,
  109. 0x000003BE, 0x0000760F, 0x9675A800, 0xABCDEF12,
  110. 0xEEEECDEA, 0x01234567, 0x00000000, 0xFEEDFADE,
  111. 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
  112. 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
  113. } ;
  114. // EDMA MMR Space Address
  115. unsigned int * dst2 = (unsigned int *)0x02704000;
  116. CSL_IDMA_IDMA0CONFIG idmaChan0Config;
  117. Uint32 bWaitEnable = 1;
  118. mask = MASK;
  119. idmaChan0Config.mask = mask;
  120. idmaChan0Config.source = src;
  121. idmaChan0Config.destn = dst2;
  122. idmaChan0Config.count = 0; // transfer one 32-byte window
  123. idmaChan0Config.intEnable = 1; // Enable CPU interrupt on completion.
  124. CSL_IDMA_chan0TransferData (&idmaChan0Config, bWaitEnable);
  125. @endverbatim
  126. * =============================================================================
  127. */
  128. static inline void CSL_IDMA_chan0TransferData (
  129. CSL_IDMA_IDMA0CONFIG* idmaChan0Config,
  130. Uint32 bWaitToCompletion
  131. )
  132. {
  133. volatile Uint32 pend;
  134. if( bWaitToCompletion )
  135. {
  136. /* Make sure that there are no pending transfers before using
  137. * this channel. This is done by reading bit "1" of the status
  138. * register.
  139. */
  140. while( (pend = ( CSL_FEXT(hIdma->IDMA0_STAT, CGEM_IDMA0_STAT_PEND) |
  141. CSL_FEXT(hIdma->IDMA0_STAT, CGEM_IDMA0_STAT_ACTV)
  142. )
  143. )
  144. );
  145. }
  146. /* Poke in "mask", "src", "dst" and "count" with the correct
  147. * count and interrupt flag on.
  148. */
  149. CSL_FINS (hIdma->IDMA0_MASK, CGEM_IDMA0_MASK_MASK, idmaChan0Config->mask);
  150. hIdma->IDMA0_SOURCE = (Uint32)idmaChan0Config->source;
  151. hIdma->IDMA0_DEST = (Uint32)idmaChan0Config->destn;
  152. hIdma->IDMA0_COUNT = CSL_FMK (CGEM_IDMA0_COUNT_INT, idmaChan0Config->intEnable) |
  153. CSL_FMK (CGEM_IDMA0_COUNT_COUNT, idmaChan0Config->count);
  154. /* Wait till the transfer is complete. */
  155. if( bWaitToCompletion )
  156. {
  157. while( (pend = ( CSL_FEXT(hIdma->IDMA0_STAT, CGEM_IDMA0_STAT_PEND) |
  158. CSL_FEXT(hIdma->IDMA0_STAT, CGEM_IDMA0_STAT_ACTV)
  159. )
  160. )
  161. );
  162. }
  163. return;
  164. }
  165. /** ============================================================================
  166. * @n@b CSL_IDMA_chan0Wait
  167. *
  168. * @b Description
  169. * @n This function waits until all previous transfers for IDMA Channel
  170. * 0 have been completed by making sure that both active and pend
  171. * bits are zero. These are the two least significant bits of the
  172. * status register for the channel.
  173. *
  174. * Waits until previous transfers have completed for IDMA channel 0
  175. * before returning.
  176. *
  177. * @b Arguments
  178. * @n None
  179. *
  180. * <b> Return Value </b>
  181. * @n None
  182. *
  183. * <b> Pre Condition </b>
  184. * @n @a CSL_IDMA_chan0TransferData(bWaitToCompletion=0) must be called
  185. * to setup an IDMA Channel 0 data transfer before this API is called.
  186. *
  187. * <b> Post Condition </b>
  188. * @n None
  189. *
  190. * @b Reads
  191. * @n CGEM_IDMA0_STAT_PEND,
  192. * CGEM_IDMA0_STAT_ACTV
  193. *
  194. * @b Affects
  195. * @n CGEM_IDMA0_STAT_PEND=0,
  196. * CGEM_IDMA0_STAT_ACTV=0
  197. *
  198. * @b Example
  199. * @verbatim
  200. #define MASK 0xFFFFFF0F
  201. // Align various arrays to a word address, in internal L2
  202. #pragma DATA_SECTION(src, "ISRAM");
  203. #pragma CSL_SET_DALIGN(src, 32);
  204. #pragma CSL_SET_DALIGN(dst2, 32);
  205. // Static 128 byte array of data in "src" with known test pattern.
  206. unsigned int src[32] = {
  207. 0xDEADBEEF, 0xFADE0003, 0x5AA51C3A, 0x03036BA3,
  208. 0x0000ABCD, 0x00001234, 0x00005670, 0x00005678,
  209. 0x000003BE, 0x0000760F, 0x9675A800, 0xABCDEF12,
  210. 0xEEEECDEA, 0x01234567, 0x00000000, 0xFEEDFADE,
  211. 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
  212. 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
  213. } ;
  214. // EDMA MMR Space Address
  215. unsigned int * dst2 = (unsigned int *)0x02704000;
  216. CSL_IDMA_IDMA0CONFIG idmaChan0Config;
  217. Uint32 bWaitEnable = 1;
  218. mask = MASK;
  219. idmaChan0Config.mask = mask;
  220. idmaChan0Config.source = src;
  221. idmaChan0Config.destn = dst2;
  222. idmaChan0Config.count = 0; // transfer one 32-byte window
  223. idmaChan0Config.intEnable = 1; // Enable CPU interrupt on completion.
  224. CSL_IDMA_chan0TransferData (&idmaChan0Config, bWaitEnable);
  225. CSL_IDMA_chan0Wait ();
  226. ...
  227. @endverbatim
  228. * =============================================================================
  229. */
  230. static inline void CSL_IDMA_chan0Wait (
  231. void
  232. )
  233. {
  234. volatile Uint32 pend;
  235. while( (pend = ( CSL_FEXT(hIdma->IDMA0_STAT, CGEM_IDMA0_STAT_PEND) |
  236. CSL_FEXT(hIdma->IDMA0_STAT, CGEM_IDMA0_STAT_ACTV)
  237. )
  238. )
  239. );
  240. return;
  241. }
  242. /** ============================================================================
  243. * @n@b CSL_IDMA_chan0GetStatus
  244. *
  245. * @b Description
  246. * @n This function waits until all previous transfers for IDMA Channel
  247. * 0 have been completed by making sure that both active and pend
  248. * bits are zero. These are the two least significant bits of the
  249. * status register for the channel.
  250. *
  251. * Waits until previous transfers have completed for IDMA channel 1
  252. * before returning.
  253. *
  254. * @b Arguments
  255. @verbatim
  256. idmaChanStatus CSL_IDMA_STATUS structure pointer that needs to
  257. be populated with iDMA Channel 0 transfer status.
  258. @endverbatim
  259. *
  260. * <b> Return Value </b>
  261. * @n None
  262. *
  263. * <b> Pre Condition </b>
  264. * @n None.
  265. *
  266. * <b> Post Condition </b>
  267. * @n None
  268. *
  269. * @b Reads
  270. * @n CGEM_IDMA0_STAT_PEND,
  271. * CGEM_IDMA0_STAT_ACTV
  272. *
  273. * @b Example
  274. * @verbatim
  275. CSL_IDMA_STATUS idma1Status;
  276. CSL_IDMA_chan0GetStatus (&idma1Status);
  277. @endverbatim
  278. * =============================================================================
  279. */
  280. static inline void CSL_IDMA_chan0GetStatus (
  281. CSL_IDMA_STATUS* idmaChanStatus
  282. )
  283. {
  284. idmaChanStatus->isPending = CSL_FEXT(hIdma->IDMA0_STAT, CGEM_IDMA0_STAT_PEND);
  285. idmaChanStatus->isActive = CSL_FEXT(hIdma->IDMA0_STAT, CGEM_IDMA0_STAT_ACTV);
  286. return;
  287. }
  288. /** ============================================================================
  289. * @n@b CSL_IDMA_chan1TransferData
  290. *
  291. * @b Description
  292. * @n This function initiates a GEM local memory "block transfer" operation
  293. * using the IDMA Channel 1. This API assumes that the source and destination
  294. * addresses passed in the "idmaChan1Config" argument are both in GEM's internal
  295. * memory, i.e., L1P, L1D, L2 or CFG memories. Transfers from addresses
  296. * that are not in the internal memory will raise an exception. This API
  297. * initiates a block transfer and if needed waits till the transfer completes
  298. * based on the "bWaitToCompletion" flag value passed.
  299. *
  300. * @b Arguments
  301. @verbatim
  302. idmaChan1Config CSL_IDMA_IDMA1CONFIG structure pointer that holds
  303. information relevant to perform a IDMA Channel 1 block
  304. transfer.
  305. bWaitToCompletion Boolean flag that indicates if this function should
  306. wait till the block transfer is completed or should
  307. just return after initiating one. When set to 1, this
  308. API waits and returns after requested block transfer is
  309. complete. Otherwise, returns immediately after configuring
  310. appropriate registers.
  311. @endverbatim
  312. *
  313. * <b> Return Value </b>
  314. * @n None
  315. *
  316. * <b> Pre Condition </b>
  317. * @n None.
  318. *
  319. * <b> Post Condition </b>
  320. * @n The appropriate IDMA Channel 1 registers are configured to initiate the
  321. * data transfer operation. Furthermore, if bWaitToCompletion argument is set
  322. * to 1, the API polls on the IDMA1 Status register to wait until the
  323. * transfer completes.
  324. *
  325. * @b Writes
  326. * @n CGEM_IDMA1_SOURCE_SOURCEADDR,
  327. * CGEM_IDMA1_DEST_DESTADDR,
  328. * CGEM_IDMA1_COUNT_PRI,
  329. * CGEM_IDMA1_COUNT_INT,
  330. * CGEM_IDMA1_COUNT_FILL,
  331. * CGEM_IDMA1_COUNT_COUNT
  332. *
  333. * @b Example
  334. * @verbatim
  335. #pragma CSL_SET_DALIGN(src1, 8);
  336. #pragma CSL_SET_DALIGN(dst1, 8);
  337. // Static 80 byte array of data in "src1" with known test pattern
  338. Uint32 src1[20] =
  339. {
  340. 0xDEADBEEF, 0xFADEBABE, 0x5AA51C3A, 0xD4536BA3,
  341. 0x5E69BA23, 0x4884A01F, 0x9265ACDA, 0xFFFF0123,
  342. 0xBEADDABE, 0x234A76B2, 0x9675ABCD, 0xABCDEF12,
  343. 0xEEEECDEA, 0x01234567, 0x00000000, 0xFEEDFADE,
  344. 0x0A1B2C3D, 0x4E5F6B7C, 0x5AA5ECCE, 0xFABEFACE
  345. };
  346. Uint32 dst1[20];
  347. CSL_IDMA_IDMA1CONFIG idmaChan1Config;
  348. Uint32 bWaitEnable = 1;
  349. idmaChan1Config.source = src1;
  350. idmaChan1Config.destn = dst1;
  351. idmaChan1Config.intEnable = 1;
  352. idmaChan1Config.priority = IDMA_PRI_7;
  353. idmaChan1Config.count = DATA_COUNT_BYTES;
  354. CSL_IDMA_chan1TransferData (&idmaChan1Config, bWaitEnable);
  355. @endverbatim
  356. * =============================================================================
  357. */
  358. static inline void CSL_IDMA_chan1TransferData (
  359. CSL_IDMA_IDMA1CONFIG* idmaChan1Config,
  360. Uint32 bWaitToCompletion
  361. )
  362. {
  363. volatile Uint32 pend;
  364. if( bWaitToCompletion )
  365. {
  366. /* Make sure that there are no pending transfers before using
  367. * this channel. This is done by reading bit "1" of the status
  368. * register.
  369. */
  370. while( (pend = ( CSL_FEXT(hIdma->IDMA1_STAT, CGEM_IDMA1_STAT_PEND) |
  371. CSL_FEXT(hIdma->IDMA1_STAT, CGEM_IDMA1_STAT_ACTV)
  372. )
  373. )
  374. );
  375. }
  376. /* Poke in "src", "dst" and "count" with the correct
  377. * priority and interrupt flags on. Also disable the "fill" bit
  378. * since this is a block transfer.
  379. */
  380. hIdma->IDMA1_SOURCE = (Uint32)idmaChan1Config->source;
  381. hIdma->IDMA1_DEST = (Uint32)idmaChan1Config->destn;
  382. hIdma->IDMA1_COUNT = CSL_FMK(CGEM_IDMA1_COUNT_PRI, idmaChan1Config->priority) |
  383. CSL_FMK(CGEM_IDMA1_COUNT_INT, idmaChan1Config->intEnable) |
  384. CSL_FMK(CGEM_IDMA1_COUNT_FILL, ZERO) |
  385. CSL_FMK(CGEM_IDMA1_COUNT_COUNT, idmaChan1Config->count);
  386. /* Wait till the transfer is complete. */
  387. if( bWaitToCompletion )
  388. {
  389. while( (pend = ( CSL_FEXT(hIdma->IDMA1_STAT, CGEM_IDMA1_STAT_PEND) |
  390. CSL_FEXT(hIdma->IDMA1_STAT, CGEM_IDMA1_STAT_ACTV)
  391. )
  392. )
  393. );
  394. }
  395. return;
  396. }
  397. /** ============================================================================
  398. * @n@b CSL_IDMA_chan1FillData
  399. *
  400. * @b Description
  401. * @n This function initiates a GEM local memory "block fill" operation
  402. * using the IDMA Channel 1. Given a fill value in Channel configuration structure's
  403. * source address, a valid destination address and the number of bytes to fill, this
  404. * API fills the destination with the fill value specified. This API initiates a
  405. * block fill and if needed waits till the transfer completes based on the
  406. * "bWaitToCompletion" flag value passed.
  407. *
  408. * @b Arguments
  409. @verbatim
  410. idmaChan1Config CSL_IDMA_IDMA1CONFIG structure pointer that holds
  411. information relevant to perform a IDMA Channel 1 block
  412. fill operation.
  413. bWaitToCompletion Boolean flag that indicates if this function should
  414. wait till the block fill is completed or should
  415. just return after initiating one. When set to 1, this
  416. API waits and returns after requested block transfer is
  417. complete. Otherwise, returns immediately after configuring
  418. appropriate registers.
  419. @endverbatim
  420. *
  421. * <b> Return Value </b>
  422. * @n None
  423. *
  424. * <b> Pre Condition </b>
  425. * @n None.
  426. *
  427. * <b> Post Condition </b>
  428. * @n The appropriate IDMA Channel 1 registers are configured to initiate the
  429. * block fill operation. Furthermore, if bWaitToCompletion argument is set
  430. * to 1, the API polls on the IDMA1 Status register to wait until the
  431. * fill operation completes.
  432. *
  433. * @b Writes
  434. * @n CGEM_IDMA1_SOURCE_SOURCEADDR,
  435. * CGEM_IDMA1_DEST_DESTADDR,
  436. * CGEM_IDMA1_COUNT_PRI,
  437. * CGEM_IDMA1_COUNT_INT,
  438. * CGEM_IDMA1_COUNT_FILL,
  439. * CGEM_IDMA1_COUNT_COUNT
  440. *
  441. * @b Example
  442. * @verbatim
  443. #pragma CSL_SET_DALIGN(dst1, 8);
  444. Uint32 dst1[20];
  445. CSL_IDMA_IDMA1CONFIG idmaChan1Config;
  446. Uint32 bWaitEnable = 1;
  447. // Fill the destination with a value of "0xAAAABABA"
  448. idmaChan1Config.source = (Uint32 *) (0xAAAABABA);
  449. idmaChan1Config.destn = dst1;
  450. idmaChan1Config.intEnable = 1;
  451. idmaChan1Config.priority = IDMA_PRI_7;
  452. idmaChan1Config.count = 20;
  453. CSL_IDMA_chan1FillData (&idmaChan1Config, bWaitEnable);
  454. @endverbatim
  455. * =============================================================================
  456. */
  457. static inline void CSL_IDMA_chan1FillData (
  458. CSL_IDMA_IDMA1CONFIG* idmaChan1Config,
  459. Uint32 bWaitToCompletion
  460. )
  461. {
  462. volatile Uint32 pend;
  463. if( bWaitToCompletion )
  464. {
  465. /* Make sure that there are no pending transfers before using
  466. * this channel. This is done by reading bit "1" of the status
  467. * register.
  468. */
  469. while( (pend = ( CSL_FEXT(hIdma->IDMA1_STAT, CGEM_IDMA1_STAT_PEND) |
  470. CSL_FEXT(hIdma->IDMA1_STAT, CGEM_IDMA1_STAT_ACTV)
  471. )
  472. )
  473. );
  474. }
  475. /* Poke in "src", "dst" and "count" with the correct
  476. * priority and interrupt flags on. Also enable the "fill" bit
  477. * since this is a block fill operation.
  478. */
  479. hIdma->IDMA1_SOURCE = (Uint32)idmaChan1Config->source;
  480. hIdma->IDMA1_DEST = (Uint32)idmaChan1Config->destn;
  481. hIdma->IDMA1_COUNT = CSL_FMK(CGEM_IDMA1_COUNT_PRI, idmaChan1Config->priority) |
  482. CSL_FMK(CGEM_IDMA1_COUNT_INT, idmaChan1Config->intEnable) |
  483. CSL_FMK(CGEM_IDMA1_COUNT_FILL, ONE) |
  484. CSL_FMK(CGEM_IDMA1_COUNT_COUNT, idmaChan1Config->count);
  485. /* Wait till the transfer is complete. */
  486. if( bWaitToCompletion )
  487. {
  488. while( (pend = ( CSL_FEXT(hIdma->IDMA1_STAT, CGEM_IDMA1_STAT_PEND) |
  489. CSL_FEXT(hIdma->IDMA1_STAT, CGEM_IDMA1_STAT_ACTV)
  490. )
  491. )
  492. );
  493. }
  494. return;
  495. }
  496. /** ============================================================================
  497. * @n@b CSL_IDMA_chan1Wait
  498. *
  499. * @b Description
  500. * @n This function waits until all previous transfers for IDMA Channel
  501. * 1 have been completed by making sure that both active and pend
  502. * bits are zero. These are the two least significant bits of the
  503. * status register for the channel.
  504. *
  505. * Waits until previous transfers have completed for IDMA channel 1
  506. * before returning.
  507. *
  508. * @b Arguments
  509. * @n None
  510. *
  511. * <b> Return Value </b>
  512. * @n None
  513. *
  514. * <b> Pre Condition </b>
  515. * @n @a CSL_IDMA_chan1TransferData(bWaitToCompletion = 0) or
  516. * @a CSL_IDMA_chan1FillData(bWaitToCompletion = 0) must be called to
  517. * setup IDMA Channel 1 data transfer before this API is called.
  518. *
  519. * <b> Post Condition </b>
  520. * @n None
  521. *
  522. * @b Reads
  523. * @n CGEM_IDMA1_STAT_PEND,
  524. * CGEM_IDMA1_STAT_ACTV
  525. *
  526. * @b Affects
  527. * @n CGEM_IDMA1_STAT_PEND=0,
  528. * CGEM_IDMA1_STAT_ACTV=0
  529. *
  530. * @b Example
  531. * @verbatim
  532. #pragma CSL_SET_DALIGN(src1, 8);
  533. #pragma CSL_SET_DALIGN(dst1, 8);
  534. // Static 80 byte array of data in "src1" with known test pattern
  535. Uint32 src1[20] =
  536. {
  537. 0xDEADBEEF, 0xFADEBABE, 0x5AA51C3A, 0xD4536BA3,
  538. 0x5E69BA23, 0x4884A01F, 0x9265ACDA, 0xFFFF0123,
  539. 0xBEADDABE, 0x234A76B2, 0x9675ABCD, 0xABCDEF12,
  540. 0xEEEECDEA, 0x01234567, 0x00000000, 0xFEEDFADE,
  541. 0x0A1B2C3D, 0x4E5F6B7C, 0x5AA5ECCE, 0xFABEFACE
  542. };
  543. Uint32 dst1[20];
  544. CSL_IDMA_IDMA1CONFIG idmaChan1Config;
  545. Uint32 bWaitEnable = 0;
  546. idmaChan1Config.source = src1;
  547. idmaChan1Config.destn = dst1;
  548. idmaChan1Config.intEnable = 1;
  549. idmaChan1Config.priority = IDMA_PRI_7;
  550. idmaChan1Config.count = DATA_COUNT_BYTES;
  551. CSL_IDMA_chan1TransferData (&idmaChan1Config, bWaitEnable);
  552. CSL_IDMA_chan1Wait();
  553. ...
  554. @endverbatim
  555. * =============================================================================
  556. */
  557. static inline void CSL_IDMA_chan1Wait (
  558. void
  559. )
  560. {
  561. volatile Uint32 pend;
  562. while( (pend = ( CSL_FEXT(hIdma->IDMA1_STAT, CGEM_IDMA1_STAT_PEND) |
  563. CSL_FEXT(hIdma->IDMA1_STAT, CGEM_IDMA1_STAT_ACTV)
  564. )
  565. )
  566. );
  567. return;
  568. }
  569. /** ============================================================================
  570. * @n@b CSL_IDMA_chan1GetStatus
  571. *
  572. * @b Description
  573. * @n This function waits until all previous transfers for IDMA Channel
  574. * 1 have been completed by making sure that both active and pend
  575. * bits are zero. These are the two least significant bits of the
  576. * status register for the channel.
  577. *
  578. * Waits until previous transfers have completed for IDMA channel 1
  579. * before returning.
  580. *
  581. * @b Arguments
  582. @verbatim
  583. idmaChanStatus CSL_IDMA_STATUS structure pointer that needs to
  584. be populated with iDMA Channel 1 transfer status.
  585. @endverbatim
  586. *
  587. * <b> Return Value </b>
  588. * @n None
  589. *
  590. * <b> Pre Condition </b>
  591. * @n None.
  592. *
  593. * <b> Post Condition </b>
  594. * @n None
  595. *
  596. * @b Reads
  597. * @n CGEM_IDMA1_STAT_PEND,
  598. * CGEM_IDMA1_STAT_ACTV
  599. *
  600. * @b Example
  601. * @verbatim
  602. CSL_IDMA_STATUS idma1Status;
  603. CSL_IDMA_chan1GetStatus (&idma1Status);
  604. @endverbatim
  605. * =============================================================================
  606. */
  607. static inline void CSL_IDMA_chan1GetStatus (
  608. CSL_IDMA_STATUS* idmaChanStatus
  609. )
  610. {
  611. idmaChanStatus->isPending = CSL_FEXT(hIdma->IDMA1_STAT, CGEM_IDMA1_STAT_PEND);
  612. idmaChanStatus->isActive = CSL_FEXT(hIdma->IDMA1_STAT, CGEM_IDMA1_STAT_ACTV);
  613. return;
  614. }
  615. #ifdef __cplusplus
  616. }
  617. #endif
  618. /** @} */
  619. #endif /*CSL_IDMAAUX_H_*/