A DMA region descriptor is an object defining a contiguous DMA region. DMA descriptors can be chained to describe scattered regions. (The DMA mapping function itself will be defined as a PCI function, as the DMA is a PCI device) Note that this file is not included in include/odp.h as it does not belong to the ODP-application interface.
Signed-off-by: Christophe Milard <christophe.mil...@linaro.org> --- include/odp/api/dma.h | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 include/odp/api/dma.h diff --git a/include/odp/api/dma.h b/include/odp/api/dma.h new file mode 100644 index 0000000..2cabcec --- /dev/null +++ b/include/odp/api/dma.h @@ -0,0 +1,102 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * DMA descriptor and related operations. + */ + +#ifndef ODP_API_DMA_H_ +#define ODP_API_DMA_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @defgroup odp_dma DMA + * @{ + */ + +/** + * @typedef odp_dma_addr_t + * DMA address (iether physical or iova) + */ + +/** + * @typedef odp_dma_map_t + * DMA map region descriptor + * DMA map region descriptors are returned by ODP (on request) and describe + * how a DMA mapping should be done to access a given resource + * (sucha as a packet pool or a memory area). + * If needed (i.e. if the DMA region is scattered), the returned region can + * link to others (odp_dma_map_get_next() then returns valid region(s)), hence + * allowing a scattered region to be described. + * Regions descriptor are used to request DMA mapping for NIC devices. + * Region descriptors must be released using odp_dma_map_free(). + */ + +/** + * @def ODP_DMA_REG_INVALID + * Invalid DMA region + */ + +/* operations on DMA maps: */ + +/** + * Get the DMA region user address. + * + * @param an ODP DMA region descriptor + * + * @retval the virtual userland address for the region + */ +void *odp_dma_map_get_addr(odp_dma_map_t map); + +/** + * Get the DMA region DMA address. + * + * @param an ODP DMA region descriptor + * + * @retval the DMA address (i.e. physical or iova) for the region + */ +odp_dma_addr_t odp_dma_map_get_dma_addr(odp_dma_map_t map); + +/** + * Get the DMA region size. + * + * @param an ODP DMA region descriptor + * + * @retval size (in bytes) for the region + */ +int odp_dma_map_get_size(odp_dma_map_t map); + +/** + * Get the following region (if any). + * + * @param an ODP DMA region descriptor + * + * @retval a DMA region descriptor describing the next fragment + * (if any) of a scattered region. Returns ODP_DMA_REG_INVALID if none. + */ +odp_dma_map_t odp_dma_map_get_next(odp_dma_map_t map); + +/** + * Free a region descriptor. The region must be unmapped first. + * + * @param an unmapped ODP DMA region descriptor + * + */ +void odp_dma_map_free(odp_dma_map_t map); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* ODP_API_DMA_H_ */ -- 2.1.4 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp