wdenk | e537b3b | 2004-02-23 23:54:43 +0000 | [diff] [blame^] | 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 | |
| 112 | #ifndef XIPIF_H /* prevent circular inclusions */ |
| 113 | #define XIPIF_H /* by using protection macros */ |
| 114 | |
| 115 | /***************************** Include Files *********************************/ |
| 116 | #include "xbasic_types.h" |
| 117 | #include "xstatus.h" |
| 118 | #include "xversion.h" |
| 119 | |
| 120 | /************************** Constant Definitions *****************************/ |
| 121 | |
| 122 | /* the following constants define the register offsets for the registers of the |
| 123 | * IPIF, there are some holes in the memory map for reserved addresses to allow |
| 124 | * other registers to be added and still match the memory map of the interrupt |
| 125 | * controller registers |
| 126 | */ |
| 127 | #define XIIF_V123B_DISR_OFFSET 0UL /* device interrupt status register */ |
| 128 | #define XIIF_V123B_DIPR_OFFSET 4UL /* device interrupt pending register */ |
| 129 | #define XIIF_V123B_DIER_OFFSET 8UL /* device interrupt enable register */ |
| 130 | #define XIIF_V123B_DIIR_OFFSET 24UL /* device interrupt ID register */ |
| 131 | #define XIIF_V123B_DGIER_OFFSET 28UL /* device global interrupt enable reg */ |
| 132 | #define XIIF_V123B_IISR_OFFSET 32UL /* IP interrupt status register */ |
| 133 | #define XIIF_V123B_IIER_OFFSET 40UL /* IP interrupt enable register */ |
| 134 | #define XIIF_V123B_RESETR_OFFSET 64UL /* reset register */ |
| 135 | |
| 136 | #define XIIF_V123B_RESET_MASK 0xAUL |
| 137 | |
| 138 | /* the following constant is used for the device global interrupt enable |
| 139 | * register, to enable all interrupts for the device, this is the only bit |
| 140 | * in the register |
| 141 | */ |
| 142 | #define XIIF_V123B_GINTR_ENABLE_MASK 0x80000000UL |
| 143 | |
| 144 | /* the following constants contain the masks to identify each internal IPIF |
| 145 | * condition in the device registers of the IPIF, interrupts are assigned |
| 146 | * in the register from LSB to the MSB |
| 147 | */ |
| 148 | #define XIIF_V123B_ERROR_MASK 1UL /* LSB of the register */ |
| 149 | |
| 150 | /* The following constants contain interrupt IDs which identify each internal |
| 151 | * IPIF condition, this value must correlate with the mask constant for the |
| 152 | * error |
| 153 | */ |
| 154 | #define XIIF_V123B_ERROR_INTERRUPT_ID 0 /* interrupt bit #, (LSB = 0) */ |
| 155 | #define XIIF_V123B_NO_INTERRUPT_ID 128 /* no interrupts are pending */ |
| 156 | |
| 157 | /**************************** Type Definitions *******************************/ |
| 158 | |
| 159 | /***************** Macros (Inline Functions) Definitions *********************/ |
| 160 | |
| 161 | /****************************************************************************** |
| 162 | * |
| 163 | * MACRO: |
| 164 | * |
| 165 | * XIIF_V123B_RESET |
| 166 | * |
| 167 | * DESCRIPTION: |
| 168 | * |
| 169 | * Reset the IPIF component and hardware. This is a destructive operation that |
| 170 | * could cause the loss of data since resetting the IPIF of a device also |
| 171 | * resets the device using the IPIF and any blocks, such as FIFOs or DMA |
| 172 | * channels, within the IPIF. All registers of the IPIF will contain their |
| 173 | * reset value when this function returns. |
| 174 | * |
| 175 | * ARGUMENTS: |
| 176 | * |
| 177 | * RegBaseAddress contains the base address of the IPIF registers. |
| 178 | * |
| 179 | * RETURN VALUE: |
| 180 | * |
| 181 | * None. |
| 182 | * |
| 183 | * NOTES: |
| 184 | * |
| 185 | * None. |
| 186 | * |
| 187 | ******************************************************************************/ |
| 188 | |
| 189 | /* the following constant is used in the reset register to cause the IPIF to |
| 190 | * reset |
| 191 | */ |
| 192 | #define XIIF_V123B_RESET(RegBaseAddress) \ |
| 193 | XIo_Out32(RegBaseAddress + XIIF_V123B_RESETR_OFFSET, XIIF_V123B_RESET_MASK) |
| 194 | |
| 195 | /****************************************************************************** |
| 196 | * |
| 197 | * MACRO: |
| 198 | * |
| 199 | * XIIF_V123B_WRITE_DISR |
| 200 | * |
| 201 | * DESCRIPTION: |
| 202 | * |
| 203 | * This function sets the device interrupt status register to the value. |
| 204 | * This register indicates the status of interrupt sources for a device |
| 205 | * which contains the IPIF. The status is independent of whether interrupts |
| 206 | * are enabled and could be used for polling a device at a higher level rather |
| 207 | * than a more detailed level. |
| 208 | * |
| 209 | * Each bit of the register correlates to a specific interrupt source within the |
| 210 | * device which contains the IPIF. With the exception of some internal IPIF |
| 211 | * conditions, the contents of this register are not latched but indicate |
| 212 | * the live status of the interrupt sources within the device. Writing any of |
| 213 | * the non-latched bits of the register will have no effect on the register. |
| 214 | * |
| 215 | * For the latched bits of this register only, setting a bit which is zero |
| 216 | * within this register causes an interrupt to generated. The device global |
| 217 | * interrupt enable register and the device interrupt enable register must be set |
| 218 | * appropriately to allow an interrupt to be passed out of the device. The |
| 219 | * interrupt is cleared by writing to this register with the bits to be |
| 220 | * cleared set to a one and all others to zero. This register implements a |
| 221 | * toggle on write functionality meaning any bits which are set in the value |
| 222 | * written cause the bits in the register to change to the opposite state. |
| 223 | * |
| 224 | * This function writes the specified value to the register such that |
| 225 | * some bits may be set and others cleared. It is the caller's responsibility |
| 226 | * to get the value of the register prior to setting the value to prevent a |
| 227 | * destructive behavior. |
| 228 | * |
| 229 | * ARGUMENTS: |
| 230 | * |
| 231 | * RegBaseAddress contains the base address of the IPIF registers. |
| 232 | * |
| 233 | * Status contains the value to be written to the interrupt status register of |
| 234 | * the device. The only bits which can be written are the latched bits which |
| 235 | * contain the internal IPIF conditions. The following values may be used to |
| 236 | * set the status register or clear an interrupt condition. |
| 237 | * |
| 238 | * XIIF_V123B_ERROR_MASK Indicates a device error in the IPIF |
| 239 | * |
| 240 | * RETURN VALUE: |
| 241 | * |
| 242 | * None. |
| 243 | * |
| 244 | * NOTES: |
| 245 | * |
| 246 | * None. |
| 247 | * |
| 248 | ******************************************************************************/ |
| 249 | #define XIIF_V123B_WRITE_DISR(RegBaseAddress, Status) \ |
| 250 | XIo_Out32((RegBaseAddress) + XIIF_V123B_DISR_OFFSET, (Status)) |
| 251 | |
| 252 | /****************************************************************************** |
| 253 | * |
| 254 | * MACRO: |
| 255 | * |
| 256 | * XIIF_V123B_READ_DISR |
| 257 | * |
| 258 | * DESCRIPTION: |
| 259 | * |
| 260 | * This function gets the device interrupt status register contents. |
| 261 | * This register indicates the status of interrupt sources for a device |
| 262 | * which contains the IPIF. The status is independent of whether interrupts |
| 263 | * are enabled and could be used for polling a device at a higher level. |
| 264 | * |
| 265 | * Each bit of the register correlates to a specific interrupt source within the |
| 266 | * device which contains the IPIF. With the exception of some internal IPIF |
| 267 | * conditions, the contents of this register are not latched but indicate |
| 268 | * the live status of the interrupt sources within the device. |
| 269 | * |
| 270 | * For only the latched bits of this register, the interrupt may be cleared by |
| 271 | * writing to these bits in the status register. |
| 272 | * |
| 273 | * ARGUMENTS: |
| 274 | * |
| 275 | * RegBaseAddress contains the base address of the IPIF registers. |
| 276 | * |
| 277 | * RETURN VALUE: |
| 278 | * |
| 279 | * A status which contains the value read from the interrupt status register of |
| 280 | * the device. The bit definitions are specific to the device with |
| 281 | * the exception of the latched internal IPIF condition bits. The following |
| 282 | * values may be used to detect internal IPIF conditions in the status. |
| 283 | * |
| 284 | * XIIF_V123B_ERROR_MASK Indicates a device error in the IPIF |
| 285 | * |
| 286 | * NOTES: |
| 287 | * |
| 288 | * None. |
| 289 | * |
| 290 | ******************************************************************************/ |
| 291 | #define XIIF_V123B_READ_DISR(RegBaseAddress) \ |
| 292 | XIo_In32((RegBaseAddress) + XIIF_V123B_DISR_OFFSET) |
| 293 | |
| 294 | /****************************************************************************** |
| 295 | * |
| 296 | * MACRO: |
| 297 | * |
| 298 | * XIIF_V123B_WRITE_DIER |
| 299 | * |
| 300 | * DESCRIPTION: |
| 301 | * |
| 302 | * This function sets the device interrupt enable register contents. |
| 303 | * This register controls which interrupt sources of the device are allowed to |
| 304 | * generate an interrupt. The device global interrupt enable register must also |
| 305 | * be set appropriately for an interrupt to be passed out of the device. |
| 306 | * |
| 307 | * Each bit of the register correlates to a specific interrupt source within the |
| 308 | * device which contains the IPIF. Setting a bit in this register enables that |
| 309 | * interrupt source to generate an interrupt. Clearing a bit in this register |
| 310 | * disables interrupt generation for that interrupt source. |
| 311 | * |
| 312 | * This function writes only the specified value to the register such that |
| 313 | * some interrupts source may be enabled and others disabled. It is the |
| 314 | * caller's responsibility to get the value of the interrupt enable register |
| 315 | * prior to setting the value to prevent an destructive behavior. |
| 316 | * |
| 317 | * An interrupt source may not be enabled to generate an interrupt, but can |
| 318 | * still be polled in the interrupt status register. |
| 319 | * |
| 320 | * ARGUMENTS: |
| 321 | * |
| 322 | * RegBaseAddress contains the base address of the IPIF registers. |
| 323 | * |
| 324 | * Enable contains the value to be written to the interrupt enable register |
| 325 | * of the device. The bit definitions are specific to the device with |
| 326 | * the exception of the internal IPIF conditions. The following |
| 327 | * values may be used to enable the internal IPIF conditions interrupts. |
| 328 | * |
| 329 | * XIIF_V123B_ERROR_MASK Indicates a device error in the IPIF |
| 330 | * |
| 331 | * RETURN VALUE: |
| 332 | * |
| 333 | * None. |
| 334 | * |
| 335 | * NOTES: |
| 336 | * |
| 337 | * Signature: u32 XIIF_V123B_WRITE_DIER(u32 RegBaseAddress, |
| 338 | * u32 Enable) |
| 339 | * |
| 340 | ******************************************************************************/ |
| 341 | #define XIIF_V123B_WRITE_DIER(RegBaseAddress, Enable) \ |
| 342 | XIo_Out32((RegBaseAddress) + XIIF_V123B_DIER_OFFSET, (Enable)) |
| 343 | |
| 344 | /****************************************************************************** |
| 345 | * |
| 346 | * MACRO: |
| 347 | * |
| 348 | * XIIF_V123B_READ_DIER |
| 349 | * |
| 350 | * DESCRIPTION: |
| 351 | * |
| 352 | * This function gets the device interrupt enable register contents. |
| 353 | * This register controls which interrupt sources of the device |
| 354 | * are allowed to generate an interrupt. The device global interrupt enable |
| 355 | * register and the device interrupt enable register must also be set |
| 356 | * appropriately for an interrupt to be passed out of the device. |
| 357 | * |
| 358 | * Each bit of the register correlates to a specific interrupt source within the |
| 359 | * device which contains the IPIF. Setting a bit in this register enables that |
| 360 | * interrupt source to generate an interrupt if the global enable is set |
| 361 | * appropriately. Clearing a bit in this register disables interrupt generation |
| 362 | * for that interrupt source regardless of the global interrupt enable. |
| 363 | * |
| 364 | * ARGUMENTS: |
| 365 | * |
| 366 | * RegBaseAddress contains the base address of the IPIF registers. |
| 367 | * |
| 368 | * RETURN VALUE: |
| 369 | * |
| 370 | * The value read from the interrupt enable register of the device. The bit |
| 371 | * definitions are specific to the device with the exception of the internal |
| 372 | * IPIF conditions. The following values may be used to determine from the |
| 373 | * value if the internal IPIF conditions interrupts are enabled. |
| 374 | * |
| 375 | * XIIF_V123B_ERROR_MASK Indicates a device error in the IPIF |
| 376 | * |
| 377 | * NOTES: |
| 378 | * |
| 379 | * None. |
| 380 | * |
| 381 | ******************************************************************************/ |
| 382 | #define XIIF_V123B_READ_DIER(RegBaseAddress) \ |
| 383 | XIo_In32((RegBaseAddress) + XIIF_V123B_DIER_OFFSET) |
| 384 | |
| 385 | /****************************************************************************** |
| 386 | * |
| 387 | * MACRO: |
| 388 | * |
| 389 | * XIIF_V123B_READ_DIPR |
| 390 | * |
| 391 | * DESCRIPTION: |
| 392 | * |
| 393 | * This function gets the device interrupt pending register contents. |
| 394 | * This register indicates the pending interrupt sources, those that are waiting |
| 395 | * to be serviced by the software, for a device which contains the IPIF. |
| 396 | * An interrupt must be enabled in the interrupt enable register of the IPIF to |
| 397 | * be pending. |
| 398 | * |
| 399 | * Each bit of the register correlates to a specific interrupt source within the |
| 400 | * the device which contains the IPIF. With the exception of some internal IPIF |
| 401 | * conditions, the contents of this register are not latched since the condition |
| 402 | * is latched in the IP interrupt status register, by an internal block of the |
| 403 | * IPIF such as a FIFO or DMA channel, or by the IP of the device. This register |
| 404 | * is read only and is not latched, but it is necessary to acknowledge (clear) |
| 405 | * the interrupt condition by performing the appropriate processing for the IP |
| 406 | * or block within the IPIF. |
| 407 | * |
| 408 | * This register can be thought of as the contents of the interrupt status |
| 409 | * register ANDed with the contents of the interrupt enable register. |
| 410 | * |
| 411 | * ARGUMENTS: |
| 412 | * |
| 413 | * RegBaseAddress contains the base address of the IPIF registers. |
| 414 | * |
| 415 | * RETURN VALUE: |
| 416 | * |
| 417 | * The value read from the interrupt pending register of the device. The bit |
| 418 | * definitions are specific to the device with the exception of the latched |
| 419 | * internal IPIF condition bits. The following values may be used to detect |
| 420 | * internal IPIF conditions in the value. |
| 421 | * |
| 422 | * XIIF_V123B_ERROR_MASK Indicates a device error in the IPIF |
| 423 | * |
| 424 | * NOTES: |
| 425 | * |
| 426 | * None. |
| 427 | * |
| 428 | ******************************************************************************/ |
| 429 | #define XIIF_V123B_READ_DIPR(RegBaseAddress) \ |
| 430 | XIo_In32((RegBaseAddress) + XIIF_V123B_DIPR_OFFSET) |
| 431 | |
| 432 | /****************************************************************************** |
| 433 | * |
| 434 | * MACRO: |
| 435 | * |
| 436 | * XIIF_V123B_READ_DIIR |
| 437 | * |
| 438 | * DESCRIPTION: |
| 439 | * |
| 440 | * This function gets the device interrupt ID for the highest priority interrupt |
| 441 | * which is pending from the interrupt ID register. This function provides |
| 442 | * priority resolution such that faster interrupt processing is possible. |
| 443 | * Without priority resolution, it is necessary for the software to read the |
| 444 | * interrupt pending register and then check each interrupt source to determine |
| 445 | * if an interrupt is pending. Priority resolution becomes more important as the |
| 446 | * number of interrupt sources becomes larger. |
| 447 | * |
| 448 | * Interrupt priorities are based upon the bit position of the interrupt in the |
| 449 | * interrupt pending register with bit 0 being the highest priority. The |
| 450 | * interrupt ID is the priority of the interrupt, 0 - 31, with 0 being the |
| 451 | * highest priority. The interrupt ID register is live rather than latched such |
| 452 | * that multiple calls to this function may not yield the same results. A |
| 453 | * special value, outside of the interrupt priority range of 0 - 31, is |
| 454 | * contained in the register which indicates that no interrupt is pending. This |
| 455 | * may be useful for allowing software to continue processing interrupts in a |
| 456 | * loop until there are no longer any interrupts pending. |
| 457 | * |
| 458 | * The interrupt ID is designed to allow a function pointer table to be used |
| 459 | * in the software such that the interrupt ID is used as an index into that |
| 460 | * table. The function pointer table could contain an instance pointer, such |
| 461 | * as to DMA channel, and a function pointer to the function which handles |
| 462 | * that interrupt. This design requires the interrupt processing of the device |
| 463 | * driver to be partitioned into smaller more granular pieces based upon |
| 464 | * hardware used by the device, such as DMA channels and FIFOs. |
| 465 | * |
| 466 | * It is not mandatory that this function be used by the device driver software. |
| 467 | * It may choose to read the pending register and resolve the pending interrupt |
| 468 | * priorities on it's own. |
| 469 | * |
| 470 | * ARGUMENTS: |
| 471 | * |
| 472 | * RegBaseAddress contains the base address of the IPIF registers. |
| 473 | * |
| 474 | * RETURN VALUE: |
| 475 | * |
| 476 | * An interrupt ID, 0 - 31, which identifies the highest priority interrupt |
| 477 | * which is pending. A value of XIIF_NO_INTERRUPT_ID indicates that there is |
| 478 | * no interrupt pending. The following values may be used to identify the |
| 479 | * interrupt ID for the internal IPIF interrupts. |
| 480 | * |
| 481 | * XIIF_V123B_ERROR_INTERRUPT_ID Indicates a device error in the IPIF |
| 482 | * |
| 483 | * NOTES: |
| 484 | * |
| 485 | * None. |
| 486 | * |
| 487 | ******************************************************************************/ |
| 488 | #define XIIF_V123B_READ_DIIR(RegBaseAddress) \ |
| 489 | XIo_In32((RegBaseAddress) + XIIF_V123B_DIIR_OFFSET) |
| 490 | |
| 491 | /****************************************************************************** |
| 492 | * |
| 493 | * MACRO: |
| 494 | * |
| 495 | * XIIF_V123B_GLOBAL_INTR_DISABLE |
| 496 | * |
| 497 | * DESCRIPTION: |
| 498 | * |
| 499 | * This function disables all interrupts for the device by writing to the global |
| 500 | * interrupt enable register. This register provides the ability to disable |
| 501 | * interrupts without any modifications to the interrupt enable register such |
| 502 | * that it is minimal effort to restore the interrupts to the previous enabled |
| 503 | * state. The corresponding function, XIpIf_GlobalIntrEnable, is provided to |
| 504 | * restore the interrupts to the previous enabled state. This function is |
| 505 | * designed to be used in critical sections of device drivers such that it is |
| 506 | * not necessary to disable other device interrupts. |
| 507 | * |
| 508 | * ARGUMENTS: |
| 509 | * |
| 510 | * RegBaseAddress contains the base address of the IPIF registers. |
| 511 | * |
| 512 | * RETURN VALUE: |
| 513 | * |
| 514 | * None. |
| 515 | * |
| 516 | * NOTES: |
| 517 | * |
| 518 | * None. |
| 519 | * |
| 520 | ******************************************************************************/ |
| 521 | #define XIIF_V123B_GINTR_DISABLE(RegBaseAddress) \ |
| 522 | XIo_Out32((RegBaseAddress) + XIIF_V123B_DGIER_OFFSET, 0) |
| 523 | |
| 524 | /****************************************************************************** |
| 525 | * |
| 526 | * MACRO: |
| 527 | * |
| 528 | * XIIF_V123B_GINTR_ENABLE |
| 529 | * |
| 530 | * DESCRIPTION: |
| 531 | * |
| 532 | * This function writes to the global interrupt enable register to enable |
| 533 | * interrupts from the device. This register provides the ability to enable |
| 534 | * interrupts without any modifications to the interrupt enable register such |
| 535 | * that it is minimal effort to restore the interrupts to the previous enabled |
| 536 | * state. This function does not enable individual interrupts as the interrupt |
| 537 | * enable register must be set appropriately. This function is designed to be |
| 538 | * used in critical sections of device drivers such that it is not necessary to |
| 539 | * disable other device interrupts. |
| 540 | * |
| 541 | * ARGUMENTS: |
| 542 | * |
| 543 | * RegBaseAddress contains the base address of the IPIF registers. |
| 544 | * |
| 545 | * RETURN VALUE: |
| 546 | * |
| 547 | * None. |
| 548 | * |
| 549 | * NOTES: |
| 550 | * |
| 551 | * None. |
| 552 | * |
| 553 | ******************************************************************************/ |
| 554 | #define XIIF_V123B_GINTR_ENABLE(RegBaseAddress) \ |
| 555 | XIo_Out32((RegBaseAddress) + XIIF_V123B_DGIER_OFFSET, \ |
| 556 | XIIF_V123B_GINTR_ENABLE_MASK) |
| 557 | |
| 558 | /****************************************************************************** |
| 559 | * |
| 560 | * MACRO: |
| 561 | * |
| 562 | * XIIF_V123B_IS_GINTR_ENABLED |
| 563 | * |
| 564 | * DESCRIPTION: |
| 565 | * |
| 566 | * This function determines if interrupts are enabled at the global level by |
| 567 | * reading the gloabl interrupt register. This register provides the ability to |
| 568 | * disable interrupts without any modifications to the interrupt enable register |
| 569 | * such that it is minimal effort to restore the interrupts to the previous |
| 570 | * enabled state. |
| 571 | * |
| 572 | * ARGUMENTS: |
| 573 | * |
| 574 | * RegBaseAddress contains the base address of the IPIF registers. |
| 575 | * |
| 576 | * RETURN VALUE: |
| 577 | * |
| 578 | * TRUE if interrupts are enabled for the IPIF, FALSE otherwise. |
| 579 | * |
| 580 | * NOTES: |
| 581 | * |
| 582 | * None. |
| 583 | * |
| 584 | ******************************************************************************/ |
| 585 | #define XIIF_V123B_IS_GINTR_ENABLED(RegBaseAddress) \ |
| 586 | (XIo_In32((RegBaseAddress) + XIIF_V123B_DGIER_OFFSET) == \ |
| 587 | XIIF_V123B_GINTR_ENABLE_MASK) |
| 588 | |
| 589 | /****************************************************************************** |
| 590 | * |
| 591 | * MACRO: |
| 592 | * |
| 593 | * XIIF_V123B_WRITE_IISR |
| 594 | * |
| 595 | * DESCRIPTION: |
| 596 | * |
| 597 | * This function sets the IP interrupt status register to the specified value. |
| 598 | * This register indicates the status of interrupt sources for the IP of the |
| 599 | * device. The IP is defined as the part of the device that connects to the |
| 600 | * IPIF. The status is independent of whether interrupts are enabled such that |
| 601 | * the status register may also be polled when interrupts are not enabled. |
| 602 | * |
| 603 | * Each bit of the register correlates to a specific interrupt source within the |
| 604 | * IP. All bits of this register are latched. Setting a bit which is zero |
| 605 | * within this register causes an interrupt to be generated. The device global |
| 606 | * interrupt enable register and the device interrupt enable register must be set |
| 607 | * appropriately to allow an interrupt to be passed out of the device. The |
| 608 | * interrupt is cleared by writing to this register with the bits to be |
| 609 | * cleared set to a one and all others to zero. This register implements a |
| 610 | * toggle on write functionality meaning any bits which are set in the value |
| 611 | * written cause the bits in the register to change to the opposite state. |
| 612 | * |
| 613 | * This function writes only the specified value to the register such that |
| 614 | * some status bits may be set and others cleared. It is the caller's |
| 615 | * responsibility to get the value of the register prior to setting the value |
| 616 | * to prevent an destructive behavior. |
| 617 | * |
| 618 | * ARGUMENTS: |
| 619 | * |
| 620 | * RegBaseAddress contains the base address of the IPIF registers. |
| 621 | * |
| 622 | * Status contains the value to be written to the IP interrupt status |
| 623 | * register. The bit definitions are specific to the device IP. |
| 624 | * |
| 625 | * RETURN VALUE: |
| 626 | * |
| 627 | * None. |
| 628 | * |
| 629 | * NOTES: |
| 630 | * |
| 631 | * None. |
| 632 | * |
| 633 | ******************************************************************************/ |
| 634 | #define XIIF_V123B_WRITE_IISR(RegBaseAddress, Status) \ |
| 635 | XIo_Out32((RegBaseAddress) + XIIF_V123B_IISR_OFFSET, (Status)) |
| 636 | |
| 637 | /****************************************************************************** |
| 638 | * |
| 639 | * MACRO: |
| 640 | * |
| 641 | * XIIF_V123B_READ_IISR |
| 642 | * |
| 643 | * DESCRIPTION: |
| 644 | * |
| 645 | * This function gets the contents of the IP interrupt status register. |
| 646 | * This register indicates the status of interrupt sources for the IP of the |
| 647 | * device. The IP is defined as the part of the device that connects to the |
| 648 | * IPIF. The status is independent of whether interrupts are enabled such |
| 649 | * that the status register may also be polled when interrupts are not enabled. |
| 650 | * |
| 651 | * Each bit of the register correlates to a specific interrupt source within the |
| 652 | * device. All bits of this register are latched. Writing a 1 to a bit within |
| 653 | * this register causes an interrupt to be generated if enabled in the interrupt |
| 654 | * enable register and the global interrupt enable is set. Since the status is |
| 655 | * latched, each status bit must be acknowledged in order for the bit in the |
| 656 | * status register to be updated. Each bit can be acknowledged by writing a |
| 657 | * 0 to the bit in the status register. |
| 658 | |
| 659 | * ARGUMENTS: |
| 660 | * |
| 661 | * RegBaseAddress contains the base address of the IPIF registers. |
| 662 | * |
| 663 | * RETURN VALUE: |
| 664 | * |
| 665 | * A status which contains the value read from the IP interrupt status register. |
| 666 | * The bit definitions are specific to the device IP. |
| 667 | * |
| 668 | * NOTES: |
| 669 | * |
| 670 | * None. |
| 671 | * |
| 672 | ******************************************************************************/ |
| 673 | #define XIIF_V123B_READ_IISR(RegBaseAddress) \ |
| 674 | XIo_In32((RegBaseAddress) + XIIF_V123B_IISR_OFFSET) |
| 675 | |
| 676 | /****************************************************************************** |
| 677 | * |
| 678 | * MACRO: |
| 679 | * |
| 680 | * XIIF_V123B_WRITE_IIER |
| 681 | * |
| 682 | * DESCRIPTION: |
| 683 | * |
| 684 | * This function sets the IP interrupt enable register contents. This register |
| 685 | * controls which interrupt sources of the IP are allowed to generate an |
| 686 | * interrupt. The global interrupt enable register and the device interrupt |
| 687 | * enable register must also be set appropriately for an interrupt to be |
| 688 | * passed out of the device containing the IPIF and the IP. |
| 689 | * |
| 690 | * Each bit of the register correlates to a specific interrupt source within the |
| 691 | * IP. Setting a bit in this register enables the interrupt source to generate |
| 692 | * an interrupt. Clearing a bit in this register disables interrupt generation |
| 693 | * for that interrupt source. |
| 694 | * |
| 695 | * This function writes only the specified value to the register such that |
| 696 | * some interrupt sources may be enabled and others disabled. It is the |
| 697 | * caller's responsibility to get the value of the interrupt enable register |
| 698 | * prior to setting the value to prevent an destructive behavior. |
| 699 | * |
| 700 | * ARGUMENTS: |
| 701 | * |
| 702 | * RegBaseAddress contains the base address of the IPIF registers. |
| 703 | * |
| 704 | * Enable contains the value to be written to the IP interrupt enable register. |
| 705 | * The bit definitions are specific to the device IP. |
| 706 | * |
| 707 | * RETURN VALUE: |
| 708 | * |
| 709 | * None. |
| 710 | * |
| 711 | * NOTES: |
| 712 | * |
| 713 | * None. |
| 714 | * |
| 715 | ******************************************************************************/ |
| 716 | #define XIIF_V123B_WRITE_IIER(RegBaseAddress, Enable) \ |
| 717 | XIo_Out32((RegBaseAddress) + XIIF_V123B_IIER_OFFSET, (Enable)) |
| 718 | |
| 719 | /****************************************************************************** |
| 720 | * |
| 721 | * MACRO: |
| 722 | * |
| 723 | * XIIF_V123B_READ_IIER |
| 724 | * |
| 725 | * DESCRIPTION: |
| 726 | * |
| 727 | * |
| 728 | * This function gets the IP interrupt enable register contents. This register |
| 729 | * controls which interrupt sources of the IP are allowed to generate an |
| 730 | * interrupt. The global interrupt enable register and the device interrupt |
| 731 | * enable register must also be set appropriately for an interrupt to be |
| 732 | * passed out of the device containing the IPIF and the IP. |
| 733 | * |
| 734 | * Each bit of the register correlates to a specific interrupt source within the |
| 735 | * IP. Setting a bit in this register enables the interrupt source to generate |
| 736 | * an interrupt. Clearing a bit in this register disables interrupt generation |
| 737 | * for that interrupt source. |
| 738 | * |
| 739 | * ARGUMENTS: |
| 740 | * |
| 741 | * RegBaseAddress contains the base address of the IPIF registers. |
| 742 | * |
| 743 | * RETURN VALUE: |
| 744 | * |
| 745 | * The contents read from the IP interrupt enable register. The bit definitions |
| 746 | * are specific to the device IP. |
| 747 | * |
| 748 | * NOTES: |
| 749 | * |
| 750 | * Signature: u32 XIIF_V123B_READ_IIER(u32 RegBaseAddress) |
| 751 | * |
| 752 | ******************************************************************************/ |
| 753 | #define XIIF_V123B_READ_IIER(RegBaseAddress) \ |
| 754 | XIo_In32((RegBaseAddress) + XIIF_V123B_IIER_OFFSET) |
| 755 | |
| 756 | /************************** Function Prototypes ******************************/ |
| 757 | |
| 758 | /* |
| 759 | * Initialization Functions |
| 760 | */ |
| 761 | XStatus XIpIfV123b_SelfTest(u32 RegBaseAddress, u8 IpRegistersWidth); |
| 762 | |
| 763 | #endif /* end of protection macro */ |