Difference between revisions of "Unit DMA"
(13 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
---- | ---- | ||
− | '''Ultibo DMA | + | '''Ultibo DMA Interface unit''' |
The DMA interfaces are 1 tier (Host only) whereas the USB interface is 3 tier (Host, Device and Driver). | The DMA interfaces are 1 tier (Host only) whereas the USB interface is 3 tier (Host, Device and Driver). | ||
Line 25: | Line 25: | ||
<br /> | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
− | <div style="font-size: 14px; padding-left: 12px;">'''DMA host type | + | <div style="font-size: 14px; padding-left: 12px;">'''DMA host type''' <code> DMA_TYPE_* </code></div> |
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
Line 31: | Line 31: | ||
| <code>DMA_TYPE_NONE = 0;</code> | | <code>DMA_TYPE_NONE = 0;</code> | ||
| style="width: 50%;"| | | style="width: 50%;"| | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>DMA_TYPE_MAX = 0;</code> | ||
+ | | | ||
|- | |- | ||
|} | |} | ||
Line 36: | Line 41: | ||
<br /> | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
− | <div style="font-size: 14px; padding-left: 12px;">'''DMA host state | + | <div style="font-size: 14px; padding-left: 12px;">'''DMA host state''' <code> DMA_STATE_* </code></div> |
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
Line 44: | Line 49: | ||
|- | |- | ||
| <code>DMA_STATE_ENABLED = 1;</code> | | <code>DMA_STATE_ENABLED = 1;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>DMA_STATE_MAX = 1;</code> | ||
| | | | ||
|- | |- | ||
Line 50: | Line 60: | ||
<br /> | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
− | <div style="font-size: 14px; padding-left: 12px;">'''DMA host flag | + | <div style="font-size: 14px; padding-left: 12px;">'''DMA host flag''' <code> DMA_FLAG_* </code></div> |
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
Line 86: | Line 96: | ||
| <code>DMA_FLAG_BULK = $00000200;</code> | | <code>DMA_FLAG_BULK = $00000200;</code> | ||
| Host supports bulk transfer | | Host supports bulk transfer | ||
+ | |- | ||
+ | | <code>DMA_FLAG_LITE = $00000400;</code> | ||
+ | | Host supports "lite" transfer | ||
+ | |- | ||
+ | | <code>DMA_FLAG_40BIT = $00000800;</code> | ||
+ | | Host supports 40-bit address transfer | ||
|- | |- | ||
|} | |} | ||
</div></div> | </div></div> | ||
− | <br /> | + | <br /> |
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''DMA data flag''' <code> DMA_DATA_FLAG_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|See: Platform DMA_DATA_FLAG_* | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
− | <div style="font-size: 14px; padding-left: 12px;">'''DMA request flag | + | <div style="font-size: 14px; padding-left: 12px;">'''DMA request flag''' <code> DMA_REQUEST_FLAG_* </code></div> |
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
Line 103: | Line 129: | ||
| <code>DMA_REQUEST_FLAG_CYCLIC = $00000002;</code> | | <code>DMA_REQUEST_FLAG_CYCLIC = $00000002;</code> | ||
| This is a cyclic request which loops around from tail to head | | This is a cyclic request which loops around from tail to head | ||
+ | |- | ||
+ | | <code>DMA_REQUEST_FLAG_COMPATIBLE = $00000004;</code> | ||
+ | | If set then all buffers supplied are host configuration compatible (Sizing, Alignment, Flags) | ||
|- | |- | ||
|} | |} | ||
Line 108: | Line 137: | ||
<br /> | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
− | <div style="font-size: 14px; padding-left: 12px;">'''DMA logging | + | <div style="font-size: 14px; padding-left: 12px;">'''DMA logging''' <code> DMA_LOG_* </code></div> |
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
Line 117: | Line 146: | ||
| <code>DMA_LOG_LEVEL_INFO = LOG_LEVEL_INFO;</code> | | <code>DMA_LOG_LEVEL_INFO = LOG_LEVEL_INFO;</code> | ||
| DMA informational messages, such as a device being attached or detached | | DMA informational messages, such as a device being attached or detached | ||
+ | |- | ||
+ | | <code>DMA_LOG_LEVEL_WARN = LOG_LEVEL_WARN;</code> | ||
+ | | DMA warning messages | ||
|- | |- | ||
| <code>DMA_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;</code> | | <code>DMA_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;</code> | ||
Line 131: | Line 163: | ||
---- | ---- | ||
− | '' | + | |
+ | '''DMA properties''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PDMAProperties = ^TDMAProperties;</code> | ||
+ | |||
+ | <code>TDMAProperties = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Flags:LongWord;</code> | ||
+ | | Host flags (eg DMA_FLAG_STRIDE) | ||
+ | |- | ||
+ | | <code>Alignment:LongWord;</code> | ||
+ | | Host data buffer alignment | ||
+ | |- | ||
+ | | <code>Multiplier:LongWord;</code> | ||
+ | | Host data buffer multiplier | ||
+ | |- | ||
+ | | <code>Channels:LongWord;</code> | ||
+ | | Total number of host channels | ||
+ | |- | ||
+ | | <code>MaxSize:LongWord;</code> | ||
+ | | Maximum transfer size | ||
+ | |- | ||
+ | | <code>MaxCount:LongWord;</code> | ||
+ | | Maximum Y count for 2D stride | ||
+ | |- | ||
+ | | <code>MaxLength:LongWord;</code> | ||
+ | | Maximum X length for 2D stride | ||
+ | |- | ||
+ | | <code>MinStride:LongInt;</code> | ||
+ | | Minimum stride value (Increment between rows) May be negative. | ||
+ | |- | ||
+ | | <code>MaxStride:LongWord;</code> | ||
+ | | Maximum stride value (Increment between rows) | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''DMA enumeration callback''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TDMAEnumerate = function(DMA:PDMAHost; Data:Pointer):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''DMA notification callback''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TDMANotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''DMA host start''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TDMAHostStart = function(DMA:PDMAHost):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''DMA host stop''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TDMAHostStop = function(DMA:PDMAHost):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''DMA host reset''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TDMAHostReset = function(DMA:PDMAHost):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''DMA host submit''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TDMAHostSubmit = function(DMA:PDMAHost; Request:PDMARequest):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''DMA host cancel''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TDMAHostCancel = function(DMA:PDMAHost; Request:PDMARequest):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''DMA host properties''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TDMAHostProperties = function(DMA:PDMAHost; Properties:PDMAProperties):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''DMA host''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PDMAHost = ^TDMAHost;</code> | ||
+ | |||
+ | <code>TDMAHost = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|''Device Properties'' | ||
+ | |- | ||
+ | | <code>Device:TDevice;</code> | ||
+ | | The Device entry for this DMA host | ||
+ | |- | ||
+ | |colspan="2"|''DMA Properties'' | ||
+ | |- | ||
+ | | <code>DMAId:LongWord;</code> | ||
+ | | Unique Id of this DMA host in the DMA host table | ||
+ | |- | ||
+ | | <code>DMAId:LongWord;</code> | ||
+ | | Unique Id of this DMA host in the DMA host table | ||
+ | |- | ||
+ | | <code>DMAState:LongWord;</code> | ||
+ | | DMA state (eg DMA_STATE_ENABLED) | ||
+ | |- | ||
+ | | <code>HostStart:TDMAHostStart;</code> | ||
+ | | A Host specific HostStart method implementing the standard DMA host interface (Mandatory) | ||
+ | |- | ||
+ | | <code>HostStop:TDMAHostStop;</code> | ||
+ | | A Host specific HostStop method implementing the standard DMA host interface (Mandatory) | ||
+ | |- | ||
+ | | <code>HostReset:TDMAHostReset;</code> | ||
+ | | A Host specific HostReset method implementing the standard DMA host interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>HostSubmit:TDMAHostSubmit;</code> | ||
+ | | A Host specific HostSubmit method implementing the standard DMA host interface (Mandatory) | ||
+ | |- | ||
+ | | <code>HostCancel:TDMAHostCancel;</code> | ||
+ | | A Host specific HostCancel method implementing the standard DMA host interface (Mandatory) | ||
+ | |- | ||
+ | | <code>HostProperties:TDMAHostProperties;</code> | ||
+ | | A Host specific HostProperties method implementing the standard DMA host interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | |colspan="2"|''Driver Properties'' | ||
+ | |- | ||
+ | | <code>Lock:TMutexHandle;</code> | ||
+ | | Host lock | ||
+ | |- | ||
+ | | <code>Alignment:LongWord;</code> | ||
+ | | Host data buffer alignment | ||
+ | |- | ||
+ | | <code>Multiplier:LongWord;</code> | ||
+ | | Host data buffer multiplier | ||
+ | |- | ||
+ | | <code>Properties:TDMAProperties;</code> | ||
+ | | Host properties | ||
+ | |- | ||
+ | | <code>LastError:LongWord;</code> | ||
+ | | Last error to occur on this host | ||
+ | |- | ||
+ | | <code>PendingCount:LongWord;</code> | ||
+ | | Number of DMA requests pending for this host | ||
+ | |- | ||
+ | | <code>WaiterThread:TThreadId;</code> | ||
+ | | Thread waiting for pending requests to complete | ||
+ | |- | ||
+ | |colspan="2"|''Statistics Properties'' | ||
+ | |- | ||
+ | | <code>RequestCount:LongWord;</code> | ||
+ | | Number of DMA requests that have been submitted to this host | ||
+ | |- | ||
+ | | <code>RequestErrors:LongWord;</code> | ||
+ | | Number of DMA requests that have failed on this host | ||
+ | |- | ||
+ | |colspan="2"|''Internal Properties'' | ||
+ | |- | ||
+ | | <code>Prev:PDMAHost;</code> | ||
+ | | Previous entry in DMA host table | ||
+ | |- | ||
+ | | <code>Next:PDMAHost;</code> | ||
+ | | Next entry in DMA host table | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''DMA request completed''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TDMARequestCompleted = procedure(Request:PDMARequest);</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''DMA request''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PDMARequest = ^TDMARequest;</code> | ||
+ | |||
+ | <code>TDMARequest = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: Forward declared to satisfy DMAHost | ||
+ | |- | ||
+ | |colspan="2"|''Request Properties'' | ||
+ | |- | ||
+ | | <code>Host:PDMAHost;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Data:PDMAData;</code> | ||
+ | | List of data blocks for this request | ||
+ | |- | ||
+ | | <code>Flags:LongWord;</code> | ||
+ | | Flags for the request (eg DMA_REQUEST_FLAG_RELEASE) | ||
+ | |- | ||
+ | | <code>Direction:LongWord;</code> | ||
+ | | The direction of the DMA request (eg DMA_DIR_MEM_TO_MEM) | ||
+ | |- | ||
+ | | <code>Peripheral:LongWord;</code> | ||
+ | | The peripheral ID for data request gating (eg DMA_DREQ_ID_NONE) | ||
+ | |- | ||
+ | | <code>Callback:TDMARequestCompleted;</code> | ||
+ | | Callback function that will be called when this DMA request has been successfully completed or has failed | ||
+ | |- | ||
+ | | <code>DriverData:Pointer;</code> | ||
+ | | Private data for the completion callback (Optional) | ||
+ | |- | ||
+ | |colspan="2"|''Result Properties'' | ||
+ | |- | ||
+ | | <code>Status:LongWord;</code> | ||
+ | | Status of the request (ERROR_SUCCESS if successful, or another error code if the request failed) | ||
+ | |- | ||
+ | |colspan="2"|''Driver Properties (Private variables for use by Host drivers)'' | ||
+ | |- | ||
+ | | <code>ControlBlocks:Pointer;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Public variables === | === Public variables === | ||
Line 142: | Line 426: | ||
|- | |- | ||
| <code>DMA_DEFAULT_LOG_LEVEL:LongWord = DMA_LOG_LEVEL_DEBUG;</code> | | <code>DMA_DEFAULT_LOG_LEVEL:LongWord = DMA_LOG_LEVEL_DEBUG;</code> | ||
− | | style="width: | + | | style="width: 40%;"|Minimum level for DMA messages. Only messages with level greater than or equal to this will be printed. |
|- | |- | ||
|} | |} | ||
Line 148: | Line 432: | ||
|- | |- | ||
| <code>DMA_LOG_ENABLED:Boolean;</code> | | <code>DMA_LOG_ENABLED:Boolean;</code> | ||
− | | style="width: | + | | style="width: 40%;"| |
|- | |- | ||
|} | |} | ||
Line 165: | Line 449: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 180: | Line 464: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 192: | Line 476: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 204: | Line 488: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 216: | Line 500: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 228: | Line 512: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Return |
| Pointer to new DMA entry or nil if DMA could not be created | | Pointer to new DMA entry or nil if DMA could not be created | ||
|- | |- | ||
Line 240: | Line 524: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Size |
− | | Size in bytes to allocate for new DMA (Including the DMA entry | + | | Size in bytes to allocate for new DMA (Including the DMA entry) |
|- | |- | ||
− | ! | + | ! Return |
| Pointer to new DMA entry or nil if DMA could not be created | | Pointer to new DMA entry or nil if DMA could not be created | ||
|- | |- | ||
Line 255: | Line 539: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 267: | Line 551: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 279: | Line 563: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 291: | Line 575: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 303: | Line 587: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 315: | Line 599: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 330: | Line 614: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 342: | Line 626: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 354: | Line 638: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 369: | Line 653: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! DMA |
| The DMA host that the request will be sent to | | The DMA host that the request will be sent to | ||
|- | |- | ||
− | ! | + | ! Size |
| The size of the data buffer to allocate | | The size of the data buffer to allocate | ||
|- | |- | ||
− | ! | + | ! Return |
| The newly allocated buffer or nil on failure | | The newly allocated buffer or nil on failure | ||
|- | |- | ||
Line 387: | Line 671: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! DMA |
| The DMA host that the request will be sent to | | 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) | | The size of the data buffer to allocate (Updated on return to actual size) | ||
|- | |- | ||
− | ! | + | ! Return |
| The newly allocated buffer or nil on failure | | The newly allocated buffer or nil on failure | ||
|- | |- | ||
− | ! | + | ! Note |
| This differs from DMABufferAllocate in that it updates the size value to reflect the actual size of the buffer allocated which may be required for some uses | | This differs from DMABufferAllocate in that it updates the size value to reflect the actual size of the buffer allocated which may be required for some uses | ||
|- | |- | ||
Line 408: | Line 692: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! DMA |
| The DMA host that the request will be sent to | | The DMA host that the request will be sent to | ||
|- | |- | ||
− | ! | + | ! Buffer |
| The data buffer to validate | | The data buffer to validate | ||
|- | |- | ||
− | ! | + | ! Size |
| The size of the data buffer | | The size of the data buffer | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS on success or another error code on failure (ERROR_NOT_COMPATIBLE if not compatible with host) | | ERROR_SUCCESS on success or another error code on failure (ERROR_NOT_COMPATIBLE if not compatible with host) | ||
|- | |- | ||
− | ! | + | ! Note |
− | | Does not check for cache coherency requirements (Shared, Non Cached) only alignment and size. Buffers used as the source of a DMA request do not | + | | Does not check for cache coherency requirements (Shared, Non Cached) only alignment and size. Buffers used as the source of a DMA request do not necessarily need to meet alignment and size requirements, however buffers used as a destination must meet these requirements or the caller must take appropriate actions to prevent undesirable side effects from cache invalidation. |
|- | |- | ||
|} | |} | ||
Line 432: | Line 716: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Data |
| The buffer to be released | | The buffer to be released | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS on success or another error code on failure | | ERROR_SUCCESS on success or another error code on failure | ||
|- | |- | ||
Line 450: | Line 734: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! DMA |
| The DMA host this request will be sent to | | The DMA host this request will be sent to | ||
|- | |- | ||
− | ! | + | ! Data |
| A linked list of DMA data blocks for the transfer (Optional) | | A linked list of DMA data blocks for the transfer (Optional) | ||
|- | |- | ||
− | ! | + | ! Callback |
| The callback function to be called on completion of the request | | The callback function to be called on completion of the request | ||
|- | |- | ||
− | ! | + | ! DriverData |
| Driver private data for the callback (Optional) | | Driver private data for the callback (Optional) | ||
|- | |- | ||
− | ! | + | ! Direction |
| The direction of the DMA request (eg DMA_DIR_MEM_TO_MEM) | | 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) | | The peripheral ID for data request gating (eg DMA_DREQ_ID_NONE) | ||
|- | |- | ||
− | ! | + | ! Flags |
| Additional flags for this request (eg DMA_REQUEST_FLAG_CYCLIC) | | Additional flags for this request (eg DMA_REQUEST_FLAG_CYCLIC) | ||
|- | |- | ||
− | ! | + | ! Return |
| The newly allocated request or nil on failure | | The newly allocated request or nil on failure | ||
|- | |- | ||
Line 483: | Line 767: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Request |
| The request to be released | | The request to be released | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS on success or another error code on failure | | ERROR_SUCCESS on success or another error code on failure | ||
|- | |- | ||
Line 498: | Line 782: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Request |
| The request to be submitted | | The request to be submitted | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
− | ! | + | ! Note |
| The request will be completed asynchronously by the DMA host and the completion callback will be called when the request has either succeeded or failed | | The request will be completed asynchronously by the DMA host and the completion callback will be called when the request has either succeeded or failed | ||
|- | |- | ||
Line 516: | Line 800: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Request |
| The request to be cancelled | | The request to be cancelled | ||
|- | |- | ||
− | ! | + | ! Return'' |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 531: | Line 815: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Request |
| The DMA request which has completed | | The DMA request which has completed | ||
|- | |- | ||
− | ! | + | ! Note |
| DMA host drivers may call this on a worker thread | | DMA host drivers may call this on a worker thread | ||
|- | |- | ||
Line 549: | Line 833: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! DMA |
| The DMA host to execute the request on | | The DMA host to execute the request on | ||
|- | |- | ||
− | ! | + | ! Data |
| A linked list of DMA data blocks for the transfer | | A linked list of DMA data blocks for the transfer | ||
|- | |- | ||
− | ! | + | ! Direction |
| The direction of the DMA request (eg DMA_DIR_MEM_TO_MEM) | | 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) | | The peripheral ID for data request gating (eg DMA_DREQ_ID_NONE) | ||
|- | |- | ||
− | ! | + | ! Flags |
| Additional flags for this transfer request (eg DMA_REQUEST_FLAG_CYCLIC) | | Additional flags for this transfer request (eg DMA_REQUEST_FLAG_CYCLIC) | ||
|- | |- | ||
− | ! | + | ! Timeout |
| Milliseconds to wait for request to complete (INFINITE to wait forever) | | Milliseconds to wait for request to complete (INFINITE to wait forever) | ||
|- | |- | ||
− | ! | + | ! Note |
| An internal callback will be specified and the function will wait for the transfer to complete | | An internal callback will be specified and the function will wait for the transfer to complete | ||
|- | |- | ||
Line 579: | Line 863: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! DMA |
| The DMA host to execute the request on | | The DMA host to execute the request on | ||
|- | |- | ||
− | ! | + | ! Data |
| A linked list of DMA data blocks for the transfer | | A linked list of DMA data blocks for the transfer | ||
|- | |- | ||
− | ! | + | ! Callback |
| The callback function to be called on completion of the request | | The callback function to be called on completion of the request | ||
|- | |- | ||
− | ! | + | ! DriverData |
| Driver private data for the callback (Optional) | | Driver private data for the callback (Optional) | ||
|- | |- | ||
− | ! | + | ! Direction |
| The direction of the DMA request (eg DMA_DIR_MEM_TO_MEM) | | 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) | | The peripheral ID for data request gating (eg DMA_DREQ_ID_NONE) | ||
|- | |- | ||
− | ! | + | ! Flags |
| Additional flags for this transfer request (eg DMA_REQUEST_FLAG_CYCLIC) | | Additional flags for this transfer request (eg DMA_REQUEST_FLAG_CYCLIC) | ||
|- | |- | ||
− | ! | + | ! Note |
| The request will be passed to the callback with the DriverData field set to the DriverData passed to this function. On completion of the callback the request will automatically be released by the internal callback handler. | | The request will be passed to the callback with the DriverData field set to the DriverData passed to this function. On completion of the callback the request will automatically be released by the internal callback handler. | ||
|- | |- | ||
Line 612: | Line 896: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Request |
| The DMA request which has completed | | The DMA request which has completed | ||
|- | |- | ||
− | ! | + | ! Note |
| This is the internal callback for DMATransferRequest | | This is the internal callback for DMATransferRequest | ||
|- | |- | ||
Line 630: | Line 914: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 642: | Line 926: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Data |
| A linked list of DMA data blocks for the transfer | | A linked list of DMA data blocks for the transfer | ||
|- | |- | ||
− | ! | + | ! Direction |
| The direction of the DMA request (eg DMA_DIR_MEM_TO_MEM) | | 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) | | The peripheral ID for data request gating (eg DMA_DREQ_ID_NONE) | ||
|- | |- | ||
Line 660: | Line 944: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Dest |
| The address to start the memory fill | | The address to start the memory fill | ||
|- | |- | ||
− | ! | + | ! Size |
| The size of memory to fill in bytes | | The size of memory to fill in bytes | ||
|- | |- | ||
− | ! | + | ! Value |
| The value to fill the memory with | | The value to fill the memory with | ||
|- | |- | ||
Line 678: | Line 962: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Source |
| The source address to start the memory copy | | The source address to start the memory copy | ||
|- | |- | ||
− | ! | + | ! Dest |
| The destination address to start the memory copy | | The destination address to start the memory copy | ||
|- | |- | ||
− | ! | + | ! Size |
| The size of memory to copy in bytes | | The size of memory to copy in bytes | ||
|- | |- | ||
Line 696: | Line 980: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Address |
| The address of the periperhal register to read from | | The address of the periperhal register to read from | ||
|- | |- | ||
− | ! | + | ! Dest |
| The destination address to start writing to | | The destination address to start writing to | ||
|- | |- | ||
− | ! | + | ! Size |
| The size of the read in bytes | | The size of the read in bytes | ||
|- | |- | ||
− | ! | + | ! Peripheral |
| The peripheral ID for data request gating (eg DMA_DREQ_ID_UART_RX) | | The peripheral ID for data request gating (eg DMA_DREQ_ID_UART_RX) | ||
|- | |- | ||
Line 717: | Line 1,001: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Source |
| The source address to start reading from | | The source address to start reading from | ||
|- | |- | ||
− | ! | + | ! Address |
| The address of the peripheral register to write to | | The address of the peripheral register to write to | ||
|- | |- | ||
− | ! | + | ! Size |
| The size of the write in bytes | | The size of the write in bytes | ||
|- | |- | ||
− | ! | + | ! Peripheral |
| The peripheral ID for data request gating (eg DMA_DREQ_ID_UART_TX) | | The peripheral ID for data request gating (eg DMA_DREQ_ID_UART_TX) | ||
|- | |- | ||
Line 738: | Line 1,022: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Size |
| The size of the buffer to allocate | | The size of the buffer to allocate | ||
|- | |- | ||
Line 750: | Line 1,034: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Size |
| The size of the buffer to allocate (Updated on return to actual size) | | The size of the buffer to allocate (Updated on return to actual size) | ||
|- | |- | ||
Line 762: | Line 1,046: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Buffer |
| The buffer to be released | | The buffer to be released | ||
|- | |- | ||
Line 772: | Line 1,056: | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
− | <pre style="border: 0; padding-bottom:0px;">function DMAGetCount:LongWord | + | <pre style="border: 0; padding-bottom:0px;">function DMAGetCount:LongWord;</pre> |
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current DMA host count</div> | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current DMA host count</div> | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 784: | Line 1,068: | ||
<br /> | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
− | <pre style="border: 0; padding-bottom:0px;">function DMAHostGetDefault:PDMAHost | + | <pre style="border: 0; padding-bottom:0px;">function DMAHostGetDefault:PDMAHost;</pre> |
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current default DMA host</div> | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current default DMA host</div> | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 801: | Line 1,085: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 813: | Line 1,097: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! '''Note''' | + | ! Note |
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function DMATypeToString(DMAType:LongWord):String;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Convert a DMA type value to a string</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function DMAStateToString(DMAState:LongWord):String;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Convert a DMA state value to a string</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
| None documented | | None documented | ||
|- | |- | ||
Line 825: | Line 1,133: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! ''' | + | ! Note |
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">procedure DMALogInfo(DMA:PDMAHost; const AText:String); inline;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
| None documented | | None documented | ||
|- | |- | ||
Line 832: | Line 1,152: | ||
<br /> | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
− | <pre style="border: 0; padding-bottom:0px;">procedure | + | <pre style="border: 0; padding-bottom:0px;">procedure DMALogWarn(DMA:PDMAHost; const AText:String); inline;</pre> |
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 844: | Line 1,164: | ||
<br /> | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
− | <pre style="border: 0; padding-bottom:0px;">procedure DMALogError(DMA:PDMAHost; const AText:String);</pre> | + | <pre style="border: 0; padding-bottom:0px;">procedure DMALogError(DMA:PDMAHost; const AText:String); inline;</pre> |
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 856: | Line 1,176: | ||
<br /> | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
− | <pre style="border: 0; padding-bottom:0px;">procedure DMALogDebug(DMA:PDMAHost;const AText:String);</pre> | + | <pre style="border: 0; padding-bottom:0px;">procedure DMALogDebug(DMA:PDMAHost; const AText:String); inline;</pre> |
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- |
Latest revision as of 04:51, 10 October 2023
Return to Unit Reference
Description
Ultibo DMA Interface unit
The DMA interfaces are 1 tier (Host only) whereas the USB interface is 3 tier (Host, Device and Driver).
Constants
DMA_*
DMA_NAME_PREFIX = 'DMA';
|
Name prefix for DMA Hosts |
DMA_TYPE_*
DMA_TYPE_NONE = 0;
|
|
DMA_TYPE_MAX = 0;
|
DMA_STATE_*
DMA_STATE_DISABLED = 0;
|
|
DMA_STATE_ENABLED = 1;
|
|
DMA_STATE_MAX = 1;
|
DMA_FLAG_*
DMA_FLAG_NONE = $00000000;
|
|
DMA_FLAG_SHARED = $00000001;
|
Host requires data buffers in shared memory |
DMA_FLAG_NOCACHE = $00000002;
|
Host requires data buffers in non cached memory |
DMA_FLAG_COHERENT = $00000004;
|
Data buffers are cache coherent if allocated according to host configuration |
DMA_FLAG_STRIDE = $00000008;
|
Host supports 2D stride on source and/or dest address |
DMA_FLAG_DREQ = $00000010;
|
Host supports data request gating (DREQ) on source and/or dest address |
DMA_FLAG_NOINCREMENT = $00000020;
|
Host supports no increment on source and/or dest address |
DMA_FLAG_NOREAD = $00000040;
|
Host supports no read from source address (write to dest address only) (Zero fill the destination) |
DMA_FLAG_NOWRITE = $00000080;
|
Host supports no write to dest address (read from source address only) (Cache fill from the source) |
DMA_FLAG_WIDE = $00000100;
|
Host supports wide read and/or write |
DMA_FLAG_BULK = $00000200;
|
Host supports bulk transfer |
DMA_FLAG_LITE = $00000400;
|
Host supports "lite" transfer |
DMA_FLAG_40BIT = $00000800;
|
Host supports 40-bit address transfer |
DMA_DATA_FLAG_*
See: Platform DMA_DATA_FLAG_* |
DMA_REQUEST_FLAG_*
DMA_REQUEST_FLAG_NONE = $00000000;
|
|
DMA_REQUEST_FLAG_RELEASE = $00000001;
|
If set then release the request automatically after completion |
DMA_REQUEST_FLAG_CYCLIC = $00000002;
|
This is a cyclic request which loops around from tail to head |
DMA_REQUEST_FLAG_COMPATIBLE = $00000004;
|
If set then all buffers supplied are host configuration compatible (Sizing, Alignment, Flags) |
DMA_LOG_*
DMA_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG;
|
DMA debugging messages |
DMA_LOG_LEVEL_INFO = LOG_LEVEL_INFO;
|
DMA informational messages, such as a device being attached or detached |
DMA_LOG_LEVEL_WARN = LOG_LEVEL_WARN;
|
DMA warning messages |
DMA_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;
|
DMA error messages |
DMA_LOG_LEVEL_NONE = LOG_LEVEL_NONE;
|
No DMA messages |
Type definitions
DMA properties
PDMAProperties = ^TDMAProperties;
TDMAProperties = record
Flags:LongWord;
|
Host flags (eg DMA_FLAG_STRIDE) |
Alignment:LongWord;
|
Host data buffer alignment |
Multiplier:LongWord;
|
Host data buffer multiplier |
Channels:LongWord;
|
Total number of host channels |
MaxSize:LongWord;
|
Maximum transfer size |
MaxCount:LongWord;
|
Maximum Y count for 2D stride |
MaxLength:LongWord;
|
Maximum X length for 2D stride |
MinStride:LongInt;
|
Minimum stride value (Increment between rows) May be negative. |
MaxStride:LongWord;
|
Maximum stride value (Increment between rows) |
DMA enumeration callback
TDMAEnumerate = function(DMA:PDMAHost; Data:Pointer):LongWord;
|
DMA notification callback
TDMANotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;
|
DMA host start
TDMAHostStart = function(DMA:PDMAHost):LongWord;
|
DMA host stop
TDMAHostStop = function(DMA:PDMAHost):LongWord;
|
DMA host reset
TDMAHostReset = function(DMA:PDMAHost):LongWord;
|
DMA host submit
TDMAHostSubmit = function(DMA:PDMAHost; Request:PDMARequest):LongWord;
|
DMA host cancel
TDMAHostCancel = function(DMA:PDMAHost; Request:PDMARequest):LongWord;
|
DMA host properties
TDMAHostProperties = function(DMA:PDMAHost; Properties:PDMAProperties):LongWord;
|
DMA host
PDMAHost = ^TDMAHost;
TDMAHost = record
Device Properties | |
Device:TDevice;
|
The Device entry for this DMA host |
DMA Properties | |
DMAId:LongWord;
|
Unique Id of this DMA host in the DMA host table |
DMAId:LongWord;
|
Unique Id of this DMA host in the DMA host table |
DMAState:LongWord;
|
DMA state (eg DMA_STATE_ENABLED) |
HostStart:TDMAHostStart;
|
A Host specific HostStart method implementing the standard DMA host interface (Mandatory) |
HostStop:TDMAHostStop;
|
A Host specific HostStop method implementing the standard DMA host interface (Mandatory) |
HostReset:TDMAHostReset;
|
A Host specific HostReset method implementing the standard DMA host interface (Or nil if the default method is suitable) |
HostSubmit:TDMAHostSubmit;
|
A Host specific HostSubmit method implementing the standard DMA host interface (Mandatory) |
HostCancel:TDMAHostCancel;
|
A Host specific HostCancel method implementing the standard DMA host interface (Mandatory) |
HostProperties:TDMAHostProperties;
|
A Host specific HostProperties method implementing the standard DMA host interface (Or nil if the default method is suitable) |
Driver Properties | |
Lock:TMutexHandle;
|
Host lock |
Alignment:LongWord;
|
Host data buffer alignment |
Multiplier:LongWord;
|
Host data buffer multiplier |
Properties:TDMAProperties;
|
Host properties |
LastError:LongWord;
|
Last error to occur on this host |
PendingCount:LongWord;
|
Number of DMA requests pending for this host |
WaiterThread:TThreadId;
|
Thread waiting for pending requests to complete |
Statistics Properties | |
RequestCount:LongWord;
|
Number of DMA requests that have been submitted to this host |
RequestErrors:LongWord;
|
Number of DMA requests that have failed on this host |
Internal Properties | |
Prev:PDMAHost;
|
Previous entry in DMA host table |
Next:PDMAHost;
|
Next entry in DMA host table |
DMA request completed
TDMARequestCompleted = procedure(Request:PDMARequest);
|
DMA request
PDMARequest = ^TDMARequest;
TDMARequest = record
Note: Forward declared to satisfy DMAHost | |
Request Properties | |
Host:PDMAHost;
|
|
Data:PDMAData;
|
List of data blocks for this request |
Flags:LongWord;
|
Flags for the request (eg DMA_REQUEST_FLAG_RELEASE) |
Direction:LongWord;
|
The direction of the DMA request (eg DMA_DIR_MEM_TO_MEM) |
Peripheral:LongWord;
|
The peripheral ID for data request gating (eg DMA_DREQ_ID_NONE) |
Callback:TDMARequestCompleted;
|
Callback function that will be called when this DMA request has been successfully completed or has failed |
DriverData:Pointer;
|
Private data for the completion callback (Optional) |
Result Properties | |
Status:LongWord;
|
Status of the request (ERROR_SUCCESS if successful, or another error code if the request failed) |
Driver Properties (Private variables for use by Host drivers) | |
ControlBlocks:Pointer;
|
Public variables
DMA logging
DMA_DEFAULT_LOG_LEVEL:LongWord = DMA_LOG_LEVEL_DEBUG;
|
Minimum level for DMA messages. Only messages with level greater than or equal to this will be printed. |
DMA_LOG_ENABLED:Boolean;
|
Function declarations
Initialization functions
procedure DMAInit;
Note | None documented |
---|
DMA host functions
function DMAHostStart(DMA:PDMAHost):LongWord;
Note | None documented |
---|
function DMAHostStop(DMA:PDMAHost):LongWord;
Note | None documented |
---|
function DMAHostReset(DMA:PDMAHost):LongWord;
Note | None documented |
---|
function DMAHostProperties(DMA:PDMAHost; Properties:PDMAProperties):LongWord;
Note | None documented |
---|
function DMAHostCreate:PDMAHost;
Return | Pointer to new DMA entry or nil if DMA could not be created |
---|
function DMAHostCreateEx(Size:LongWord):PDMAHost;
Size | Size in bytes to allocate for new DMA (Including the DMA entry) |
---|---|
Return | Pointer to new DMA entry or nil if DMA could not be created |
function DMAHostDestroy(DMA:PDMAHost):LongWord;
Note | None documented |
---|
function DMAHostRegister(DMA:PDMAHost):LongWord;
Note | None documented |
---|
function DMAHostDeregister(DMA:PDMAHost):LongWord;
Note | None documented |
---|
function DMAHostFind(DMAId:LongWord):PDMAHost;
Note | None documented |
---|
function DMAHostEnumerate(Callback:TDMAEnumerate; Data:Pointer):LongWord;
Note | None documented |
---|
function DMAHostNotification(DMA:PDMAHost; Callback:TDMANotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Note | None documented |
---|
DMA data functions
function DMADataCount(Data:PDMAData):LongWord;
Note | None documented |
---|
function DMADataFlags(Data:PDMAData):LongWord;
Note | None documented |
---|
function DMADataMaximum(Data:PDMAData):LongWord;
Note | None documented |
---|
DMA buffer functions
function DMABufferAllocate(DMA:PDMAHost; Size:LongWord):Pointer; inline;
DMA | The DMA host that the request will be sent to |
---|---|
Size | The size of the data buffer to allocate |
Return | The newly allocated buffer or nil on failure |
function DMABufferAllocateEx(DMA:PDMAHost; var Size:LongWord):Pointer;
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) |
Return | The newly allocated buffer or nil on failure |
Note | This differs from DMABufferAllocate in that it updates the size value to reflect the actual size of the buffer allocated which may be required for some uses |
function DMABufferValidate(DMA:PDMAHost; Buffer:Pointer; Size:LongWord):LongWord;
DMA | The DMA host that the request will be sent to |
---|---|
Buffer | The data buffer to validate |
Size | The size of the data buffer |
Return | ERROR_SUCCESS on success or another error code on failure (ERROR_NOT_COMPATIBLE if not compatible with host) |
Note | Does not check for cache coherency requirements (Shared, Non Cached) only alignment and size. Buffers used as the source of a DMA request do not necessarily need to meet alignment and size requirements, however buffers used as a destination must meet these requirements or the caller must take appropriate actions to prevent undesirable side effects from cache invalidation. |
function DMABufferRelease(Buffer:Pointer):LongWord;
Data | The buffer to be released |
---|---|
Return | ERROR_SUCCESS on success or another error code on failure |
DMA request functions
function DMARequestAllocate(DMA:PDMAHost; Data:PDMAData; Callback:TDMARequestCompleted; DriverData:Pointer; Direction,Peripheral,Flags:LongWord):PDMARequest;
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) |
Return | The newly allocated request or nil on failure |
function DMARequestRelease(Request:PDMARequest):LongWord;
Request | The request to be released |
---|---|
Return | ERROR_SUCCESS on success or another error code on failure |
function DMARequestSubmit(Request:PDMARequest):LongWord;
Request | The request to be submitted |
---|---|
Return | ERROR_SUCCESS if completed or another error code on failure |
Note | The request will be completed asynchronously by the DMA host and the completion callback will be called when the request has either succeeded or failed |
function DMARequestCancel(Request:PDMARequest):LongWord;
Request | The request to be cancelled |
---|---|
Return | ERROR_SUCCESS if completed or another error code on failure |
procedure DMARequestComplete(Request:PDMARequest);
Request | The DMA request which has completed |
---|---|
Note | DMA host drivers may call this on a worker thread |
DMA transfer functions
function DMATransferRequest(DMA:PDMAHost; Data:PDMAData; Direction,Peripheral,Flags,Timeout:LongWord):LongWord;
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) |
Note | An internal callback will be specified and the function will wait for the transfer to complete |
function DMATransferRequestEx(DMA:PDMAHost; Data:PDMAData; Callback:TDMARequestCompleted; DriverData:Pointer; Direction,Peripheral,Flags:LongWord):LongWord;
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) |
Note | The request will be passed to the callback with the DriverData field set to the DriverData passed to this function. On completion of the callback the request will automatically be released by the internal callback handler. |
procedure DMATransferRequestComplete(Request:PDMARequest);
Request | The DMA request which has completed |
---|---|
Note | This is the internal callback for DMATransferRequest |
RTL DMA functions
function SysDMAAvailable:Boolean;
Note | None documented |
---|
function SysDMATransfer(Data:PDMAData; Direction,Peripheral:LongWord):LongWord;
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) |
function SysDMAFillMemory(Dest:Pointer; Size:LongWord; Value:Byte):LongWord;
Dest | The address to start the memory fill |
---|---|
Size | The size of memory to fill in bytes |
Value | The value to fill the memory with |
function SysDMACopyMemory(Source,Dest:Pointer; Size:LongWord):LongWord;
Source | The source address to start the memory copy |
---|---|
Dest | The destination address to start the memory copy |
Size | The size of memory to copy in bytes |
function SysDMAReadPeripheral(Address,Dest:Pointer; Size,Peripheral:LongWord):LongWord;
Address | The address of the periperhal register to read from |
---|---|
Dest | The destination address to start writing to |
Size | The size of the read in bytes |
Peripheral | The peripheral ID for data request gating (eg DMA_DREQ_ID_UART_RX) |
function SysDMAWritePeripheral(Source,Address:Pointer; Size,Peripheral:LongWord):LongWord;
Source | The source address to start reading from |
---|---|
Address | The address of the peripheral register to write to |
Size | The size of the write in bytes |
Peripheral | The peripheral ID for data request gating (eg DMA_DREQ_ID_UART_TX) |
function SysDMAAllocateBuffer(Size:LongWord):Pointer;
Size | The size of the buffer to allocate |
---|
function SysDMAAllocateBufferEx(var Size:LongWord):Pointer;
Size | The size of the buffer to allocate (Updated on return to actual size) |
---|
function SysDMAReleaseBuffer(Buffer:Pointer):LongWord;
Buffer | The buffer to be released |
---|
DMA helper functions
function DMAGetCount:LongWord;
Note | None documented |
---|
function DMAHostGetDefault:PDMAHost;
Note | None documented |
---|
function DMAHostSetDefault(DMA:PDMAHost):LongWord;
Note | None documented |
---|
function DMAHostCheck(DMA:PDMAHost):PDMAHost;
Note | None documented |
---|
function DMATypeToString(DMAType:LongWord):String;
Note | None documented |
---|
function DMAStateToString(DMAState:LongWord):String;
Note | None documented |
---|
procedure DMALog(Level:Integer; DMA:PDMAHost; const AText:String);
Note | None documented |
---|
procedure DMALogInfo(DMA:PDMAHost; const AText:String); inline;
Note | None documented |
---|
procedure DMALogWarn(DMA:PDMAHost; const AText:String); inline;
Note | None documented |
---|
procedure DMALogError(DMA:PDMAHost; const AText:String); inline;
Note | None documented |
---|
procedure DMALogDebug(DMA:PDMAHost; const AText:String); inline;
Note | None documented |
---|
Return to Unit Reference