libmetal
Loading...
Searching...
No Matches
dma.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016, Xilinx Inc. and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7/*
8 * @file dma.h
9 * @brief DMA primitives for libmetal.
10 */
11
12#ifndef __METAL_DMA__H__
13#define __METAL_DMA__H__
14
15#include <stdint.h>
16#include <metal/sys.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
25
26#define METAL_DMA_DEV_R 1
27#define METAL_DMA_DEV_W 2
28#define METAL_DMA_DEV_WR 3
29
33struct metal_sg {
34 void *virt;
36 int len;
37};
38
39struct metal_device;
40
53int metal_dma_map(struct metal_device *dev,
54 uint32_t dir,
55 struct metal_sg *sg_in,
56 int nents_in,
57 struct metal_sg *sg_out);
58
69void metal_dma_unmap(struct metal_device *dev,
70 uint32_t dir,
71 struct metal_sg *sg,
72 int nents);
73
75
76#ifdef __cplusplus
77}
78#endif
79
80#endif /* __METAL_DMA__H__ */
void metal_dma_unmap(struct metal_device *dev, uint32_t dir, struct metal_sg *sg, int nents)
Unmap DMA memory After the memory is DMA unmapped, the memory should be accessed by the CPU but not t...
Definition dma.c:39
int metal_dma_map(struct metal_device *dev, uint32_t dir, struct metal_sg *sg_in, int nents_in, struct metal_sg *sg_out)
Map memory for DMA transaction. After the memory is DMA mapped, the memory should be accessed by the ...
Definition dma.c:14
Definition device.h:72
Definition io.h:73
scatter/gather list element structure
Definition dma.h:33
struct metal_io_region * io
Definition dma.h:35
int len
Definition dma.h:36
void * virt
Definition dma.h:34