(*$M-*)
DEFINITION MODULE Serial;

FROM SYSTEM IMPORT 
 ADDRESS,BYTE,LONGSET;
FROM Exec IMPORT
 nonstd,IOFlagSet,IOStdReq,UByte;

CONST
 serialName="serial.device";
 query=nonstd;
 break=nonstd+1;
 setParams=nonstd+2;
 mark=LONGSET{0};
 mSpOn=LONGSET{1};
 active=IOFlagSet{4};
 abort=IOFlagSet{5};
 queued=IOFlagSet{6};
 bufrRead=IOFlagSet{7};

TYPE
 IOTArray=RECORD
  termArray0:LONGCARD;
  termArray1:LONGCARD;
 END;
 SerFlags=(
  partyOn,partyOdd,sevenWire,queuedBrk,radBoogie,shared,
  eofMode,xDisabled
 );
 SerFlagSet=SET OF SerFlags;
 Status=(
  busy,paperOut,select,dataSetReady,clearToSend,carrierDetect,
  readyToSend,dataTerminalReady,overrun,wroteBreak,readBreak,
  xOffWrite,xOffRead
 );
 StatusSet=SET OF Status;
 Error=(
  e0,devBusy,baudMismatch,invBaud,bufErr,invParam,lineErr,
  notOpen,portReset,parityErr,initErr,timerErr,bufOverflow,
  nodsr,nocts,detectedBreak
 );
 IOSerial=RECORD
  ioSer:IOStdReq;
  ctlChar:LONGCARD;
  rBufLen:LONGCARD;
  extFlags:LONGSET;
  baud:LONGCARD;
  brkTime:LONGCARD;
  termArray:IOTArray;
  readLen:UByte;
  writeLen:UByte;
  stopBits:UByte;
  serFlags:SerFlagSet;
  status:StatusSet;
 END;
 IOSerialPtr=POINTER TO IOExtSer;

END Serial.
