home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / OB3.2D4.DMS / in.adf / Interfaces / Serial.mod < prev    next >
Encoding:
Text File  |  1992-12-17  |  5.2 KB  |  139 lines

  1. (*-------------------------------------------------------------------------*)
  2. (*                                                                         *)
  3. (*  Amiga Oberon Interface Module:                    Date: 02-Nov-92      *)
  4. (*                                                                         *)
  5. (*   © 1992 by Fridtjof Siebert                                            *)
  6. (*                                                                         *)
  7. (*-------------------------------------------------------------------------*)
  8.  
  9. MODULE Serial;   (* $Implementation- *)
  10.  
  11. IMPORT e * := Exec;
  12.  
  13. TYPE
  14.  
  15.                    (* array of termination char's *)
  16.                    (* to use,see serial.doc setparams *)
  17.  
  18.   IOTArrayPtr * = UNTRACED POINTER TO IOTArray;
  19.   IOTArray * = ARRAY 8 OF CHAR;
  20.  
  21. CONST
  22.  
  23.   defaultCtlChar * = 011130000H;    (* default chars for xON,xOFF *)
  24. (* You may change these via SETPARAMS.  At this time, parity is not
  25.    calculated for xON/xOFF characters.  You must supply them with the
  26.    desired parity. *)
  27.  
  28. TYPE
  29.  
  30. (******************************************************************)
  31. (* CAUTION !!  IF YOU ACCESS the serial.device, you MUST (!!!!) use an
  32.    IOExtSer-sized structure or you may overlay innocent memory !! *)
  33. (******************************************************************)
  34.  
  35.   IOExtSerPtr * = UNTRACED POINTER TO IOExtSer;
  36.   IOExtSer * = STRUCT (ioSer * : e.IOStdReq)
  37.  
  38. (*     STRUCT   MsgNode
  39. *   0   APTR     Succ
  40. *   4   APTR     Pred
  41. *   8   UBYTE    Type
  42. *   9   UBYTE    Pri
  43. *   A   APTR     Name
  44. *   E   APTR     ReplyPort
  45. *  12   UWORD    MNLength
  46. *     STRUCT   IOExt
  47. *  14   APTR     io_Device
  48. *  18   APTR     io_Unit
  49. *  1C   UWORD    io_Command
  50. *  1E   UBYTE    io_Flags
  51. *  1F   UBYTE    io_Error
  52. *     STRUCT   IOStdExt
  53. *  20   ULONG    io_Actual
  54. *  24   ULONG    io_Length
  55. *  28   APTR     io_Data
  56. *  2C   ULONG    io_Offset
  57. *
  58. *  30 *)
  59.     ctlChar * : LONGINT;    (* control char's (order = xON,xOFF,INQ,ACK) *)
  60.     rBufLen * : LONGINT;    (* length in bytes of serial port's read buffer *)
  61.     extFlags * : LONGSET;   (* additional serial flags (see bitdefs below) *)
  62.     baud * : LONGINT;       (* baud rate requested (true baud) *)
  63.     brkTime * : LONGINT;    (* duration of break signal in MICROseconds *)
  64.     termArray * : IOTArray; (* termination character array *)
  65.     readLen * : SHORTINT;   (* bits per read character (# of bits) *)
  66.     writeLen * : SHORTINT;  (* bits per write character (# of bits) *)
  67.     stopBits * : SHORTINT;  (* stopbits for read (# of bits) *)
  68.     serFlags * : SHORTSET;  (* see SerFlags bit definitions below  *)
  69.     status * : SET;
  70.   END;
  71.    (* status of serial port, as follows:
  72. *                  BIT  ACTIVE  FUNCTION
  73. *                   0    ---    reserved
  74. *                   1    ---    reserved
  75. *                   2    high   Connected to parallel "select" on the A1000.
  76. *                               Connected to both the parallel "select" and
  77. *                               serial "ring indicator" pins on the A500
  78. *                               & A2000.  Take care when making cables.
  79. *                   3    low    Data Set Ready
  80. *                   4    low    Clear To Send
  81. *                   5    low    Carrier Detect
  82. *                   6    low    Ready To Send
  83. *                   7    low    Data Terminal Ready
  84. *                   8    high   read overrun
  85. *                   9    high   break sent
  86. *                  10    high   break received
  87. *                  11    high   transmit x-OFFed
  88. *                  12    high   receive x-OFFed
  89. *               13-15           reserved
  90. *)
  91.  
  92. CONST
  93.  
  94.   query       * = e.nonstd;       (* 09H *)
  95.   break       * = e.nonstd+1;     (* 0AH *)
  96.   setparams   * = e.nonstd+2;     (* 0BH *)
  97.  
  98.  
  99.   xDisabled  * = 7;       (* serFlags xOn-xOff feature disabled bit *)
  100.   eofMode    * = 6;       (*    "     EOF mode enabled bit *)
  101.   shared     * = 5;       (*    "     non-exclusive access bit *)
  102.   radBoogie  * = 4;       (*    "     high-speed mode active bit *)
  103.   queuedBrk  * = 3;       (*    "     queue this Break ioRqst *)
  104.   sevenWire  * = 2;       (*    "     RS232 7-wire protocol *)
  105.   partyOdd   * = 1;       (*    "     parity feature enabled bit *)
  106.   partyOn    * = 0;       (*    "     parity-enabled bit *)
  107.  
  108. (* These now refect the actual bit positions in the io_Status UWORD *)
  109.   xOffRead   * = 12;      (* status receive currently xOFF'ed bit  *)
  110.   xOffWrite  * = 11;      (*    "   transmit currently xOFF'ed bit *)
  111.   readBreak  * = 10;      (*    "   break was latest input bit     *)
  112.   wroteBreak * =  9;      (*    "   break was latest output bit    *)
  113.   overRun    * =  8;      (*    "   status word RBF overrun bit    *)
  114.  
  115.  
  116.   mSpOn     * = 1;        (* io_ExtFlags. Use mark-space parity, *)
  117.                           (*          instead of odd-even. *)
  118.   mark      * = 0;        (*    "     if mark-space, use mark *)
  119.  
  120.  
  121. (* SerErrs: *)
  122.   devBusy        * =  1;
  123.   baudMismatch   * =  2;  (* baud rate not supported by hardware *)
  124.   bufErr         * =  4;  (* Failed to allocate new read buffer *)
  125.   invParam       * =  5;
  126.   lineErr        * =  6;
  127.   parityErr      * =  9;
  128.   timerErr       * = 11;  (*(See the serial/OpenDevice autodoc)*)
  129.   bufOverflow    * = 12;
  130.   noDSR          * = 13;
  131.   detectedBreak  * = 15;
  132.  
  133.  
  134.   serialName * = "serial.device";
  135.  
  136. END Serial.
  137.  
  138.  
  139.