csl_cpIntcAux.h 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930
  1. /**
  2. * @file csl_cpintcAux.h
  3. *
  4. * @brief
  5. * This is the CPINTC Auxilary Header File which exposes the various
  6. * CSL Functional Layer API's to configure the CPINTC Module.
  7. *
  8. * \par
  9. * ============================================================================
  10. * @n (C) Copyright 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. #ifndef CSL_CPINTC_AUX_H_
  42. #define CSL_CPINTC_AUX_H_
  43. #include <ti/csl/csl_cpIntc.h>
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47. /** @addtogroup CSL_CPINTC_FUNCTION
  48. @{ */
  49. /** ============================================================================
  50. * @n@b CSL_CPINTC_setNestingMode
  51. *
  52. * @b Description
  53. * @n This API configures the Interrupt Controller nesting mode.
  54. *
  55. * @b Arguments
  56. * @verbatim
  57. hnd This is the handle to the CPINTC instance.
  58. nestMode Nesting Mode to be configured
  59. @endverbatim
  60. *
  61. * <b> Return Value </b>
  62. * None
  63. *
  64. * <b> Pre Condition </b>
  65. * @n @a CSL_CPINTC_open() must be called.
  66. *
  67. * <b> Post Condition </b>
  68. * @n The interrupt controller is configured to use the specified nesting mode.
  69. *
  70. * @b Writes
  71. * @n CPINTC_CONTROL_REG_NEST_MODE
  72. *
  73. * @b Example
  74. * @verbatim
  75. CSL_CPINTCNestingMode nestMode;
  76. CSL_CPINTC_HANDLE hnd;
  77. ...
  78. hnd = CSL_CPINTC_open (0); // Opens CPINTC Instance 0
  79. ...
  80. CSL_CPINTC_setNestingMode (hnd, nestMode);
  81. ...
  82. @endverbatim
  83. * ===========================================================================
  84. */
  85. static inline void CSL_CPINTC_setNestingMode
  86. (
  87. CSL_CPINTC_Handle hnd,
  88. CSL_CPINTCNestingMode nestMode
  89. )
  90. {
  91. /* Write the CONTROL_REG with the specified nesting mode. */
  92. ((CSL_CPINTC_RegsOvly)hnd)->CONTROL_REG = CSL_FMK(CPINTC_CONTROL_REG_NEST_MODE, nestMode);
  93. }
  94. /** ============================================================================
  95. * @n@b CSL_CPINTC_getNestingMode
  96. *
  97. * @b Description
  98. * @n This API gets the current nesting mode which is configured in the
  99. * interrupt controller.
  100. *
  101. * @b Arguments
  102. * @verbatim
  103. hnd This is the handle to the CPINTC instance.
  104. @endverbatim
  105. *
  106. *
  107. * <b> Return Value </b>
  108. * CSL_CPINTCNestingMode - Current Nesting Mode.
  109. *
  110. * <b> Pre Condition </b>
  111. * @n @a CSL_CPINTC_open() must be called.
  112. *
  113. * <b> Post Condition </b>
  114. * @n None
  115. *
  116. * @b Reads
  117. * @n CPINTC_CONTROL_REG_NEST_MODE
  118. *
  119. * @b Example
  120. * @verbatim
  121. CSL_CPINTC_HANDLE hnd;
  122. CSL_CPINTCNestingMode nestMode;
  123. ...
  124. hnd = CSL_CPINTC_open (0); // Opens CPINTC Instance 0
  125. ...
  126. nestMode = CSL_CPINTC_getNestingMode();
  127. @endverbatim
  128. * ===========================================================================
  129. */
  130. static inline CSL_CPINTCNestingMode CSL_CPINTC_getNestingMode (CSL_CPINTC_Handle hnd)
  131. {
  132. return (CSL_CPINTCNestingMode)CSL_FEXT(((CSL_CPINTC_RegsOvly)hnd)->CONTROL_REG,
  133. CPINTC_CONTROL_REG_NEST_MODE);
  134. }
  135. /** ============================================================================
  136. * @n@b CSL_CPINTC_setNestingLevel
  137. *
  138. * @b Description
  139. * @n This API overrides the Interrupt Controller global nesting level that
  140. is set by automatic nesting mode
  141. *
  142. * @b Arguments
  143. * @verbatim
  144. hnd This is the handle to the CPINTC instance.
  145. nestLevel Nesting Level to be configured
  146. @endverbatim
  147. *
  148. * <b> Return Value </b>
  149. * None
  150. *
  151. * <b> Pre Condition </b>
  152. * @n @a CSL_CPINTC_open() must be called.
  153. *
  154. * <b> Post Condition </b>
  155. * @n The interrupt controller is configured to use the specified nesting level.
  156. *
  157. * @b Writes
  158. * @n CPINTC_GLB_NEST_LEVEL_REG_GLB_NEST_LEVEL
  159. *
  160. * @b Example
  161. * @verbatim
  162. CSL_CPINTCNestingLevel nestLevel;
  163. CSL_CPINTC_HANDLE hnd;
  164. ...
  165. hnd = CSL_CPINTC_open (0); // Opens CPINTC Instance 0
  166. ...
  167. CSL_CPINTC_setNestingLevel (hnd, nestLevel);
  168. ...
  169. @endverbatim
  170. * ===========================================================================
  171. */
  172. static inline void CSL_CPINTC_setNestingLevel
  173. (
  174. CSL_CPINTC_Handle hnd,
  175. CSL_CPINTCNestingLevel nestLevel
  176. )
  177. {
  178. Uint32 writeVal;
  179. writeVal = nestLevel & 0x1ff;
  180. writeVal |= 0x80000000; /* set bit 31 auto_override */
  181. /* Write the GLB_NEST_LEVEL_REG with the specified nesting mode. */
  182. ((CSL_CPINTC_RegsOvly)hnd)->GLB_NEST_LEVEL_REG = writeVal;
  183. }
  184. /** ============================================================================
  185. * @n@b CSL_CPINTC_getNestingLevel
  186. *
  187. * @b Description
  188. * @n This API gets the current nesting level which is configured in the
  189. * interrupt controller.
  190. *
  191. * @b Arguments
  192. * @verbatim
  193. hnd This is the handle to the CPINTC instance.
  194. @endverbatim
  195. *
  196. *
  197. * <b> Return Value </b>
  198. * CSL_CPINTCNestingLevel - Current Nesting Level.
  199. *
  200. * <b> Pre Condition </b>
  201. * @n @a CSL_CPINTC_open() must be called.
  202. *
  203. * <b> Post Condition </b>
  204. * @n None
  205. *
  206. * @b Reads
  207. * @n CPINTC_GLB_NEST_LEVEL_REG_GLB_NEST_LEVEL
  208. *
  209. * @b Example
  210. * @verbatim
  211. CSL_CPINTC_HANDLE hnd;
  212. CSL_CPINTCNestingLevel nestLevel;
  213. ...
  214. hnd = CSL_CPINTC_open (0); // Opens CPINTC Instance 0
  215. ...
  216. nestLevel = CSL_CPINTC_getNestingLevel();
  217. @endverbatim
  218. * ===========================================================================
  219. */
  220. static inline CSL_CPINTCNestingLevel CSL_CPINTC_getNestingLevel (CSL_CPINTC_Handle hnd)
  221. {
  222. return (CSL_CPINTCNestingLevel)CSL_FEXT(((CSL_CPINTC_RegsOvly)hnd)->GLB_NEST_LEVEL_REG,
  223. CPINTC_GLB_NEST_LEVEL_REG_GLB_NEST_LEVEL);
  224. }
  225. /** ============================================================================
  226. * @n@b CSL_CPINTC_enableAllHostInterrupt
  227. *
  228. * @b Description
  229. * @n This API enables all the Host Interrupts in the system.
  230. *
  231. * @b Arguments
  232. * @verbatim
  233. hnd This is the handle to the CPINTC instance.
  234. @endverbatim
  235. *
  236. * <b> Return Value </b>
  237. * None
  238. *
  239. * <b> Pre Condition </b>
  240. * @n @a CSL_CPINTC_open() must be called.
  241. *
  242. * <b> Post Condition </b>
  243. * @n All host interrupts are enabled in the system. Individual Host
  244. * interrupts are still enabled/disabled from their individual
  245. * registers
  246. *
  247. * @b Writes
  248. * @n CPINTC_GLOBAL_ENABLE_HINT_REG_ENABLE_HINT_ANY=1
  249. *
  250. * @b Example
  251. * @verbatim
  252. CSL_CPINTC_HANDLE hnd;
  253. ...
  254. hnd = CSL_CPINTC_open (0); // Opens CPINTC Instance 0
  255. ...
  256. CSL_CPINTC_enableAllHostInterrupt (hnd);
  257. ...
  258. @endverbatim
  259. * ===========================================================================
  260. */
  261. static inline void CSL_CPINTC_enableAllHostInterrupt (CSL_CPINTC_Handle hnd)
  262. {
  263. /* Enable all host interrupts by writing 1 to the register. */
  264. ((CSL_CPINTC_RegsOvly)hnd)->GLOBAL_ENABLE_HINT_REG =
  265. CSL_FMK(CPINTC_GLOBAL_ENABLE_HINT_REG_ENABLE_HINT_ANY, 1);
  266. }
  267. /** ============================================================================
  268. * @n@b CSL_CPINTC_disableAllHostInterrupt
  269. *
  270. * @b Description
  271. * @n This API disables all the Host Interrupts in the system.
  272. *
  273. * @b Arguments
  274. * @verbatim
  275. hnd This is the handle to the CPINTC instance.
  276. @endverbatim
  277. *
  278. * <b> Return Value </b>
  279. * None
  280. *
  281. * <b> Pre Condition </b>
  282. * @n @a CSL_CPINTC_open() must be called.
  283. *
  284. * <b> Post Condition </b>
  285. * @n All host interrupts are disabled in the system.
  286. *
  287. * @b Writes
  288. * @n CPINTC_GLOBAL_ENABLE_HINT_REG_ENABLE_HINT_ANY=0
  289. *
  290. * @b Example
  291. * @verbatim
  292. CSL_CPINTC_HANDLE hnd;
  293. ...
  294. hnd = CSL_CPINTC_open (0); // Opens CPINTC Instance 0
  295. ...
  296. CSL_CPINTC_disableAllHostInterrupt (hnd);
  297. ...
  298. @endverbatim
  299. * ===========================================================================
  300. */
  301. static inline void CSL_CPINTC_disableAllHostInterrupt (CSL_CPINTC_Handle hnd)
  302. {
  303. /* Disable all host interrupts by writing 0 to the register. */
  304. ((CSL_CPINTC_RegsOvly)hnd)->GLOBAL_ENABLE_HINT_REG =
  305. CSL_FMK(CPINTC_GLOBAL_ENABLE_HINT_REG_ENABLE_HINT_ANY, 0);
  306. }
  307. /** ============================================================================
  308. * @n@b CSL_CPINTC_enableSysInterrupt
  309. *
  310. * @b Description
  311. * @n This API enables the system interrupt in the interrupt controller.
  312. *
  313. * @b Arguments
  314. * @verbatim
  315. hnd This is the handle to the CPINTC instance.
  316. sysIntr System Interrupt which is to be enabled.
  317. @endverbatim
  318. *
  319. * <b> Return Value </b>
  320. * None
  321. *
  322. * <b> Pre Condition </b>
  323. * @n @a CSL_CPINTC_open() must be called.
  324. *
  325. * <b> Post Condition </b>
  326. * @n The specific System Interrupt is enabled in the controller and
  327. * can now generate host interrupts.
  328. *
  329. * @b Writes
  330. * @n CPINTC_ENABLE_SET_INDEX_REG_ENABLE_SET_INDEX
  331. *
  332. * @b Example
  333. * @verbatim
  334. CSL_CPINTCSystemInterrupt sysIntr;
  335. CSL_CPINTC_HANDLE hnd;
  336. ...
  337. hnd = CSL_CPINTC_open (0); // Opens CPINTC Instance 0
  338. ...
  339. CSL_CPINTC_enableSysInterrupt (hnd, sysIntr);
  340. ...
  341. @endverbatim
  342. * ===========================================================================
  343. */
  344. static inline void CSL_CPINTC_enableSysInterrupt
  345. (
  346. CSL_CPINTC_Handle hnd,
  347. CSL_CPINTCSystemInterrupt sysIntr
  348. )
  349. {
  350. /* Write the sysIntr to the ENABLE_SET_INDEX_REG to enable the interrupt. */
  351. ((CSL_CPINTC_RegsOvly)hnd)->ENABLE_SET_INDEX_REG =
  352. CSL_FMK(CPINTC_ENABLE_SET_INDEX_REG_ENABLE_SET_INDEX, sysIntr);
  353. }
  354. /** ============================================================================
  355. * @n@b CSL_CPINTC_disableSysInterrupt
  356. *
  357. * @b Description
  358. * @n This API disables the system interrupt in the interrupt controller.
  359. *
  360. * @b Arguments
  361. * @verbatim
  362. hnd This is the handle to the CPINTC instance.
  363. sysIntr System Interrupt which is to be disabled.
  364. @endverbatim
  365. *
  366. * <b> Return Value </b>
  367. * None
  368. *
  369. * <b> Pre Condition </b>
  370. * @n @a CSL_CPINTC_open() must be called.
  371. *
  372. * <b> Post Condition </b>
  373. * @n The specific System Interrupt is disabled in the controller and
  374. * cannot generate host interrupts.
  375. *
  376. * @b Writes
  377. * @n CPINTC_ENABLE_CLR_INDEX_REG_ENABLE_CLR_INDEX
  378. *
  379. * @b Example
  380. * @verbatim
  381. CSL_CPINTCSystemInterrupt sysIntr;
  382. CSL_CPINTC_HANDLE hnd;
  383. ...
  384. hnd = CSL_CPINTC_open (0); // Opens CPINTC Instance 0
  385. ...
  386. CSL_CPINTC_disableSysInterrupt (hnd, sysIntr);
  387. ...
  388. @endverbatim
  389. * ===========================================================================
  390. */
  391. static inline void CSL_CPINTC_disableSysInterrupt
  392. (
  393. CSL_CPINTC_Handle hnd,
  394. CSL_CPINTCSystemInterrupt sysIntr
  395. )
  396. {
  397. /* Write the sysIntr to the ENABLE_CLR_INDEX_REG to disable the interrupt. */
  398. ((CSL_CPINTC_RegsOvly)hnd)->ENABLE_CLR_INDEX_REG =
  399. CSL_FMK(CPINTC_ENABLE_CLR_INDEX_REG_ENABLE_CLR_INDEX, sysIntr);
  400. }
  401. /** ============================================================================
  402. * @n@b CSL_CPINTC_clearSysInterrupt
  403. *
  404. * @b Description
  405. * @n This API clear the system interrupt in the interrupt controller.
  406. *
  407. * @b Arguments
  408. * @verbatim
  409. hnd This is the handle to the CPINTC instance.
  410. sysIntr System Interrupt which is to be cleared.
  411. @endverbatim
  412. *
  413. * <b> Return Value </b>
  414. * None
  415. *
  416. * <b> Pre Condition </b>
  417. * @n @a CSL_CPINTC_open() must be called.
  418. *
  419. * <b> Post Condition </b>
  420. * @n The specific system interrupt has been serviced and is cleared.
  421. *
  422. * @b Writes
  423. * @n CPINTC_STATUS_CLR_INDEX_REG_STATUS_CLR_INDEX
  424. *
  425. * @b Example
  426. * @verbatim
  427. CSL_CPINTCSystemInterrupt sysIntr;
  428. CSL_CPINTC_HANDLE hnd;
  429. ...
  430. hnd = CSL_CPINTC_open (0); // Opens CPINTC Instance 0
  431. ...
  432. CSL_CPINTC_clearSysInterrupt (hnd, sysIntr);
  433. ...
  434. @endverbatim
  435. * ===========================================================================
  436. */
  437. static inline void CSL_CPINTC_clearSysInterrupt
  438. (
  439. CSL_CPINTC_Handle hnd,
  440. CSL_CPINTCSystemInterrupt sysIntr
  441. )
  442. {
  443. /* Write the sysIntr to the STATUS_CLR_INDEX_REG to clear the interrupt. */
  444. ((CSL_CPINTC_RegsOvly)hnd)->STATUS_CLR_INDEX_REG =
  445. CSL_FMK(CPINTC_STATUS_CLR_INDEX_REG_STATUS_CLR_INDEX, sysIntr);
  446. }
  447. /** ============================================================================
  448. * @n@b CSL_CPINTC_enableHostInterrupt
  449. *
  450. * @b Description
  451. * @n This API enables the host interrupt in the interrupt controller.
  452. *
  453. * @b Arguments
  454. * @verbatim
  455. hnd This is the handle to the CPINTC instance.
  456. sysIntr Host Interrupt which is to be enabled.
  457. @endverbatim
  458. *
  459. * <b> Return Value </b>
  460. * None
  461. *
  462. * <b> Pre Condition </b>
  463. * @n @a CSL_CPINTC_open() must be called.
  464. *
  465. * <b> Post Condition </b>
  466. * @n The specific Host Interrupt is enabled in the controller and
  467. * can now generate host interrupts.
  468. *
  469. * @b Writes
  470. * @n CPINTC_HINT_ENABLE_SET_INDEX_REG_HINT_ENABLE_SET_INDEX
  471. *
  472. * @b Example
  473. * @verbatim
  474. CSL_CPINTCHostInterrupt hostIntr;
  475. CSL_CPINTC_HANDLE hnd;
  476. ...
  477. hnd = CSL_CPINTC_open (0); // Opens CPINTC Instance 0
  478. ...
  479. CSL_CPINTC_enableHostInterrupt (hnd, hostIntr);
  480. ...
  481. @endverbatim
  482. * ===========================================================================
  483. */
  484. static inline void CSL_CPINTC_enableHostInterrupt
  485. (
  486. CSL_CPINTC_Handle hnd,
  487. CSL_CPINTCHostInterrupt hostIntr
  488. )
  489. {
  490. /* Write the hostIntr to the HINT_ENABLE_SET_INDEX_REG to enable the interrupt. */
  491. ((CSL_CPINTC_RegsOvly)hnd)->HINT_ENABLE_SET_INDEX_REG =
  492. CSL_FMK(CPINTC_HINT_ENABLE_SET_INDEX_REG_HINT_ENABLE_SET_INDEX, hostIntr);
  493. }
  494. /** ============================================================================
  495. * @n@b CSL_CPINTCdisableHostInterrupt
  496. *
  497. * @b Description
  498. * @n This API disables the host interrupt in the interrupt controller.
  499. *
  500. * @b Arguments
  501. * @verbatim
  502. hnd This is the handle to the CPINTC instance.
  503. sysIntr Host Interrupt which is to be disabled.
  504. @endverbatim
  505. *
  506. * <b> Return Value </b>
  507. * None
  508. *
  509. * <b> Pre Condition </b>
  510. * @n @a CSL_CPINTC_open() must be called.
  511. *
  512. * <b> Post Condition </b>
  513. * @n The specific Host Interrupt is enabled in the controller and
  514. * can now generate host interrupts.
  515. *
  516. * @b Writes
  517. * @n CPINTC_HINT_ENABLE_CLR_INDEX_REG_HINT_ENABLE_CLR_INDEX
  518. *
  519. * @b Example
  520. * @verbatim
  521. CSL_CPINTCHostInterrupt hostIntr;
  522. CSL_CPINTC_HANDLE hnd;
  523. ...
  524. hnd = CSL_CPINTC_open (0); // Opens CPINTC Instance 0
  525. ...
  526. CSL_CPINTCdisableHostInterrupt (hnd, hostIntr);
  527. ...
  528. @endverbatim
  529. * ===========================================================================
  530. */
  531. static inline void CSL_CPINTC_disableHostInterrupt
  532. (
  533. CSL_CPINTC_Handle hnd,
  534. CSL_CPINTCHostInterrupt hostIntr
  535. )
  536. {
  537. /* Write the hostIntr to the HINT_ENABLE_CLR_INDEX_REG to disable the interrupt. */
  538. ((CSL_CPINTC_RegsOvly)hnd)->HINT_ENABLE_CLR_INDEX_REG =
  539. CSL_FMK(CPINTC_HINT_ENABLE_CLR_INDEX_REG_HINT_ENABLE_CLR_INDEX, hostIntr);
  540. }
  541. /** ============================================================================
  542. * @n@b CSL_CPINTC_isInterruptPending
  543. *
  544. * @b Description
  545. * @n This API is used to check if there are any pending interrupts active
  546. * in the system or not.
  547. *
  548. * @b Arguments
  549. * @verbatim
  550. hnd This is the handle to the CPINTC instance.
  551. @endverbatim
  552. *
  553. * <b> Return Value </b>
  554. * TRUE - Interrupts are pending.
  555. * FALSE - No interrupts are pending.
  556. *
  557. * <b> Pre Condition </b>
  558. * @n @a CSL_CPINTC_open() must be called.
  559. *
  560. * <b> Post Condition </b>
  561. * @n None
  562. *
  563. * @b Reads
  564. * @n CPINTC_GLB_PRI_INTR_REG_GLB_NONE
  565. *
  566. * @b Example
  567. * @verbatim
  568. Bool pendingStatus;
  569. CSL_CPINTC_HANDLE hnd;
  570. ...
  571. hnd = CSL_CPINTC_open (0); // Opens CPINTC Instance 0
  572. ...
  573. pendingStatus = CSL_CPINTCisInterruptPending(hnd);
  574. ...
  575. @endverbatim
  576. * ===========================================================================
  577. */
  578. static inline Bool CSL_CPINTC_isInterruptPending (CSL_CPINTC_Handle hnd)
  579. {
  580. Int32 pendStatus;
  581. /* Read the 'GLB_PRI_INTR_REG' to determine if there is a pending interrupt or not? */
  582. pendStatus = CSL_FEXT(((CSL_CPINTC_RegsOvly)hnd)->GLB_PRI_INTR_REG,
  583. CPINTC_GLB_PRI_INTR_REG_GLB_NONE);
  584. return (pendStatus == 1) ? FALSE : TRUE;
  585. }
  586. /** ============================================================================
  587. * @n@b CSL_CPINTC_getPendingInterrupt
  588. *
  589. * @b Description
  590. * @n This API gets the current highest priority pending interrupt. This API
  591. * should only be called after checking if there are pending interrupts
  592. * using the 'CSL_CPINTCisInterruptPending'.
  593. *
  594. * @b Arguments
  595. * @verbatim
  596. hnd This is the handle to the CPINTC instance.
  597. @endverbatim
  598. *
  599. * <b> Return Value </b>
  600. * CSL_CPINTCHostInterrupt - Highest Priority System Interrupt.
  601. *
  602. * <b> Pre Condition </b>
  603. * @n @a CSL_CPINTC_open() must be called.
  604. *
  605. * <b> Post Condition </b>
  606. * @n None
  607. *
  608. * @b Reads
  609. * @n CPINTC_GLB_PRI_INTR_REG_GLB_PRI_INTR
  610. *
  611. * @b Example
  612. * @verbatim
  613. CSL_CPINTCHostInterrupt intr;
  614. Bool pendingStatus;
  615. CSL_CPINTC_HANDLE hnd;
  616. ...
  617. hnd = CSL_CPINTC_open (0); // Opens CPINTC Instance 0
  618. ...
  619. pendingStatus = CSL_CPINTC_isInterruptPending(hnd);
  620. if (pendingStatus == TRUE)
  621. {
  622. intr = CSL_CPINTC_getPendingInterrupt(hnd);
  623. }
  624. ...
  625. @endverbatim
  626. * ===========================================================================
  627. */
  628. static inline CSL_CPINTCSystemInterrupt CSL_CPINTC_getPendingInterrupt (CSL_CPINTC_Handle hnd)
  629. {
  630. return (CSL_CPINTCHostInterrupt)(CSL_FEXT(((CSL_CPINTC_RegsOvly)hnd)->GLB_PRI_INTR_REG,
  631. CPINTC_GLB_PRI_INTR_REG_GLB_PRI_INTR));
  632. }
  633. /** ============================================================================
  634. * @n@b CSL_CPINTC_isHostInterruptPending
  635. *
  636. * @b Description
  637. * @n This API is used to check if there are any pending interrupts active
  638. * for a particular host.
  639. *
  640. * @b Arguments
  641. * @verbatim
  642. hnd This is the handle to the CPINTC instance.
  643. hostIntr This is the specific host interrupt output.
  644. @endverbatim
  645. *
  646. * <b> Return Value </b>
  647. * TRUE - Interrupts are pending.
  648. * FALSE - No interrupts are pending.
  649. *
  650. * <b> Pre Condition </b>
  651. * @n @a CSL_CPINTC_open() must be called.
  652. *
  653. * <b> Post Condition </b>
  654. * @n None
  655. *
  656. * @b Reads
  657. * @n CPINTC_PRI_HINT_REG0_NONE_HINT_0..CPINTC_PRI_HINT_REG255_NONE_HINT_255
  658. *
  659. * @b Example
  660. * @verbatim
  661. Bool pendingStatus;
  662. CSL_CPINTC_HANDLE hnd;
  663. CSL_CPINTCHostInterrupt host;
  664. ...
  665. hnd = CSL_CPINTC_open (0); // Opens CPINTC Instance 0
  666. ...
  667. pendingStatus = CSL_CPINTC_isHostInterruptPending(hnd, host);
  668. ...
  669. @endverbatim
  670. * ===========================================================================
  671. */
  672. static inline Bool CSL_CPINTC_isHostInterruptPending
  673. (
  674. CSL_CPINTC_Handle hnd,
  675. CSL_CPINTCHostInterrupt hostIntr
  676. )
  677. {
  678. Int32 pendStatus;
  679. /* Read the 'PRI_HINT_REG' to determine if there is a pending interrupt for this host */
  680. pendStatus = CSL_FEXT(((CSL_CPINTC_RegsOvly)hnd)->PRI_HINT_REG[hostIntr],
  681. CPINTC_PRI_HINT_REG0_NONE_HINT_0);
  682. return (pendStatus == 1) ? FALSE : TRUE;
  683. }
  684. /** ============================================================================
  685. * @n@b CSL_CPINTC_getPendingHostInterrupt
  686. *
  687. * @b Description
  688. * @n This API gets the current highest priority pending interrupt for a
  689. * given host. This API should only be called after checking if there
  690. * are pending interrupts using the 'CSL_CPINTCisHostInterruptPending'.
  691. *
  692. * @b Arguments
  693. * @verbatim
  694. hnd This is the handle to the CPINTC instance.
  695. hostIntr This is the specific host interrupt output.
  696. @endverbatim
  697. *
  698. * <b> Return Value </b>
  699. * CSL_CPINTCSystemInterrupt - Highest Priority System Interrupt.
  700. *
  701. * <b> Pre Condition </b>
  702. * @n @a CSL_CPINTC_open() must be called.
  703. *
  704. * <b> Post Condition </b>
  705. * @n None
  706. *
  707. * @b Reads
  708. * @n CPINTC_PRI_HINT_REG0_PRI_HINT_0..CPINTC_PRI_HINT_REG255_PRI_HINT_255
  709. *
  710. * @b Example
  711. * @verbatim
  712. CSL_CPINTCSystemInterrupt intr;
  713. Bool pendingStatus;
  714. CSL_CPINTC_HANDLE hnd;
  715. CSL_CPINTCHostInterrupt host;
  716. ...
  717. hnd = CSL_CPINTC_open (0); // Opens CPINTC Instance 0
  718. ...
  719. pendingStatus = CSL_CPINTC_isHostInterruptPending(hnd, host);
  720. if (pendingStatus == TRUE)
  721. {
  722. intr = CSL_CPINTC_getPendingHostInterrupt(hnd, host);
  723. }
  724. ...
  725. @endverbatim
  726. * ===========================================================================
  727. */
  728. static inline CSL_CPINTCSystemInterrupt CSL_CPINTC_getPendingHostInterrupt
  729. (
  730. CSL_CPINTC_Handle hnd,
  731. CSL_CPINTCHostInterrupt hostIntr
  732. )
  733. {
  734. return (CSL_CPINTCSystemInterrupt)(CSL_FEXT(((CSL_CPINTC_RegsOvly)hnd)->PRI_HINT_REG[hostIntr],
  735. CPINTC_PRI_HINT_REG0_PRI_HINT_0));
  736. }
  737. /** ============================================================================
  738. * @n@b CSL_CPINTC_getRawInterruptStatus
  739. *
  740. * @b Description
  741. * @n The function is used to get the contents of the RAW Interrupt status
  742. * register.
  743. *
  744. * @b Arguments
  745. * @verbatim
  746. hnd This is the handle to the CPINTC instance.
  747. index RAW Status Index register which is to be read
  748. rawStatus RAW Status which indicates which interrupts are pending.
  749. @endverbatim
  750. *
  751. * <b> Return Value </b>
  752. * @n None
  753. *
  754. * <b> Pre Condition </b>
  755. * @n @a CSL_CPINTC_open() must be called.
  756. *
  757. * <b> Post Condition </b>
  758. * @n None
  759. *
  760. * @b Reads
  761. * @n CPINTC_RAW_STATUS_REG
  762. *
  763. * @b Example
  764. * @verbatim
  765. CSL_CPINTC_HANDLE hnd;
  766. Uint32 rawStatus;
  767. ...
  768. hnd = CSL_CPINTC_open (0); // Opens CPINTC Instance 0
  769. ...
  770. // Check if there are any interrupts between 0-31 pending.
  771. CSL_CPINTC_getRawInterruptStatus(hnd, 0, &rawStatus);
  772. if (rawStatus != 0)
  773. {
  774. // An Interrupt from 0-31 is pending.
  775. }
  776. ...
  777. @endverbatim
  778. * ===========================================================================
  779. */
  780. static inline void CSL_CPINTC_getRawInterruptStatus
  781. (
  782. CSL_CPINTC_Handle hnd,
  783. Uint8 index,
  784. Uint32* rawStatus
  785. )
  786. {
  787. *rawStatus = ((CSL_CPINTC_RegsOvly)hnd)->RAW_STATUS_REG[index];
  788. }
  789. /** ============================================================================
  790. * @n@b CSL_CPINTC_mapSystemIntrToChannel
  791. *
  792. * @b Description
  793. * @n This API is used to map a system interrupt to a specific channel.
  794. *
  795. * @b Arguments
  796. * @verbatim
  797. hnd This is the handle to the CPINTC instance.
  798. sysIntr System Interrupt which is to be mapped
  799. channel Channel Number to which the interrupt is to be mapped.
  800. @endverbatim
  801. *
  802. * <b> Return Value </b>
  803. * None
  804. *
  805. * <b> Pre Condition </b>
  806. * @n @a CSL_CPINTC_open() must be called.
  807. *
  808. * <b> Post Condition </b>
  809. * @n None
  810. *
  811. * @b Writes
  812. * @n CPINTC_CH_MAP_REG0_CH_MAP_0..CPINTC_CH_MAP_REG49_CH_MAP_196
  813. *
  814. * @b Example
  815. * @verbatim
  816. CSL_CPINTCSystemInterrupt sysIntr;
  817. CSL_CPINTCChannel channel;
  818. CSL_CPINTC_HANDLE hnd;
  819. ...
  820. hnd = CSL_CPINTC_open (0); // Opens CPINTC Instance 0
  821. ...
  822. CSL_CPINTC_mapSystemIntrToChannel(hnd, sysIntr, channel);
  823. ...
  824. @endverbatim
  825. * ===========================================================================
  826. */
  827. static inline void CSL_CPINTC_mapSystemIntrToChannel
  828. (
  829. CSL_CPINTC_Handle hnd,
  830. CSL_CPINTCSystemInterrupt sysIntr,
  831. CSL_CPINTCChannel channel
  832. )
  833. {
  834. #ifdef _LITTLE_ENDIAN
  835. ((CSL_CPINTC_RegsOvly)hnd)->CH_MAP[sysIntr] = channel;
  836. #else
  837. ((CSL_CPINTC_RegsOvly)hnd)->CH_MAP[(sysIntr&~3) + (3-(sysIntr&3))] = channel;
  838. #endif
  839. return;
  840. }
  841. /** ============================================================================
  842. * @n@b CSL_CPINTC_mapChannelToHostInterrupt
  843. *
  844. * @b Description
  845. * @n This API is used to map the channel to the host interrupt.
  846. *
  847. * @b Arguments
  848. * @verbatim
  849. hnd This is the handle to the CPINTC instance.
  850. channel Channel Number to be mapped
  851. sysIntr Host Interrupt to which the channel is mapped to.
  852. @endverbatim
  853. *
  854. * <b> Return Value </b>
  855. * None
  856. *
  857. * <b> Pre Condition </b>
  858. * @n @a CSL_CPINTC_open() must be called.
  859. *
  860. * <b> Post Condition </b>
  861. * @n None
  862. *
  863. * @b Writes
  864. * @n CPINTC_HINT_MAP_REG0_HINT_MAP_0..CPINTC_HINT_MAP_REG49_HINT_MAP_196
  865. *
  866. * @b Example
  867. * @verbatim
  868. CSL_CPINTCHostInterrupt hostIntr;
  869. CSL_CPINTCChannel channel;
  870. CSL_CPINTC_HANDLE hnd;
  871. ...
  872. hnd = CSL_CPINTC_open (0); // Opens CPINTC Instance 0
  873. ...
  874. CSL_CPINTC_mapChannelToHostInterrupt(hnd, channel, hostIntr);
  875. ...
  876. @endverbatim
  877. * ===========================================================================
  878. */
  879. static inline void CSL_CPINTC_mapChannelToHostInterrupt
  880. (
  881. CSL_CPINTC_Handle hnd,
  882. CSL_CPINTCChannel channel,
  883. CSL_CPINTCHostInterrupt hostIntr
  884. )
  885. {
  886. #ifdef _LITTLE_ENDIAN
  887. ((CSL_CPINTC_RegsOvly)hnd)->HINT_MAP[hostIntr] = channel;
  888. #else
  889. ((CSL_CPINTC_RegsOvly)hnd)->HINT_MAP[(hostIntr&~3) + (3-(hostIntr&3))] = channel;
  890. #endif
  891. return;
  892. }
  893. /**
  894. @}
  895. */
  896. #ifdef __cplusplus
  897. }
  898. #endif
  899. #endif /* CSL_CPINTC_AUX_H_ */