csl_edma3.h 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119
  1. /**
  2. * @file csl_edma3.h
  3. *
  4. * @brief
  5. * This is the main header file for the EDMA Module which defines
  6. * all the data structures and exported API.
  7. *
  8. * \par
  9. * ============================================================================
  10. * @n (C) Copyright 2002, 2003, 2004, 2005, 2008, 2009, Texas Instruments, Inc.
  11. *
  12. * Redistribution and use in source and binary forms, with or without
  13. * modification, are permitted provided that the following conditions
  14. * are met:
  15. *
  16. * Redistributions of source code must retain the above copyright
  17. * notice, this list of conditions and the following disclaimer.
  18. *
  19. * Redistributions in binary form must reproduce the above copyright
  20. * notice, this list of conditions and the following disclaimer in the
  21. * documentation and/or other materials provided with the
  22. * distribution.
  23. *
  24. * Neither the name of Texas Instruments Incorporated nor the names of
  25. * its contributors may be used to endorse or promote products derived
  26. * from this software without specific prior written permission.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  29. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  30. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  31. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  32. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  33. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  34. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  35. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  36. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  37. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  38. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  39. *
  40. */
  41. /** @defgroup CSL_EDMA3_API EDMA3
  42. *
  43. * @section Introduction
  44. *
  45. * @subsection xxx Overview
  46. * This page describes the Functions, Data Structures, Enumerations and Macros
  47. * within EDMA module.
  48. *
  49. * The EDMA controller handles all data transfers between the level-two (L2)
  50. * cache/memory controller and the device peripherals.These data transfers
  51. * include cache servicing, noncacheable memory accesses, user-programmed data
  52. * transfers, and host accesses. The EDMA supports up to 64-event channels and
  53. * 8 QDMA channels. The EDMA consists of a scalable Parameter RAM (PaRAM) that
  54. * supports flexible ping-pong, circular buffering, channel-chaining,
  55. * auto-reloading, and memory protection. The EDMA allows movement of data
  56. * to/from any addressable memory spaces, including internal memory (L2 SRAM),
  57. * peripherals, and external memory.
  58. *
  59. * @subsection References
  60. * -# CSL 3.x Technical Requirements Specifications Version 0.5, dated
  61. * May 14th, 2003
  62. * -# EDMA Channel Controller Specification (Revision 3.0.2)
  63. * -# EDMA Transfer Controller Specification (Revision 3.0.1)
  64. *
  65. * @subsection Assumptions
  66. * The abbreviations EDMA, edma and Edma have been used throughout this
  67. * document to refer to Enhanced Direct Memory Access.
  68. */
  69. /* =============================================================================
  70. * Revision History
  71. * ================
  72. * 02-May-2008 New file created
  73. * 25-Jul-2008 Update for Doxygen
  74. * =============================================================================
  75. */
  76. #ifndef CSL_EDMA3_H
  77. #define CSL_EDMA3_H
  78. #ifdef __cplusplus
  79. extern "C" {
  80. #endif
  81. #include <ti/csl/csl.h>
  82. #include <ti/csl/soc.h>
  83. #include <ti/csl/cslr_tpcc.h>
  84. typedef CSL_TpccRegs* CSL_Edma3ccRegsOvly;
  85. /**
  86. @defgroup CSL_EDMA3_SYMBOL EDMA3 Symbols Defined
  87. @ingroup CSL_EDMA3_API
  88. */
  89. /**
  90. @defgroup CSL_EDMA3_DATASTRUCT EDMA3 Data Structures
  91. @ingroup CSL_EDMA3_API
  92. */
  93. /**
  94. @defgroup CSL_EDMA3_FUNCTION EDMA3 Functions
  95. @ingroup CSL_EDMA3_API
  96. */
  97. /**
  98. @defgroup CSL_EDMA3_ENUM EDMA3 Enumerated Data Types
  99. @ingroup CSL_EDMA3_API
  100. */
  101. /**
  102. @addtogroup CSL_EDMA3_SYMBOL
  103. @{
  104. */
  105. /* EDMA Symbols Defined */
  106. /** EDMA Regions: Global and 8 SHADOW Regions. */
  107. #define CSL_EDMA3_REGION_GLOBAL (-(int32_t)(1))
  108. #define CSL_EDMA3_REGION_0 (0)
  109. #define CSL_EDMA3_REGION_1 (1)
  110. #define CSL_EDMA3_REGION_2 (2)
  111. #define CSL_EDMA3_REGION_3 (3)
  112. #define CSL_EDMA3_REGION_4 (4)
  113. #define CSL_EDMA3_REGION_5 (5)
  114. #define CSL_EDMA3_REGION_6 (6)
  115. #define CSL_EDMA3_REGION_7 (7)
  116. /** Link to a Null Param set */
  117. #define CSL_EDMA3_LINK_NULL (0xFFFF)
  118. /** Link to a Null Param set */
  119. #define CSL_EDMA3_LINK_DEFAULT (0xFFFF)
  120. /** A synchronized transfer */
  121. #define CSL_EDMA3_SYNC_A (0)
  122. /** AB synchronized transfer */
  123. #define CSL_EDMA3_SYNC_AB (1)
  124. /** Normal Completion */
  125. #define CSL_EDMA3_TCC_NORMAL (0)
  126. /** Early Completion */
  127. #define CSL_EDMA3_TCC_EARLY (1)
  128. /** Only for ease */
  129. #define CSL_EDMA3_FIFOWIDTH_NONE (0)
  130. /** 8 bit FIFO Width */
  131. #define CSL_EDMA3_FIFOWIDTH_8BIT (0)
  132. /** 16 bit FIFO Width */
  133. #define CSL_EDMA3_FIFOWIDTH_16BIT (1)
  134. /** 32 bit FIFO Width */
  135. #define CSL_EDMA3_FIFOWIDTH_32BIT (2)
  136. /** 64 bit FIFO Width */
  137. #define CSL_EDMA3_FIFOWIDTH_64BIT (3)
  138. /** 128 bit FIFO Width */
  139. #define CSL_EDMA3_FIFOWIDTH_128BIT (4)
  140. /** 256 bit FIFO Width */
  141. #define CSL_EDMA3_FIFOWIDTH_256BIT (5)
  142. /** Address Mode is incremental */
  143. #define CSL_EDMA3_ADDRMODE_INCR (0)
  144. /** Address Mode is such it wraps around after reaching FIFO width */
  145. #define CSL_EDMA3_ADDRMODE_CONST (1)
  146. /* Bitwise OR of the below symbols are used for setting the Memory attributes
  147. These are defined only if the Memory Protection feature exists */
  148. /** User Execute permission */
  149. #define CSL_EDMA3_MEMACCESS_UX 0x0001
  150. /** User Write permission */
  151. #define CSL_EDMA3_MEMACCESS_UW 0x0002
  152. /** User Read permission */
  153. #define CSL_EDMA3_MEMACCESS_UR 0x0004
  154. /** Supervisor Execute permission */
  155. #define CSL_EDMA3_MEMACCESS_SX 0x0008
  156. /** Supervisor Write permission */
  157. #define CSL_EDMA3_MEMACCESS_SW 0x0010
  158. /** Supervisor Read permission */
  159. #define CSL_EDMA3_MEMACCESS_SR 0x0020
  160. /** External Allowed ID. Requests with PrivID >= '6' are permitted
  161. * if access type is allowed
  162. */
  163. #define CSL_EDMA3_MEMACCESS_EXT 0x0200
  164. /** Allowed ID '0' */
  165. #define CSL_EDMA3_MEMACCESS_AID0 0x0400
  166. /** Allowed ID '1' */
  167. #define CSL_EDMA3_MEMACCESS_AID1 0x0800
  168. /** Allowed ID '2' */
  169. #define CSL_EDMA3_MEMACCESS_AID2 0x1000
  170. /** Allowed ID '3' */
  171. #define CSL_EDMA3_MEMACCESS_AID3 0x2000
  172. /** Allowed ID '4' */
  173. #define CSL_EDMA3_MEMACCESS_AID4 0x4000
  174. /** Allowed ID '5' */
  175. #define CSL_EDMA3_MEMACCESS_AID5 0x8000
  176. /** Intermediate transfer completion interrupt enable */
  177. #define CSL_EDMA3_ITCINT_EN 1
  178. /** Intermediate transfer completion interrupt disable */
  179. #define CSL_EDMA3_ITCINT_DIS 0
  180. /** Intermediate transfer completion chaining enable */
  181. #define CSL_EDMA3_ITCCH_EN 1
  182. /** Intermediate transfer completion chaining disable */
  183. #define CSL_EDMA3_ITCCH_DIS 0
  184. /** Transfer completion interrupt enable */
  185. #define CSL_EDMA3_TCINT_EN 1
  186. /** Transfer completion interrupt disable */
  187. #define CSL_EDMA3_TCINT_DIS 0
  188. /** Transfer completion chaining enable */
  189. #define CSL_EDMA3_TCCH_EN 1
  190. /** Transfer completion chaining disable */
  191. #define CSL_EDMA3_TCCH_DIS 0
  192. /** Enable Static */
  193. #define CSL_EDMA3_STATIC_EN 1
  194. /** Disable Static */
  195. #define CSL_EDMA3_STATIC_DIS 0
  196. /** Last trigger word in a QDMA parameter set */
  197. #define CSL_EDMA3_TRIGWORD_DEFAULT 7
  198. /** Trigger word option field */
  199. #define CSL_EDMA3_TRIGWORD_OPT 0
  200. /** Trigger word source */
  201. #define CSL_EDMA3_TRIGWORD_SRC 1
  202. /** Trigger word AB count */
  203. #define CSL_EDMA3_TRIGWORD_A_B_CNT 2
  204. /** Trigger word destination */
  205. #define CSL_EDMA3_TRIGWORD_DST 3
  206. /** Trigger word src and dst B index */
  207. #define CSL_EDMA3_TRIGWORD_SRC_DST_BIDX 4
  208. /** Trigger word B count reload */
  209. #define CSL_EDMA3_TRIGWORD_LINK_BCNTRLD 5
  210. /** Trigger word src and dst C index */
  211. #define CSL_EDMA3_TRIGWORD_SRC_DST_CIDX 6
  212. /** Trigger word C count */
  213. #define CSL_EDMA3_TRIGWORD_CCNT 7
  214. /** Used for creating the options entry in the parameter ram */
  215. #define CSL_EDMA3_OPT_MAKE(itcchEn, tcchEn, itcintEn, tcintEn, tcc, tccMode, \
  216. fwid, stat, syncDim, dam, sam) \
  217. (Uint32)(\
  218. CSL_FMKR(23,23,(itcchEn)) \
  219. |CSL_FMKR(22,22,(tcchEn)) \
  220. |CSL_FMKR(21,21,(itcintEn)) \
  221. |CSL_FMKR(20,20,(tcintEn)) \
  222. |CSL_FMKR(17,12,(tcc)) \
  223. |CSL_FMKR(11,11,(tccMode)) \
  224. |CSL_FMKR(10,8,(fwid)) \
  225. |CSL_FMKR(3,3,(stat)) \
  226. |CSL_FMKR(2,2,(syncDim)) \
  227. |CSL_FMKR(1,1,(dam)) \
  228. |CSL_FMKR(0,0,(sam)))
  229. /** Used for creating the A,B Count entry in the parameter ram */
  230. #define CSL_EDMA3_CNT_MAKE(aCnt,bCnt) \
  231. (Uint32)(\
  232. CSL_FMKR(15, 0, (aCnt)) \
  233. |CSL_FMKR(31, 16, (bCnt)) \
  234. )
  235. /** Used for creating the link and B count reload entry in the parameter ram */
  236. #define CSL_EDMA3_LINKBCNTRLD_MAKE(link,bCntRld) \
  237. (Uint32)(\
  238. CSL_FMKR(15, 0 , (Uint32)(link)) \
  239. |CSL_FMKR(31, 16, (bCntRld))\
  240. )
  241. /** Used for creating the B index entry in the parameter ram */
  242. #define CSL_EDMA3_BIDX_MAKE(src,dst) \
  243. (Uint32)(\
  244. CSL_FMKR(31, 16, (Uint32)(dst)) \
  245. |CSL_FMKR(15, 0 , (Uint32)(src))\
  246. )
  247. /** Used for creating the C index entry in the parameter ram */
  248. #define CSL_EDMA3_CIDX_MAKE(src,dst) \
  249. (Uint32)(\
  250. CSL_FMKR(31, 16, (Uint32)(dst)) \
  251. |CSL_FMKR(15, 0, (Uint32)(src))\
  252. )
  253. /**
  254. @}
  255. */
  256. /** @addtogroup CSL_EDMA3_ENUM
  257. @{ */
  258. /** @brief Enumeration for System priorities
  259. *
  260. * This is used for Setting up the Que Priority level
  261. */
  262. typedef enum {
  263. /** System priority level 0 */
  264. CSL_EDMA3_QUE_PRI_0 = 0,
  265. /** System priority level 1 */
  266. CSL_EDMA3_QUE_PRI_1 = 1,
  267. /** System priority level 2 */
  268. CSL_EDMA3_QUE_PRI_2 = 2,
  269. /** System priority level 3 */
  270. CSL_EDMA3_QUE_PRI_3 = 3,
  271. /** System priority level 4 */
  272. CSL_EDMA3_QUE_PRI_4 = 4,
  273. /** System priority level 5 */
  274. CSL_EDMA3_QUE_PRI_5 = 5,
  275. /** System priority level 6 */
  276. CSL_EDMA3_QUE_PRI_6 = 6,
  277. /** System priority level 7 */
  278. CSL_EDMA3_QUE_PRI_7 = 7
  279. }CSL_Edma3QuePri;
  280. /** @brief Enumeration for EDMA Event Queues
  281. *
  282. * These are a list of all the event queues.
  283. */
  284. /* Enumerations for EDMA Event Queues */
  285. typedef enum {
  286. /** Default Event Queue */
  287. CSL_EDMA3_QUE_DEFAULT = 0,
  288. /** Event Queue 0 */
  289. CSL_EDMA3_QUE_0 = 0,
  290. /** Event Queue 1 */
  291. CSL_EDMA3_QUE_1 = 1,
  292. /** Event Queue 2 */
  293. CSL_EDMA3_QUE_2 = 2,
  294. /** Event Queue 3 */
  295. CSL_EDMA3_QUE_3 = 3,
  296. /** Event Queue 4 */
  297. CSL_EDMA3_QUE_4 = 4,
  298. /** Event Queue 5 */
  299. CSL_EDMA3_QUE_5 = 5,
  300. /** Event Queue 6 */
  301. CSL_EDMA3_QUE_6 = 6,
  302. /** Event Queue 7 */
  303. CSL_EDMA3_QUE_7 = 7
  304. } CSL_Edma3Que;
  305. /** @brief Enumeration for EDMA Que Thresholds
  306. *
  307. * This is used for Setting up the Que thresholds
  308. */
  309. typedef enum {
  310. /** EDMA Que Threshold 0 */
  311. CSL_EDMA3_QUE_THR_0 = 0,
  312. /** EDMA Que Threshold 1 */
  313. CSL_EDMA3_QUE_THR_1 = 1,
  314. /** EDMA Que Threshold 2 */
  315. CSL_EDMA3_QUE_THR_2 = 2,
  316. /** EDMA Que Threshold 3 */
  317. CSL_EDMA3_QUE_THR_3 = 3,
  318. /** EDMA Que Threshold 4 */
  319. CSL_EDMA3_QUE_THR_4 = 4,
  320. /** EDMA Que Threshold 5 */
  321. CSL_EDMA3_QUE_THR_5 = 5,
  322. /** EDMA Que Threshold 6 */
  323. CSL_EDMA3_QUE_THR_6 = 6,
  324. /** EDMA Que Threshold 7 */
  325. CSL_EDMA3_QUE_THR_7 = 7,
  326. /** EDMA Que Threshold 8 */
  327. CSL_EDMA3_QUE_THR_8 = 8,
  328. /** EDMA Que Threshold 9 */
  329. CSL_EDMA3_QUE_THR_9 = 9,
  330. /** EDMA Que Threshold 10 */
  331. CSL_EDMA3_QUE_THR_10 = 10,
  332. /** EDMA Que Threshold 11 */
  333. CSL_EDMA3_QUE_THR_11 = 11,
  334. /** EDMA Que Threshold 12 */
  335. CSL_EDMA3_QUE_THR_12 = 12,
  336. /** EDMA Que Threshold 13 */
  337. CSL_EDMA3_QUE_THR_13 = 13,
  338. /** EDMA Que Threshold 14 */
  339. CSL_EDMA3_QUE_THR_14 = 14,
  340. /** EDMA Que Threshold 15 */
  341. CSL_EDMA3_QUE_THR_15 = 15,
  342. /** EDMA Que Threshold 16 */
  343. CSL_EDMA3_QUE_THR_16 = 16,
  344. /* EDMA Que Threshold Disable Errors */
  345. CSL_EDMA3_QUE_THR_DISABLE = 17
  346. }CSL_Edma3QueThr;
  347. /** MODULE Level Commands */
  348. typedef enum {
  349. /**
  350. * @brief Programmation of MPPAG,MPPA[0-7] attributes
  351. *
  352. * @param (CSL_Edma3CmdRegion *)
  353. */
  354. CSL_EDMA3_CMD_MEMPROTECT_SET = 1,
  355. /**
  356. * @brief Clear Memory Fault
  357. *
  358. * @param (None)
  359. */
  360. CSL_EDMA3_CMD_MEMFAULT_CLEAR,
  361. /**
  362. * @brief Enables bits as specified in the argument passed in
  363. * DRAE/DRAEH. Please note:If bits are already set in
  364. * DRAE/DRAEH this Control command will cause additional bits
  365. * (as specified by the bitmask) to be set and does
  366. * @param (CSL_Edma3CmdDrae *)
  367. */
  368. CSL_EDMA3_CMD_DMAREGION_ENABLE,
  369. /**
  370. * @brief Disables bits as specified in the argument passed in
  371. * DRAE/DRAEH
  372. * @param (CSL_Edma3CmdDrae *)
  373. */
  374. CSL_EDMA3_CMD_DMAREGION_DISABLE,
  375. /**
  376. * @brief Enables bits as specified in the argument
  377. * passed in QRAE.Pleasenote:If bits are already set in
  378. * QRAE/QRAEH this Control command will cause additional bits
  379. * (as specified by the bitmask) to be set and does
  380. * @param (CSL_Edma3CmdQrae *)
  381. */
  382. CSL_EDMA3_CMD_QDMAREGION_ENABLE,
  383. /**
  384. * @brief Disables bits as specified in the argument passed in QRAE
  385. * DRAE/DRAEH
  386. * @param (CSL_Edma3CmdQrae *)
  387. */
  388. CSL_EDMA3_CMD_QDMAREGION_DISABLE,
  389. /**
  390. * @brief Programmation of QUEPRI register with the specified priority
  391. * DRAE/DRAEH
  392. * @param (CSL_Edma3CmdQuePri *)
  393. */
  394. CSL_EDMA3_CMD_QUEPRIORITY_SET,
  395. /**
  396. * @brief Programmation of QUE Threshold levels
  397. *
  398. * @param (CSL_Edma3CmdQueThr *)
  399. */
  400. CSL_EDMA3_CMD_QUETHRESHOLD_SET,
  401. /**
  402. * @brief Sets the EVAL bit in the EEVAL register
  403. *
  404. * @param (None)
  405. */
  406. CSL_EDMA3_CMD_ERROR_EVAL,
  407. /**
  408. * @brief Clears specified (Bitmask)pending interrupt at Module/Region
  409. * Level
  410. * @param (CSL_Edma3CmdIntr *)
  411. */
  412. CSL_EDMA3_CMD_INTRPEND_CLEAR,
  413. /**
  414. * @brief Enables specified interrupts(BitMask) at Module/Region Level
  415. *
  416. * @param (CSL_Edma3CmdIntr *)
  417. */
  418. CSL_EDMA3_CMD_INTR_ENABLE,
  419. /**
  420. * @brief Disables specified interrupts(BitMask) at Module/Region
  421. * Level
  422. * @param (CSL_Edma3CmdIntr *)
  423. */
  424. CSL_EDMA3_CMD_INTR_DISABLE,
  425. /**
  426. * @brief Interrupt Evaluation asserted for the Module/Region
  427. *
  428. * @param (Int *)
  429. */
  430. CSL_EDMA3_CMD_INTR_EVAL,
  431. /**
  432. * @brief Clear the EDMA Controller Erorr
  433. *
  434. * @param (CSL_Edma3CtrlErrStat *)
  435. */
  436. CSL_EDMA3_CMD_CTRLERROR_CLEAR ,
  437. /**
  438. * @brief Pointer to an array of 3 elements, where element0 refers to
  439. * the EMR register to be cleared, element1 refers to the EMRH
  440. * register to be cleared, element2 refers to the QEMR register
  441. * to be cleared.
  442. * @param (CSL_BitMask32 *)
  443. */
  444. CSL_EDMA3_CMD_EVENTMISSED_CLEAR
  445. } CSL_Edma3HwControlCmd;
  446. /** @brief MODULE Level Queries */
  447. typedef enum {
  448. /**
  449. * @brief Return the Memory fault details
  450. *
  451. * @param (CSL_Edma3MemFaultStat *)
  452. */
  453. CSL_EDMA3_QUERY_MEMFAULT,
  454. /**
  455. * @brief Return memory attribute of the specified region
  456. *
  457. * @param (CSL_Edma3CmdRegion *)
  458. */
  459. CSL_EDMA3_QUERY_MEMPROTECT,
  460. /**
  461. * @brief Return Controller Error
  462. *
  463. * @param (CSL_Edma3CtrlErrStat *)
  464. */
  465. CSL_EDMA3_QUERY_CTRLERROR,
  466. /**
  467. * @brief Return pend status of specified interrupt
  468. *
  469. * @param (CSL_Edma3CmdIntr *)
  470. */
  471. CSL_EDMA3_QUERY_INTRPEND,
  472. /**
  473. * @brief Returns Miss Status of all Channels
  474. * Pointer to an array of 3 elements, where element0 refers to
  475. * the EMR registr, element1 refers to the EMRH register,
  476. * element2 refers to the QEMR register
  477. * @param (CSL_BitMask32 *)
  478. */
  479. CSL_EDMA3_QUERY_EVENTMISSED,
  480. /**
  481. * @brief Returns the Que status
  482. *
  483. * @param (CSL_Edma3QueStat *)
  484. */
  485. CSL_EDMA3_QUERY_QUESTATUS,
  486. /**
  487. * @brief Returns the Channel Controller Active Status
  488. *
  489. * @param (CSL_Edma3ActivityStat *)
  490. */
  491. CSL_EDMA3_QUERY_ACTIVITY,
  492. /**
  493. * @brief Returns the Channel Controller Information viz.
  494. * Configuration, Revision Id
  495. * @param (CSL_Edma3QueryInfo *)
  496. */
  497. CSL_EDMA3_QUERY_INFO
  498. } CSL_Edma3HwStatusQuery;
  499. /** @brief CHANNEL Commands */
  500. typedef enum {
  501. /**
  502. * @brief Enables specified Channel
  503. *
  504. * @param (None)
  505. */
  506. CSL_EDMA3_CMD_CHANNEL_ENABLE,
  507. /**
  508. * @brief Disables specified Channel
  509. *
  510. * @param (None)
  511. */
  512. CSL_EDMA3_CMD_CHANNEL_DISABLE,
  513. /**
  514. * @brief Manually sets the Channel Event,writes into ESR/ESRH
  515. * and not ER.NA for QDMA
  516. * @param (None)
  517. */
  518. CSL_EDMA3_CMD_CHANNEL_SET,
  519. /**
  520. * @brief Manually clears the Channel Event, does not write into
  521. * ESR/ESRH or ER/ERH but the ECR/ECRH. NA for QDMA
  522. * @param (None)
  523. */
  524. CSL_EDMA3_CMD_CHANNEL_CLEAR,
  525. /**
  526. * @brief In case of DMA channels clears SER/SERH(by writing into
  527. * SECR/SECRH if "secEvt" and "missed" are both TRUE) and
  528. * EMR/EMRH(by writing into EMCR/EMCRH if "missed" is TRUE).
  529. * In case of QDMA channels clears QSER(by writing into QSECR
  530. * if "ser" and "missed" are both TRUE) and QEMR(by writing
  531. * into QEMCR if "missed" is TRUE)
  532. * @param (CSL_Edma3ChannelErr *)
  533. */
  534. CSL_EDMA3_CMD_CHANNEL_CLEARERR
  535. } CSL_Edma3HwChannelControlCmd;
  536. /** @brief CHANNEL Queries */
  537. typedef enum {
  538. /**
  539. * @brief In case of DMA channels returns TRUE if ER/ERH is set,
  540. * In case of QDMA channels returns TRUE if QER is set
  541. * @param (Bool *)
  542. */
  543. CSL_EDMA3_QUERY_CHANNEL_STATUS,
  544. /**
  545. * @brief In case of DMA channels,'missed' is set
  546. * to TRUE if EMR/EMRH is set, 'secEvt' is set to TRUE if
  547. * SER/SERH is set.In case of QDMA channels,'missed' is set to
  548. * TRUE if QEMR is set, 'secEvt' is set to TRUE if QSER is set.
  549. * It should be noted that if secEvt ONLY is set to TRUE it
  550. * may not be a valid error condition
  551. * @param (CSL_Edma3ChannelErr *)
  552. */
  553. CSL_EDMA3_QUERY_CHANNEL_ERR
  554. } CSL_Edma3HwChannelStatusQuery;
  555. /**
  556. @}
  557. */
  558. /** @addtogroup CSL_EDMA3_DATASTRUCT
  559. @{ */
  560. /** @brief Module specific context information.
  561. * This is a dummy handle.
  562. */
  563. typedef void *CSL_Edma3Context;
  564. /** @brief Module Attributes specific information.
  565. * This is a dummy handle.
  566. */
  567. typedef void *CSL_Edma3ModuleAttr;
  568. /** @brief EDMA3 Configuration Information
  569. * This describes the configuration information for each EDMA instance.
  570. * This is populated by the SOC layer for each instance.
  571. */
  572. typedef struct CSL_Edma3CfgInfo_s
  573. {
  574. /** This is the number of DMA channels supported by this instance */
  575. Uint8 numDMAChannel;
  576. /** This is the number of QDMA channels supported by this instance */
  577. Uint8 numQDMAChannel;
  578. /** This is the number of Interrupt Channels supported by this instance */
  579. Uint8 numINTChannel;
  580. /** This is the number of PARAM Sets supported by this instance */
  581. Uint16 numParamsets;
  582. /** This is the number of Event Queues supported by this instance */
  583. Uint8 numEvque;
  584. /** This is the number of regions supported by this instance */
  585. Uint8 numRegions;
  586. /** This indicates if the instance supports Channel Mapping. */
  587. Bool IsChannelMapping;
  588. /** This indicates if the instance supports Memory Protection. */
  589. Bool IsMemoryProtection;
  590. }CSL_Edma3CfgInfo;
  591. /** @brief This object contains the reference to the instance of Edma Module
  592. * opened using the @a CSL_edma3Open().
  593. *
  594. * A pointer to this object is passed to all Edma Module level CSL APIs.
  595. */
  596. typedef struct CSL_Edma3Obj_s
  597. {
  598. /** This is a pointer to the Edma CC registers */
  599. CSL_Edma3ccRegsOvly regs;
  600. /** This is the instance of module number i.e CSL_EDMA3 */
  601. CSL_InstNum instNum;
  602. /** This is the configuration information for the CSL EDMA3 instance. */
  603. CSL_Edma3CfgInfo cfgInfo;
  604. } CSL_Edma3Obj;
  605. /** @brief EDMA handle */
  606. typedef struct CSL_Edma3Obj_s *CSL_Edma3Handle;
  607. /** CSL Parameter Set Handle */
  608. typedef volatile CSL_TPCC_ParamsetRegs *CSL_Edma3ParamHandle;
  609. /** @brief Edma ParamSetup Structure
  610. *
  611. * An object of this type is allocated by the user and
  612. * its address is passed as a parameter to the CSL_edma3ParamSetup().
  613. * This structure is used to program the Param Set for EDMA/QDMA.
  614. * The macros can be used to assign values to the fields of the structure.
  615. * The setup structure should be setup using the macros provided OR
  616. * as per the bit descriptions in the user guide..
  617. *
  618. */
  619. typedef struct CSL_Edma3ParamSetup_s {
  620. /** Options */
  621. Uint32 option;
  622. /** Specifies the source address */
  623. Uint32 srcAddr;
  624. /** Lower 16 bits are A Count Upper 16 bits are B Count*/
  625. Uint32 aCntbCnt;
  626. /** Specifies the destination address */
  627. Uint32 dstAddr;
  628. /** Lower 16 bits are source b index Upper 16 bits are
  629. * destination b index
  630. */
  631. Uint32 srcDstBidx;
  632. /** Lower 16 bits are link of the next param entry Upper 16 bits are
  633. * b count reload
  634. */
  635. Uint32 linkBcntrld;
  636. /** Lower 16 bits are source c index Upper 16 bits are destination
  637. * c index
  638. */
  639. Uint32 srcDstCidx;
  640. /** C count */
  641. Uint32 cCnt;
  642. } CSL_Edma3ParamSetup;
  643. /** @brief Edma Object Structure
  644. *
  645. * An object of this type is allocated by the user and
  646. * its address is passed as a parameter to the CSL_edma3ChannelOpen()
  647. * The CSL_edma3ChannelOpen() updates all the members of the data structure
  648. * and returns the objects address as a @a #CSL_Edma3ChannelHandle. The
  649. * @a #CSL_Edma3ChannelHandle is used in all subsequent function calls.
  650. */
  651. typedef struct CSL_Edma3ChannelObj_s {
  652. /** Pointer to the Edma Channel Controller module register
  653. * Overlay structure
  654. */
  655. CSL_Edma3ccRegsOvly regs;
  656. /** Region number to which the channel belongs to */
  657. Int region;
  658. /** EDMA instance whose channel is being requested */
  659. Int edmaNum;
  660. /** Channel Number being requested */
  661. Uint8 chaNum;
  662. /** This is the configuration information for the CSL EDMA3 instance. */
  663. CSL_Edma3CfgInfo cfgInfo;
  664. } CSL_Edma3ChannelObj;
  665. /** CSL Channel Handle
  666. * All channel level API calls must be made with this handle.
  667. */
  668. typedef struct CSL_Edma3ChannelObj_s *CSL_Edma3ChannelHandle;
  669. /** @brief Edma Memory Protection Fault Error Status
  670. *
  671. * An object of this type is allocated by the user and
  672. * its address is passed as a parameter to the CSL_edma3GetMemoryFaultError()
  673. * / CSL_edma3GetHwStatus() with the relevant command. This is relevant only is
  674. * MPEXIST is present for a given device.
  675. */
  676. typedef struct CSL_Edma3MemFaultStat_s {
  677. /** Memory Protection Fault Address */
  678. Uint32 addr;
  679. /** Bit Mask of the Errors */
  680. CSL_BitMask16 error;
  681. /** Faulted ID */
  682. Uint16 fid;
  683. } CSL_Edma3MemFaultStat;
  684. /** @brief Edma Controller Error Status.
  685. *
  686. * An object of this type is allocated by the user and
  687. * its address is passed as a parameter to the CSL_edma3GetControllerError()
  688. * /CSL_edma3GetHwStatus().
  689. */
  690. typedef struct CSL_Edma3CtrlErrStat_s {
  691. /** Bit Mask of the Que Threshold Errors */
  692. CSL_BitMask16 error;
  693. /** Whether number of permissible outstanding Tcc's is exceeded */
  694. Bool exceedTcc;
  695. } CSL_Edma3CtrlErrStat;
  696. /** @brief Edma Controller Information
  697. *
  698. * An object of this type is allocated by the user and
  699. * its address is passed as a parameter to the CSL_edma3GetInfo()
  700. * /CSL_edma3GetHwStatus().
  701. */
  702. typedef struct CSL_Edma3QueryInfo_s {
  703. /** Revision/Periperhal id of the EDMA3 Channel Controller */
  704. Uint32 revision;
  705. /** Channel Controller Configuration obtained from the CCCFG register */
  706. Uint32 config;
  707. } CSL_Edma3QueryInfo;
  708. /** @brief Edma Channel Controller Activity Status
  709. *
  710. * An object of this type is allocated by the user and
  711. * its address is passed as a parameter to the CSL_edma3GetActivityStatus()
  712. * /CSL_edma3GetHwStatus().
  713. */
  714. typedef struct CSL_Edma3ActivityStat_s {
  715. /** Number of outstanding completion requests */
  716. Uint16 outstandingTcc;
  717. /** BitMask of the que active in the Channel Controller */
  718. CSL_BitMask16 queActive;
  719. /** Indicates if the Channel Controller is active at all */
  720. Bool active;
  721. /** Indicates whether any QDMA events are active */
  722. Bool qevtActive;
  723. /** Indicates whether any EDMA events are active */
  724. Bool evtActive;
  725. /** Indicates whether the TR processing/submission logic is active*/
  726. Bool trActive;
  727. } CSL_Edma3ActivityStat;
  728. /** @brief Edma Controller Que Status.
  729. *
  730. * An object of this type is allocated by the user and
  731. * its address is passed as a parameter to the CSL_edma3GetQueStatus()
  732. * /CSL_edma3GetHwStatus().
  733. */
  734. typedef struct CSL_Edma3QueStat_s {
  735. /** Input field: Event Que. This needs to be specified by the user
  736. * before invocation of the above API
  737. */
  738. CSL_Edma3Que que;
  739. /** Output field: The number of valid entries in a queue has exceeded the
  740. * threshold specified in QWMTHRA has been exceeded
  741. */
  742. Bool exceed;
  743. /** Output field: The most entries that have been in Que since reset/last
  744. * time the watermark was cleared
  745. */
  746. Uint8 waterMark;
  747. /** Output field: Number of valid entries in Que N*/
  748. Uint8 numVal;
  749. /** Output field: Start pointer/Head of the queue */
  750. Uint8 startPtr;
  751. } CSL_Edma3QueStat;
  752. /** @brief Edma Control/Query Command Structure for querying region specific
  753. * attributes.
  754. *
  755. * An object of this type is allocated by the user and
  756. * its address is passed as a parameter to the
  757. * CSL_edma3GetHwStatus/CSL_edma3HwControl with the relevant command.
  758. */
  759. typedef struct CSL_Edma3CmdRegion_s {
  760. /** Input field:- this field needs to be initialized by the user before
  761. * issuing the query/command
  762. */
  763. Int region;
  764. /** Input/Output field:-this needs to be filled by the user in case
  765. * of issuing a COMMAND or it will be filled in by the CSL when
  766. * used with a QUERY
  767. */
  768. CSL_BitMask32 regionVal;
  769. } CSL_Edma3CmdRegion;
  770. /** @brief Edma Control/Query Command Structure for querying qdma region access
  771. * enable attributes.
  772. *
  773. * An object of this type is allocated by the user and
  774. * its address is passed as a parameter to the
  775. * CSL_edma3GetHwStatus/CSL_edma3HwControl with the relevant command.
  776. */
  777. typedef struct CSL_Edma3CmdQrae_s {
  778. /** this field needs to be initialized by the user before issuing
  779. * the query/command
  780. */
  781. Int region;
  782. /** this needs to be filled by the user in case of issuing a
  783. * COMMAND or it will be filled in by the CSL when used with a QUERY
  784. */
  785. CSL_BitMask32 qrae;
  786. } CSL_Edma3CmdQrae;
  787. /** @brief Edma Control/Query Control Command structure for issuing commands
  788. * for Interrupt related APIs
  789. * An object of this type is allocated by the user and
  790. * its address is passed to the Control API.
  791. */
  792. typedef struct CSL_Edma3CmdIntr_s {
  793. /** Input field:- this field needs to be initialized by the user before
  794. * issuing the query/command
  795. */
  796. Int region;
  797. /** Input/Output field:- this needs to be filled by the user in case
  798. * of issuing a COMMAND or it will be filled in by the CSL when used with
  799. * a QUERY
  800. */
  801. CSL_BitMask32 intr;
  802. /** Input/Output:- this needs to be filled by the user in case of issuing a
  803. * COMMAND or it will be filled in by the CSL when used with a QUERY
  804. */
  805. CSL_BitMask32 intrh;
  806. } CSL_Edma3CmdIntr;
  807. /** @brief Edma Command Structure for setting region specific
  808. * attributes.
  809. *
  810. * An object of this type is allocated by the user and
  811. * its address is passed as a parameter to the CSL_edma3GetHwStatus
  812. * when
  813. */
  814. typedef struct CSL_Edma3CmdDrae_s {
  815. /** this field needs to be initialiazed by the user before issuing
  816. * the command specifying the region for which attributes need to be set
  817. */
  818. Int region;
  819. /** DRAE Setting for the region */
  820. CSL_BitMask32 drae;
  821. /** DRAEH Setting for the region */
  822. CSL_BitMask32 draeh;
  823. } CSL_Edma3CmdDrae;
  824. /** @brief Edma Command Structure used for setting Event Que priority level
  825. *
  826. * An object of this type is allocated by the user and
  827. * its address is passed as a parameter to the CSL_edma3HwControl API.
  828. */
  829. typedef struct CSL_Edma3CmdQuePri_s {
  830. /** Specifies the Que that needs a priority change */
  831. CSL_Edma3Que que;
  832. /** Que priority */
  833. CSL_Edma3QuePri pri;
  834. } CSL_Edma3CmdQuePri;
  835. /** @brief Edma Command Structure used for setting Event Que threshold level
  836. *
  837. * An object of this type is allocated by the user and
  838. * its address is passed as a parameter to the CSL_edma3HwControl API.
  839. */
  840. typedef struct CSL_Edma3CmdQueThr_s {
  841. /** Specifies the Que that needs a change in the threshold setting */
  842. CSL_Edma3Que que;
  843. /** Que threshold setting */
  844. CSL_Edma3QueThr threshold;
  845. } CSL_Edma3CmdQueThr;
  846. /** @brief This will have the base-address information for the module
  847. * instance
  848. */
  849. typedef struct {
  850. /** Base-address of the peripheral registers */
  851. CSL_Edma3ccRegsOvly regs;
  852. } CSL_Edma3ModuleBaseAddress;
  853. /** @brief Edma Channel parameter structure used for opening a channel
  854. */
  855. typedef struct {
  856. /** Region Number */
  857. Int regionNum;
  858. /** Channel number */
  859. Int chaNum;
  860. } CSL_Edma3ChannelAttr;
  861. /** @brief Edma Channel Error .
  862. *
  863. * An object of this type is allocated by the user and
  864. * its address is passed as a parameter to the CSL_edma3GetChannelError()
  865. * /CSL_edma3GetHwStatus()/ CSL_edma3ChannelErrorClear()
  866. * /CSL_edma3HwChannelControl().
  867. */
  868. typedef struct CSL_Edma3ChannelErr_s {
  869. /** a TRUE indicates an event is missed on this channel. */
  870. Bool missed;
  871. /** a TRUE indicates an event that no events on this channel will be
  872. * prioritized till this is cleared. This being TRUE does NOT necessarily
  873. * mean it is an error. ONLY if both missed and ser are set, this kind of
  874. * error need to be cleared.
  875. */
  876. Bool secEvt;
  877. } CSL_Edma3ChannelErr;
  878. /** @brief QDMA Edma Channel Setup
  879. *
  880. * An array of such objects are allocated by the user and
  881. * address initialized in the CSL_Edma3HwSetup structure which is passed
  882. * CSL_edma3HwSetup()
  883. */
  884. typedef struct CSL_Edma3HwQdmaChannelSetup_s {
  885. /** Que number for the channel */
  886. CSL_Edma3Que que;
  887. /** Parameter set mapping for the channel. */
  888. Uint16 paramNum;
  889. /** Trigger word for the QDMA channels. */
  890. Uint8 triggerWord;
  891. } CSL_Edma3HwQdmaChannelSetup;
  892. /** @brief QDMA Edma Channel Setup
  893. *
  894. * An array of such objects are allocated by the user and
  895. * address initialized in the CSL_Edma3HwSetup structure which is passed
  896. * CSL_edma3HwSetup()
  897. */
  898. typedef struct CSL_Edma3HwDmaChannelSetup_s {
  899. /** Que number for the channel */
  900. CSL_Edma3Que que;
  901. /** Parameter set mapping for the channel. */
  902. Uint16 paramNum;
  903. } CSL_Edma3HwDmaChannelSetup;
  904. /** @brief Edma Hw Setup Structure
  905. */
  906. typedef struct {
  907. /** Edma Hw Channel setup */
  908. CSL_Edma3HwDmaChannelSetup *dmaChaSetup;
  909. /** QEdma Hw Channel setup */
  910. CSL_Edma3HwQdmaChannelSetup *qdmaChaSetup;
  911. } CSL_Edma3HwSetup;
  912. /**
  913. @}
  914. */
  915. /** @addtogroup CSL_EDMA3_FUNCTION
  916. @{ */
  917. /**************************************************************************\
  918. * EDMA global function declarations
  919. \**************************************************************************/
  920. extern CSL_Status CSL_edma3Init (
  921. CSL_Edma3Context *pContext
  922. );
  923. extern CSL_Edma3Handle CSL_edma3Open (
  924. CSL_Edma3Obj* pEdmaObj,
  925. CSL_InstNum edmaNum,
  926. CSL_Edma3ModuleAttr* pAttr,
  927. CSL_Status* pStatus
  928. );
  929. extern CSL_Status CSL_edma3Close (
  930. CSL_Edma3Handle hEdma
  931. );
  932. extern CSL_Status CSL_edma3HwSetup (
  933. CSL_Edma3Handle hMod,
  934. const CSL_Edma3HwSetup *setup
  935. );
  936. extern CSL_Status CSL_edma3GetHwSetup (
  937. CSL_Edma3Handle hMod,
  938. const CSL_Edma3HwSetup *setup
  939. );
  940. extern CSL_Status CSL_edma3HwControl (
  941. CSL_Edma3Handle hMod,
  942. CSL_Edma3HwControlCmd cmd,
  943. const void *cmdArg
  944. );
  945. extern CSL_Status CSL_edma3ccGetModuleBaseAddr (
  946. CSL_InstNum edmaNum,
  947. CSL_Edma3ModuleAttr* pParam,
  948. CSL_Edma3ModuleBaseAddress* pBaseAddress,
  949. CSL_Edma3CfgInfo* pCfgInfo
  950. );
  951. extern CSL_Status CSL_edma3GetHwStatus (
  952. CSL_Edma3Handle hMod,
  953. CSL_Edma3HwStatusQuery myQuery,
  954. void *response
  955. );
  956. extern CSL_Edma3ChannelHandle CSL_edma3ChannelOpen (
  957. CSL_Edma3ChannelObj* pEdmaObj,
  958. CSL_InstNum edmaNum,
  959. const CSL_Edma3ChannelAttr* pChAttr,
  960. CSL_Status* pStatus
  961. );
  962. extern CSL_Status CSL_edma3ChannelClose (
  963. CSL_Edma3ChannelHandle hEdma
  964. );
  965. extern CSL_Status CSL_edma3HwChannelSetupParam (
  966. CSL_Edma3ChannelHandle hEdma,
  967. Uint16 paramNum
  968. );
  969. extern CSL_Status CSL_edma3HwChannelSetupTriggerWord (
  970. CSL_Edma3ChannelHandle hEdma,
  971. Uint8 triggerWord
  972. );
  973. extern CSL_Status CSL_edma3HwChannelSetupQue (
  974. CSL_Edma3ChannelHandle hEdma,
  975. CSL_Edma3Que evtQue
  976. );
  977. extern CSL_Status CSL_edma3GetHwChannelSetupParam (
  978. CSL_Edma3ChannelHandle hEdma,
  979. Uint16 *paramNum
  980. );
  981. extern CSL_Status CSL_edma3GetHwChannelSetupTriggerWord (
  982. CSL_Edma3ChannelHandle hEdma,
  983. Uint8 *triggerWord
  984. );
  985. extern CSL_Status CSL_edma3GetHwChannelSetupQue (
  986. CSL_Edma3ChannelHandle hEdma,
  987. CSL_Edma3Que* evtQue
  988. );
  989. extern CSL_Status CSL_edma3HwChannelControl (
  990. CSL_Edma3ChannelHandle hCh,
  991. CSL_Edma3HwChannelControlCmd cmd,
  992. void *cmdArg
  993. );
  994. extern CSL_Status CSL_edma3GetHwChannelStatus (
  995. CSL_Edma3ChannelHandle hEdma,
  996. CSL_Edma3HwChannelStatusQuery myQuery,
  997. void* response
  998. );
  999. extern CSL_Edma3ParamHandle CSL_edma3GetParamHandle (
  1000. CSL_Edma3ChannelHandle hEdma,
  1001. Int16 paramNum,
  1002. CSL_Status *status
  1003. );
  1004. extern CSL_Status CSL_edma3ParamSetup (
  1005. CSL_Edma3ParamHandle hParamHndl,
  1006. const CSL_Edma3ParamSetup* setup
  1007. );
  1008. extern CSL_Status CSL_edma3ParamWriteWord (
  1009. CSL_Edma3ParamHandle hParamHndl,
  1010. Uint16 wordOffset,
  1011. Uint32 word
  1012. );
  1013. /**
  1014. @}
  1015. */
  1016. #ifdef __cplusplus
  1017. }
  1018. #endif
  1019. #endif