Zephyr API Documentation
3.7.0
A Scalable Open Source RTOS
|
Public APIs for the PCIe EP drivers. More...
Go to the source code of this file.
Data Structures | |
struct | pcie_ep_driver_api |
Typedefs | |
typedef void(* | pcie_ep_reset_callback_t) (void *arg) |
Callback API for PCIe reset interrupts. | |
Enumerations | |
enum | pcie_ob_mem_type { PCIE_OB_ANYMEM , PCIE_OB_LOWMEM , PCIE_OB_HIGHMEM } |
enum | pci_ep_irq_type { PCIE_EP_IRQ_LEGACY , PCIE_EP_IRQ_MSI , PCIE_EP_IRQ_MSIX } |
enum | xfer_direction { HOST_TO_DEVICE , DEVICE_TO_HOST } |
enum | pcie_reset { PCIE_PERST , PCIE_PERST_INB , PCIE_FLR , PCIE_RESET_MAX } |
Functions | |
static int | pcie_ep_conf_read (const struct device *dev, uint32_t offset, uint32_t *data) |
Read PCIe EP configuration space. | |
static void | pcie_ep_conf_write (const struct device *dev, uint32_t offset, uint32_t data) |
Write PCIe EP configuration space. | |
static int | pcie_ep_map_addr (const struct device *dev, uint64_t pcie_addr, uint64_t *mapped_addr, uint32_t size, enum pcie_ob_mem_type ob_mem_type) |
Map a host memory buffer to PCIe outbound region. | |
static void | pcie_ep_unmap_addr (const struct device *dev, uint64_t mapped_addr) |
Remove mapping to PCIe outbound region. | |
static int | pcie_ep_raise_irq (const struct device *dev, enum pci_ep_irq_type irq_type, uint32_t irq_num) |
Raise interrupt to Host. | |
static int | pcie_ep_register_reset_cb (const struct device *dev, enum pcie_reset reset, pcie_ep_reset_callback_t cb, void *arg) |
Register callback function for reset interrupts. | |
static int | pcie_ep_dma_xfer (const struct device *dev, uint64_t mapped_addr, uintptr_t local_addr, uint32_t size, const enum xfer_direction dir) |
Data transfer between mapped Host memory and device memory with "System DMA". | |
int | pcie_ep_xfer_data_memcpy (const struct device *dev, uint64_t pcie_addr, uintptr_t *local_addr, uint32_t size, enum pcie_ob_mem_type ob_mem_type, enum xfer_direction dir) |
Data transfer using memcpy. | |
int | pcie_ep_xfer_data_dma (const struct device *dev, uint64_t pcie_addr, uintptr_t *local_addr, uint32_t size, enum pcie_ob_mem_type ob_mem_type, enum xfer_direction dir) |
Data transfer using system DMA. | |
Public APIs for the PCIe EP drivers.
pcie_ep_reset_callback_t |
Callback API for PCIe reset interrupts.
These callbacks execute in interrupt context. Therefore, use only interrupt-safe APIS. Registration of callbacks is done via pcie_ep_register_reset_cb
arg | Pointer provided at registration time, later to be passed back as argument to callback function |
enum pci_ep_irq_type |
enum pcie_ob_mem_type |
enum pcie_reset |
enum xfer_direction |
|
inlinestatic |
Read PCIe EP configuration space.
This API reads EP's own configuration space
dev | Pointer to the device structure for the driver instance |
offset | Offset within configuration space |
data | Pointer to data read from the offset |
|
inlinestatic |
Write PCIe EP configuration space.
This API writes EP's own configuration space
dev | Pointer to the device structure for the driver instance |
offset | Offset within configuration space |
data | Data to be written at the offset |
|
inlinestatic |
Data transfer between mapped Host memory and device memory with "System DMA".
The term "System DMA" is used to clarify that we are not talking about dedicated "PCIe DMA"; rather the one which does not understand PCIe address directly, and uses the mapped Host memory.
If DMA controller is available in the EP device, this API can be used to achieve data transfer between mapped Host memory, i.e. outbound memory and EP device's local memory with DMA
dev | Pointer to the device structure for the driver instance |
mapped_addr | Mapped Host memory address |
local_addr | Device memory address |
size | DMA transfer length (bytes) |
dir | Direction of DMA transfer |
|
inlinestatic |
Map a host memory buffer to PCIe outbound region.
This API maps a host memory buffer to PCIe outbound region, It is left to EP driver to manage multiple mappings through multiple PCIe outbound regions if supported by SoC
dev | Pointer to the device structure for the driver instance |
pcie_addr | Host memory buffer address to be mapped |
mapped_addr | Mapped PCIe outbound region address |
size | Host memory buffer size (bytes) |
ob_mem_type | Hint if lowmem/highmem outbound region has to be used, this is useful in cases where bus master cannot generate more than 32-bit address; it becomes essential to use lowmem outbound region |
|
inlinestatic |
Raise interrupt to Host.
This API raises interrupt to Host
dev | Pointer to the device structure for the driver instance |
irq_type | Type of Interrupt be raised (legacy, MSI or MSI-X) |
irq_num | MSI or MSI-X interrupt number |
|
inlinestatic |
Register callback function for reset interrupts.
If reset interrupts are handled by device, this API can be used to register callback function, which will be executed part of corresponding PCIe reset handler
dev | Pointer to the device structure for the driver instance |
reset | Reset interrupt type |
cb | Callback function being registered |
arg | Argument to be passed back to callback function |
Remove mapping to PCIe outbound region.
This API removes mapping to PCIe outbound region. Mapped PCIe outbound region address is given as argument to figure out the outbound region to be unmapped
dev | Pointer to the device structure for the driver instance |
mapped_addr | PCIe outbound region address |
int pcie_ep_xfer_data_dma | ( | const struct device * | dev, |
uint64_t | pcie_addr, | ||
uintptr_t * | local_addr, | ||
uint32_t | size, | ||
enum pcie_ob_mem_type | ob_mem_type, | ||
enum xfer_direction | dir | ||
) |
Data transfer using system DMA.
Helper API to achieve data transfer with system DMA through PCIe outbound memory, this API is based off pcie_ep_xfer_data_memcpy, here we use "system dma" instead of memcpy
dev | Pointer to the device structure for the driver instance |
pcie_addr | Host memory buffer address |
local_addr | Local memory buffer address |
size | Data transfer size (bytes) |
ob_mem_type | Hint if lowmem/highmem outbound region has to be used (PCIE_OB_LOWMEM / PCIE_OB_HIGHMEM / PCIE_OB_ANYMEM) |
dir | Data transfer direction (HOST_TO_DEVICE / DEVICE_TO_HOST) |
int pcie_ep_xfer_data_memcpy | ( | const struct device * | dev, |
uint64_t | pcie_addr, | ||
uintptr_t * | local_addr, | ||
uint32_t | size, | ||
enum pcie_ob_mem_type | ob_mem_type, | ||
enum xfer_direction | dir | ||
) |
Data transfer using memcpy.
Helper API to achieve data transfer with memcpy through PCIe outbound memory
dev | Pointer to the device structure for the driver instance |
pcie_addr | Host memory buffer address |
local_addr | Local memory buffer address |
size | Data transfer size (bytes) |
ob_mem_type | Hint if lowmem/highmem outbound region has to be used (PCIE_OB_LOWMEM / PCIE_OB_HIGHMEM / PCIE_OB_ANYMEM), should be PCIE_OB_LOWMEM if bus master cannot generate more than 32-bit address |
dir | Data transfer direction (HOST_TO_DEVICE / DEVICE_TO_HOST) |