![]() |
Ultibo API
C/C++ API for Ultibo Core
|
#include "ultibo/globaltypes.h"#include "ultibo/globalconst.h"#include "ultibo/system.h"#include "ultibo/devices.h"Go to the source code of this file.
Data Structures | |
| struct | _DMA_PROPERTIES |
| struct | _DMA_HOST |
| struct | _DMA_REQUEST |
Macros | |
| #define | DMA_NAME_PREFIX "DMA" |
| Name prefix for DMA Hosts. | |
| #define | DMA_TYPE_NONE 0 |
| #define | DMA_STATE_DISABLED 0 |
| #define | DMA_STATE_ENABLED 1 |
| #define | DMA_FLAG_NONE 0x00000000 |
| #define | DMA_FLAG_SHARED 0x00000001 |
| Host requires data buffers in shared memory. | |
| #define | DMA_FLAG_NOCACHE 0x00000002 |
| Host requires data buffers in non cached memory. | |
| #define | DMA_FLAG_COHERENT 0x00000004 |
| Data buffers are cache coherent if allocated according to host configuration. | |
| #define | DMA_FLAG_STRIDE 0x00000008 |
| Host supports 2D stride on source and/or dest address. | |
| #define | DMA_FLAG_DREQ 0x00000010 |
| Host supports data request gating (DREQ) on source and/or dest address. | |
| #define | DMA_FLAG_NOINCREMENT 0x00000020 |
| Host supports no increment on source and/or dest address. | |
| #define | DMA_FLAG_NOREAD 0x00000040 |
| Host supports no read from source address (write to dest address only) (Zero fill the destination). | |
| #define | DMA_FLAG_NOWRITE 0x00000080 |
| Host supports no write to dest address (read from source address only) (Cache fill from the source). | |
| #define | DMA_FLAG_WIDE 0x00000100 |
| Host supports wide read and/or write. | |
| #define | DMA_FLAG_BULK 0x00000200 |
| Host supports bulk transfer. | |
| #define | DMA_FLAG_LITE 0x00000400 |
| Host supports "lite" transfer. | |
| #define | DMA_FLAG_40BIT 0x00000800 |
| Host supports 40-bit address transfer. | |
| #define | DMA_REQUEST_FLAG_NONE 0x00000000 |
| #define | DMA_REQUEST_FLAG_RELEASE 0x00000001 |
| If set then release the request automatically after completion. | |
| #define | DMA_REQUEST_FLAG_CYCLIC 0x00000002 |
| This is a cyclic request which loops around from tail to head. | |
| #define | DMA_REQUEST_FLAG_COMPATIBLE 0x00000004 |
| If set then all buffers supplied are host configuration compatible (Sizing, Alignment, Flags). | |
Typedefs | |
| typedef struct _DMA_PROPERTIES | DMA_PROPERTIES |
| typedef struct _DMA_HOST | DMA_HOST |
| typedef struct _DMA_REQUEST | DMA_REQUEST |
| Forward declared to satisfy DMAHost. | |
| typedef uint32_t STDCALL(* | dma_enumerate_cb) (DMA_HOST *dma, void *data) |
| typedef uint32_t STDCALL(* | dma_notification_cb) (DEVICE *device, void *data, uint32_t notification) |
| typedef uint32_t STDCALL(* | dma_host_start_proc) (DMA_HOST *dma) |
| typedef uint32_t STDCALL(* | dma_host_stop_proc) (DMA_HOST *dma) |
| typedef uint32_t STDCALL(* | dma_host_reset_proc) (DMA_HOST *dma) |
| typedef uint32_t STDCALL(* | dma_host_submit_proc) (DMA_HOST *dma, DMA_REQUEST *request) |
| typedef uint32_t STDCALL(* | dma_host_cancel_proc) (DMA_HOST *dma, DMA_REQUEST *request) |
| typedef uint32_t STDCALL(* | dma_host_properties_proc) (DMA_HOST *dma, DMA_PROPERTIES *properties) |
| typedef void STDCALL(* | dma_request_completed_cb) (DMA_REQUEST *request) |
Functions | |
| uint32_t STDCALL | dma_host_start (DMA_HOST *dma) |
| uint32_t STDCALL | dma_host_stop (DMA_HOST *dma) |
| uint32_t STDCALL | dma_host_reset (DMA_HOST *dma) |
| uint32_t STDCALL | dma_host_properties (DMA_HOST *dma, DMA_PROPERTIES *properties) |
| DMA_HOST *STDCALL | dma_host_create (void) |
| Create a new DMA entry. | |
| DMA_HOST *STDCALL | dma_host_create_ex (uint32_t size) |
| Create a new DMA entry. | |
| uint32_t STDCALL | dma_host_destroy (DMA_HOST *dma) |
| Destroy an existing DMA entry. | |
| uint32_t STDCALL | dma_host_register (DMA_HOST *dma) |
| Register a new DMA in the DMA host table. | |
| uint32_t STDCALL | dma_host_deregister (DMA_HOST *dma) |
| Deregister a DMA from the DMA host table. | |
| DMA_HOST *STDCALL | dma_host_find (uint32_t dmaid) |
| uint32_t STDCALL | dma_host_enumerate (dma_enumerate_cb callback, void *data) |
| uint32_t STDCALL | dma_host_notification (DMA_HOST *dma, dma_notification_cb callback, void *data, uint32_t notification, uint32_t flags) |
| uint32_t STDCALL | dma_data_count (DMA_DATA *data) |
| Return the total number of data blocks in the linked list. | |
| uint32_t STDCALL | dma_data_flags (DMA_DATA *data) |
| Return the combined flags of the data blocks in the linked list. | |
| uint32_t STDCALL | dma_data_maximum (DMA_DATA *data) |
| Return the size of the largest data block in the linked list. | |
| void *STDCALL | dma_buffer_allocate (DMA_HOST *dma, uint32_t size) |
| Allocate a data buffer for a DMA request. | |
| void *STDCALL | dma_buffer_allocate_ex (DMA_HOST *dma, uint32_t *size) |
| Allocate a data buffer for a DMA request. | |
| uint32_t STDCALL | dma_buffer_validate (DMA_HOST *dma, void *buffer, uint32_t size) |
| Validate a data buffer for a DMA request against the DMA host requirements. | |
| uint32_t STDCALL | dma_buffer_release (void *buffer) |
| Release a data buffer from a DMA request. | |
| DMA_REQUEST *STDCALL | dma_request_allocate (DMA_HOST *dma, DMA_DATA *data, dma_request_completed_cb callback, void *driverdata, uint32_t direction, uint32_t peripheral, uint32_t flags) |
| Allocate a new DMA request. | |
| uint32_t STDCALL | dma_request_release (DMA_REQUEST *request) |
| Release and destroy a DMA request. | |
| uint32_t STDCALL | dma_request_submit (DMA_REQUEST *request) |
| Submit a DMA request to a DMA host. | |
| uint32_t STDCALL | dma_request_cancel (DMA_REQUEST *request) |
| Cancel a DMA request previously submitted to a DMA host. | |
| void STDCALL | dma_request_complete (DMA_REQUEST *request) |
| Called by a DMA host when a DMA request completes. | |
| uint32_t STDCALL | dma_transfer_request (DMA_HOST *dma, DMA_DATA *data, uint32_t direction, uint32_t peripheral, uint32_t flags, uint32_t timeout) |
| Perform a DMA transfer request with the supplied data blocks on the supplied host. | |
| uint32_t STDCALL | dma_transfer_request_ex (DMA_HOST *dma, DMA_DATA *data, dma_request_completed_cb callback, void *driverdata, uint32_t direction, uint32_t peripheral, uint32_t flags) |
| Perform a DMA transfer request with the supplied data blocks on the supplied host. | |
| void STDCALL | dma_transfer_request_complete (DMA_REQUEST *request) |
| Called when a DMA transfer request completes. | |
| uint32_t STDCALL | dma_get_count (void) |
| Get the current DMA host count. | |
| DMA_HOST *STDCALL | dma_host_get_default (void) |
| Get the current default DMA host. | |
| uint32_t STDCALL | dma_host_set_default (DMA_HOST *dma) |
| Set the current default DMA device. | |
| DMA_HOST *STDCALL | dma_host_check (DMA_HOST *dma) |
| Check if the supplied DMA is in the DMA host table. | |
| uint32_t STDCALL | dma_type_to_string (uint32_t dmatype, char *string, uint32_t len) |
| Convert a DMA type value to a string. | |
| uint32_t STDCALL | dma_state_to_string (uint32_t dmastate, char *string, uint32_t len) |
| Convert a DMA state value to a string. | |
| #define DMA_NAME_PREFIX "DMA" |
Name prefix for DMA Hosts.
DMA specific constants
| #define DMA_TYPE_NONE 0 |
DMA Host Types
| #define DMA_STATE_DISABLED 0 |
DMA Host States
| #define DMA_STATE_ENABLED 1 |
| #define DMA_FLAG_NONE 0x00000000 |
DMA Host Flags
| #define DMA_FLAG_SHARED 0x00000001 |
Host requires data buffers in shared memory.
| #define DMA_FLAG_NOCACHE 0x00000002 |
Host requires data buffers in non cached memory.
| #define DMA_FLAG_COHERENT 0x00000004 |
Data buffers are cache coherent if allocated according to host configuration.
| #define DMA_FLAG_STRIDE 0x00000008 |
Host supports 2D stride on source and/or dest address.
| #define DMA_FLAG_DREQ 0x00000010 |
Host supports data request gating (DREQ) on source and/or dest address.
| #define DMA_FLAG_NOINCREMENT 0x00000020 |
Host supports no increment on source and/or dest address.
| #define DMA_FLAG_NOREAD 0x00000040 |
Host supports no read from source address (write to dest address only) (Zero fill the destination).
| #define DMA_FLAG_NOWRITE 0x00000080 |
Host supports no write to dest address (read from source address only) (Cache fill from the source).
| #define DMA_FLAG_WIDE 0x00000100 |
Host supports wide read and/or write.
| #define DMA_FLAG_BULK 0x00000200 |
Host supports bulk transfer.
| #define DMA_FLAG_LITE 0x00000400 |
Host supports "lite" transfer.
| #define DMA_FLAG_40BIT 0x00000800 |
Host supports 40-bit address transfer.
| #define DMA_REQUEST_FLAG_NONE 0x00000000 |
DMA Data Flags See: Platform DMA_DATA_FLAG_* DMA Request Flags
| #define DMA_REQUEST_FLAG_RELEASE 0x00000001 |
If set then release the request automatically after completion.
| #define DMA_REQUEST_FLAG_CYCLIC 0x00000002 |
This is a cyclic request which loops around from tail to head.
| #define DMA_REQUEST_FLAG_COMPATIBLE 0x00000004 |
If set then all buffers supplied are host configuration compatible (Sizing, Alignment, Flags).
| typedef struct _DMA_PROPERTIES DMA_PROPERTIES |
DMA specific types DMA Properties
| typedef struct _DMA_REQUEST DMA_REQUEST |
Forward declared to satisfy DMAHost.
DMA Notification Callback
| typedef uint32_t STDCALL(* dma_host_submit_proc) (DMA_HOST *dma, DMA_REQUEST *request) |
| typedef uint32_t STDCALL(* dma_host_cancel_proc) (DMA_HOST *dma, DMA_REQUEST *request) |
| typedef uint32_t STDCALL(* dma_host_properties_proc) (DMA_HOST *dma, DMA_PROPERTIES *properties) |
| typedef void STDCALL(* dma_request_completed_cb) (DMA_REQUEST *request) |
DMA Request DMA Request Methods
| uint32_t STDCALL dma_host_properties | ( | DMA_HOST * | dma, |
| DMA_PROPERTIES * | properties ) |
Create a new DMA entry.
Create a new DMA entry.
| Size | Size in bytes to allocate for new DMA (Including the DMA entry) |
| uint32_t STDCALL dma_host_enumerate | ( | dma_enumerate_cb | callback, |
| void * | data ) |
| uint32_t STDCALL dma_host_notification | ( | DMA_HOST * | dma, |
| dma_notification_cb | callback, | ||
| void * | data, | ||
| uint32_t | notification, | ||
| uint32_t | flags ) |
Return the total number of data blocks in the linked list.
DMA Data Functions
Return the combined flags of the data blocks in the linked list.
Return the size of the largest data block in the linked list.
Allocate a data buffer for a DMA request.
DMA Buffer Functions
| DMA | The DMA host that the request will be sent to |
| Size | The size of the data buffer to allocate |
Allocate a data buffer for a DMA request.
| DMA | The DMA host that the request will be sent to |
| Size | The size of the data buffer to allocate (Updated on return to actual size) |
Validate a data buffer for a DMA request against the DMA host requirements.
| DMA | The DMA host that the request will be sent to |
| Buffer | The data buffer to validate |
| Size | The size of the data buffer |
| uint32_t STDCALL dma_buffer_release | ( | void * | buffer | ) |
Release a data buffer from a DMA request.
| Data | The buffer to be released |
| DMA_REQUEST *STDCALL dma_request_allocate | ( | DMA_HOST * | dma, |
| DMA_DATA * | data, | ||
| dma_request_completed_cb | callback, | ||
| void * | driverdata, | ||
| uint32_t | direction, | ||
| uint32_t | peripheral, | ||
| uint32_t | flags ) |
Allocate a new DMA request.
DMA Request Functions
| DMA | The DMA host this request will be sent to |
| Data | A linked list of DMA data blocks for the transfer (Optional) |
| Callback | The callback function to be called on completion of the request |
| DriverData | Driver private data for the callback (Optional) |
| Direction | The direction of the DMA request (eg DMA_DIR_MEM_TO_MEM) |
| Peripheral | The peripheral ID for data request gating (eg DMA_DREQ_ID_NONE) |
| Flags | Additional flags for this request (eg DMA_REQUEST_FLAG_CYCLIC) |
| uint32_t STDCALL dma_request_release | ( | DMA_REQUEST * | request | ) |
Release and destroy a DMA request.
| Request | The request to be released |
| uint32_t STDCALL dma_request_submit | ( | DMA_REQUEST * | request | ) |
Submit a DMA request to a DMA host.
| Request | The request to be submitted |
| uint32_t STDCALL dma_request_cancel | ( | DMA_REQUEST * | request | ) |
Cancel a DMA request previously submitted to a DMA host.
| Request | The request to be cancelled |
| void STDCALL dma_request_complete | ( | DMA_REQUEST * | request | ) |
Called by a DMA host when a DMA request completes.
| Request | The DMA request which has completed |
| uint32_t STDCALL dma_transfer_request | ( | DMA_HOST * | dma, |
| DMA_DATA * | data, | ||
| uint32_t | direction, | ||
| uint32_t | peripheral, | ||
| uint32_t | flags, | ||
| uint32_t | timeout ) |
Perform a DMA transfer request with the supplied data blocks on the supplied host.
DMA Transfer Functions
| DMA | The DMA host to execute the request on |
| Data | A linked list of DMA data blocks for the transfer |
| Direction | The direction of the DMA request (eg DMA_DIR_MEM_TO_MEM) |
| Peripheral | The peripheral ID for data request gating (eg DMA_DREQ_ID_NONE) |
| Flags | Additional flags for this transfer request (eg DMA_REQUEST_FLAG_CYCLIC) |
| Timeout | Milliseconds to wait for request to complete (INFINITE to wait forever) |
| uint32_t STDCALL dma_transfer_request_ex | ( | DMA_HOST * | dma, |
| DMA_DATA * | data, | ||
| dma_request_completed_cb | callback, | ||
| void * | driverdata, | ||
| uint32_t | direction, | ||
| uint32_t | peripheral, | ||
| uint32_t | flags ) |
Perform a DMA transfer request with the supplied data blocks on the supplied host.
| DMA | The DMA host to execute the request on |
| Data | A linked list of DMA data blocks for the transfer |
| Callback | The callback function to be called on completion of the request |
| DriverData | Driver private data for the callback (Optional) |
| Direction | The direction of the DMA request (eg DMA_DIR_MEM_TO_MEM) |
| Peripheral | The peripheral ID for data request gating (eg DMA_DREQ_ID_NONE) |
| Flags | Additional flags for this transfer request (eg DMA_REQUEST_FLAG_CYCLIC) |
| void STDCALL dma_transfer_request_complete | ( | DMA_REQUEST * | request | ) |
Called when a DMA transfer request completes.
| Request | The DMA request which has completed |
| uint32_t STDCALL dma_get_count | ( | void | ) |
Get the current DMA host count.
DMA Helper Functions
Check if the supplied DMA is in the DMA host table.
| uint32_t STDCALL dma_type_to_string | ( | uint32_t | dmatype, |
| char * | string, | ||
| uint32_t | len ) |
Convert a DMA type value to a string.
| uint32_t STDCALL dma_state_to_string | ( | uint32_t | dmastate, |
| char * | string, | ||
| uint32_t | len ) |
Convert a DMA state value to a string.