@ GNU AS assembler header file for DMA
@ Written by DefMod (Dec  9 2012) on Sun Dec  9 15:47:40 2012
@ Jonathan Coxhead, jonathan@doves.demon.co.uk, 29 June 1995

@ OSLib---efficient, type-safe, transparent, extensible,
@ register-safe API coverage of RISC OS
@ 
@ Copyright (c) 1994-2012 Jonathan Coxhead and OSLib maintainers
@ 
@ Licence:
@ 
@    OSLib is free software; you can redistribute it and/or modify
@ it under the terms of the GNU General Public License as published by
@ the Free Software Foundation; either version 1, or (at your option)
@ any later version - and this with the following clarification and
@ special exception:
@ 
@    Linking this library statically or dynamically with other modules
@ is making a combined work based on this library. Thus, the terms
@ and conditions of the GNU General Public License cover the whole
@ combination.
@ 
@    As a special exception, the copyright holders of this library
@ give you permission to link this library with independent modules
@ to produce an executable, regardless of the license terms of these
@ independent modules, and to copy and distribute the resulting
@ executable under terms of your choice, provided that you also meet,
@ for each linked independent module, the terms and conditions of the
@ license of that module. An independent module is a module which is
@ not derived from or based on this library. If you modify this
@ library, you may extend this exception to your version of the library,
@ but you are not obliged to do so. If you do not wish to do so, delete
@ this exception statement from your version.
@ 
@    OSLib is distributed in the hope that it will be useful,
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@ GNU General Public License for more details.
@ 
@    You should have received a copy of the GNU General Public License
@ along with this programme; if not, write to the Free Software
@ Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, USA.

#ifndef DMA_Hdr
#  define DMA_Hdr

#  ifndef Get_Types
#    define Get_Types
#    include "oslib/Types.Hdr"
#  endif

#  ifndef Get_OS
#    define Get_OS
#    include "oslib/OS.Hdr"
#  endif

@Symbols for constants
#  define DMA_QueueWrite 0x1
#  define DMA_QueueCircularList 0x2
#  define DMA_QueueUseSync 0x4
#  define DMA_SuspendStartNext 0x1

@Symbols for structure offsets and sizes
@ abstract type
#  define DMA_C 4

@ abstract type
#  define DMA_Tag 4

        .struct 0
DMA_Routines_enable            : .skip   Ptr
DMA_Routines_disable           : .skip   Ptr
DMA_Routines_start             : .skip   Ptr
DMA_Routines_completed         : .skip   Ptr
DMA_Routines_sync              : .skip   Ptr
DMA_Routines                   : 

        .struct 0
DMA_Scatter_address            : .skip   Ptr
DMA_Scatter_size               : .skip   Int
DMA_Scatter                    : 

        .struct 0
DMA_ScatterList_s              : .skip   DMA_Scatter
DMA_ScatterList                : 

        .struct 0
        .skip   Bits
DMA_RegisterChannelFlags       : 

        .struct 0
        .skip   Bits
DMA_QueueFlags                 : 

        .struct 0
        .skip   Bits
DMA_SuspendFlags               : 

        .struct 0
        .skip   Bits
DMA_ResumeFlags                : 

        .struct 0
        .skip   Bits
DMA_ExamineFlags               : 


@Symbols for SWI's and SWI reason codes
.set XDMA_RegisterChannel,0x66140
.set DMA_RegisterChannel,0x46140
   @Entry
   @  R0 = flags (DMA_RegisterChannelFlags)
   @  R1 = log_channel (Int)
   @  R2 = cycle_speed (Int)
   @  R3 = transfer_size (Int)
   @  R4 -> control_routines (DMA_Routines)
   @  R5 = workspace (pointer to Void)
   @Exit
   @  R0 = channel (DMA_C)

.set XDMA_DeregisterChannel,0x66141
.set DMA_DeregisterChannel,0x46141
   @Entry
   @  R0 = channel (DMA_C)

.set XDMA_QueueTransfer,0x66142
.set DMA_QueueTransfer,0x46142
   @Entry
   @  R0 = flags (DMA_QueueFlags)
   @  R1 = channel (DMA_C)
   @  R2 = workspace (pointer to Void)
   @  R3 -> scatter_list (DMA_ScatterList)
   @  R4 = transfer_size (Int)
   @  R5 = buffer_size (Int)
   @  R6 = sync_size (Int)
   @Exit
   @  R0 = tag (DMA_Tag)

.set XDMA_TerminateTransfer,0x66143
.set DMA_TerminateTransfer,0x46143
   @Entry
   @  R0 -> error (OS_Error)
   @  R1 = tag (DMA_Tag)

.set XDMA_SuspendTransfer,0x66144
.set DMA_SuspendTransfer,0x46144
   @Entry
   @  R0 = flags (DMA_SuspendFlags)
   @  R1 = tag (DMA_Tag)

.set XDMA_ResumeTransfer,0x66145
.set DMA_ResumeTransfer,0x46145
   @Entry
   @  R0 = flags (DMA_ResumeFlags)
   @  R1 = tag (DMA_Tag)

.set XDMA_ExamineTransfer,0x66146
.set DMA_ExamineTransfer,0x46146
   @Entry
   @  R0 = flags (DMA_ExamineFlags)
   @  R1 = tag (DMA_Tag)
   @Exit
   @  R0 = transferred_size (Int)

#endif
