xipif_v1_23_b.h 28 KB

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