home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / TRSICAT.LZX / CATS_CD2_TRSI / Inc&AD1.3 / Includes / devices / serial.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-12  |  7.1 KB  |  181 lines

  1. #ifndef DEVICES_SERIAL_H
  2. #define DEVICES_SERIAL_H
  3.  
  4. /*
  5. **    $Filename: devices/serial.h $
  6. **    $Release: 1.3 $
  7. **
  8. **    external declarations for the serial device
  9. **
  10. **    (C) Copyright 1985,1986,1987,1988 Commodore-Amiga, Inc.
  11. **        All Rights Reserved
  12. */
  13.  
  14. #ifndef EXEC_IO_H
  15. #include    "exec/io.h"
  16. #endif /* EXEC_IO_H */
  17.  
  18.            /* array of termination char's */
  19.            /* to use,see serial.doc setparams */
  20.  
  21.  struct     IOTArray {    
  22.     ULONG TermArray0; 
  23.     ULONG TermArray1;
  24. };
  25.  
  26.  
  27. #define SER_DEFAULT_CTLCHAR 0x11130000    /* default chars for xON,xOFF */
  28. /* You may change these via SETPARAMS.    At this time, parity is not
  29.    calculated for xON/xOFF characters.    You must supply them with the
  30.    desired parity. */
  31.  
  32. /******************************************************************/
  33. /* CAUTION !!  IF YOU ACCESS the serial.device, you MUST (!!!!) use an
  34.    IOExtSer-sized structure or you may overlay innocent memory !! */
  35. /******************************************************************/
  36.  
  37.  struct     IOExtSer {
  38.     struct     IOStdReq IOSer;
  39.  
  40. /*     STRUCT    MsgNode
  41. *   0    APTR     Succ
  42. *   4    APTR     Pred
  43. *   8    UBYTE     Type
  44. *   9    UBYTE     Pri
  45. *   A    APTR     Name
  46. *   E    APTR     ReplyPort
  47. *  12    UWORD     MNLength
  48. *     STRUCT   IOExt
  49. *  14    APTR     io_Device
  50. *  18    APTR     io_Unit
  51. *  1C    UWORD     io_Command
  52. *  1E    UBYTE     io_Flags
  53. *  1F    UBYTE     io_Error
  54. *     STRUCT   IOStdExt
  55. *  20    ULONG     io_Actual
  56. *  24    ULONG     io_Length
  57. *  28    APTR     io_Data
  58. *  2C    ULONG     io_Offset
  59. *
  60. *  30 */  
  61.    ULONG   io_CtlChar;      /* control char's (order = xON,xOFF,INQ,ACK) */
  62.    ULONG   io_RBufLen;      /* length in bytes of serial port's read buffer */
  63.    ULONG   io_ExtFlags;      /* additional serial flags (see bitdefs below) */
  64.    ULONG   io_Baud;      /* baud rate requested (true baud) */
  65.    ULONG   io_BrkTime;      /* duration of break signal in MICROseconds */
  66.    struct  IOTArray io_TermArray; /* termination character array */
  67.    UBYTE   io_ReadLen;      /* bits per read character (# of bits) */
  68.    UBYTE   io_WriteLen;      /* bits per write character (# of bits) */
  69.    UBYTE   io_StopBits;      /* stopbits for read (# of bits) */
  70.    UBYTE   io_SerFlags;      /* see SerFlags bit definitions below     */
  71.    UWORD   io_Status;  
  72. };
  73.    /* status of serial port, as follows:
  74. *           BIT    ACTIVE    FUNCTION
  75. *            0     ---    reserved
  76. *            1     ---    reserved 
  77. *            2     high    Connected to parallel "select" on the A1000.
  78. *                Connected to both the parallel "select" and
  79. *                serial "ring indicator" pins on the A500 &
  80. *                A2000.    Take care when making cables.
  81. *            3     low    Data Set Ready
  82. *            4     low    Clear To Send
  83. *            5     low    Carrier Detect
  84. *            6     low    Ready To Send
  85. *            7     low    Data Terminal Ready
  86. *            8     high    read overrun
  87. *            9     high    break sent
  88. *           10     high    break received
  89. *           11     high    transmit x-OFFed       
  90. *           12     high    receive x-OFFed          
  91. *        13-15        reserved
  92. */
  93.  
  94. #define      SDCMD_QUERY        CMD_NONSTD
  95. #define      SDCMD_BREAK           (CMD_NONSTD+1)
  96. #define      SDCMD_SETPARAMS      (CMD_NONSTD+2)
  97.  
  98.     
  99. #define SERB_XDISABLED    7    /* io_SerFlags xOn-xOff feature disabled bit */
  100. #define SERF_XDISABLED    (1<<7)    /*    "        xOn-xOff feature disabled mask */
  101. #define SERB_EOFMODE    6    /*    "        EOF mode enabled bit */
  102. #define SERF_EOFMODE    (1<<6)    /*    "        EOF mode enabled mask */
  103. #define SERB_SHARED    5    /*    "        non-exclusive access bit */
  104. #define SERF_SHARED    (1<<5)    /*    "        non-exclusive access mask */
  105. #define SERB_RAD_BOOGIE 4    /*    "        high-speed mode active bit */
  106. #define SERF_RAD_BOOGIE (1<<4)    /*    "        high-speed mode active mask */
  107. #define SERB_QUEUEDBRK    3    /*    "        queue this Break ioRqst */
  108. #define SERF_QUEUEDBRK    (1<<3)    /*    "        queue this Break ioRqst */
  109. #define SERB_7WIRE    2    /*    "        RS232 7-wire protocol */
  110. #define SERF_7WIRE    (1<<2)    /*    "        RS232 7-wire protocol */
  111. #define SERB_PARTY_ODD    1    /*    "        parity feature enabled bit */
  112. #define SERF_PARTY_ODD    (1<<1)    /*    "        parity feature enabled mask */
  113. #define SERB_PARTY_ON    0    /*    "        parity-enabled bit */ 
  114. #define SERF_PARTY_ON    (1<<0)    /*    "        parity-enabled mask */
  115.  
  116. /* These now refect the actual bit positions in the io_Status UWORD */
  117. #define IO_STATB_XOFFREAD 12       /* io_Status receive currently xOFF'ed bit */
  118. #define IO_STATF_XOFFREAD (1<<12)  /*     "     receive currently xOFF'ed mask */
  119. #define IO_STATB_XOFFWRITE 11       /*     "     transmit currently xOFF'ed bit */
  120. #define IO_STATF_XOFFWRITE (1<<11) /*     "     transmit currently xOFF'ed mask */
  121. #define IO_STATB_READBREAK 10       /*     "     break was latest input bit */
  122. #define IO_STATF_READBREAK (1<<10) /*     "     break was latest input mask */
  123. #define IO_STATB_WROTEBREAK 9       /*     "     break was latest output bit */
  124. #define IO_STATF_WROTEBREAK (1<<9) /*     "     break was latest output mask */
  125. #define IO_STATB_OVERRUN 8       /*     "     status word RBF overrun bit */
  126. #define IO_STATF_OVERRUN (1<<8)       /*     "     status word RBF overrun mask */
  127.  
  128.  
  129. #define SEXTB_MSPON    1    /* io_ExtFlags. Use mark-space parity, */
  130.                 /*        instead of odd-even. */
  131. #define SEXTF_MSPON    (1<<1)    /*    "        mark-space parity mask */
  132. #define SEXTB_MARK    0    /*    "        if mark-space, use mark */
  133. #define SEXTF_MARK    (1<<0)    /*    "        if mark-space, use mark mask */
  134.  
  135.  
  136. #define SerErr_DevBusy           1
  137. #define SerErr_BufErr           4    /* Failed to allocate new read buffer */
  138. #define SerErr_InvParam           5
  139. #define SerErr_LineErr           6
  140. #define SerErr_ParityErr       9
  141. #define SerErr_TimerErr          11    /*(See the serial/OpenDevice autodoc)*/
  142. #define SerErr_BufOverflow    12
  143. #define SerErr_NoDSR          13
  144. #define SerErr_DetectedBreak  15
  145.  
  146.  
  147. #ifdef    DEVICES_SERIAL_H_OBSOLETE
  148. #define SerErr_BaudMismatch    2    /* unused */
  149. #define SerErr_InvBaud           3    /* unused */
  150. #define SerErr_NotOpen           7    /* unused */
  151. #define SerErr_PortReset       8    /* unused */
  152. #define SerErr_InitErr          10    /* unused */
  153. #define SerErr_NoCTS          14    /* unused */
  154. /* These defines refer to the HIGH ORDER byte of io_Status.  They have
  155.    been replaced by the new, corrected ones above */
  156. #define IOSTB_XOFFREAD    4    /* iost_hob receive currently xOFF'ed bit */
  157. #define IOSTF_XOFFREAD    (1<<4)    /*    "        receive currently xOFF'ed mask */
  158. #define IOSTB_XOFFWRITE 3    /*    "        transmit currently xOFF'ed bit */
  159. #define IOSTF_XOFFWRITE (1<<3)    /*    "        transmit currently xOFF'ed mask */
  160. #define IOSTB_READBREAK 2    /*    "        break was latest input bit */
  161. #define IOSTF_READBREAK (1<<2)    /*    "        break was latest input mask */
  162. #define IOSTB_WROTEBREAK 1    /*    "        break was latest output bit */
  163. #define IOSTF_WROTEBREAK (1<<1) /*    "        break was latest output mask */
  164. #define IOSTB_OVERRUN    0    /*    "        status word RBF overrun bit */
  165. #define IOSTF_OVERRUN    (1<<0)    /*    "        status word RBF overrun mask */
  166.  
  167. #define IOSERB_BUFRREAD 7    /* io_Flags from read buffer bit */
  168. #define IOSERF_BUFRREAD (1<<7)    /*    "        from read buffer mask */
  169. #define IOSERB_QUEUED    6    /*    "        rqst-queued bit */
  170. #define IOSERF_QUEUED    (1<<6)    /*    "        rqst-queued mask */
  171. #define IOSERB_ABORT    5    /*    "        rqst-aborted bit */
  172. #define IOSERF_ABORT    (1<<5)    /*    "        rqst-aborted mask */
  173. #define IOSERB_ACTIVE    4    /*    "        rqst-qued-or-current bit */
  174. #define IOSERF_ACTIVE    (1<<4)    /*    "        rqst-qued-or-current mask */
  175. #endif    /* DEVICES_SERIAL_H_OBSOLETE */
  176.  
  177.  
  178. #define SERIALNAME     "serial.device"
  179.  
  180. #endif    /* DEVICES_SERIAL_H */
  181.