20 #define DMAAPI_PREFIX_op 22 #define DMAAPI_PREFIX_op __op_ 26 #define DMAAPI_PREFIX_flat 28 #define DMAAPI_PREFIX_flat __flat_ 138 #define DMA_BI ( DMA_TX | DMA_RX ) 147 #define DMAAPI_INLINE( _subsys, _api_func ) \ 148 SINGLE_API_INLINE ( DMAAPI_PREFIX_ ## _subsys, _api_func ) 157 #define PROVIDE_DMAAPI( _subsys, _api_func, _func ) \ 158 PROVIDE_SINGLE_API ( DMAAPI_PREFIX_ ## _subsys, _api_func, _func ) 166 #define PROVIDE_DMAAPI_INLINE( _subsys, _api_func ) \ 167 PROVIDE_SINGLE_API_INLINE ( DMAAPI_PREFIX_ ## _subsys, _api_func ) int(* map)(struct dma_device *dma, struct dma_mapping *map, physaddr_t addr, size_t len, int flags)
Map buffer for DMA.
static __always_inline void struct dma_mapping size_t size_t align
struct dma_device * dma
DMA device (if unmapping is required)
static __always_inline void dma_init(struct dma_device *dma, struct dma_operations *op)
Initialise DMA device.
physaddr_t dma_phys(struct dma_mapping *map, physaddr_t addr)
Get DMA address from physical address.
struct dma_operations * op
DMA operations.
static __always_inline void dma_set_mask_64bit(struct dma_device *dma)
Set 64-bit addressable space mask.
static void *__malloc malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
void(* unmap)(struct dma_device *dma, struct dma_mapping *map)
Unmap buffer.
static __always_inline unsigned long virt_to_phys(volatile const void *addr)
Convert virtual address to a physical address.
static __always_inline int struct dma_mapping physaddr_t addr __unused
Dynamic memory allocation.
physaddr_t mask
Addressable space mask.
static __always_inline void struct dma_mapping size_t len
uint32_t userptr_t
A pointer to a user buffer.
static __always_inline int dma_mapped(struct dma_mapping *map)
Check if DMA unmapping is required.
void dma_free(struct dma_mapping *map, void *addr, size_t len)
Unmap and free DMA-coherent buffer.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define DMAAPI_INLINE(_subsys, _api_func)
Calculate static inline DMA I/O API function name.
void dma_unmap(struct dma_mapping *map)
Unmap buffer.
physaddr_t offset
Address offset.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
void dma_set_mask(struct dma_device *dma, physaddr_t mask)
Set addressable space mask.
void(* set_mask)(struct dma_device *dma, physaddr_t mask)
Set addressable space mask.
#define __always_inline
Declare a function to be always inline.
static __always_inline int struct dma_mapping * map
unsigned int mapped
Total number of mappings (for debugging)
void * dma_alloc(struct dma_device *dma, struct dma_mapping *map, size_t len, size_t align)
Allocate and map DMA-coherent buffer.
static uint16_t struct vmbus_xfer_pages_operations * op
unsigned int allocated
Total number of allocations (for debugging)
void dma_ufree(struct dma_mapping *map, userptr_t addr, size_t len)
Unmap and free DMA-coherent buffer from external (user) memory.
static __always_inline void ufree(userptr_t userptr)
Free external memory.
static __always_inline userptr_t umalloc(size_t size)
Allocate external memory.
void * token
Platform mapping token.
userptr_t(* umalloc)(struct dma_device *dma, struct dma_mapping *map, size_t len, size_t align)
Allocate and map DMA-coherent buffer from external (user) memory.
static void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
userptr_t dma_umalloc(struct dma_device *dma, struct dma_mapping *map, size_t len, size_t align)
Allocate and map DMA-coherent buffer from external (user) memory.
void(* ufree)(struct dma_device *dma, struct dma_mapping *map, userptr_t addr, size_t len)
Unmap and free DMA-coherent buffer from external (user) memory.
void(* free)(struct dma_device *dma, struct dma_mapping *map, void *addr, size_t len)
Unmap and free DMA-coherent buffer.
static __always_inline physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
#define NULL
NULL pointer (VOID *)