Linux-generic implementation of the function returning a DMA mapping descriptor for an allocated shared memory block.
Signed-off-by: Christophe Milard <christophe.mil...@linaro.org> --- platform/linux-generic/odp_shared_memory.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/platform/linux-generic/odp_shared_memory.c b/platform/linux-generic/odp_shared_memory.c index ab48dda..6ef89c8 100644 --- a/platform/linux-generic/odp_shared_memory.c +++ b/platform/linux-generic/odp_shared_memory.c @@ -13,6 +13,7 @@ #include <odp/align.h> #include <odp/system_info.h> #include <odp/debug.h> +#include <odp_dma_internal.h> #include <odp_debug_internal.h> #include <odp_align_internal.h> #include <odp/config.h> @@ -363,6 +364,31 @@ int odp_shm_info(odp_shm_t shm, odp_shm_info_t *info) return 0; } +odp_dma_map_t odp_shm_get_dma_map(odp_shm_t shm) +{ + odp_shm_block_t *block; + uint32_t i; + dma_map_t *dma_map; + + i = from_handle(shm); + + if (i > (ODP_CONFIG_SHM_BLOCKS - 1)) + return ODP_DMA_REGION_INVALID; + + block = &odp_shm_tbl->block[i]; + if (!(block->flags & ODP_SHM_DMA)) + return ODP_DMA_REGION_INVALID; + + dma_map = _odp_dma_map_alloc(); + if (odp_unlikely(dma_map == NULL)) + return ODP_DMA_REGION_INVALID; + + dma_map->addr = block->addr; + dma_map->dma_addr = (odp_dma_addr_t)block->addr; + dma_map->size = block->size; + + return (odp_dma_map_t)dma_map; +} void odp_shm_print_all(void) { -- 2.1.4 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp