CRpi
A library for rpi with intefaces to: gpio, pwm, dma
|
Provides a way to easily allocate memory areas that are coherent between CPU and DMA. More...
#include <stdint.h>
#include <stddef.h>
Go to the source code of this file.
Data Structures | |
struct | ccmb_desc_struct |
Describes a Cache Coherent Memory Block allocated by ccmp_malloc() More... | |
Typedefs | |
typedef struct ccmb_desc_struct | Ccmb_desc |
Describes a Cache Coherent Memory Block allocated by ccmp_malloc() | |
Functions | |
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. More... | |
int | ccmp_free (Ccmb_desc *allocatedAreaDesc) |
Frees a block allocated with ccmp_malloc() More... | |
uintptr_t | ccmp_virtAddrToBusAddr (Ccmb_desc *desc, void *virtAddr) |
Converts a virtual address inside the block described by desc to it's bus address. More... | |
Provides a way to easily allocate memory areas that are coherent between CPU and DMA.
This files provides functions to get blocks of memory with known associated physical address that are cache coherent. This is useful when interfacing with peripherals that access memory directly, bypassing the L1 or L2 caches, like the DMA.
int ccmp_free | ( | Ccmb_desc * | allocatedAreaDesc | ) |
Frees a block allocated with ccmp_malloc()
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.
reqSize | The size of the block to be allocated. |
allocatedAreaDesc | Here will be returned the descriptor for the allocated block |
byteAlignment | The allocated block will be aligned to this value |
uintptr_t ccmp_virtAddrToBusAddr | ( | Ccmb_desc * | desc, |
void * | virtAddr | ||
) |
Converts a virtual address inside the block described by desc to it's bus address.