pciepsu: xpciepsu.c File Reference

| pciepsu Xilinx SDK Drivers API Documentation

- Overview
- APIs
- File List
- Examples

Functions
xpciepsu.c File Reference

## Overview

Implements all of functions for psu_pci IP driver except interrupts and initialization.

    MODIFICATION HISTORY:

    Ver   Who  Date     Changes

    1.0     bs      08/21/2018      First release

## Functions
u32 | XPciePsu_ComposeExternalConfigAddress (u8 Bus, u8 Device, u8 Function, u16 Offset)
| This function Composes configuration space location. More...
u8 | XPciePsu_ReadConfigSpace (XPciePsu *InstancePtr, u8 Bus, u8 Device, u8 Function, u16 Offset, u32 *DataPtr)
| This function read from remote configuration space location. More...
u8 | XPciePsu_WriteConfigSpace (XPciePsu *InstancePtr, u8 Bus, u8 Device, u8 Function, u16 Offset, u32 Data)
| This function write to remote configuration space location. More...
u8 | XPciePsu_EnumerateBus (XPciePsu *InstancePtr)
| This function starts PCIe enumeration. More...
u32 | XPciePsu_CfgInitialize (XPciePsu *InstancePtr, XPciePsu_Config *CfgPtr, UINTPTR EffectiveBrgAddress)
| This function initializes the config space and PCIe bridge. More...

## Function Documentation

u32 XPciePsu_CfgInitialize | ( | XPciePsu * | InstancePtr,
|  | XPciePsu_Config * | CfgPtr,
|  | UINTPTR | EffectiveBrgAddress
| ) |  |

This function initializes the config space and PCIe bridge.

Parameters

  InstancePtr | pointer to XPciePsu Instance Pointer
  CfgPtr | pointer to XPciePsu_Config instrance Pointer.
  EffectiveBrgAddress | config brigReg address

Returns
  XST_SUCCESS on success err on failure

Referenced by PcieInitRootComplex().

u32 XPciePsu_ComposeExternalConfigAddress | ( | u8 | Bus,
|  | u8 | Device,
|  | u8 | Function,
|  | u16 | Offset
| ) |  |

This function Composes configuration space location.

Parameters

  Bus |
  Device |
  Function |
  Offset |

Returns
  location address of the composed address

References XPCIEPSU_ECAM_BUS_MASK, XPCIEPSU_ECAM_BUS_SHIFT, XPCIEPSU_ECAM_DEV_MASK, XPCIEPSU_ECAM_DEV_SHIFT, XPCIEPSU_ECAM_FUN_MASK, XPCIEPSU_ECAM_FUN_SHIFT, XPCIEPSU_ECAM_MASK, XPCIEPSU_ECAM_REG_MASK, and XPCIEPSU_ECAM_REG_SHIFT.

Referenced by XPciePsu_GetCapability(), XPciePsu_ReadConfigSpace(), and XPciePsu_WriteConfigSpace().

u8 XPciePsu_EnumerateBus | ( | XPciePsu * | InstancePtr | ) |

This function starts PCIe enumeration.

Parameters

  InstancePtr | pointer to XPciePsu Instance Pointer

Returns
  1 if success 0 if fails

Referenced by main().

u8 XPciePsu_ReadConfigSpace | ( | XPciePsu * | InstancePtr,
|  | u8 | Bus,
|  | u8 | Device,
|  | u8 | Function,
|  | u16 | Offset,
|  | u32 * | DataPtr
| ) |  |

This function read from remote configuration space location.

Parameters

  InstancePtr | pointer to XPciePsu Instance Pointer
  Bus |
  Device |
  Function |
  Offset | location of the address to read data from.
  DataPtr | pointer store date available in the offset

Returns
  XST_SUCCESS on success XST_FAILURE on failure.

References XPciePsu_ComposeExternalConfigAddress().

Referenced by XPciePsu_GetCapability(), XPciePsu_HasCapability(), and XPciePsu_PrintAllCapabilites().

u8 XPciePsu_WriteConfigSpace | ( | XPciePsu * | InstancePtr,
|  | u8 | Bus,
|  | u8 | Device,
|  | u8 | Function,
|  | u16 | Offset,
|  | u32 | Data
| ) |  |

This function write to remote configuration space location.

Parameters

  InstancePtr | pointer to XPciePsu Instance Pointer
  Bus |
  Device |
  Function |
  Offset | location of the address to write data.
  Data | to be written on to the offset

Returns
  XST_SUCCESS on success XST_FAILURE on failure.

References XPciePsu_ComposeExternalConfigAddress().