-
Notifications
You must be signed in to change notification settings - Fork 0
API DMA
Functions
Not a complete list
Marks a transfer ready and sends to the Transfer System.
Prototype bool geneticc_dma_register_transfer(geneticc_dma_transfer_t* transfer)
Parameters
Name | Type | Description |
---|---|---|
transfer | geneticc_dma_transfer_t* | Contains data used to keep track of completed transfers, and a list of sub-transfers which contain data to configure the DMA engine. |
Returns
bool
True if the transfer was registered, or false if the transfer count has reached the maximum.
Example
int a[100];
int b[100];
//Source and destination used to keep track of what transfers have finished.
geneticc_dma_transfer_t* transfer = geneticc_dma_create_transfer(b, a, 100 * sizeof(int), false);
//Contains configuration data for the DMA engine.
geneticc_dma_subtransfer_t* subtransfer = geneticc_dma_create_subtransfer(b, a, 100 * sizeof(int), transfer, NULL);
//Queue transfer
geneticc_dma_register_transfer(transfer);
Remarks
It is not recommended to use the Transfer System outside of GeNETiCC's internal functions.
Using your systems native DMA API is faster, as GeNETiCC adds another layer on top of it.
Allocates a transfer, and initializes a list used to hold sub-transfers.
Prototype geneticc_dma_transfer_t* geneticc_dma_create_transfer(void* dest, void* src, size_t size, bool free_source)
Parameters
Name | Type | Description |
---|---|---|
dest | void* | Pointer to the destination "object," used to keep track of when a transfer is complete. *Should point to index 0 of the array, or the list. |
src | void* | Pointer to the source "object" for keeping track of when a transfer has completed. *Should point to index 0 of the array. |
size | size_t | Total size of the source array, NOT how many bytes are being transferred |
free_source | bool | Should the "src" be freed upon transfer completion? |
Returns
[geneticc_dma_transfer_t*](https://github.com/AddioElectronics/Generic-Array-C-gcc/wiki/DMA#geneticc_dma_transfer_t)
Pointer to the transfer.
Example
int a[100];
int b[100];
//Source and destination used to keep track of what transfers have finished.
geneticc_dma_transfer_t* transfer = geneticc_dma_create_transfer(b, a, 100 * sizeof(int), false);
//Contains configuration data for the DMA engine.
geneticc_dma_subtransfer_t* subtransfer = geneticc_dma_create_subtransfer(b, a, 100 * sizeof(int), transfer, NULL);
//Queue transfer
geneticc_dma_register_transfer(transfer);
Allocates a transfer, and initializes a list used to hold sub-transfers.
Prototype geneticc_dma_subtransfer_t* geneticc_dma_create_subtransfer(ARRAY_PTR dest, ARRAY_PTR src, size_t size, geneticc_dma_transfer_t* transfer, geneticc_dma_subtransfer_flags_t* flags)
Parameters
Name | Type | Description |
---|---|---|
dest | ARRAY_PTR | Pointer to the destination "object," used to keep track of when a transfer is complete. *Should point to index 0 of the array, or the list. |
src | ARRAY_PTR | Pointer to the source "object" for keeping track of when a transfer has completed. *Should point to index 0 of the array. |
size | size_t | The amount of bytes being transferred. |
transfer | geneticc_dma_transfer_t* | The parent transfer. *Can be null for synchronous operations. |
flags | geneticc_dma_subtransfer_flags_t* | Flags used to configure the DMA engine, and hold the status of the transfer. |
Returns
geneticc_dma_subtransfer_t*
Pointer to the sub-transfer.
Example
int a[100];
int b[100];
//Source and destination used to keep track of what transfers have finished.
geneticc_dma_transfer_t* transfer = geneticc_dma_create_transfer(b, a, 100 * sizeof(int), false);
//Contains configuration data for the DMA engine.
geneticc_dma_subtransfer_t* subtransfer = geneticc_dma_create_subtransfer(b, a, 100 * sizeof(int), transfer, NULL);
//Queue transfer
geneticc_dma_register_transfer(transfer);