diff --git a/components/drivers/pci/pci.c b/components/drivers/pci/pci.c index e4d287b35307..d101b87abb2e 100644 --- a/components/drivers/pci/pci.c +++ b/components/drivers/pci/pci.c @@ -712,6 +712,19 @@ rt_err_t rt_pci_device_alloc_resource(struct rt_pci_host_bridge *host_bridge, return err; } +rt_ubase_t rt_pci_get_addr(struct rt_pci_device *pdev, rt_ubase_t flags) +{ + for (int i = 0; i < RT_PCI_BAR_NR_MAX; i++) + { + if (!pdev->resource[i].base) + break; + + if (pdev->resource[i].flags == flags) + return pdev->resource[i].base; + } + return 0; +} + void rt_pci_enum_device(struct rt_pci_bus *bus, rt_bool_t (callback(struct rt_pci_device *, void *)), void *data) {