This module contains APIs to program and use the PCIE module. The APIs can be used by other drivers to get access to PCIE and also by applications
Files | |
file | pcie/pcie.h |
PCIE Driver API/interface file. | |
Data Structures | |
struct | Pcie_DeviceCfgBaseAddr |
The Pcie_DeviceCfg is used to specify device level configuration of the driver instance. More... | |
struct | Pcie_ObAtuCfg |
Pcie_ObAtuCfg specifies the Outbound ATU configurations for PCIe. More... | |
struct | Pcie_IbAtuCfg |
Pcie_IbAtuCfg specifies the Inbound ATU configurations for PCIe. More... | |
struct | Pcie_RegisterMsiIsrParams |
Pcie_RegisterMsiIsrParams specifies the parameters to register an ISR for MSI. More... | |
struct | Pcie_RegisterMsixIsrParams |
Pcie_RegisterMsixIsrParams specifies the parameters to register an ISR for MSIX. More... | |
struct | Pcie_MsiIsrCtrl |
PCIe MSI Isr control structure. More... | |
struct | Pcie_MsixIsrCtrl |
ISR and arguement list for MSIx. More... | |
struct | Pcie_MsixTblEntry |
PCIe MSIx table entry. More... | |
struct | Pcie_MsixTbl |
struct | Pcie_Attrs |
PCIe atributes. More... | |
struct | Pcie_Object |
PCIe driver object. More... | |
struct | Pcie_DeviceCfg |
PCIe device configuration. More... | |
struct | Pcie_InitCfg |
PCIe configuration for initalization. More... | |
struct | Pcie_Config |
PCIE global configuration array. More... | |
struct | Pcie_BarCfg |
PCIe BAR configuration info. More... | |
struct | Pcie_IbTransCfg |
Inbound traslation configuration info The Pcie_IbTransCfg is used to configure the Inbound Translation Registers. More... | |
struct | Pcie_AtuRegionParams |
This Structure defines the ATU region parameters. More... | |
Functions | |
void | Pcie_init (void) |
This function initializes the PCIe module. More... | |
Pcie_Handle | Pcie_open (uint32_t index) |
This function opens a given PCIe peripheral. More... | |
void | Pcie_close (Pcie_Handle handle) |
Function to close PCIe peripheral specified by PCIe handle. More... | |
Pcie_DeviceCfgBaseAddr * | Pcie_handleGetBases (Pcie_Handle handle) |
Get the device base address info for the PCIe peripheral. More... | |
int32_t | Pcie_setInterfaceMode (Pcie_Handle handle, Pcie_Mode mode, Pcie_Gen gen) |
Set interfac mode (RC/EP) More... | |
int32_t | Pcie_getMemSpaceReserved (Pcie_Handle handle, uint32_t *resSize) |
Pcie_getMemSpaceReserved returns amount of reserved space between beginning of hardware's data area and the base returned by Pcie_getMemSpaceRange. More... | |
int32_t | Pcie_getMemSpaceRange (Pcie_Handle handle, void **base, uint32_t *size) |
Returns the PCIe Internal Address Range for the memory space. This range is used for accessing memory. More... | |
int32_t | Pcie_cfgBar (Pcie_Handle handle, const Pcie_BarCfg *barCfg) |
Configure a BAR Register (32 bits) More... | |
int32_t | Pcie_atuRegionConfig (Pcie_Handle handle, Pcie_Location location, uint32_t atuRegionIndex, const Pcie_AtuRegionParams *atuRegionParams) |
Configure address translation registers. More... | |
int32_t | Pcie_getVendorId (Pcie_Handle handle, Pcie_Location location, uint32_t *vendorId, uint32_t *deviceId) |
Get vendor ID and device ID of Pcie Device. More... | |
int32_t | Pcie_getPwrState (Pcie_Handle handle, Pcie_PwrState *pwrState) |
Get current PCIe Power State. More... | |
int32_t | Pcie_getLinkParams (Pcie_Handle handle, Pcie_Gen *gen, uint32_t *numLanes) |
Get current PCIe Link Parameter. More... | |
int32_t | Pcie_isLinkUp (Pcie_Handle handle) |
Check if PCIe link training completed. More... | |
int32_t | Pcie_waitLinkUp (Pcie_Handle handle) |
Wait for PCIe link training to complete. More... | |
int32_t | Pcie_checkLinkParams (Pcie_Handle handle) |
Verify if the link parameters is established as configured. More... | |
int32_t | Pcie_LtssmCtrl (Pcie_Handle handle, uint8_t enable) |
Enable/disable PCIe link training. More... | |
int32_t | Pcie_setLanes (Pcie_Handle handle) |
Set number of PCIe lanes as configured. More... | |
int32_t | Pcie_cfgEP (Pcie_Handle handle) |
Configure Pcie for EP (End Point) operation. PCIe mode setting is NOT done here (Pcie_setInterfaceMode) More... | |
int32_t | Pcie_cfgRC (Pcie_Handle handle) |
Configure Pcie for RC (Root Complex) operation. PCIe mode setting is NOT done here (Pcie_setInterfaceMode) More... | |
int32_t | Pcie_setCfgEn (Pcie_Handle handle, int enable) |
Set CONFIG_ENABLE to signal RC that the local EP configuration is completed. More... | |
int32_t | Pcie_setSlotClockCnfg (Pcie_Handle handle, int enable) |
Set slot clock configuration bit in Link Status Register. More... | |
int32_t | Pcie_setDwnStrIrq (Pcie_Handle handle, int enable) |
Enable downstream interrupt in PCIE Controller. More... | |
int32_t | Pcie_setLnkDwnStateIrq (Pcie_Handle handle, int enable) |
Enable link down status interrupt in PCIE Controller. More... | |
int32_t | Pcie_setPwrStateIrq (Pcie_Handle handle, int enable) |
Enable power management state interrupt in PCIE Controller. More... | |
int32_t | Pcie_setHotResetIrq (Pcie_Handle handle, int enable) |
Enable hot reset interrupt in PCIE Controller. More... | |
int32_t | Pcie_ackDwnStrIrq (Pcie_Handle handle) |
Acknowledge downstream interrupt. More... | |
int32_t | Pcie_ackLnkDwnStateIrq (Pcie_Handle handle) |
Acknowledge link down status interrupt. More... | |
int32_t | Pcie_ackPwrStateIrq (Pcie_Handle handle) |
Acknowledge power management state interrupt. More... | |
Typedefs | |
typedef void * | Pcie_Handle |
Driver handle returned by Pcie_open() call. More... | |
typedef void(* | Pcie_MsiIsr) (void *arg, uint32_t msiData) |
Function pointer for the PCIe MSI ISR. More... | |
typedef void(* | Pcie_MsixIsr) (void *arg, uint32_t msixData) |
Function pointer for the PCIe MSIx ISR. More... | |
Macros | |
#define | PCIE_MAX_PERIPHS (4U) |
Maximum PCIe devices supported by the driver. More... | |
#define | PCIE_MAX_MSI_IRQ (32U) |
Maximum PCIe MSI interrupts supported. More... | |
#define | PCIE_MAX_MSIX_IRQ (2048U) |
Maxmium number of MSIx interrupts supported. More... | |
#define | PCIE_MAX_NUM_IBATU (6U) |
Maximum number of configurable Inbound ATUs. More... | |
#define PCIE_MAX_PERIPHS (4U) |
Maximum PCIe devices supported by the driver.
#define PCIE_MAX_MSI_IRQ (32U) |
Maximum PCIe MSI interrupts supported.
#define PCIE_MAX_MSIX_IRQ (2048U) |
Maxmium number of MSIx interrupts supported.
#define PCIE_MAX_NUM_IBATU (6U) |
Maximum number of configurable Inbound ATUs.
typedef void* Pcie_Handle |
Driver handle returned by Pcie_open() call.
typedef void(* Pcie_MsiIsr) (void *arg, uint32_t msiData) |
Function pointer for the PCIe MSI ISR.
typedef void(* Pcie_MsixIsr) (void *arg, uint32_t msixData) |
Function pointer for the PCIe MSIx ISR.
enum Pcie_Mode |
These are the possible values for PCIe mode.
Enumerator | |
---|---|
PCIE_EP_MODE | Required when setting the PCIe Mode to End Point using the Pcie_setInterfaceMode function |
PCIE_LEGACY_EP_MODE | Required when setting the PCIe Mode to Legacy End Point using the Pcie_setInterfaceMode function |
PCIE_RC_MODE | Required when setting the PCIe Mode to Root Complex using the Pcie_setInterfaceMode function |
enum Pcie_Gen |
enum Pcie_RefClk_Mode |
Enumeration for PCIe Reference Clock mode.
enum Pcie_SRIS_Mode |
enum Pcie_PwrState |
enum Pcie_IntPin |
enum Pcie_BarPref |
enum Pcie_BarType |
enum Pcie_BarMem |
enum Pcie_AtuRegionDir |
enum Pcie_TlpType |
This enum is used to select PCIe TLP(Transaction layer packet) type while configuring inbound or outbound region.
enum Pcie_Location |
Enumeration for PCIe access type remote/local.
Selects whether to read/write local or remote PCIe registers. PCIe configuration registers are accessible locally and remotely
For PCIe application registers the access is always local
Enumerator | |
---|---|
PCIE_LOCATION_LOCAL | Access the local PCIe peripheral |
PCIE_LOCATION_REMOTE | Access the remote PCIe peripheral |
enum Pcie_LtssmState |
Enumeration for possible values for encoding LTSSM state.
void Pcie_init | ( | void | ) |
This function initializes the PCIe module.
Pcie_Handle Pcie_open | ( | uint32_t | index | ) |
This function opens a given PCIe peripheral.
index | Index of config to use in the Pcie_config array |
void Pcie_close | ( | Pcie_Handle | handle | ) |
Function to close PCIe peripheral specified by PCIe handle.
handle | Pcie_Handle retuned from Pcie_open() |
Pcie_DeviceCfgBaseAddr* Pcie_handleGetBases | ( | Pcie_Handle | handle | ) |
Get the device base address info for the PCIe peripheral.
handle | Pcie_Handle returned from Pcie_open() |
int32_t Pcie_setInterfaceMode | ( | Pcie_Handle | handle, |
Pcie_Mode | mode, | ||
Pcie_Gen | gen | ||
) |
Set interfac mode (RC/EP)
handle | Pcie_Handle for the instance |
mode | Interface mode (EP/EC) |
gen | PCIe operation speed |
int32_t Pcie_getMemSpaceReserved | ( | Pcie_Handle | handle, |
uint32_t * | resSize | ||
) |
Pcie_getMemSpaceReserved returns amount of reserved space between beginning of hardware's data area and the base returned by Pcie_getMemSpaceRange.
handle | Pcie_Handle for the instance |
resSize | Pointer to return reserved space |
SystemP_SUCCESS | on successful; else error on failure |
int32_t Pcie_getMemSpaceRange | ( | Pcie_Handle | handle, |
void ** | base, | ||
uint32_t * | size | ||
) |
Returns the PCIe Internal Address Range for the memory space. This range is used for accessing memory.
handle | Pcie_Handle for the instance |
base | Pointer to return base address |
size | Pointer to return size |
int32_t Pcie_cfgBar | ( | Pcie_Handle | handle, |
const Pcie_BarCfg * | barCfg | ||
) |
Configure a BAR Register (32 bits)
handle | Pcie_Handle for the instance |
barCfg | Bar configuration parameters |
int32_t Pcie_atuRegionConfig | ( | Pcie_Handle | handle, |
Pcie_Location | location, | ||
uint32_t | atuRegionIndex, | ||
const Pcie_AtuRegionParams * | atuRegionParams | ||
) |
Configure address translation registers.
handle | Pcie_Handle for the instance |
location | Local or remote configuration space |
atuRegionIndex | Address translation region index |
atuRegionParams | Address translation region parameters |
int32_t Pcie_getVendorId | ( | Pcie_Handle | handle, |
Pcie_Location | location, | ||
uint32_t * | vendorId, | ||
uint32_t * | deviceId | ||
) |
Get vendor ID and device ID of Pcie Device.
handle | Pcie_Handle returned by Pcie_open() |
location | Local or remote configuration space |
vendorId | Pointer to return vendor ID |
deviceId | Pointer to return device ID |
int32_t Pcie_getPwrState | ( | Pcie_Handle | handle, |
Pcie_PwrState * | pwrState | ||
) |
Get current PCIe Power State.
handle | Pcie_Handle returned by Pcie_open() |
pwrState | Pointer to return PCIe Power State |
int32_t Pcie_getLinkParams | ( | Pcie_Handle | handle, |
Pcie_Gen * | gen, | ||
uint32_t * | numLanes | ||
) |
Get current PCIe Link Parameter.
handle | Pcie_Handle returned by Pcie_open() |
gen | Pointer to return PCIe operation speed |
numLanes | Pointer to return Number of lanes for the instance |
int32_t Pcie_isLinkUp | ( | Pcie_Handle | handle | ) |
Check if PCIe link training completed.
handle | Pcie_Handle returned by Pcie_open() |
int32_t Pcie_waitLinkUp | ( | Pcie_Handle | handle | ) |
Wait for PCIe link training to complete.
handle | Pcie_Handle returned by Pcie_open() |
int32_t Pcie_checkLinkParams | ( | Pcie_Handle | handle | ) |
Verify if the link parameters is established as configured.
handle | Pcie_Handle returned by Pcie_open() |
int32_t Pcie_LtssmCtrl | ( | Pcie_Handle | handle, |
uint8_t | enable | ||
) |
Enable/disable PCIe link training.
handle | Pcie_Handle returned by Pcie_open() |
enable | Enable(1) / disable (0) link training |
int32_t Pcie_setLanes | ( | Pcie_Handle | handle | ) |
Set number of PCIe lanes as configured.
handle | Pcie_Handle returned by Pcie_open() |
int32_t Pcie_cfgEP | ( | Pcie_Handle | handle | ) |
Configure Pcie for EP (End Point) operation. PCIe mode setting is NOT done here (Pcie_setInterfaceMode)
handle | Pcie_Handle returned by Pcie_open() |
int32_t Pcie_cfgRC | ( | Pcie_Handle | handle | ) |
Configure Pcie for RC (Root Complex) operation. PCIe mode setting is NOT done here (Pcie_setInterfaceMode)
handle | Pcie_Handle returned by Pcie_open() |
int32_t Pcie_setCfgEn | ( | Pcie_Handle | handle, |
int | enable | ||
) |
Set CONFIG_ENABLE to signal RC that the local EP configuration is completed.
setting CONFIG_ENABLE to '0' will generate a Configuration Request Retry Status (CRS) on Configuration Requests
setting CONFIG_ENABLE to '1' will generate a Succesful Completion/Unsupported Request (SC/UR) on Configuration Requests
handle | Pcie_Handle returned from Pcie_open() |
enable | Set (1) / Reset (0) CONFIG_ENABLE bit |
int32_t Pcie_setSlotClockCnfg | ( | Pcie_Handle | handle, |
int | enable | ||
) |
Set slot clock configuration bit in Link Status Register.
If set indicates the EP uses the reference clock provided on the connector, else the EP uses a independent clock
handle | Pcie_Handle returned by Pcie_open() |
enable | Enable(1) / disable (0) slot clock configuration |
int32_t Pcie_setDwnStrIrq | ( | Pcie_Handle | handle, |
int | enable | ||
) |
Enable downstream interrupt in PCIE Controller.
handle | Pcie_Handle returned by Pcie_open() |
enable | Enable(1) / disable (0) downstream IRQ |
int32_t Pcie_setLnkDwnStateIrq | ( | Pcie_Handle | handle, |
int | enable | ||
) |
Enable link down status interrupt in PCIE Controller.
handle | Pcie_Handle returned by Pcie_open() |
enable | Enable(1) / disable (0) Linkdown State IRQ |
int32_t Pcie_setPwrStateIrq | ( | Pcie_Handle | handle, |
int | enable | ||
) |
Enable power management state interrupt in PCIE Controller.
handle | Pcie_Handle returned by Pcie_open() |
enable | Enable(1) / disable (0) Power State IRQ |
int32_t Pcie_setHotResetIrq | ( | Pcie_Handle | handle, |
int | enable | ||
) |
Enable hot reset interrupt in PCIE Controller.
handle | Pcie_Handle returned by Pcie_open() |
enable | Enable(1) / disable (0) Power State IRQ |
int32_t Pcie_ackDwnStrIrq | ( | Pcie_Handle | handle | ) |
Acknowledge downstream interrupt.
handle | Pcie_Handle returned by Pcie_open() |
int32_t Pcie_ackLnkDwnStateIrq | ( | Pcie_Handle | handle | ) |
Acknowledge link down status interrupt.
handle | Pcie_Handle returned by Pcie_open() |
int32_t Pcie_ackPwrStateIrq | ( | Pcie_Handle | handle | ) |
Acknowledge power management state interrupt.
handle | Pcie_Handle returned by Pcie_open() |
|
extern |
Externally defined driver configuration array.
|
extern |
Externally defined driver configuration array size.