home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / m2 / CycloneModules.lha / modules / txt / Serial.def < prev    next >
Text File  |  1996-07-05  |  4KB  |  150 lines

  1. (*$ Implementation- *)
  2. DEFINITION MODULE Serial;
  3. (* 2-July-96/Stefan Tiemann for Cyclone *)
  4. (* Converted from C-include: serial.h 33.6 (6.11.90), Includes Release 40.15 *)
  5.  
  6. FROM SYSTEM IMPORT
  7.  ADDRESS;
  8.  
  9. FROM ExecD IMPORT
  10.  nonstd,IOFlagSet,IOStdReq;
  11.  
  12. CONST
  13.  serialName="serial.device";
  14.  
  15. CONST
  16.  query= nonstd;             (* $09 *)
  17.  break= nonstd+1;        (* $0A *)
  18.  setParams= nonstd+2;    (* $0B *)
  19.  
  20.  active= IOFlagSet{4};   (* rqst-qued-or-current bit *)
  21.  abort= IOFlagSet{5};    (* rqst-aborted bit *)
  22.  queued= IOFlagSet{6};   (* rqst-queued bit *)
  23.  bufrRead= IOFlagSet{7}; (* from read buffer bit *)
  24.  
  25. TYPE
  26.            (* array of termination char's *)
  27.            (* to use,see serial.doc setparams *)
  28.  
  29.  IOTArray= RECORD
  30.   termArray0: LONGCARD;
  31.   termArray1: LONGCARD;
  32.  END;
  33.  
  34. CONST
  35.  defaultCtlChar=11130000H;    (* default chars for xON,xOFF *)
  36. (* You may change these via SETPARAMS.    At this time, parity is not
  37.    calculated for xON/xOFF characters.    You must supply them with the
  38.    desired parity. *)
  39.  
  40.  
  41.  
  42. TYPE
  43.  SerFlags=(
  44.   partyOn,  (* parity-enabled bit *)
  45.   partyOdd, (* parity feature enabled bit *)
  46.   sevenWire,(* RS232 7-wire protocol *)
  47.   queuedBrk,(* queue this Break ioRqst *)
  48.   radBoogie,(* high-speed mode active bit *)
  49.   shared,   (* non-exclusive access bit *)
  50.   eofMode,  (* EOF mode enabled bit *)
  51.   xDisabled (* xOn-xOff feature disabled bit *)
  52.  );
  53.  SerFlagSet=SET OF SerFlags;
  54.  
  55.    (* status of serial port, as follows:
  56. *           BIT    ACTIVE    FUNCTION
  57. *            0     ---    reserved
  58. *            1     ---    reserved
  59. *            2     high    Connected to parallel "select" on the A1000.
  60. *                Connected to both the parallel "select" and
  61. *                serial "ring indicator" pins on the A500
  62. *                & A2000.  Take care when making cables.
  63. *            3     low    Data Set Ready
  64. *            4     low    Clear To Send
  65. *            5     low    Carrier Detect
  66. *            6     low    Ready To Send
  67. *            7     low    Data Terminal Ready
  68. *            8     high    read overrun
  69. *            9     high    break sent
  70. *           10     high    break received
  71. *           11     high    transmit x-OFFed
  72. *           12     high    receive x-OFFed
  73. *        13-15        reserved
  74. *)
  75.  Status=(
  76.   sta0,
  77.   sta1,
  78.   ringIndicator,  (* = select *)
  79.   dataSetReady,
  80.   clearToSend,
  81.   carrierDetect,
  82.   readyToSend,
  83.   dataTerminalReady,
  84.   overrun,        (* status word RBF overrun bit *)
  85.   wroteBreak,     (* break was latest output bit *)
  86.   readBreak,      (* break was latest input bit *)
  87.   xOffWrite,      (* transmit currently xOFF'ed bit *)
  88.   xOffRead        (* receive currently xOFF'ed bit *)
  89.  );
  90.  StatusSet= SET OF Status;
  91. CONST
  92.  select= ringIndicator;
  93.  
  94. TYPE
  95.  ExtSerFlags=(
  96.   mark,    (* if mark-space, use mark *)
  97.   mSpOn,   (* Use mark-space parity, instead of odd-even. **)
  98.   esf2,esf3,esf4,esf5,esf6,esf7,esf8,esf9,esf10,esf11,esf12,esf13,
  99.   esf14,esf15,esf16
  100.  );
  101.  ExtSerFlagSet= SET OF ExtSerFlags;
  102.  
  103.  
  104.  
  105. (******************************************************************)
  106. (* CAUTION !!  IF YOU ACCESS the serial.device, you MUST (!!!!) use an
  107.    IOExtSer-sized structure or you may overlay innocent memory !! *)
  108. (******************************************************************)
  109.  IOExtSer= RECORD
  110.   ioSer: IOStdReq;
  111.   ctlChar: LONGCARD;       (* control char's (order = xON,xOFF,INQ,ACK) *)
  112.   rBufLen: LONGCARD;       (* length in bytes of serial port's read buffer *)
  113.   extFlags: ExtSerFlagSet; (* additional serial flags (see bitdefs below) *)
  114.   baud: LONGCARD;          (* baud rate requested (true baud) *)
  115.   brkTime: LONGCARD;       (* duration of break signal in MICROseconds *)
  116.   termArray: IOTArray;     (* termination character array *)
  117.   readLen: SHORTCARD;      (* bits per read character (# of bits) *)
  118.   writeLen: SHORTCARD;     (* bits per write character (# of bits) *)
  119.   stopBits: SHORTCARD;     (* stopbits for read (# of bits) *)
  120.   serFlags: SerFlagSet;    (* see SerFlags bit definitions below  *)
  121.   status: StatusSet;
  122.  END;
  123.  IOExtSerPtr= POINTER TO IOExtSer;
  124.  
  125.  
  126.  Error=(
  127.   e0,
  128.   devBusy,
  129.   baudMismatch,   (* baud rate not supported by hardware *)
  130.   invBaud,        (* unused *)
  131.   bufErr,         (* Failed to allocate new read buffer *)
  132.   invParam,
  133.   lineErr,
  134.   notOpen,        (* unused *)
  135.   portReset,      (* unused *)
  136.   parityErr,
  137.   initErr,        (* unused *)
  138.   timerErr,       (*(See the serial/OpenDevice autodoc)*)
  139.   bufOverflow,
  140.   nodsr,
  141.   nocts,          (* unused *)
  142.   detectedBreak
  143.  );
  144.  
  145. END Serial.
  146.  
  147.  
  148.  
  149.  
  150.