CRpi
A library for rpi with intefaces to: gpio, pwm, dma
cacheCoherentMemoryProvider.h
Go to the documentation of this file.
1 #ifndef CACHE_COHERENT_MEMORY_PROVIDER_H
2 #define CACHE_COHERENT_MEMORY_PROVIDER_H
3 
4 #include <stdint.h>
5 #include <stddef.h>//for size_t
6 
7 
8 
23 typedef struct ccmb_desc_struct
24 {
26  uint32_t mem_alloc_handle; //return value of mem_alloc(...) from mailbox.c
28  uintptr_t bus_address; //from mem_lock(...)
30  void* virt_address; //from mmap
32  size_t size;
33 }Ccmb_desc;
34 
35 int ccmp_malloc(size_t reqSize, Ccmb_desc* allocatedAreaDesc, unsigned int byteAlignment);
36 
37 int ccmp_free(Ccmb_desc* allocatedAreaDesc);
38 
39 uintptr_t ccmp_virtAddrToBusAddr(Ccmb_desc* desc, void* virtAddr);
40 
41 
42 
43 #endif
int ccmp_free(Ccmb_desc *allocatedAreaDesc)
Frees a block allocated with ccmp_malloc()
Definition: cacheCoherentMemoryProvider.cpp:53
uint32_t mem_alloc_handle
A hande to the allocated block.
Definition: cacheCoherentMemoryProvider.h:26
Describes a Cache Coherent Memory Block allocated by ccmp_malloc()
Definition: cacheCoherentMemoryProvider.h:23
size_t size
The size of the block in bytes.
Definition: cacheCoherentMemoryProvider.h:32
void * virt_address
The virtual address of the block.
Definition: cacheCoherentMemoryProvider.h:30
uintptr_t bus_address
The bus address of the block.
Definition: cacheCoherentMemoryProvider.h:28
struct ccmb_desc_struct Ccmb_desc
Describes a Cache Coherent Memory Block allocated by ccmp_malloc()
uintptr_t ccmp_virtAddrToBusAddr(Ccmb_desc *desc, void *virtAddr)
Converts a virtual address inside the block described by desc to it&#39;s bus address.
Definition: cacheCoherentMemoryProvider.cpp:72
int ccmp_malloc(size_t reqSize, Ccmb_desc *allocatedAreaDesc, unsigned int byteAlignment)
Provides a way to easily allocate memory areas that are coherent between CPU and DMA.
Definition: cacheCoherentMemoryProvider.cpp:31