libmetal
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
DMA Interfaces

Data Structures

struct  metal_sg
 scatter/gather list element structure More...
 

Macros

#define METAL_DMA_DEV_R   1
 
#define METAL_DMA_DEV_W   2
 
#define METAL_DMA_DEV_WR   3
 

Functions

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 DMA device but not the CPU. More...
 
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 the DMA device. More...
 

Detailed Description

Macro Definition Documentation

◆ METAL_DMA_DEV_R

#define METAL_DMA_DEV_R   1

DMA direction, device read

◆ METAL_DMA_DEV_W

#define METAL_DMA_DEV_W   2

DMA direction, device write

◆ METAL_DMA_DEV_WR

#define METAL_DMA_DEV_WR   3

DMA direction, device read/write

Function Documentation

◆ metal_dma_map()

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 DMA device but not the CPU.

Parameters
[in]devDMA device
[in]dirDMA direction
[in]sg_insg list of memory to map
[in]nents_innumber of sg list entries of memory to map
[out]sg_outsg list of mapped memory
Returns
number of mapped sg entries, -error on failure.

◆ metal_dma_unmap()

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 the DMA device.

Parameters
[in]devDMA device
[in]dirDMA direction
[in]sgsg list of mapped DMA memory
[in]nentsnumber of sg list entries of DMA memory