xipif_v1_23_b.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763
  1. /******************************************************************************
  2. *
  3. * Author: Xilinx, Inc.
  4. *
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2 of the License, or (at your
  9. * option) any later version.
  10. *
  11. *
  12. * XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
  13. * COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
  14. * ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD,
  15. * XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE
  16. * FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING
  17. * ANY THIRD PARTY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
  18. * XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
  19. * THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY
  20. * WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM
  21. * CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND
  22. * FITNESS FOR A PARTICULAR PURPOSE.
  23. *
  24. *
  25. * Xilinx hardware products are not intended for use in life support
  26. * appliances, devices, or systems. Use in such applications is
  27. * expressly prohibited.
  28. *
  29. *
  30. * (c) Copyright 2002-2004 Xilinx Inc.
  31. * All rights reserved.
  32. *
  33. *
  34. * You should have received a copy of the GNU General Public License along
  35. * with this program; if not, write to the Free Software Foundation, Inc.,
  36. * 675 Mass Ave, Cambridge, MA 02139, USA.
  37. *
  38. ******************************************************************************/
  39. /******************************************************************************
  40. *
  41. * FILENAME:
  42. *
  43. * xipif.h
  44. *
  45. * DESCRIPTION:
  46. *
  47. * The XIpIf component encapsulates the IPIF, which is the standard interface
  48. * that IP must adhere to when connecting to a bus. The purpose of this
  49. * component is to encapsulate the IPIF processing such that maintainability
  50. * is increased. This component does not provide a lot of abstraction from
  51. * from the details of the IPIF as it is considered a building block for
  52. * device drivers. A device driver designer must be familiar with the
  53. * details of the IPIF hardware to use this component.
  54. *
  55. * The IPIF hardware provides a building block for all hardware devices such
  56. * that each device does not need to reimplement these building blocks. The
  57. * IPIF contains other building blocks, such as FIFOs and DMA channels, which
  58. * are also common to many devices. These blocks are implemented as separate
  59. * hardware blocks and instantiated within the IPIF. The primary hardware of
  60. * the IPIF which is implemented by this software component is the interrupt
  61. * architecture. Since there are many blocks of a device which may generate
  62. * interrupts, all the interrupt processing is contained in the common part
  63. * of the device, the IPIF. This interrupt processing is for the device level
  64. * only and does not include any processing for the interrupt controller.
  65. *
  66. * A device is a mechanism such as an Ethernet MAC. The device is made
  67. * up of several parts which include an IPIF and the IP. The IPIF contains most
  68. * of the device infrastructure which is common to all devices, such as
  69. * interrupt processing, DMA channels, and FIFOs. The infrastructure may also
  70. * be referred to as IPIF internal blocks since they are part of the IPIF and
  71. * are separate blocks that can be selected based upon the needs of the device.
  72. * The IP of the device is the logic that is unique to the device and interfaces
  73. * to the IPIF of the device.
  74. *
  75. * In general, there are two levels of registers within the IPIF. The first
  76. * level, referred to as the device level, contains registers which are for the
  77. * entire device. The second level, referred to as the IP level, contains
  78. * registers which are specific to the IP of the device. The two levels of
  79. * registers are designed to be hierarchical such that the device level is
  80. * is a more general register set above the more specific registers of the IP.
  81. * The IP level of registers provides functionality which is typically common
  82. * across all devices and allows IP designers to focus on the unique aspects
  83. * of the IP.
  84. *
  85. * Critical Sections
  86. *
  87. * It is the responsibility of the device driver designer to use critical
  88. * sections as necessary when calling functions of the IPIF. This component
  89. * does not use critical sections and it does access registers using
  90. * read-modify-write operations. Calls to IPIF functions from a main thread
  91. * and from an interrupt context could produce unpredictable behavior such that
  92. * the caller must provide the appropriate critical sections.
  93. *
  94. * Mutual Exclusion
  95. *
  96. * The functions of the IPIF are not thread safe such that the caller of all
  97. * functions is responsible for ensuring mutual exclusion for an IPIF. Mutual
  98. * exclusion across multiple IPIF components is not necessary.
  99. *
  100. * NOTES:
  101. *
  102. * None.
  103. *
  104. * MODIFICATION HISTORY:
  105. *
  106. * Ver Who Date Changes
  107. * ----- ---- -------- -----------------------------------------------
  108. * 1.23b jhl 02/27/01 Repartioned to minimize size
  109. *
  110. ******************************************************************************/
  111. #ifndef XIPIF_H /* prevent circular inclusions */
  112. #define XIPIF_H /* by using protection macros */
  113. /***************************** Include Files *********************************/
  114. #include "xbasic_types.h"
  115. #include "xstatus.h"
  116. #include "xversion.h"
  117. /************************** Constant Definitions *****************************/
  118. /* the following constants define the register offsets for the registers of the
  119. * IPIF, there are some holes in the memory map for reserved addresses to allow
  120. * other registers to be added and still match the memory map of the interrupt
  121. * controller registers
  122. */
  123. #define XIIF_V123B_DISR_OFFSET 0UL /* device interrupt status register */
  124. #define XIIF_V123B_DIPR_OFFSET 4UL /* device interrupt pending register */
  125. #define XIIF_V123B_DIER_OFFSET 8UL /* device interrupt enable register */
  126. #define XIIF_V123B_DIIR_OFFSET 24UL /* device interrupt ID register */
  127. #define XIIF_V123B_DGIER_OFFSET 28UL /* device global interrupt enable reg */
  128. #define XIIF_V123B_IISR_OFFSET 32UL /* IP interrupt status register */
  129. #define XIIF_V123B_IIER_OFFSET 40UL /* IP interrupt enable register */
  130. #define XIIF_V123B_RESETR_OFFSET 64UL /* reset register */
  131. #define XIIF_V123B_RESET_MASK 0xAUL
  132. /* the following constant is used for the device global interrupt enable
  133. * register, to enable all interrupts for the device, this is the only bit
  134. * in the register
  135. */
  136. #define XIIF_V123B_GINTR_ENABLE_MASK 0x80000000UL
  137. /* the following constants contain the masks to identify each internal IPIF
  138. * condition in the device registers of the IPIF, interrupts are assigned
  139. * in the register from LSB to the MSB
  140. */
  141. #define XIIF_V123B_ERROR_MASK 1UL /* LSB of the register */
  142. /* The following constants contain interrupt IDs which identify each internal
  143. * IPIF condition, this value must correlate with the mask constant for the
  144. * error
  145. */
  146. #define XIIF_V123B_ERROR_INTERRUPT_ID 0 /* interrupt bit #, (LSB = 0) */
  147. #define XIIF_V123B_NO_INTERRUPT_ID 128 /* no interrupts are pending */
  148. /**************************** Type Definitions *******************************/
  149. /***************** Macros (Inline Functions) Definitions *********************/
  150. /******************************************************************************
  151. *
  152. * MACRO:
  153. *
  154. * XIIF_V123B_RESET
  155. *
  156. * DESCRIPTION:
  157. *
  158. * Reset the IPIF component and hardware. This is a destructive operation that
  159. * could cause the loss of data since resetting the IPIF of a device also
  160. * resets the device using the IPIF and any blocks, such as FIFOs or DMA
  161. * channels, within the IPIF. All registers of the IPIF will contain their
  162. * reset value when this function returns.
  163. *
  164. * ARGUMENTS:
  165. *
  166. * RegBaseAddress contains the base address of the IPIF registers.
  167. *
  168. * RETURN VALUE:
  169. *
  170. * None.
  171. *
  172. * NOTES:
  173. *
  174. * None.
  175. *
  176. ******************************************************************************/
  177. /* the following constant is used in the reset register to cause the IPIF to
  178. * reset
  179. */
  180. #define XIIF_V123B_RESET(RegBaseAddress) \
  181. XIo_Out32(RegBaseAddress + XIIF_V123B_RESETR_OFFSET, XIIF_V123B_RESET_MASK)
  182. /******************************************************************************
  183. *
  184. * MACRO:
  185. *
  186. * XIIF_V123B_WRITE_DISR
  187. *
  188. * DESCRIPTION:
  189. *
  190. * This function sets the device interrupt status register to the value.
  191. * This register indicates the status of interrupt sources for a device
  192. * which contains the IPIF. The status is independent of whether interrupts
  193. * are enabled and could be used for polling a device at a higher level rather
  194. * than a more detailed level.
  195. *
  196. * Each bit of the register correlates to a specific interrupt source within the
  197. * device which contains the IPIF. With the exception of some internal IPIF
  198. * conditions, the contents of this register are not latched but indicate
  199. * the live status of the interrupt sources within the device. Writing any of
  200. * the non-latched bits of the register will have no effect on the register.
  201. *
  202. * For the latched bits of this register only, setting a bit which is zero
  203. * within this register causes an interrupt to generated. The device global
  204. * interrupt enable register and the device interrupt enable register must be set
  205. * appropriately to allow an interrupt to be passed out of the device. The
  206. * interrupt is cleared by writing to this register with the bits to be
  207. * cleared set to a one and all others to zero. This register implements a
  208. * toggle on write functionality meaning any bits which are set in the value
  209. * written cause the bits in the register to change to the opposite state.
  210. *
  211. * This function writes the specified value to the register such that
  212. * some bits may be set and others cleared. It is the caller's responsibility
  213. * to get the value of the register prior to setting the value to prevent a
  214. * destructive behavior.
  215. *
  216. * ARGUMENTS:
  217. *
  218. * RegBaseAddress contains the base address of the IPIF registers.
  219. *
  220. * Status contains the value to be written to the interrupt status register of
  221. * the device. The only bits which can be written are the latched bits which
  222. * contain the internal IPIF conditions. The following values may be used to
  223. * set the status register or clear an interrupt condition.
  224. *
  225. * XIIF_V123B_ERROR_MASK Indicates a device error in the IPIF
  226. *
  227. * RETURN VALUE:
  228. *
  229. * None.
  230. *
  231. * NOTES:
  232. *
  233. * None.
  234. *
  235. ******************************************************************************/
  236. #define XIIF_V123B_WRITE_DISR(RegBaseAddress, Status) \
  237. XIo_Out32((RegBaseAddress) + XIIF_V123B_DISR_OFFSET, (Status))
  238. /******************************************************************************
  239. *
  240. * MACRO:
  241. *
  242. * XIIF_V123B_READ_DISR
  243. *
  244. * DESCRIPTION:
  245. *
  246. * This function gets the device interrupt status register contents.
  247. * This register indicates the status of interrupt sources for a device
  248. * which contains the IPIF. The status is independent of whether interrupts
  249. * are enabled and could be used for polling a device at a higher level.
  250. *
  251. * Each bit of the register correlates to a specific interrupt source within the
  252. * device which contains the IPIF. With the exception of some internal IPIF
  253. * conditions, the contents of this register are not latched but indicate
  254. * the live status of the interrupt sources within the device.
  255. *
  256. * For only the latched bits of this register, the interrupt may be cleared by
  257. * writing to these bits in the status register.
  258. *
  259. * ARGUMENTS:
  260. *
  261. * RegBaseAddress contains the base address of the IPIF registers.
  262. *
  263. * RETURN VALUE:
  264. *
  265. * A status which contains the value read from the interrupt status register of
  266. * the device. The bit definitions are specific to the device with
  267. * the exception of the latched internal IPIF condition bits. The following
  268. * values may be used to detect internal IPIF conditions in the status.
  269. *
  270. * XIIF_V123B_ERROR_MASK Indicates a device error in the IPIF
  271. *
  272. * NOTES:
  273. *
  274. * None.
  275. *
  276. ******************************************************************************/
  277. #define XIIF_V123B_READ_DISR(RegBaseAddress) \
  278. XIo_In32((RegBaseAddress) + XIIF_V123B_DISR_OFFSET)
  279. /******************************************************************************
  280. *
  281. * MACRO:
  282. *
  283. * XIIF_V123B_WRITE_DIER
  284. *
  285. * DESCRIPTION:
  286. *
  287. * This function sets the device interrupt enable register contents.
  288. * This register controls which interrupt sources of the device are allowed to
  289. * generate an interrupt. The device global interrupt enable register must also
  290. * be set appropriately for an interrupt to be passed out of the device.
  291. *
  292. * Each bit of the register correlates to a specific interrupt source within the
  293. * device which contains the IPIF. Setting a bit in this register enables that
  294. * interrupt source to generate an interrupt. Clearing a bit in this register
  295. * disables interrupt generation for that interrupt source.
  296. *
  297. * This function writes only the specified value to the register such that
  298. * some interrupts source may be enabled and others disabled. It is the
  299. * caller's responsibility to get the value of the interrupt enable register
  300. * prior to setting the value to prevent an destructive behavior.
  301. *
  302. * An interrupt source may not be enabled to generate an interrupt, but can
  303. * still be polled in the interrupt status register.
  304. *
  305. * ARGUMENTS:
  306. *
  307. * RegBaseAddress contains the base address of the IPIF registers.
  308. *
  309. * Enable contains the value to be written to the interrupt enable register
  310. * of the device. The bit definitions are specific to the device with
  311. * the exception of the internal IPIF conditions. The following
  312. * values may be used to enable the internal IPIF conditions interrupts.
  313. *
  314. * XIIF_V123B_ERROR_MASK Indicates a device error in the IPIF
  315. *
  316. * RETURN VALUE:
  317. *
  318. * None.
  319. *
  320. * NOTES:
  321. *
  322. * Signature: u32 XIIF_V123B_WRITE_DIER(u32 RegBaseAddress,
  323. * u32 Enable)
  324. *
  325. ******************************************************************************/
  326. #define XIIF_V123B_WRITE_DIER(RegBaseAddress, Enable) \
  327. XIo_Out32((RegBaseAddress) + XIIF_V123B_DIER_OFFSET, (Enable))
  328. /******************************************************************************
  329. *
  330. * MACRO:
  331. *
  332. * XIIF_V123B_READ_DIER
  333. *
  334. * DESCRIPTION:
  335. *
  336. * This function gets the device interrupt enable register contents.
  337. * This register controls which interrupt sources of the device
  338. * are allowed to generate an interrupt. The device global interrupt enable
  339. * register and the device interrupt enable register must also be set
  340. * appropriately for an interrupt to be passed out of the device.
  341. *
  342. * Each bit of the register correlates to a specific interrupt source within the
  343. * device which contains the IPIF. Setting a bit in this register enables that
  344. * interrupt source to generate an interrupt if the global enable is set
  345. * appropriately. Clearing a bit in this register disables interrupt generation
  346. * for that interrupt source regardless of the global interrupt enable.
  347. *
  348. * ARGUMENTS:
  349. *
  350. * RegBaseAddress contains the base address of the IPIF registers.
  351. *
  352. * RETURN VALUE:
  353. *
  354. * The value read from the interrupt enable register of the device. The bit
  355. * definitions are specific to the device with the exception of the internal
  356. * IPIF conditions. The following values may be used to determine from the
  357. * value if the internal IPIF conditions interrupts are enabled.
  358. *
  359. * XIIF_V123B_ERROR_MASK Indicates a device error in the IPIF
  360. *
  361. * NOTES:
  362. *
  363. * None.
  364. *
  365. ******************************************************************************/
  366. #define XIIF_V123B_READ_DIER(RegBaseAddress) \
  367. XIo_In32((RegBaseAddress) + XIIF_V123B_DIER_OFFSET)
  368. /******************************************************************************
  369. *
  370. * MACRO:
  371. *
  372. * XIIF_V123B_READ_DIPR
  373. *
  374. * DESCRIPTION:
  375. *
  376. * This function gets the device interrupt pending register contents.
  377. * This register indicates the pending interrupt sources, those that are waiting
  378. * to be serviced by the software, for a device which contains the IPIF.
  379. * An interrupt must be enabled in the interrupt enable register of the IPIF to
  380. * be pending.
  381. *
  382. * Each bit of the register correlates to a specific interrupt source within the
  383. * the device which contains the IPIF. With the exception of some internal IPIF
  384. * conditions, the contents of this register are not latched since the condition
  385. * is latched in the IP interrupt status register, by an internal block of the
  386. * IPIF such as a FIFO or DMA channel, or by the IP of the device. This register
  387. * is read only and is not latched, but it is necessary to acknowledge (clear)
  388. * the interrupt condition by performing the appropriate processing for the IP
  389. * or block within the IPIF.
  390. *
  391. * This register can be thought of as the contents of the interrupt status
  392. * register ANDed with the contents of the interrupt enable register.
  393. *
  394. * ARGUMENTS:
  395. *
  396. * RegBaseAddress contains the base address of the IPIF registers.
  397. *
  398. * RETURN VALUE:
  399. *
  400. * The value read from the interrupt pending register of the device. The bit
  401. * definitions are specific to the device with the exception of the latched
  402. * internal IPIF condition bits. The following values may be used to detect
  403. * internal IPIF conditions in the value.
  404. *
  405. * XIIF_V123B_ERROR_MASK Indicates a device error in the IPIF
  406. *
  407. * NOTES:
  408. *
  409. * None.
  410. *
  411. ******************************************************************************/
  412. #define XIIF_V123B_READ_DIPR(RegBaseAddress) \
  413. XIo_In32((RegBaseAddress) + XIIF_V123B_DIPR_OFFSET)
  414. /******************************************************************************
  415. *
  416. * MACRO:
  417. *
  418. * XIIF_V123B_READ_DIIR
  419. *
  420. * DESCRIPTION:
  421. *
  422. * This function gets the device interrupt ID for the highest priority interrupt
  423. * which is pending from the interrupt ID register. This function provides
  424. * priority resolution such that faster interrupt processing is possible.
  425. * Without priority resolution, it is necessary for the software to read the
  426. * interrupt pending register and then check each interrupt source to determine
  427. * if an interrupt is pending. Priority resolution becomes more important as the
  428. * number of interrupt sources becomes larger.
  429. *
  430. * Interrupt priorities are based upon the bit position of the interrupt in the
  431. * interrupt pending register with bit 0 being the highest priority. The
  432. * interrupt ID is the priority of the interrupt, 0 - 31, with 0 being the
  433. * highest priority. The interrupt ID register is live rather than latched such
  434. * that multiple calls to this function may not yield the same results. A
  435. * special value, outside of the interrupt priority range of 0 - 31, is
  436. * contained in the register which indicates that no interrupt is pending. This
  437. * may be useful for allowing software to continue processing interrupts in a
  438. * loop until there are no longer any interrupts pending.
  439. *
  440. * The interrupt ID is designed to allow a function pointer table to be used
  441. * in the software such that the interrupt ID is used as an index into that
  442. * table. The function pointer table could contain an instance pointer, such
  443. * as to DMA channel, and a function pointer to the function which handles
  444. * that interrupt. This design requires the interrupt processing of the device
  445. * driver to be partitioned into smaller more granular pieces based upon
  446. * hardware used by the device, such as DMA channels and FIFOs.
  447. *
  448. * It is not mandatory that this function be used by the device driver software.
  449. * It may choose to read the pending register and resolve the pending interrupt
  450. * priorities on it's own.
  451. *
  452. * ARGUMENTS:
  453. *
  454. * RegBaseAddress contains the base address of the IPIF registers.
  455. *
  456. * RETURN VALUE:
  457. *
  458. * An interrupt ID, 0 - 31, which identifies the highest priority interrupt
  459. * which is pending. A value of XIIF_NO_INTERRUPT_ID indicates that there is
  460. * no interrupt pending. The following values may be used to identify the
  461. * interrupt ID for the internal IPIF interrupts.
  462. *
  463. * XIIF_V123B_ERROR_INTERRUPT_ID Indicates a device error in the IPIF
  464. *
  465. * NOTES:
  466. *
  467. * None.
  468. *
  469. ******************************************************************************/
  470. #define XIIF_V123B_READ_DIIR(RegBaseAddress) \
  471. XIo_In32((RegBaseAddress) + XIIF_V123B_DIIR_OFFSET)
  472. /******************************************************************************
  473. *
  474. * MACRO:
  475. *
  476. * XIIF_V123B_GLOBAL_INTR_DISABLE
  477. *
  478. * DESCRIPTION:
  479. *
  480. * This function disables all interrupts for the device by writing to the global
  481. * interrupt enable register. This register provides the ability to disable
  482. * interrupts without any modifications to the interrupt enable register such
  483. * that it is minimal effort to restore the interrupts to the previous enabled
  484. * state. The corresponding function, XIpIf_GlobalIntrEnable, is provided to
  485. * restore the interrupts to the previous enabled state. This function is
  486. * designed to be used in critical sections of device drivers such that it is
  487. * not necessary to disable other device interrupts.
  488. *
  489. * ARGUMENTS:
  490. *
  491. * RegBaseAddress contains the base address of the IPIF registers.
  492. *
  493. * RETURN VALUE:
  494. *
  495. * None.
  496. *
  497. * NOTES:
  498. *
  499. * None.
  500. *
  501. ******************************************************************************/
  502. #define XIIF_V123B_GINTR_DISABLE(RegBaseAddress) \
  503. XIo_Out32((RegBaseAddress) + XIIF_V123B_DGIER_OFFSET, 0)
  504. /******************************************************************************
  505. *
  506. * MACRO:
  507. *
  508. * XIIF_V123B_GINTR_ENABLE
  509. *
  510. * DESCRIPTION:
  511. *
  512. * This function writes to the global interrupt enable register to enable
  513. * interrupts from the device. This register provides the ability to enable
  514. * interrupts without any modifications to the interrupt enable register such
  515. * that it is minimal effort to restore the interrupts to the previous enabled
  516. * state. This function does not enable individual interrupts as the interrupt
  517. * enable register must be set appropriately. This function is designed to be
  518. * used in critical sections of device drivers such that it is not necessary to
  519. * disable other device interrupts.
  520. *
  521. * ARGUMENTS:
  522. *
  523. * RegBaseAddress contains the base address of the IPIF registers.
  524. *
  525. * RETURN VALUE:
  526. *
  527. * None.
  528. *
  529. * NOTES:
  530. *
  531. * None.
  532. *
  533. ******************************************************************************/
  534. #define XIIF_V123B_GINTR_ENABLE(RegBaseAddress) \
  535. XIo_Out32((RegBaseAddress) + XIIF_V123B_DGIER_OFFSET, \
  536. XIIF_V123B_GINTR_ENABLE_MASK)
  537. /******************************************************************************
  538. *
  539. * MACRO:
  540. *
  541. * XIIF_V123B_IS_GINTR_ENABLED
  542. *
  543. * DESCRIPTION:
  544. *
  545. * This function determines if interrupts are enabled at the global level by
  546. * reading the gloabl interrupt register. This register provides the ability to
  547. * disable interrupts without any modifications to the interrupt enable register
  548. * such that it is minimal effort to restore the interrupts to the previous
  549. * enabled state.
  550. *
  551. * ARGUMENTS:
  552. *
  553. * RegBaseAddress contains the base address of the IPIF registers.
  554. *
  555. * RETURN VALUE:
  556. *
  557. * TRUE if interrupts are enabled for the IPIF, FALSE otherwise.
  558. *
  559. * NOTES:
  560. *
  561. * None.
  562. *
  563. ******************************************************************************/
  564. #define XIIF_V123B_IS_GINTR_ENABLED(RegBaseAddress) \
  565. (XIo_In32((RegBaseAddress) + XIIF_V123B_DGIER_OFFSET) == \
  566. XIIF_V123B_GINTR_ENABLE_MASK)
  567. /******************************************************************************
  568. *
  569. * MACRO:
  570. *
  571. * XIIF_V123B_WRITE_IISR
  572. *
  573. * DESCRIPTION:
  574. *
  575. * This function sets the IP interrupt status register to the specified value.
  576. * This register indicates the status of interrupt sources for the IP of the
  577. * device. The IP is defined as the part of the device that connects to the
  578. * IPIF. The status is independent of whether interrupts are enabled such that
  579. * the status register may also be polled when interrupts are not enabled.
  580. *
  581. * Each bit of the register correlates to a specific interrupt source within the
  582. * IP. All bits of this register are latched. Setting a bit which is zero
  583. * within this register causes an interrupt to be generated. The device global
  584. * interrupt enable register and the device interrupt enable register must be set
  585. * appropriately to allow an interrupt to be passed out of the device. The
  586. * interrupt is cleared by writing to this register with the bits to be
  587. * cleared set to a one and all others to zero. This register implements a
  588. * toggle on write functionality meaning any bits which are set in the value
  589. * written cause the bits in the register to change to the opposite state.
  590. *
  591. * This function writes only the specified value to the register such that
  592. * some status bits may be set and others cleared. It is the caller's
  593. * responsibility to get the value of the register prior to setting the value
  594. * to prevent an destructive behavior.
  595. *
  596. * ARGUMENTS:
  597. *
  598. * RegBaseAddress contains the base address of the IPIF registers.
  599. *
  600. * Status contains the value to be written to the IP interrupt status
  601. * register. The bit definitions are specific to the device IP.
  602. *
  603. * RETURN VALUE:
  604. *
  605. * None.
  606. *
  607. * NOTES:
  608. *
  609. * None.
  610. *
  611. ******************************************************************************/
  612. #define XIIF_V123B_WRITE_IISR(RegBaseAddress, Status) \
  613. XIo_Out32((RegBaseAddress) + XIIF_V123B_IISR_OFFSET, (Status))
  614. /******************************************************************************
  615. *
  616. * MACRO:
  617. *
  618. * XIIF_V123B_READ_IISR
  619. *
  620. * DESCRIPTION:
  621. *
  622. * This function gets the contents of the IP interrupt status register.
  623. * This register indicates the status of interrupt sources for the IP of the
  624. * device. The IP is defined as the part of the device that connects to the
  625. * IPIF. The status is independent of whether interrupts are enabled such
  626. * that the status register may also be polled when interrupts are not enabled.
  627. *
  628. * Each bit of the register correlates to a specific interrupt source within the
  629. * device. All bits of this register are latched. Writing a 1 to a bit within
  630. * this register causes an interrupt to be generated if enabled in the interrupt
  631. * enable register and the global interrupt enable is set. Since the status is
  632. * latched, each status bit must be acknowledged in order for the bit in the
  633. * status register to be updated. Each bit can be acknowledged by writing a
  634. * 0 to the bit in the status register.
  635. * ARGUMENTS:
  636. *
  637. * RegBaseAddress contains the base address of the IPIF registers.
  638. *
  639. * RETURN VALUE:
  640. *
  641. * A status which contains the value read from the IP interrupt status register.
  642. * The bit definitions are specific to the device IP.
  643. *
  644. * NOTES:
  645. *
  646. * None.
  647. *
  648. ******************************************************************************/
  649. #define XIIF_V123B_READ_IISR(RegBaseAddress) \
  650. XIo_In32((RegBaseAddress) + XIIF_V123B_IISR_OFFSET)
  651. /******************************************************************************
  652. *
  653. * MACRO:
  654. *
  655. * XIIF_V123B_WRITE_IIER
  656. *
  657. * DESCRIPTION:
  658. *
  659. * This function sets the IP interrupt enable register contents. This register
  660. * controls which interrupt sources of the IP are allowed to generate an
  661. * interrupt. The global interrupt enable register and the device interrupt
  662. * enable register must also be set appropriately for an interrupt to be
  663. * passed out of the device containing the IPIF and the IP.
  664. *
  665. * Each bit of the register correlates to a specific interrupt source within the
  666. * IP. Setting a bit in this register enables the interrupt source to generate
  667. * an interrupt. Clearing a bit in this register disables interrupt generation
  668. * for that interrupt source.
  669. *
  670. * This function writes only the specified value to the register such that
  671. * some interrupt sources may be enabled and others disabled. It is the
  672. * caller's responsibility to get the value of the interrupt enable register
  673. * prior to setting the value to prevent an destructive behavior.
  674. *
  675. * ARGUMENTS:
  676. *
  677. * RegBaseAddress contains the base address of the IPIF registers.
  678. *
  679. * Enable contains the value to be written to the IP interrupt enable register.
  680. * The bit definitions are specific to the device IP.
  681. *
  682. * RETURN VALUE:
  683. *
  684. * None.
  685. *
  686. * NOTES:
  687. *
  688. * None.
  689. *
  690. ******************************************************************************/
  691. #define XIIF_V123B_WRITE_IIER(RegBaseAddress, Enable) \
  692. XIo_Out32((RegBaseAddress) + XIIF_V123B_IIER_OFFSET, (Enable))
  693. /******************************************************************************
  694. *
  695. * MACRO:
  696. *
  697. * XIIF_V123B_READ_IIER
  698. *
  699. * DESCRIPTION:
  700. *
  701. *
  702. * This function gets the IP interrupt enable register contents. This register
  703. * controls which interrupt sources of the IP are allowed to generate an
  704. * interrupt. The global interrupt enable register and the device interrupt
  705. * enable register must also be set appropriately for an interrupt to be
  706. * passed out of the device containing the IPIF and the IP.
  707. *
  708. * Each bit of the register correlates to a specific interrupt source within the
  709. * IP. Setting a bit in this register enables the interrupt source to generate
  710. * an interrupt. Clearing a bit in this register disables interrupt generation
  711. * for that interrupt source.
  712. *
  713. * ARGUMENTS:
  714. *
  715. * RegBaseAddress contains the base address of the IPIF registers.
  716. *
  717. * RETURN VALUE:
  718. *
  719. * The contents read from the IP interrupt enable register. The bit definitions
  720. * are specific to the device IP.
  721. *
  722. * NOTES:
  723. *
  724. * Signature: u32 XIIF_V123B_READ_IIER(u32 RegBaseAddress)
  725. *
  726. ******************************************************************************/
  727. #define XIIF_V123B_READ_IIER(RegBaseAddress) \
  728. XIo_In32((RegBaseAddress) + XIIF_V123B_IIER_OFFSET)
  729. /************************** Function Prototypes ******************************/
  730. /*
  731. * Initialization Functions
  732. */
  733. XStatus XIpIfV123b_SelfTest(u32 RegBaseAddress, u8 IpRegistersWidth);
  734. #endif /* end of protection macro */