home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD v1.2 / amidev_cd_12.iso / inc&ad2.0 / includes / devices / serial.i < prev    next >
Text File  |  1992-09-01  |  5KB  |  172 lines

  1.     IFND DEVICES_SERIAL_I
  2. DEVICES_SERIAL_I SET 1
  3. **
  4. **    $Filename: devices/serial.i $
  5. **    $Release: 2.04 Includes, V37.4 $
  6. **    $Revision: 33.6 $
  7. **    $Date: 90/11/06 $
  8. **
  9. **    external declarations for the serial device
  10. **
  11. **    (C) Copyright 1985-1991 Commodore-Amiga, Inc.
  12. **        All Rights Reserved
  13. **
  14.     IFND     EXEC_IO_I
  15.     include "exec/io.i"
  16.     ENDC    !EXEC_IO_I
  17.  
  18. *--------------------------------------------------------------------
  19. *
  20. * Useful constants
  21. *
  22. *--------------------------------------------------------------------
  23. *
  24. SER_DEFAULT_CTLCHAR EQU $11130000  ; default chars for xON,xOFF
  25. ; You may change these via SETPARAMS.  At this time, parity is not
  26. ; calculated for xON/xOFF characters.  You must supply them with the
  27. ; desired parity.
  28.  
  29. *
  30. *--------------------------------------------------------------------
  31. *
  32. * Driver Specific Commands
  33.  
  34. SDCMD_QUERY    EQU    CMD_NONSTD    ;$09
  35. SDCMD_BREAK    EQU    CMD_NONSTD+1    ;$0A
  36. SDCMD_SETPARAMS EQU    CMD_NONSTD+2    ;$0B
  37.  
  38. SER_DEVFINISH    EQU    CMD_NONSTD+2 ; number of device comands
  39.  
  40. *--------------------------------------------------------------------
  41.  
  42. SERIALNAME:    MACRO
  43.         dc.b    'serial.device',0
  44.         dc.w    0
  45.         ENDM
  46.  
  47.     BITDEF    SER,XDISABLED,7      ; SERFLAGS xOn-xOff feature disabled bit
  48.     BITDEF    SER,EOFMODE,6      ;    "     EOF mode enabled bit
  49.     BITDEF    SER,SHARED,5      ;    "     non-exclusive access
  50.     BITDEF    SER,RAD_BOOGIE,4  ;    "     high-speed mode active
  51.     BITDEF    SER,QUEUEDBRK,3      ;    "     queue this Break ioRqst
  52.     BITDEF    SER,7WIRE,2      ;    "     RS232 7-wire protocol 
  53.     BITDEF    SER,PARTY_ODD,1      ;    "     use-odd-parity bit
  54.     BITDEF    SER,PARTY_ON,0      ;    "     parity-enabled bit 
  55. ;
  56. ;WARNING: The next series of BITDEFs refer to the HIGH order BYTE of
  57. ;IO_STATUS.  Example usage: "BTST.B #IOST_XOFFWRITE,IO_STATUS+1(AX)"
  58. ;
  59.     BITDEF    IOST,XOFFREAD,4      ; IOST_HOB receive currently xOFF'ed
  60.     BITDEF    IOST,XOFFWRITE,3  ;    "    transmit currently xOFF'ed
  61.     BITDEF    IOST,READBREAK,2  ;    "    break was latest input
  62.     BITDEF    IOST,WROTEBREAK,1 ;    "    break was latest output
  63.     BITDEF    IOST,OVERRUN,0      ;    "    status word RBF overrun
  64. ;
  65. ;    BITDEF's in a longword field)
  66. ;    Example usage: BSET.B #SEXTB_MSPON,IO_EXTFLAGS+3(AX)
  67.                 ;IO_EXTFLAGS (extended flag longword)
  68.     BITDEF    SEXT,MSPON,1    ;     "       use mark-space parity,not odd-even
  69.     BITDEF    SEXT,MARK,0    ;     "       if mark-space, use mark
  70. *
  71. ******************************************************************************
  72.  STRUCTURE TERMARRAY,0
  73.     ULONG     TERMARRAY_0
  74.     ULONG     TERMARRAY_1
  75.     LABEL     TERMARRAY_SIZE
  76.  
  77. *****************************************************************
  78. * CAUTION !!  IF YOU ACCESS the serial.device, you MUST (!!!!) use an
  79. * IOEXTSER-sized structure or you may overlay innocent memory, okay ?!
  80. *****************************************************************
  81.  
  82.  STRUCTURE IOEXTSER,IOSTD_SIZE
  83.  
  84. *     STRUCT   MsgNode
  85. *   0    APTR     Succ
  86. *   4    APTR     Pred
  87. *   8    UBYTE     Type
  88. *   9    UBYTE     Pri
  89. *   A    APTR     Name
  90. *   E    APTR     ReplyPort
  91. *  12    UWORD     MNLength
  92. *     STRUCT   IOExt
  93. *  14    APTR     IO_DEVICE
  94. *  18    APTR     IO_UNIT
  95. *  1C    UWORD     IO_COMMAND
  96. *  1E    UBYTE     IO_FLAGS
  97. *  1F    UBYTE     IO_ERROR
  98. *     STRUCT   IOStdExt
  99. *  20    ULONG     IO_ACTUAL
  100. *  24    ULONG     IO_LENGTH
  101. *  28    APTR     IO_DATA
  102. *  2C    ULONG     IO_OFFSET
  103. *
  104. *  30
  105.     ULONG    IO_CTLCHAR    ; control char's (order = xON,xOFF,rsvd,rsvd)
  106.     ULONG    IO_RBUFLEN    ; length in bytes of serial port's read buffer
  107.     ULONG    IO_EXTFLAGS    ; additional serial flags (see bitdefs above)
  108.     ULONG    IO_BAUD        ; baud rate requested (true baud)
  109.     ULONG    IO_BRKTIME    ; duration of break signal in MICROseconds
  110.     STRUCT    IO_TERMARRAY,TERMARRAY_SIZE ; termination character array
  111.     UBYTE    IO_READLEN    ; bits per read char (bit count)
  112.     UBYTE    IO_WRITELEN    ; bits per write char (bit count)
  113.     UBYTE    IO_STOPBITS    ; stopbits for read (count)
  114.     UBYTE    IO_SERFLAGS    ; see SERFLAGS bit definitions above
  115.     UWORD    IO_STATUS    ; status of serial port, as follows:
  116. *
  117. *           BIT    ACTIVE    FUNCTION
  118. *            0     ---    reserved
  119. *            1     ---    reserved
  120. *            2     high    Connected to parallel "select" on the A1000.
  121. *                Connected to both the parallel "select" and
  122. *                serial "ring indicator" pins on the A500
  123. *                & A2000.  Take care when making cables.
  124. *            3     low    Data Set Ready
  125. *            4     low    Clear To Send
  126. *            5     low    Carrier Detect
  127. *            6     low    Ready To Send
  128. *            7     low    Data Terminal Ready
  129. *            8     high    read overrun
  130. *            9     high    break sent
  131. *           10     high    break received
  132. *           11     high    transmit x-OFF'ed    
  133. *           12     high    receive x-OFF'ed
  134. *        13-15        reserved
  135. *
  136.     LABEL    IOEXTSER_SIZE
  137.  
  138. ******************************************************************************
  139.  
  140. *--------------------------------------------------------------------
  141. *
  142. * Driver error definitions
  143. *
  144. *--------------------------------------------------------------------
  145.  
  146. SerErr_DevBusy        EQU    1
  147. SerErr_BaudMismatch    EQU    2    ;baud rate not supported by hardware
  148. SerErr_BufErr        EQU    4    ;Failed to allocate new read buffer
  149. SerErr_InvParam        EQU    5
  150. SerErr_LineErr        EQU    6
  151. SerErr_ParityErr    EQU    9
  152. SerErr_TimerErr        EQU    11    ;(See the serial/OpenDevice autodoc)
  153. SerErr_BufOverflow    EQU    12
  154. SerErr_NoDSR        EQU    13
  155. SerErr_DetectedBreak    EQU    15
  156.  
  157.  
  158.  IFD    DEVICES_SERIAL_I_OBSOLETE
  159. SER_DBAUD        EQU    9600    ;unused
  160. SerErr_InvBaud        EQU    3    ;unused
  161. SerErr_NotOpen        EQU    7    ;unused
  162. SerErr_PortReset    EQU    8    ;unused
  163. SerErr_InitErr        EQU    10    ;unused
  164. SerErr_NoCTS        EQU    14    ;unused
  165.     BITDEF    IOSER,QUEUED,6      ; IO_FLAGS rqst-queued bit
  166.     BITDEF    IOSER,ABORT,5      ;    "    rqst-aborted bit
  167.     BITDEF    IOSER,ACTIVE,4      ;    "    rqst-qued-or-current bit
  168.  ENDC
  169.  
  170.  
  171.     ENDC    !DEVICES_SERIAL_I
  172.