39#define DMA_NAME_PREFIX "DMA"
42#define DMA_TYPE_NONE 0
45#define DMA_STATE_DISABLED 0
46#define DMA_STATE_ENABLED 1
49#define DMA_FLAG_NONE 0x00000000
50#define DMA_FLAG_SHARED 0x00000001
51#define DMA_FLAG_NOCACHE 0x00000002
52#define DMA_FLAG_COHERENT 0x00000004
53#define DMA_FLAG_STRIDE 0x00000008
54#define DMA_FLAG_DREQ 0x00000010
55#define DMA_FLAG_NOINCREMENT 0x00000020
56#define DMA_FLAG_NOREAD 0x00000040
57#define DMA_FLAG_NOWRITE 0x00000080
58#define DMA_FLAG_WIDE 0x00000100
59#define DMA_FLAG_BULK 0x00000200
60#define DMA_FLAG_LITE 0x00000400
61#define DMA_FLAG_40BIT 0x00000800
67#define DMA_REQUEST_FLAG_NONE 0x00000000
68#define DMA_REQUEST_FLAG_RELEASE 0x00000001
69#define DMA_REQUEST_FLAG_CYCLIC 0x00000002
70#define DMA_REQUEST_FLAG_COMPATIBLE 0x00000004
struct _DEVICE DEVICE
Definition devices.h:373
uint32_t STDCALL dma_host_properties(DMA_HOST *dma, DMA_PROPERTIES *properties)
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_host_register(DMA_HOST *dma)
Register a new DMA in the DMA host table.
uint32_t STDCALL dma_host_reset(DMA_HOST *dma)
void *STDCALL dma_buffer_allocate_ex(DMA_HOST *dma, uint32_t *size)
Allocate a data buffer for a DMA request.
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_state_to_string(uint32_t dmastate, char *string, uint32_t len)
Convert a DMA state value to a string.
uint32_t STDCALL dma_host_start(DMA_HOST *dma)
uint32_t STDCALL dma_get_count(void)
Get the current DMA host count.
uint32_t STDCALL(* dma_host_start_proc)(DMA_HOST *dma)
Definition dma.h:99
uint32_t STDCALL dma_host_destroy(DMA_HOST *dma)
Destroy an existing DMA entry.
uint32_t STDCALL(* dma_host_reset_proc)(DMA_HOST *dma)
Definition dma.h:101
uint32_t STDCALL dma_host_stop(DMA_HOST *dma)
uint32_t STDCALL dma_request_release(DMA_REQUEST *request)
Release and destroy a DMA request.
DMA_HOST *STDCALL dma_host_find(uint32_t dmaid)
uint32_t STDCALL dma_host_deregister(DMA_HOST *dma)
Deregister a DMA from the DMA host table.
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_host_submit_proc)(DMA_HOST *dma, DMA_REQUEST *request)
Definition dma.h:102
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_buffer_release(void *buffer)
Release a data buffer from a DMA request.
struct _DMA_PROPERTIES DMA_PROPERTIES
Definition dma.h:75
uint32_t STDCALL dma_host_enumerate(dma_enumerate_cb callback, void *data)
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_HOST *STDCALL dma_host_get_default(void)
Get the current default DMA host.
void STDCALL dma_request_complete(DMA_REQUEST *request)
Called by a DMA host when a DMA request completes.
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_request_cancel(DMA_REQUEST *request)
Cancel a DMA request previously submitted to a DMA host.
struct _DMA_HOST DMA_HOST
Definition dma.h:90
uint32_t STDCALL(* dma_notification_cb)(DEVICE *device, void *data, uint32_t notification)
Definition dma.h:96
uint32_t STDCALL(* dma_host_stop_proc)(DMA_HOST *dma)
Definition dma.h:100
DMA_HOST *STDCALL dma_host_create_ex(uint32_t size)
Create a new DMA entry.
uint32_t STDCALL(* dma_host_cancel_proc)(DMA_HOST *dma, DMA_REQUEST *request)
Definition dma.h:103
struct _DMA_REQUEST DMA_REQUEST
Forward declared to satisfy DMAHost.
Definition dma.h:91
DMA_HOST *STDCALL dma_host_check(DMA_HOST *dma)
Check if the supplied DMA is in the DMA host table.
uint32_t STDCALL dma_request_submit(DMA_REQUEST *request)
Submit a DMA request to a DMA host.
void STDCALL(* dma_request_completed_cb)(DMA_REQUEST *request)
Definition dma.h:138
uint32_t STDCALL dma_data_maximum(DMA_DATA *data)
Return the size of the largest data block in the linked list.
uint32_t STDCALL(* dma_enumerate_cb)(DMA_HOST *dma, void *data)
Definition dma.h:94
uint32_t STDCALL dma_host_set_default(DMA_HOST *dma)
Set the current default DMA device.
void STDCALL dma_transfer_request_complete(DMA_REQUEST *request)
Called when a DMA transfer request completes.
uint32_t STDCALL dma_data_count(DMA_DATA *data)
Return the total number of data blocks in the linked list.
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_host_properties_proc)(DMA_HOST *dma, DMA_PROPERTIES *properties)
Definition dma.h:104
DMA_HOST *STDCALL dma_host_create(void)
Create a new DMA entry.
void *STDCALL dma_buffer_allocate(DMA_HOST *dma, uint32_t size)
Allocate a data buffer for a DMA request.
#define STDCALL
Definition globaltypes.h:45
HANDLE MUTEX_HANDLE
Definition globaltypes.h:105
uint32_t multiplier
Host data buffer multiplier.
Definition dma.h:122
MUTEX_HANDLE lock
Host lock.
Definition dma.h:120
uint32_t requestcount
Number of DMA requests that have been submitted to this host.
Definition dma.h:128
dma_host_stop_proc hoststop
A Host specific HostStop method implementing the standard DMA host interface (Mandatory).
Definition dma.h:114
DEVICE device
The Device entry for this DMA host.
Definition dma.h:109
uint32_t lasterror
Last error to occur on this host.
Definition dma.h:124
dma_host_properties_proc hostproperties
A Host specific HostProperties method implementing the standard DMA host interface (Or nil if the def...
Definition dma.h:118
DMA_HOST * next
Next entry in DMA host table.
Definition dma.h:132
uint32_t pendingcount
Number of DMA requests pending for this host.
Definition dma.h:125
dma_host_cancel_proc hostcancel
A Host specific HostCancel method implementing the standard DMA host interface (Mandatory).
Definition dma.h:117
dma_host_submit_proc hostsubmit
A Host specific HostSubmit method implementing the standard DMA host interface (Mandatory).
Definition dma.h:116
uint32_t dmastate
DMA state (eg DMA_STATE_ENABLED).
Definition dma.h:112
THREAD_ID waiterthread
Thread waiting for pending requests to complete.
Definition dma.h:126
DMA_HOST * prev
Previous entry in DMA host table.
Definition dma.h:131
dma_host_reset_proc hostreset
A Host specific HostReset method implementing the standard DMA host interface (Or nil if the default ...
Definition dma.h:115
dma_host_start_proc hoststart
A Host specific HostStart method implementing the standard DMA host interface (Mandatory).
Definition dma.h:113
uint32_t requesterrors
Number of DMA requests that have failed on this host.
Definition dma.h:129
uint32_t alignment
Host data buffer alignment.
Definition dma.h:121
uint32_t dmaid
Unique Id of this DMA host in the DMA host table.
Definition dma.h:111
DMA_PROPERTIES properties
Host properties.
Definition dma.h:123
uint32_t multiplier
Host data buffer multiplier.
Definition dma.h:80
uint32_t maxcount
Maximum Y count for 2D stride.
Definition dma.h:83
uint32_t channels
Total number of host channels.
Definition dma.h:81
uint32_t maxstride
Maximum stride value (Increment between rows).
Definition dma.h:86
uint32_t flags
Host flags (eg DMA_FLAG_STRIDE).
Definition dma.h:78
uint32_t maxsize
Maximum transfer size.
Definition dma.h:82
int32_t minstride
Minimum stride value (Increment between rows)(May be negative).
Definition dma.h:85
uint32_t maxlength
Maximum X length for 2D stride.
Definition dma.h:84
uint32_t alignment
Host data buffer alignment.
Definition dma.h:79
DMA_HOST * host
Definition dma.h:143
DMA_DATA * data
List of data blocks for this request.
Definition dma.h:144
uint32_t direction
The direction of the DMA request (eg DMA_DIR_MEM_TO_MEM).
Definition dma.h:146
void * controlblocks
Definition dma.h:153
dma_request_completed_cb callback
Callback function that will be called when this DMA request has been successfully completed or has fa...
Definition dma.h:148
uint32_t flags
Flags for the request (eg DMA_REQUEST_FLAG_RELEASE).
Definition dma.h:145
void * driverdata
Private data for the completion callback (Optional).
Definition dma.h:149
uint32_t peripheral
The peripheral ID for data request gating (eg DMA_DREQ_ID_NONE).
Definition dma.h:147
uint32_t status
Status of the request (ERROR_SUCCESS if successful, or another error code if the request failed).
Definition dma.h:151
HANDLE THREAD_ID
Type for Thread-IDs.
Definition system.h:63