| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129 |
- Listing:
- 1 (* Release 3.10 *)
- 2 (*-------------------------------------------------------------------------*
- 3 * *
- 4 * RS232.MOD - COMMS Toolkit serial i/o *
- 5 * *
- 6 * COPYRIGHT (C) 1988..1992 Clarion Software Corporation. *
- 7 * All Rights Reserved *
- 8 * *
- 9 *--------------------------------------------------------------------------*)
- 10
- 11 IMPLEMENTATION MODULE RS232;
- 12 (*%F _OS2*)
- 13 (* DOS Version *)
- 14 (*# check(index=>off)*)
- 15 IMPORT Lib,SYSTEM;
- 16
- 17 CONST
- 18 BuffSize = 1024;
- 19 LowWater = BuffSize DIV 4; (* Buffer Level when Rx is enabled *)
- 20 HighWater = LowWater * 3; (* Buffer Level when Rx is disabled *)
- 21 ICOCW2 = 20H; (* int. controller op. control word 2 *)
- 22 ICOCW1 = 21H; (* int. controller op. control word 1 (mask) *)
- 23 (* Intel 8250 register address offsets *)
- 24 RBR = 0; (* receive buffer register *)
- 25 THR = 0; (* transmitter holding register *)
- 26 DLL = 0; (* divisor latch low (least significant) *)
- 27 DLM = 1; (* divisor latch high (most significant) *)
- 28 IER = 1; (* interrupt enable register *)
- 29 IIR = 2; (* interrupt identification register *)
- 30 LCR = 3; (* line control register *)
- 31 MCR = 4; (* modem control register *)
- 32 LSR = 5; (* line status register *)
- 33 MSR = 6; (* modem status register *)
- 34
- 35 TYPE
- 36 StopStart = (Stop,Start);
- 37 RingBuffer = RECORD
- 38 rptr,wptr : CARDINAL;
- 39 Buff : ARRAY[0..BuffSize-1] OF CHAR;
- 40 END;
- 41
- 42 VAR
- 43 (*# save, data(volatile=>on)*) (* Modified asyncronously - so dont keep in registers! *)
- 44 TxIdle,NoTx : BOOLEAN;
- 45 RxBuff,TxBuff : RingBuffer;
- 46 RxCount : CARDINAL; (* a count of the chars currently in the Rx buffer *)
- 47 (*# restore *)
- 48 FlowCtrlType : FlowControls;
- 49 Installed,
- 50 DCD,CTS,Dummy : BOOLEAN;
- 51 OldVector : FarADDRESS;
- 52 Continue : PROC;
- 53
- 54 (*.............................................*)
- 55
- 56 PROCEDURE Pause():BOOLEAN;
- 57 BEGIN
- 58 (* This procedure just wastes a little time so that chips have a *)
- 59 (* little time to recover between IO calls. *)
- 60 RETURN TRUE; (* do something so that the compiler doesnt optimise *)
- 61 END Pause; (* this procedure out! *)
- 62
- 63 (*.............................................*)
- 64
- 65 PROCEDURE GetVector(Int:WORD):FarADDRESS;
- 66 VAR
- 67 r : SYSTEM.Registers;
- 68 BEGIN
- 69 r.AH := 35H;
- 70 r.AL := BYTE(Int);
- 71 Lib.Intr(r,21H); (* DOS Interrupt *)
- 72 RETURN [r.ES:r.BX];
- 73 END GetVector;
- 74
- 75 PROCEDURE SetVector(Int:WORD;Addr:FarADDRESS);
- 76 VAR
- 77 r : SYSTEM.Registers;
- 78 BEGIN
- 79 r.AH := 25H;
- 80 r.AL := BYTE(Int);
- 81 r.DS := SYSTEM.Seg(Addr^);
- 82 r.DX := SYSTEM.Ofs(Addr^);
- 83 Lib.Intr(r,21H); (* DOS Interrupt *)
- 84 END SetVector;
- 85
- 86 PROCEDURE SelectPort(Port:PortNos);
- 87 BEGIN
- 88 IF Installed THEN
- 89 UnInstall;
- 90 END; (*IF*)
- 91 CASE Port OF
- 92 1 : Base:=3F8H;
- 93 IntLevel:=4; |
- 94 2 : Base:=2F8H;
- 95 IntLevel:=3; |
- 96 3 : Base:=3E8H;
- 97 IntLevel:=4; |
- 98 4 : Base:=2E8H;
- 99 IntLevel:=3; |
- 100 END;
- 101 END SelectPort;
- 102
- 103 (*.............................................*)
- 104
- 105 PROCEDURE InitPort(Baud:CARDINAL;DataBits:Bits;StopBits:Stops;Parity:ParityCodes);
- 106 VAR
- 107 Divisor : CARDINAL;
- 108 LCRValue : SHORTCARD;
- 109 BEGIN
- 110 SYSTEM.Out(Base+LCR,80H); (* turn on DLAB to access the divisor *)
- 111 Divisor := CARDINAL(115200 DIV LONGCARD(Baud)); (* set the divisor *)
- 112 SYSTEM.Out(Base+DLL,SHORTCARD(Divisor MOD 256));
- 113 SYSTEM.Out(Base+DLM,SHORTCARD(Divisor DIV 256));
- 114 (* turn off the DLAB and set the new comm. parameters *)
- 115 LCRValue := SHORTCARD(ORD(Parity)*8+(StopBits-1)*4+(DataBits-5));
- 116 SYSTEM.Out(Base+LCR,LCRValue);
- 117 DCD := 7 IN BITSET(CARDINAL(SYSTEM.In(Base+MSR)));
- 118 Dummy := Pause();
- 119 CTS := 4 IN BITSET(CARDINAL(SYSTEM.In(Base+MSR)));
- 120 END InitPort;
- 121
- 122 (*.............................................*)
- 123
- 124 PROCEDURE TxInt;
- 125 VAR
- 126 tmp : CARDINAL;
- 127 BEGIN
- 128 WITH TxBuff DO
- 129 IF (rptr=wptr) OR (NoTx) THEN
- 130 TxIdle := TRUE
- 131 ELSE
- 132 TxIdle := FALSE;
- 133 tmp := rptr;
- 134 rptr := (rptr+1) MOD BuffSize;
- 135 SYSTEM.Out(Base+THR,SHORTCARD(Buff[tmp]));
- 136 END;
- 137 END;
- 138 END TxInt;
- 139
- 140 (*.............................................*)
- 141
- 142 PROCEDURE SetFlowControl(Which:FlowControls);
- 143 BEGIN
- 144 FlowCtrlType := Which;
- 145 IF Which=RtsCts THEN
- 146 NoTx := NOT CTS;
- 147 ELSE
- 148 NoTx := FALSE;
- 149 END;
- 150 IF TxIdle THEN
- 151 TxInt
- 152 END;
- 153 END SetFlowControl;
- 154
- 155 (*.............................................*)
- 156
- 157 PROCEDURE ControlFlow(Which:StopStart);
- 158 VAR
- 159 Ch : CHAR;
- 160 BEGIN
- 161 IF FlowCtrlType=XonXoff THEN
- 162 IF Which=Stop THEN
- 163 Ch:=XOFF
- 164 ELSE
- 165 Ch:=XON
- 166 END;
- 167 SerialWrite(Ch,1);
- 168 ELSIF FlowCtrlType=RtsCts THEN
- 169 IF Which=Stop THEN
- 170 Ch:=CHR(09H)
- 171 ELSE
- 172 Ch:=CHR(0BH)
- 173 END;
- 174 SYSTEM.Out(Base+MCR,SHORTCARD(Ch));
- 175 END;
- 176 END ControlFlow;
- 177
- 178 (*.............................................*)
- 179
- 180 (*# save, call(interrupt=>on, reg_saved=>(ax,bx,cx,dx,si,di,ds,es,st1,st2),reg_param=>(),same_ds=>off)*)
- 181 (* NB, The interrupt pragma sets up the registers as parameters to the *)
- 182 (* procedure in the order defined below. This allows easy access to *)
- 183 (* the entry registers. *)
- 184 PROCEDURE SerialInt;
- 185 VAR
- 186 c : CHAR;
- 187 IIRReg : SHORTCARD;
- 188 i : CARDINAL;
- 189 b,pic : BITSET;
- 190 BEGIN
- 191 (* Disable serial ints at the interrupt controller *)
- 192 pic := BITSET(SYSTEM.In(ICOCW1));
- 193 INCL(pic,IntLevel);
- 194 SYSTEM.Out(ICOCW1,SHORTCARD(pic));
- 195 SYSTEM.EI; (* now that serial ints are disabled we can allow other int types *)
- 196 LOOP
- 197 IIRReg := SYSTEM.In(Base+IIR);
- 198 IF ODD(IIRReg) THEN
- 199 EXIT;
- 200 END;
- 201 CASE IIRReg DIV 2 OF
- 202 0 : (* Modem Status - get CTS *)
- 203 b := BITSET(SYSTEM.In(Base+MSR));
- 204 IF 0 IN b THEN (* CTS has changed state *)
- 205 CTS := (4 IN b);
- 206 IF FlowCtrlType=RtsCts THEN
- 207 NoTx := (NOT CTS);
- 208 IF TxIdle THEN
- 209 TxInt;
- 210 END;
- 211 END;
- 212 END;
- 213 IF 3 IN b THEN (* DCD has changed state *)
- 214 DCD := (7 IN b);
- 215 END; |
- 216 1 : (* TxReady *)
- 217 TxInt; |
- 218 2 : (* RxReady *)
- 219 c := CHAR(SYSTEM.In(Base));
- 220 IF ((c=XOFF) OR (c=XON)) AND (FlowCtrlType=XonXoff) THEN
- 221 NoTx := (c=XOFF);
- 222 IF TxIdle THEN
- 223 TxInt;
- 224 END;
- 225 ELSE
- 226 WITH RxBuff DO
- 227 Buff[wptr] := CHAR(SYSTEM.In(Base));
- 228 wptr := (wptr+1) MOD BuffSize;
- 229 END;
- 230 SYSTEM.DI;
- 231 INC(RxCount);
- 232 SYSTEM.EI;
- 233 IF RxCount=HighWater THEN
- 234 ControlFlow(Stop);
- 235 END;
- 236 END; |
- 237 3 : (* Rx Line Status - check for error and clear *)
- 238 b := BITSET(SYSTEM.In(Base+LSR));
- 239 b := BITSET(SYSTEM.In(Base));
- 240 (* clear rcv reg also *) |
- 241 END;
- 242 END;
- 243 EXCL(pic,IntLevel); (* reenable serial ints at the int controller *)
- 244 SYSTEM.Out(ICOCW1,SHORTCARD(pic));
- 245 SYSTEM.Out(ICOCW2,SHORTCARD(60H+IntLevel)); (* send specific EOI to 8259 *)
- 246 END SerialInt;
- 247 (*# restore *)
- 248
- 249 (*.............................................*)
- 250
- 251 PROCEDURE Install;
- 252 VAR
- 253 x,IIRReg : SHORTCARD;
- 254 b : BITSET;
- 255 BEGIN
- 256 UnInstall;
- 257 SYSTEM.DI;
- 258 SYSTEM.Out(Base+IER,0); (* disable serial ints while we set things up. *)
- 259 SYSTEM.EI;
- 260 SetVector(IntLevel+8,FarADR(SerialInt));
- 261 RxBuff.rptr := 0; (* initialise ring buffer pointers & other vars *)
- 262 RxBuff.wptr := 0;
- 263 TxBuff.rptr := 0;
- 264 TxBuff.wptr := 0;
- 265 RxCount := 0;
- 266 TxIdle := TRUE;
- 267 NoTx := FALSE;
- 268 SYSTEM.Out(Base+MCR,10H); (* put 8250 UART into loopback mode *)
- 269 REPEAT
- 270 b := BITSET(SYSTEM.In(Base+LSR)); (* wait for tx path to empty *)
- 271 UNTIL (6 IN b);
- 272 WHILE ODD(SYSTEM.In(Base+LSR)) DO (* clear out rx path *)
- 273 x := SYSTEM.In(Base);
- 274 END;
- 275 Dummy := Pause();
- 276 SYSTEM.Out(Base+IER,0FH); (* enable all four types of serial interrupt *)
- 277 Dummy := Pause();
- 278 SYSTEM.Out(Base+MCR,0BH); (* Raise DTR,RTS and OUT2 *)
- 279 Dummy := Pause();
- 280 LOOP
- 281 Dummy := Pause();
- 282 (* force reads from int. identification reg until it clears *)
- 283 IIRReg := SYSTEM.In(Base+IIR);
- 284 IF ODD(IIRReg) THEN
- 285 EXIT;
- 286 END;
- 287 CASE IIRReg DIV 2 OF
- 288 0 : x:=SYSTEM.In(Base+MSR); |
- 289 1 : (* TxIdle -- ignore *) |
- 290 2 : x:=SYSTEM.In(Base); |
- 291 3 : (* Rx Line Status *)
- 292 x:=SYSTEM.In(Base+LSR);
- 293 x:=SYSTEM.In(Base); |
- 294 END;
- 295 END;
- 296 DCD := 7 IN BITSET(CARDINAL(SYSTEM.In(Base+MSR)));
- 297 Dummy := Pause();
- 298 CTS := 4 IN BITSET(CARDINAL(SYSTEM.In(Base+MSR)));
- 299 NoTx := (NOT CTS) AND (FlowCtrlType=RtsCts);
- 300 (* Enable level 4 or level 3 interrupt in interrupt controller *)
- 301 b := BITSET(SYSTEM.In(ICOCW1));
- 302 EXCL(b,IntLevel);
- 303 Dummy := Pause();
- 304 SYSTEM.Out(ICOCW1,SHORTCARD(b));
- 305 Dummy := Pause();
- 306 SYSTEM.Out(ICOCW2,SHORTCARD(IntLevel)+60H); (* EOI to int controller to clr it *)
- 307 Installed := TRUE;
- 308 END Install;
- 309
- 310 (*.............................................*)
- 311
- 312 PROCEDURE CarrierDetect():BOOLEAN;
- 313 BEGIN
- 314 RETURN DCD;
- 315 END CarrierDetect;
- 316
- 317 (*.............................................*)
- 318
- 319 PROCEDURE UnInstall;
- 320 VAR
- 321 b : BITSET;
- 322 BEGIN
- 323 (* Disable level 4 or level 3 interrupt in interrupt controller *)
- 324 b := BITSET(SYSTEM.In(ICOCW1));
- 325 INCL(b,IntLevel);
- 326 Dummy := Pause();
- 327 SYSTEM.Out(ICOCW1,SHORTCARD(b));
- 328 Dummy := Pause();
- 329 SYSTEM.Out(Base+IER,0); (* Disable interrupt from 8250 *)
- 330 Dummy := Pause();
- 331 SYSTEM.Out(Base+MCR,0); (* drop DTR and RTS *)
- 332 SetVector(IntLevel+8,OldVector);
- 333 Installed := FALSE;
- 334 END UnInstall;
- 335
- 336 (*.............................................*)
- 337
- 338 (*# save,call(o_a_copy=>off)*)
- 339 PROCEDURE SerialWrite(b:ARRAY OF CHAR; Lnth:CARDINAL);
- 340 VAR
- 341 c : CHAR;
- 342 i,neww : CARDINAL;
- 343 BEGIN
- 344 IF Hooked THEN
- 345 TxHook(b,Lnth);
- 346 END; (*IF*)
- 347 i:=0;
- 348 WHILE i<Lnth DO
- 349 c := b[i];
- 350 WITH TxBuff DO
- 351 neww := (wptr+1) MOD BuffSize;
- 352 WHILE (neww=rptr) DO
- 353 (* wait if buffer is about to overflow *)
- 354 END;
- 355 Buff[wptr] := c;
- 356 wptr := neww;
- 357 END;
- 358 IF TxIdle THEN
- 359 TxInt;
- 360 END;
- 361 INC(i);
- 362 END;
- 363 END SerialWrite;
- 364 (*# restore *)
- 365
- 366 (*.............................................*)
- 367
- 368 PROCEDURE SerialRead(VAR c:CHAR; t:CARDINAL):BOOLEAN;
- 369 VAR
- 370 t2 : CARDINAL;
- 371 BEGIN
- 372 WITH RxBuff DO
- 373 IF (t>0) AND (rptr=wptr) THEN
- 374 (* if t>0 then wait "t" tenth/secs for char to arrive *)
- 375 WHILE (rptr=wptr) AND (t>0) DO
- 376 t2:=50;
- 377 WHILE (rptr=wptr) AND (t2>0) DO
- 378 Lib.Delay(2);
- 379 DEC(t2);
- 380 END;
- 381 DEC(t);
- 382 END;
- 383 END;
- 384 IF Hooked THEN
- 385 RxHook(c);
- 386 END; (*IF*)
- 387 IF rptr=wptr THEN
- 388 RETURN FALSE;
- 389 ELSE
- 390 c := Buff[rptr];
- 391 rptr := (rptr+1) MOD BuffSize;
- 392 SYSTEM.DI;
- 393 DEC(RxCount);
- 394 SYSTEM.EI;
- 395 IF RxCount=LowWater THEN
- 396 ControlFlow(Start);
- 397 END;
- 398 RETURN TRUE
- 399 END;
- 400 END;
- 401 END SerialRead;
- 402
- 403 (*.............................................*)
- 404
- 405 PROCEDURE FlushInBuf;
- 406 BEGIN
- 407 SYSTEM.DI;
- 408 RxBuff.rptr := 0;
- 409 RxBuff.wptr := 0;
- 410 SYSTEM.EI;
- 411 END FlushInBuf;
- 412
- 413 (*.............................................*)
- 414
- 415 PROCEDURE SetBreak(Tenths:CARDINAL);
- 416 VAR
- 417 b : BITSET;
- 418 BEGIN
- 419 b := BITSET(SYSTEM.In(Base+LCR));
- 420 Dummy := Pause();
- 421 SYSTEM.Out(Base+LCR,SHORTCARD(b+{6}));
- 422 Lib.Delay(Tenths*100);
- 423 SYSTEM.Out(Base+LCR,SHORTCARD(b));
- 424 END SetBreak;
- 425
- 426 (*.............................................*)
- 427
- 428 PROCEDURE AddTxHook(Hook:TxHookProc;VAR OldHook:TxHookProc);
- 429 BEGIN
- 430 OldHook := TxHook;
- 431 TxHook := Hook;
- 432 END AddTxHook;
- 433
- 434 PROCEDURE AddRxHook(Hook:RxHookProc;VAR OldHook:RxHookProc);
- 435 BEGIN
- 436 OldHook := RxHook;
- 437 RxHook := Hook;
- 438 END AddRxHook;
- 439
- 440 PROCEDURE TermProc;
- 441 BEGIN
- 442 UnInstall();
- 443 Continue();
- 444 END TermProc;
- 445
- 446 (*................................................*)
- 447
- 448 BEGIN (*RS232*)
- 449 Base := 3F8H;
- 450 IntLevel := 4;
- 451 FlowCtrlType := RtsCts;
- 452 OldVector := GetVector(IntLevel+8);
- 453 Lib.Terminate(TermProc,Continue);
- 454 Hooked := FALSE;
- 455 RxHook := NULLPROC;
- 456 TxHook := NULLPROC;
- 457 Installed := FALSE;
- 458 END RS232.
- 459 (*%E*)
- 460 (*%T _OS2*)
- 461 (* OS/2 version *)
- 462 IMPORT Dos;
- 463
- 464 TYPE
- 465 Byte = SHORTCARD[0..7];
- 466 ByteSet = SET OF BYTE;
- ***** ^ undeclared identifier
- 467 DCBType = RECORD
- 468 write,read : CARDINAL;
- 469 flag1,flag2,
- 470 flag3 : ByteSet;
- 471 error,break,
- 472 xon,xoff : CHAR;
- 473 END;
- ***** ^ not supported yet
- 474
- 475 VAR
- 476 PortNum : CARDINAL;
- 477 Handle : CARDINAL;
- 478 CurrBaud : CARDINAL;
- 479 CurrData : Bits;
- ***** ^ undeclared identifier
- 480 CurrStop : Stops;
- ***** ^ undeclared identifier
- 481 CurrParity : ParityCodes;
- ***** ^ undeclared identifier
- 482 CurrFlow : FlowControls;
- ***** ^ undeclared identifier
- 483 CurrTime : CARDINAL;
- 484 Locked,Installed : BOOLEAN;
- 485 Null : FarADDRESS;
- ***** ^ undeclared identifier
- 486
- 487 PROCEDURE SelectPort(Port:PortNos);
- ***** ^ undeclared identifier
- 488 BEGIN
- 489 IF NOT Locked THEN
- 490 IF Installed THEN
- 491 UnInstall;
- ***** ^ undeclared identifier
- 492 END; (*IF*)
- 493 PortNum := Port;
- ***** ^ not supported yet
- 494 END;
- 495 END SelectPort;
- ***** ^ not supported yet
- 496
- 497 PROCEDURE InitPort2;
- 498 TYPE
- 499 ParsType = ARRAY ParityCodes OF SHORTCARD;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 500 CONST
- 501 Pars = ParsType(0,1,0,2,0,3,0,4);
- ***** ^ not supported yet
- 502 VAR
- 503 char : RECORD
- 504 data,
- 505 parity,
- 506 stop : SHORTCARD;
- 507 END;
- ***** ^ not supported yet
- 508 BEGIN
- 509 Dos.DevIOCtl(Null,FarADR(CurrBaud),41H,1,Handle);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 510 WITH char DO
- ***** ^ not supported yet
- 511 data := SHORTCARD(CurrData);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 512 parity := Pars[CurrParity];
- ***** ^ not supported yet
- ***** ^ not supported yet
- 513 IF CurrStop = 2 THEN
- ***** ^ not supported yet
- 514 stop := 2;
- ***** ^ not supported yet
- ***** ^ incompatible assignment
- 515 ELSE
- 516 stop := 0;
- ***** ^ not supported yet
- ***** ^ incompatible assignment
- 517 END;
- 518 END;
- ***** ^ not supported yet
- 519 Dos.DevIOCtl(Null,FarADR(char),42H,1,Handle);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 520 END InitPort2;
- ***** ^ not supported yet
- 521
- 522 PROCEDURE InitPort(Baud:CARDINAL;DataBits:Bits;StopBits:Stops;Parity:ParityCodes);
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- 523 BEGIN
- 524 IF NOT Locked THEN
- 525 CurrBaud := Baud;
- 526 CurrData := DataBits;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 527 CurrStop := StopBits;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 528 CurrParity := Parity;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 529 IF Handle # MAX(CARDINAL) THEN
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 530 InitPort2;
- ***** ^ not supported yet
- 531 END;
- 532 END;
- 533 END InitPort;
- ***** ^ not supported yet
- 534
- 535 PROCEDURE SetFlowControl(Which:FlowControls);
- ***** ^ undeclared identifier
- 536 VAR
- 537 dcb : DCBType;
- ***** ^ not supported yet
- 538 BEGIN
- 539 IF NOT Locked THEN
- 540 CurrFlow := Which;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 541 IF Handle # MAX(CARDINAL) THEN
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 542 Dos.DevIOCtl(FarADR(dcb),Null,73H,1,Handle);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 543 WITH dcb DO
- ***** ^ not supported yet
- 544 EXCL(flag2,7);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 545 INCL(flag2,6);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 546 EXCL(flag2,1);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 547 EXCL(flag2,0);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 548 CASE Which OF
- ***** ^ not supported yet
- 549 NoFlowControl : ; (* already set *) |
- ***** ^ undeclared identifier
- 550 RtsCts : INCL(flag2,7);
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 551 EXCL(flag2,6); |
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 552 XonXoff : INCL(flag2,1);
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 553 INCL(flag2,0); |
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 554 END;
- 555 END;
- ***** ^ not supported yet
- 556 Dos.DevIOCtl(Null,FarADR(dcb),53H,1,Handle);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 557 END;
- 558 END;
- 559 END SetFlowControl;
- ***** ^ not supported yet
- 560
- 561 PROCEDURE SetRdTime(time:CARDINAL);
- 562 VAR
- 563 dcb : DCBType;
- ***** ^ not supported yet
- 564 BEGIN
- 565 Dos.DevIOCtl(FarADR(dcb),Null,73H,1,Handle);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 566 WITH dcb DO
- ***** ^ not supported yet
- 567 INCL(flag3,1);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 568 IF time = 0 THEN
- 569 INCL(flag3,2);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 570 read := 0;
- ***** ^ not supported yet
- ***** ^ incompatible assignment
- 571 ELSE
- 572 IF time = MAX(CARDINAL) THEN
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 573 read := 0;
- ***** ^ not supported yet
- ***** ^ incompatible assignment
- 574 ELSE
- 575 read := time*10-1;
- ***** ^ not supported yet
- ***** ^ incompatible assignment
- 576 END;
- 577 EXCL(flag3,2);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 578 END;
- 579 END;
- ***** ^ not supported yet
- 580 Dos.DevIOCtl(Null,FarADR(dcb),53H,1,Handle);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 581 CurrTime := time;
- 582 END SetRdTime;
- ***** ^ not supported yet
- 583
- 584 PROCEDURE SetWrTime(time:CARDINAL);
- 585 VAR
- 586 dcb : DCBType;
- ***** ^ not supported yet
- 587 BEGIN
- 588 Dos.DevIOCtl(FarADR(dcb),Null,73H,1,Handle);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 589 WITH dcb DO
- ***** ^ not supported yet
- 590 IF time = 0 THEN
- 591 INCL(flag3,0);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 592 ELSE
- 593 IF time = MAX(CARDINAL) THEN
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 594 write := 0;
- ***** ^ not supported yet
- ***** ^ incompatible assignment
- 595 ELSE
- 596 write := time*10-1;
- ***** ^ not supported yet
- ***** ^ incompatible assignment
- 597 END;
- 598 EXCL(flag3,0);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 599 END;
- 600 END;
- ***** ^ not supported yet
- 601 Dos.DevIOCtl(Null,FarADR(dcb),53H,1,Handle);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 602 END SetWrTime;
- ***** ^ not supported yet
- 603
- 604 PROCEDURE UnInstall2;
- 605 VAR
- 606 tmp : CARDINAL;
- 607 BEGIN
- 608 IF Handle # MAX(CARDINAL) THEN
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 609 tmp := Handle;
- 610 Handle := MAX(CARDINAL);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 611 SetRdTime(MAX(CARDINAL));
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 612 SetWrTime(MAX(CARDINAL));
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 613 Dos.Close(tmp);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 614 END;
- 615 END UnInstall2;
- ***** ^ not supported yet
- 616
- 617 PROCEDURE Install;
- 618 TYPE
- 619 NamesType = ARRAY PortNos OF ARRAY[0..4] OF CHAR;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 620 CONST
- 621 Names = NamesType('COM1'+0C,'COM2'+0C,'COM3'+0C,'NUL'+0C);
- ***** ^ not supported yet
- ***** ^ arithmetic operand must be numeric
- ***** ^ not supported yet
- ***** ^ arithmetic operand must be numeric
- ***** ^ not supported yet
- ***** ^ arithmetic operand must be numeric
- ***** ^ not supported yet
- ***** ^ arithmetic operand must be numeric
- 622 VAR
- 623 r : CARDINAL;
- 624 a : CARDINAL;
- 625 BEGIN
- 626 Dos.EnterCritSec();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 627 IF NOT Locked THEN
- 628 Locked := TRUE;
- 629 Dos.ExitCritSec();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 630 UnInstall2;
- ***** ^ not supported yet
- 631 r := Dos.Open(Names[PortNum],Handle,a,0,0,1,CARDINAL({13,7,4,1}),0);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 632 IF r = 0 THEN
- 633 InitPort2;
- ***** ^ not supported yet
- 634 SetFlowControl(CurrFlow);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 635 SetRdTime(MAX(CARDINAL));
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 636 SetWrTime(600);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 637 Installed := TRUE;
- 638 ELSE
- 639 Handle := MAX(CARDINAL);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 640 END;
- 641 Locked := FALSE;
- 642 ELSE
- 643 Dos.ExitCritSec();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 644 END;
- 645 END Install;
- ***** ^ not supported yet
- 646
- 647 PROCEDURE CarrierDetect():BOOLEAN;
- 648 VAR
- 649 r : CARDINAL;
- 650 mcis : ByteSet;
- ***** ^ not supported yet
- 651 BEGIN
- 652 IF NOT Locked AND (Handle # MAX(CARDINAL)) THEN
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 653 r := Dos.DevIOCtl(FarADR(mcis),Null,67H,1,Handle);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 654 RETURN (r = 0) AND (7 IN mcis);
- ***** ^ not supported yet
- 655 ELSE
- 656 RETURN FALSE;
- 657 END;
- 658 END CarrierDetect;
- ***** ^ not supported yet
- 659
- 660 PROCEDURE UnInstall;
- 661 VAR
- 662 tmp : CARDINAL;
- 663 BEGIN
- 664 Dos.EnterCritSec();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 665 IF NOT Locked THEN
- 666 Locked := TRUE;
- 667 Dos.ExitCritSec();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 668 UnInstall2;
- ***** ^ not supported yet
- 669 Locked := FALSE;
- 670 Installed := FALSE;
- 671 ELSE
- 672 Dos.ExitCritSec();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 673 END;
- 674 END UnInstall;
- ***** ^ not supported yet
- 675
- 676 (*# save, call(o_a_copy => off), check(index=>off) *)
- 677 PROCEDURE SerialWrite(b:ARRAY OF CHAR; Lnth:CARDINAL);
- ***** ^ not supported yet
- 678 VAR
- 679 cnt,pos : CARDINAL;
- 680 BEGIN
- 681 IF NOT Locked AND (Handle # MAX(CARDINAL)) THEN
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 682 IF Hooked THEN
- ***** ^ undeclared identifier
- 683 TxHook(b,Lnth);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 684 END; (*IF*)
- 685 pos := 0;
- 686 WHILE Lnth-pos # 0 DO
- 687 Dos.Write(Handle,FarADR(b[pos]),Lnth-pos,cnt);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 688 INC(pos,cnt);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 689 END;
- 690 END;
- 691 END SerialWrite;
- ***** ^ not supported yet
- 692 (*# restore *)
- 693
- 694 PROCEDURE SerialRead(VAR c:CHAR; t:CARDINAL):BOOLEAN;
- 695 VAR
- 696 r : CARDINAL;
- 697 len : CARDINAL;
- 698 BEGIN
- 699 IF NOT Locked AND (Handle # MAX(CARDINAL)) THEN
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 700 IF t # CurrTime THEN
- 701 SetRdTime(t);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 702 END;
- 703 r := Dos.Read(Handle,FarADR(c),1,len);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 704 IF Hooked THEN
- ***** ^ undeclared identifier
- 705 RxHook(c);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 706 END; (*IF*)
- 707 RETURN (r = 0) AND (len # 0);
- 708 ELSE
- 709 RETURN FALSE;
- 710 END;
- 711 END SerialRead;
- ***** ^ not supported yet
- 712
- 713 PROCEDURE FlushInBuf;
- 714 VAR
- 715 Return : RECORD
- 716 Chars,
- 717 QSize : CARDINAL;
- 718 END; (*RECORD*)
- ***** ^ not supported yet
- 719 i : CARDINAL;
- 720 void : ARRAY[0..128] OF BYTE;
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 721 BEGIN
- 722 Dos.DevIOCtl(FarADR(Return),Null,68H,1,Handle);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 723 WHILE Return.Chars > 0 DO
- ***** ^ not supported yet
- ***** ^ not supported yet
- 724 IF Return.Chars > SIZE(void) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 725 i := SIZE(void);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 726 ELSE
- 727 i := Return.Chars;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 728 END; (*IF*)
- 729 Dos.Read(Handle,FarADR(void),i,i);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 730 DEC(Return.Chars,i);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 731 END; (*WHILE*)
- 732 END FlushInBuf;
- ***** ^ not supported yet
- 733
- 734 PROCEDURE SetBreak(Tenths:CARDINAL);
- 735 VAR
- 736 err : CARDINAL;
- 737 BEGIN
- 738 IF NOT Locked AND (Handle # MAX(CARDINAL)) THEN
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 739 Dos.DevIOCtl(FarADR(err),Null,4BH,1,Handle);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 740 Dos.Sleep(VAL(LONGCARD,Tenths)*100);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 741 Dos.DevIOCtl(FarADR(err),Null,45H,1,Handle);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 742 END;
- 743 END SetBreak;
- ***** ^ not supported yet
- 744
- 745 PROCEDURE AddTxHook(Hook:TxHookProc;VAR OldHook:TxHookProc);
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- 746 BEGIN
- 747 OldHook := TxHook;
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 748 TxHook := Hook;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 749 END AddTxHook;
- ***** ^ not supported yet
- 750
- 751 PROCEDURE AddRxHook(Hook:RxHookProc;VAR OldHook:RxHookProc);
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- 752 BEGIN
- 753 OldHook := RxHook;
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 754 RxHook := Hook;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 755 END AddRxHook;
- ***** ^ not supported yet
- 756
- 757
- 758 BEGIN (*RS232*)
- 759 Handle := MAX(CARDINAL);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 760 CurrBaud := 1200;
- 761 CurrData := 8;
- ***** ^ not supported yet
- 762 CurrStop := 1;
- ***** ^ not supported yet
- 763 CurrParity := None;
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 764 CurrFlow := RtsCts;
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 765 Locked := FALSE;
- 766 Null := FarNIL;
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 767 SelectPort(1);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 768 Hooked := FALSE;
- ***** ^ undeclared identifier
- 769 RxHook := NULLPROC;
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- 770 TxHook := NULLPROC;
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- 771 Installed := FALSE;
- 772 END RS232.
- ***** ^ not supported yet
- 773 (*%E*)
- 774
- 349 errors
|