代码拉取完成,页面将自动刷新
.
├── fpcie_ecam.c
├── fpcie_ecam.h
├── fpcie_ecam_caps.c
├── fpcie_ecam_common.h
├── fpcie_ecam_debug.c
├── fpcie_ecam_g.c
├── fpcie_ecam_intx.c
└── fpcie_ecam_sinit.c
此模块可以按照以下步骤进行初始化与使用:
struct FPcieRegion
{
FPcieAddr bus_start; /* Start on the bus */
FPciePhysAddr phys_start; /* Start in physical address space */
FPcieSize size; /* Size */
unsigned long flags; /* Resource flags */
FPcieAddr bus_lower; /* Lower address */
u32 exist_flg; /* exist flg */
};
/* Structure defining the PCIe interrupt callback function */
typedef struct
{
void (*IntxCallBack)(void *args); /* Pointer to a callback function to be invoked on a PCIe interrupt event*/
void *args; /* Arguments to be passed to the callback function*/
u8 bus; /* PCIe bus number*/
u8 device; /* PCIe device number*/
u8 function; /* PCIe function number*/
} FPcieIntxFun;
/* Structure defining the PCIe ECAM (Enhanced Configuration Access Mechanism) configuration */
typedef struct
{
u32 instance_id; /* ID of the device */
uintptr_t ecam; /* Base address for the ECAM to access PCIe configuration space */
u32 io_base_addr; /* IO base address */
u32 io_size; /* IO size */
u32 npmem_base_addr; /* Non-prefetchable memory base address */
u32 npmem_size; /* Non-prefetchable memory size */
u64 pmem_base_addr; /* Prefetchable memory base address */
u64 pmem_size; /* Prefetchable memory size */
u8 inta_irq_num; /* IRQ number for INTA */
u8 intb_irq_num; /* IRQ number for INTB */
u8 intc_irq_num; /* IRQ number for INTC */
u8 intd_irq_num; /* IRQ number for INTD */
u32 max_bus_num; /* Maximum bus number */
u32 max_dev_num; /* Maximum device number */
u32 max_fun_num; /* Maximum function number */
u32 feature; /* Feature flags, such as whether FPCI ECAM INTX requires EOI (End of Interrupt) */
#ifdef FPCI_ECAM_INTX_NEED_EOI
uintptr_t control_intx_base[FPCI_ECAM_INTX_CONTROL_STATUS_REG_NUM]; /* Array of base addresses to control INTX */
uintptr_t config_intx_base[FPCI_ECAM_INTX_CONFIG_ISTATUS_NUM]; /* Array of base addresses for INTX configuration */
#endif
} FPcieEcamConfig;
/* Main structure defining the PCIe ECAM properties */
typedef struct
{
u32 is_ready; /* Flag indicating whether the device has been initialized and is ready */
FPcieEcamConfig config; /* Configuration data for PCIe ECAM */
FPcieEcamNeedSkip need_skip_fun; /* Data structure indicating functions that need to be skipped */
struct FPcieRegion mem; /* Memory region */
struct FPcieRegion mem_prefetch; /* Prefetchable memory region */
struct FPcieRegion mem_io; /* IO memory region */
u32 bus_max; /* Maximum bus number currently in use */
FPcieIntxFun inta_fun[FPCIE_MAX_SCAN_NUMBER]; /* Array of callback functions for INTA */
s32 inta_num; /* Count of INTA callback functions */
u32 is_scaned; /* Flag indicating whether the device has been scanned */
u32 last_bus; /* Last scanned bus number */
FPcieScanBdf scans_bdf[FPCIE_MAX_SCAN_NUMBER]; /* Array of scanned BDFs */
u32 scans_bdf_count; /* Count of scanned BDFs */
} FPcieEcam;
FPcieEcam
实例FError FPcieEcamCfgInitialize(FPcieEcam *instance_p, FPcieEcamConfig *config_p, FPcieEcamNeedSkip need_skip_fun)
Note:
FPcieEcam
实例将会被初始化并包含指定的配置。Input:
FPcieEcam
实例的指针。FPcieEcamConfig
的指针,用于为 FPcieEcam
实例提供配置数据。Return:
FT_SUCCESS
FError FPcieEcamEnumerateBus(FPcieEcam *instance_p, u8 bus)
Note:
FPcieEcam
实例将包含该总线上的设备信息。Input:
FPcieEcam
实例的指针。Return:
FError FPcieEcamReadConfigSpace(FPcieEcam *instance_p, u8 bus, u8 device, u8 function, u16 offset, u32 *data)
Note:
FPCIE_EXCEED_BUS
错误码。FPCIE_CCR_INVALID_DATA
,表示未定义的寄存器数据。data
参数返回该值,并返回 FT_SUCCESS
。Input:
FPcieEcam
实例的指针。FPCIE_CCR_XXX_REGS
系列寄存器。Return:
FError FPcieEcamWriteConfigSpace(FPcieEcam *instance_p, u8 bus, u8 device, u8 function, u16 offset, u32 data)
Note:
FT_SUCCESS
。FPCIE_EXCEED_BUS
错误码。FT_SUCCESS
。Input:
FPcieEcam
实例的指针。Return:
FPcieEcamConfig *FPcieEcamLookupConfig(u32 instance_id)
Note:
FPcieEcamConfigTable
中查找相应的配置,并返回该配置的指针。FPcieEcamConfigTable
中找不到匹配的实例ID,该函数将返回 NULL
。Input:
Return:
u32 FPcieEcamHasExtendCapability(FPcieEcam *instance_p, u8 bus, u8 device, u8 function, u16 capid)
Note:
Input:
Return:
u32 FPcieEcamHasCapability(FPcieEcam *instance_p, u8 bus, u8 device, u8 function, u8 capid)
Note:
Input:
Return:
FError FPcieEcamIntxRegister(FPcieEcam *instance_p,u8 bus, u8 device, u8 function,FPcieIntxFun *func_p)
Note:
Input:
Return:
void FPcieEcamIntxIrqHandler(s32 vector, void *args)
Note:
FPcieEcamIntxIrqHandler
)将被调用。这个函数遍历系统中所有注册的PCIe设备,检查是否有INTx中断触发,然后调用相应的中断回调函数处理该中断。Input:
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。