    IFND EXEC_IO_I@
EXEC_IO_I@ = 1
;*********************************************************************
;
;   Commodore Amiga -- ROM Operating System Executive Include File
;
;*********************************************************************
;
;   Source Control:
;
;       $Header: io.i,v 33.1 86/03/31 00:55:30 neil Exp $
;
;       $Locker:  $
;
;*********************************************************************

    IFND EXEC_PORTS_I@
    INCLUDE "exec/ports.i"
    ENDIF

    IFND EXEC_LIBRARIES_I@
    INCLUDE "exec/libraries.i"
    ENDIF


;----------------------------------------------------------------
;
;   IO Request Structures
;
;----------------------------------------------------------------

;------ Required portion of IO request:

 STRUCTURE  IO,MN_SIZE
    APTR    IO_DEVICE                   ; device node pointer
    APTR    IO_UNIT                     ; unit (driver private)
    UWORD   IO_COMMAND                  ; device command
    UBYTE   IO_FLAGS                    ; special flags
    BYTE    IO_ERROR                    ; error or warning code
    LABEL   IO_SIZE


;------ Standard IO request extension:

    ULONG   IO_ACTUAL                   ; actual # of bytes transfered
    ULONG   IO_LENGTH                   ; requested # of bytes transfered
    APTR    IO_DATA                     ; pointer to data area
    ULONG   IO_OFFSET                   ; offset for seeking devices
    LABEL   IOSTD_SIZE


;------ IO_FLAGS bit definitions:

;    BITDEF  IO,QUICK,0                  ; complete IO quickly
IOB_QUICK = 0                  ; complete IO quickly
IOF_QUICK = 1<<0                  ; complete IO quickly


;----------------------------------------------------------------
;
;   Standard Device Library Functions
;
;----------------------------------------------------------------

            LIBINIT

            LIBDEF  DEV_BEGINIO         ; process IO request
            LIBDEF  DEV_ABORTIO         ; abort IO request


;----------------------------------------------------------------
;
;   IO Function Macros
;
;----------------------------------------------------------------

BEGINIO     MACRO
            LINKLIB DEV_BEGINIO,IO_DEVICE(A1)
            ENDM

ABORTIO     MACRO
            LINKLIB DEV_ABORTIO,IO_DEVICE(A1)
            ENDM


;----------------------------------------------------------------
;
;   Standard Device Command Definitions
;
;----------------------------------------------------------------

;------ Command definition macro:
DEVINIT     MACRO   $\1   ; [baseOffset]
            IFND     \1
CMD_COUNT@   =     CMD_NONSTD
            ELSE
CMD_COUNT@   =     \1
            ENDIF
            ENDM

DEVCMD      MACRO   $\1  ; cmdname
$\1          EQU     CMD_COUNT@
CMD_COUNT@   =     CMD_COUNT@+1
            ENDM


;------ Standard device commands:

            DEVINIT 0

            DEVCMD  CMD_INVALID         ; invalid command
            DEVCMD  CMD_RESET           ; reset as if just inited
            DEVCMD  CMD_READ            ; standard read
            DEVCMD  CMD_WRITE           ; standard write
            DEVCMD  CMD_UPDATE          ; write out all buffers
            DEVCMD  CMD_CLEAR           ; clear all buffers
            DEVCMD  CMD_STOP            ; hold current and queued
            DEVCMD  CMD_START           ; restart after stop
            DEVCMD  CMD_FLUSH           ; abort entire queue


;------ First non-standard device command value:

            DEVCMD  CMD_NONSTD

    ENDIF
    END

 