1 /** 2 * \file 3 * \brief DMA space C interface. 4 */ 5 /* 6 * (c) 2014 Alexander Warg <alexander.warg@kernkonzept.com> 7 * 8 * This file is part of TUD:OS and distributed under the terms of the 9 * GNU General Public License 2. 10 * Please see the COPYING-GPL-2 file for details. 11 * 12 * As a special exception, you may use this file as part of a free software 13 * library without restriction. Specifically, if other files instantiate 14 * templates or use macros or inline functions from this file, or you compile 15 * this file and link it with other files to produce an executable, this 16 * file does not by itself cause the resulting executable to be covered by 17 * the GNU General Public License. This exception does not however 18 * invalidate any other reasons why the executable file might be covered by 19 * the GNU General Public License. 20 */ 21 #pragma once 22 23 /** 24 * \defgroup api_l4re_c_dma DMA Space Interface 25 * \ingroup api_l4re_c 26 * \brief DMA Space C interface. 27 */ 28 29 #include <l4/sys/types.h> 30 #include <l4/re/c/dataspace.h> 31 32 EXTERN_C_BEGIN 33 34 /** 35 * \copydoc L4Re::Dma_space::Direction 36 */ 37 enum l4re_dma_space_direction 38 { 39 L4RE_DMA_SPACE_BIDIRECTIONAL, /**< device reads and writes to the memory */ 40 L4RE_DMA_SPACE_TO_DEVICE, /**< device reads the memory */ 41 L4RE_DMA_SPACE_FROM_DEVICE, /**< device writes to the memory */ 42 L4RE_DMA_SPACE_NONE /**< device is coherently connected */ 43 }; 44 45 /** 46 * \copydoc L4Re::Dma_space::Space_attrib 47 */ 48 enum l4re_dma_space_space_attribs 49 { 50 L4RE_DMA_SPACE_COHERENT = 1 << 0, ///< \copydoc L4Re::Dma_space::Coherent 51 L4RE_DMA_SPACE_PHYS_SPACE = 1 << 1, ///< \copydoc L4Re::Dma_space::Phys_space 52 }; 53 54 /** 55 * \brief DMA space capability type 56 * \copydoc L4Re::Dma_space 57 * \ingroup api_l4re_c_dma 58 */ 59 typedef l4_cap_idx_t l4re_dma_space_t; 60 61 /** Data type for DMA addresses. */ 62 typedef l4_uint64_t l4re_dma_space_dma_addr_t; 63 64 /** 65 * \param dma DMA space capability 66 * \copydoc L4Re::Dma_space::map 67 * \ingroup api_l4re_c_dma 68 */ 69 L4_CV long 70 l4re_dma_space_map(l4re_dma_space_t dma, l4re_ds_t src, 71 l4re_ds_offset_t offset, 72 l4_size_t * size, unsigned long attrs, 73 enum l4re_dma_space_direction dir, 74 l4re_dma_space_dma_addr_t *dma_addr) L4_NOTHROW; 75 76 77 /** 78 * \param dma DMA space capability 79 * \copydoc L4Re::Dma_space::unmap 80 * \ingroup api_l4re_c_dma 81 */ 82 L4_CV long 83 l4re_dma_space_unmap(l4re_dma_space_t dma, l4re_dma_space_dma_addr_t dma_addr, 84 l4_size_t size, unsigned long attrs, 85 enum l4re_dma_space_direction dir) L4_NOTHROW; 86 87 /** 88 * \param dma DMA space capability 89 * \copydoc L4Re::Dma_space::associate 90 * \ingroup api_l4re_c_dma 91 */ 92 L4_CV long 93 l4re_dma_space_associate(l4re_dma_space_t dma, l4_cap_idx_t dma_task, 94 unsigned long attr) L4_NOTHROW; 95 96 /** 97 * \param dma DMA space capability 98 * \copydoc L4Re::Dma_space::disassociate 99 * \ingroup api_l4re_c_dma 100 */ 101 L4_CV long 102 l4re_dma_space_disassociate(l4re_dma_space_t dma); 103 104 105 EXTERN_C_END 106