XenevaOS
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
dma.h File Reference
#include <Mm/pmmngr.h>
#include <Mm/vmmngr.h>
#include <aurora.h>
Include dependency graph for dma.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _au_dma_page_
 
struct  _au_dma_pool_
 
struct  _au_dma_global_class_
 

Macros

#define DMA_NUM_CLASSES   7
 
#define DMA_MAX_POOL_SIZE   512
 

Typedefs

typedef struct _au_dma_page_ AuDMAPage
 
typedef struct _au_dma_pool_ AuDMAPool
 
typedef struct _au_dma_global_class_ AuDMAGlobalClass
 

Functions

AU_EXTERN AU_EXPORT AuDMAPoolAuDMAPoolCreate (const char *name, size_t alloc_sz, size_t align, size_t boundary)
 AuDMAPoolCreate – create a new pool.
 
AU_EXTERN AU_EXPORT void * AuDMAPoolAlloc (AuDMAPool *pool, uint64_t *phys_out)
 AuDMAPoolAlloc – allocate a slot from desired pool.
 
AU_EXTERN AU_EXPORT void AuDMAPoolFree (AuDMAPool *pool, void *virt, uint64_t phys)
 AuDMAPoolFree – free up a slot within the pool.
 
AU_EXTERN AU_EXPORT void AuDMAPoolDestroy (AuDMAPool *pool)
 AuDMAPoolDestroy – completely destroy a pool.
 
AU_EXTERN AU_EXPORT void AuDMAGlobalClassInitialize (AuDMAGlobalClass *gclass, char *name)
 AuDMAGlobalClassInitialize – initialize and populate global class structure.
 
AU_EXTERN AU_EXPORT void * AuDMAGClassAlloc (AuDMAGlobalClass *gClass, size_t sz, uint64_t *physOut)
 AuDMAGClassAlloc – allocate memory from DMA Global Class.
 
AU_EXTERN AU_EXPORT void AuDMAGClassFree (AuDMAGlobalClass *gClass, void *virt, uint64_t physOut, size_t sz)
 AuDMAGClassFree – free a memory and put it to gclass pool.
 
AU_EXTERN AU_EXPORT void AuDMAGClassDestroy (AuDMAGlobalClass *gClass)
 AuDMAGClassDestroy – destroy entire dma global class.
 

Macro Definition Documentation

◆ DMA_MAX_POOL_SIZE

#define DMA_MAX_POOL_SIZE   512

◆ DMA_NUM_CLASSES

#define DMA_NUM_CLASSES   7

Typedef Documentation

◆ AuDMAGlobalClass

◆ AuDMAPage

typedef struct _au_dma_page_ AuDMAPage

◆ AuDMAPool

typedef struct _au_dma_pool_ AuDMAPool

Function Documentation

◆ AuDMAGClassAlloc()

AU_EXTERN AU_EXPORT void * AuDMAGClassAlloc ( AuDMAGlobalClass gClass,
size_t  sz,
uint64_t physOut 
)

AuDMAGClassAlloc – allocate memory from DMA Global Class.

Parameters
gClass– pointer to gClass
sz– size to allocate
physOut– where to put the physical output

return a full 4KiB page for larger than MAX_POOL_SZ

or allocate it using pool allocator

◆ AuDMAGClassDestroy()

AU_EXTERN AU_EXPORT void AuDMAGClassDestroy ( AuDMAGlobalClass gClass)

AuDMAGClassDestroy – destroy entire dma global class.

Parameters
gClass– pointer to gClass

◆ AuDMAGClassFree()

AU_EXTERN AU_EXPORT void AuDMAGClassFree ( AuDMAGlobalClass gClass,
void *  virt,
uint64_t  physOut,
size_t  sz 
)

AuDMAGClassFree – free a memory and put it to gclass pool.

Parameters
gClass– pointer to global class
virt– virtual address
physOut– physical address to put
sz– size of the allocated memory

◆ AuDMAGlobalClassInitialize()

AU_EXTERN AU_EXPORT void AuDMAGlobalClassInitialize ( AuDMAGlobalClass gclass,
char *  name 
)

AuDMAGlobalClassInitialize – initialize and populate global class structure.

Parameters
gclass– Pointer to allocated gclass
name– suitable gclass name

◆ AuDMAPoolAlloc()

AU_EXTERN AU_EXPORT void * AuDMAPoolAlloc ( AuDMAPool pool,
uint64_t phys_out 
)

AuDMAPoolAlloc – allocate a slot from desired pool.

Parameters
pool– pointer to pool memory
phys_out– where to store the physical address

◆ AuDMAPoolCreate()

AU_EXTERN AU_EXPORT AuDMAPool * AuDMAPoolCreate ( const char *  name,
size_t  alloc_sz,
size_t  align,
size_t  boundary 
)

AuDMAPoolCreate – create a new pool.

Parameters
name– name of the pool
alloc_sz– allocation unit size
align– alignment to check
boundary– ofcourse page boundary

◆ AuDMAPoolDestroy()

AU_EXTERN AU_EXPORT void AuDMAPoolDestroy ( AuDMAPool pool)

AuDMAPoolDestroy – completely destroy a pool.

Parameters
pool– pointer to pool

◆ AuDMAPoolFree()

AU_EXTERN AU_EXPORT void AuDMAPoolFree ( AuDMAPool pool,
void *  virt,
uint64_t  phys 
)

AuDMAPoolFree – free up a slot within the pool.

Parameters
pool– pointer to dma pool
virt– virtual address to free
phys– physical address to free