head     56.3;
access   paws bayes jws quist brad dew jwh;
symbols  ;
locks    ; strict;
comment  @# @;


56.3
date     93.01.27.13.26.11;  author jwh;  state Exp;
branches ;
next     56.2;

56.2
date     93.01.27.12.04.47;  author jwh;  state Exp;
branches ;
next     56.1;

56.1
date     91.11.05.09.46.08;  author jwh;  state Exp;
branches ;
next     55.1;

55.1
date     91.08.25.10.23.29;  author jwh;  state Exp;
branches ;
next     54.1;

54.1
date     91.03.18.15.26.55;  author jwh;  state Exp;
branches ;
next     53.1;

53.1
date     91.03.11.19.28.00;  author jwh;  state Exp;
branches ;
next     52.1;

52.1
date     91.02.19.09.11.59;  author jwh;  state Exp;
branches ;
next     51.1;

51.1
date     91.01.30.16.11.40;  author jwh;  state Exp;
branches ;
next     50.1;

50.1
date     90.10.29.16.26.25;  author jwh;  state Exp;
branches ;
next     49.1;

49.1
date     90.08.14.14.10.40;  author jwh;  state Exp;
branches ;
next     48.1;

48.1
date     90.07.26.11.16.49;  author jwh;  state Exp;
branches ;
next     47.1;

47.1
date     90.05.14.10.59.34;  author dew;  state Exp;
branches ;
next     46.1;

46.1
date     90.05.07.08.46.44;  author jwh;  state Exp;
branches ;
next     45.1;

45.1
date     90.04.19.15.54.33;  author jwh;  state Exp;
branches ;
next     44.1;

44.1
date     90.04.01.22.11.44;  author jwh;  state Exp;
branches ;
next     43.1;

43.1
date     90.03.20.14.03.35;  author jwh;  state Exp;
branches ;
next     42.1;

42.1
date     90.01.23.17.48.22;  author jwh;  state Exp;
branches ;
next     41.1;

41.1
date     89.12.22.11.30.29;  author jwh;  state Exp;
branches ;
next     40.2;

40.2
date     89.12.14.16.03.01;  author dew;  state Exp;
branches ;
next     40.1;

40.1
date     89.09.29.11.52.28;  author jwh;  state Exp;
branches ;
next     39.1;

39.1
date     89.09.26.16.36.41;  author dew;  state Exp;
branches ;
next     38.4;

38.4
date     89.09.20.12.55.04;  author jwh;  state Exp;
branches ;
next     38.3;

38.3
date     89.09.20.10.59.27;  author jwh;  state Exp;
branches ;
next     38.2;

38.2
date     89.09.14.16.47.44;  author dew;  state Exp;
branches ;
next     38.1;

38.1
date     89.08.29.11.28.49;  author jwh;  state Exp;
branches ;
next     37.1;

37.1
date     89.05.12.11.41.13;  author dew;  state Exp;
branches ;
next     36.1;

36.1
date     89.02.06.10.19.32;  author dew;  state Exp;
branches ;
next     35.1;

35.1
date     89.02.02.13.34.29;  author dew;  state Exp;
branches ;
next     34.1;

34.1
date     89.01.23.16.09.33;  author jwh;  state Exp;
branches ;
next     33.1;

33.1
date     89.01.16.11.41.33;  author dew;  state Exp;
branches ;
next     32.1;

32.1
date     89.01.10.11.50.10;  author bayes;  state Exp;
branches ;
next     31.1;

31.1
date     88.12.14.18.11.21;  author bayes;  state Exp;
branches ;
next     30.1;

30.1
date     88.12.09.13.48.14;  author dew;  state Exp;
branches ;
next     29.1;

29.1
date     88.10.31.15.33.12;  author bayes;  state Exp;
branches ;
next     28.1;

28.1
date     88.10.06.10.59.57;  author dew;  state Exp;
branches ;
next     27.1;

27.1
date     88.09.29.11.35.11;  author bayes;  state Exp;
branches ;
next     26.1;

26.1
date     88.09.28.13.14.47;  author bayes;  state Exp;
branches ;
next     25.1;

25.1
date     88.03.02.09.31.20;  author bayes;  state Exp;
branches ;
next     24.1;

24.1
date     87.08.31.09.52.06;  author jws;  state Exp;
branches ;
next     23.1;

23.1
date     87.08.26.10.29.46;  author bayes;  state Exp;
branches ;
next     22.2;

22.2
date     87.08.25.19.39.06;  author jws;  state Exp;
branches ;
next     22.1;

22.1
date     87.08.17.11.16.26;  author bayes;  state Exp;
branches ;
next     21.1;

21.1
date     87.08.12.13.58.36;  author bayes;  state Exp;
branches ;
next     20.1;

20.1
date     87.07.30.11.11.40;  author bayes;  state Exp;
branches ;
next     19.1;

19.1
date     87.06.01.08.27.11;  author jws;  state Exp;
branches ;
next     18.1;

18.1
date     87.05.20.15.27.14;  author bayes;  state Exp;
branches ;
next     17.1;

17.1
date     87.04.30.10.37.50;  author jws;  state Exp;
branches ;
next     16.1;

16.1
date     87.04.26.15.49.46;  author jws;  state Exp;
branches ;
next     15.1;

15.1
date     87.04.13.09.25.17;  author jws;  state Exp;
branches ;
next     14.1;

14.1
date     87.04.01.15.30.29;  author jws;  state Exp;
branches ;
next     13.1;

13.1
date     87.02.28.18.34.58;  author jws;  state Exp;
branches ;
next     12.1;

12.1
date     87.02.02.13.25.45;  author jws;  state Exp;
branches ;
next     11.1;

11.1
date     87.01.19.09.52.13;  author jws;  state Exp;
branches ;
next     10.1;

10.1
date     86.12.24.11.01.11;  author jws;  state Exp;
branches ;
next     9.1;

9.1
date     86.12.12.14.43.01;  author bayes;  state Exp;
branches ;
next     8.1;

8.1
date     86.11.27.11.59.02;  author jws;  state Exp;
branches ;
next     7.1;

7.1
date     86.11.20.13.49.23;  author hal;  state Exp;
branches ;
next     6.1;

6.1
date     86.11.04.18.01.21;  author paws;  state Exp;
branches ;
next     5.1;

5.1
date     86.10.28.16.50.11;  author hal;  state Exp;
branches ;
next     4.1;

4.1
date     86.09.30.19.49.57;  author hal;  state Exp;
branches ;
next     3.1;

3.1
date     86.09.01.11.59.56;  author hal;  state Exp;
branches ;
next     2.1;

2.1
date     86.07.30.14.47.14;  author hal;  state Exp;
branches ;
next     1.1;

1.1
date     86.06.30.15.16.03;  author danm;  state tmp;
branches ;
next     ;


desc
@Base file for PWS 3.2 release.

@


56.3
log
@
pws2rcs automatic delta on Wed Jan 27 13:14:25 MST 1993
@
text
@
					      (*

 (c) Copyright Hewlett-Packard Company, 1985.
All rights are reserved.  Copying or other
reproduction of this program except for archival
purposes is prohibited without the prior
written consent of Hewlett-Packard Company.


	    RESTRICTED RIGHTS LEGEND

Use, duplication, or disclosure by the Government
is subject to restrictions as set forth in
paragraph (b) (3) (B) of the Rights in Technical
Data and Computer Software clause in
DAR 7-104.9(a).

HEWLETT-PACKARD COMPANY
Fort Collins, Colorado                         *)


$MODCAL ON$
$PARTIAL_EVAL ON$
$RANGE OFF$
$DEBUG OFF$
$OVFLCHECK OFF$
$STACKCHECK OFF$
$PAGE$
(************************************************************************)
(*                                                                      *)
(*      RELEASED        VERSION         3.1                             *)
(*                                                                      *)
(************************************************************************)
(*                                                                      *)
(*                                                                      *)
(*      IOLIB           KERNEL                                          *)
(*                                                                      *)
(*                                                                      *)
(************************************************************************)
(*                                                                      *)
(*                                                                      *)
(*      library      -  IOLIB                                           *)
(*      name         -  KERNEL                                          *)
(*      module(s)    -  iodeclarations                                  *)
(*                   -  iocomasm                                        *)
(*                   -  general_0                                       *)
(*                                                                      *)
(*      author       -  Tim Mikkelsen                                   *)
(*      phone        -  303-226-3800   ext. 2910                        *)
(*                                                                      *)
(*      date         -  June  1 , 1981                                  *)
(*      update       -  June  5 , 1985                                  *)
(*      release      -  Jul  12 , 1985                                  *)
(*                                                                      *)
(*      source       -  IOLIB:KERNEL.TEXT                               *)
(*      object       -  IOLIB:KERNEL.CODE                               *)
(*                                                                      *)
(************************************************************************)
$PAGE$
(************************************************************************)
(*                                                                      *)
(*                                                                      *)
(*      This is the source code for an external procedures library      *)
(*      to be used for general purpose interfacing on the HP 9826.      *)
(*                                                                      *)
(*      The library consists of 3 primary sets of modules -             *)
(*                                                                      *)
(*              1.      KERNEL modules                                  *)
(*              2.      driver modules                                  *)
(*              3.      IOLIB  modules                                  *)
(*                                                                      *)
(*      The KERNEL modules consist of the following modules -           *)
(*                                                                      *)
(*              1.      iodeclarations  ( contains static r/w space )   *)
(*              2.      iocomasm                                        *)
(*              3.      general_0       ( initialization & low level    *)
(*                                        routines like ioread/iowrite) *)
(*      The KERNEL modules also have an executable program segement     *)
(*      that gets executed at the time it is loaded.  This program      *)
(*      initializes the static read/write memory.  This program also    *)
(*      allocates the temporary storage for any card that exists -      *)
(*      independent of whether there is or is not a driver for it.      *)
(*                                                                      *)
(*      The driver modules consist of the actual assembly or PASCAL     *)
(*      routines that deal with a specific interface card.  There is    *)
(*      also an executable program segment for each driver module.      *)
(*      This program searches the select code table in the static r/w   *)
(*      initialized by the KERNEL general_0 module for all select codes *)
(*      that have the right interface card ( HPIB drivers will search   *)
(*      for the 98624 interface ).  This program will then set up the   *)
(*      driver tables to point to the correct drivers.                  *)
(*                                                                      *)
(*      The rest of the IOLIB modules are high-level modules that are   *)
(*      used by an end user in his/her application program.             *)
(*                                                                      *)
(*      The KERNEL and some set of driver modules will exist in the     *)
(*      INITLIB file as object code ( not EXPORT text ).  The           *)
(*      export text will reside on the IO file.  The rest               *)
(*      of the library will reside on the IO file.                      *)
(*                                                                      *)
(************************************************************************)
$PAGE$
(************************************************************************)
(*                                                                      *)
(*                                                                      *)
(*      BUG FIX HISTORY         - after release 1.0                     *)
(*                                                                      *)
(*                                                                      *)
(*      BUG #   BY  / ON        LOC             DESCRIPTION             *)
(*      -----   -----------     --------------  ----------------------  *)
(*                                                                      *)
(*      1281    T Mikkelsen     IODECLARATIONS  bad error message.      *)
(*              01/08/82                        No code change in this  *)
(*                                              module - code change in *)
(*                                              GENERAL_3.              *)
(*                                                                      *)
(*      aaaa    T Mikkelsen     kernel_         No bug sheet.           *)
(*              05/24/82        initialize      The CRT and keyboard    *)
(*                                              select codes were       *)
(*                                              interchanged.  Should   *)
(*                                              have no effect.         *)
(*                                                                      *)
(*      bbbb    T Mikkelsen     kernel_         No bug sheet.           *)
(*              07/09/82        initialize      Adding machine id info  *)
(*                              iodeclarations  for Bob Morain and the  *)
(*                                              Ganglia drivers.        *)
(*                                                                      *)
(*      jw      Jeff Wu         kernel_         No bug sheet.           *)
(*              07/12/82        initialize      Adding temp type for    *)
(*                              iodeclarations  626 drivers.            *)
(*                                                                      *)
(*      0082    T Mikkelsen     kernel_         Adding a link for the   *)
(*              07/23/82        initialize      error message function. *)
(*                              iodeclarations  See also GENERAL_3.     *)
(*                              end_error_link                          *)
(*                                                                      *)
(*      cccc    T Mikkelsen     iodeclarations  Allowing the 98629 card *)
(*              08/16/82                        and the 98628_dsndl as  *)
(*                                              identifiable cards.     *)
(*                                              See DC_DRV modules also.*)
(*                                                                      *)
(*      0350    T Mikkelsen     general_0       Fundamental flaw with   *)
(*              08/19/82                        the dummy drivers.      *)
(*                                                                      *)
(*      0364    T Mikkelsen     iodeclarations  Addition of SRM errors. *)
(*              08/23/82                        See also GENERAL_3.     *)
(*                                                                      *)
(*      0367    T Mikkelsen     iolibrary_kernel                        *)
(*              09/22/82                        Allow kernel to install *)
(*                                              itself - probably will  *)
(*                                              not be used much.       *)
(*                                                                      *)
(*      tttt    T Mikkelsen     kbd_rdb         Change in the handling  *)
(*              09/22/82                        of the keyboard end of  *)
(*                                              line condition from 1.0.*)
(*                                                                      *)
(*      uuuu    T Mikkelsen     iodeclarations  Differentiate between a *)
(*              09/28/82                        628 async and 629 srm   *)
(*                                              card type (srm/serial). *)
(*                                              See also DC_DRV.        *)
(*    ------- changes for release 3.0                                   *)
(*                                                                      *)
(*       jws    J Schmidt       iodeclarations  Add card id's and types *)
(*              03/25/83        general_0       for EPROM programmer    *)
(*                                              and bubble cards.       *)
(*                                              Add initialization code.*)
(*                                                                      *)
(*       jws2   J Schmidt       general_0       Add test for internal   *)
(*              06/28/83                         HP-IB present.         *)
(*                                                                      *)
(*       jws3   J Schmidt       iodeclarations  Deleted io_model_number *)
(*              02/09/84        general_0       and io_model_name stuff *)
(*                                              Added GATOR id, init.   *)
(*       jws4   J Schmidt       iodeclarations  Added id and init for   *)
(*              03/05/84        general_0       98644 card              *)
(*                                                                      *)
(*    ----------- changes for release 3.1                               *)
(*       jws5   J Schmidt       iodeclarations   added new temp type    *)
(*              06/05/85                        to allow space for      *)
(*                                              default settings on     *)
(*                                              98644, 98626            *)
(*                                                                      *)
(*    ----------- changes for release 3.23                              *)
(*       DEW    Dave Willis     iodeclarations  added support for the   *)
(*              09/89                           scsi interfaces.        *)
(*                                                                      *)
(*       DEW1   Dave Willis     iodeclarations  added support for the   *)
(*              12/89                           HP Parallel interfaces  *)
(*                                                                      *)
(************************************************************************)

$PAGE$
(************************************************************************)
(*                                                                      *)
(*                                                                      *)
(*      REFERENCES :                                                    *)
(*                                                                      *)
(*                                                                      *)
(*      1.  9826 I/O Designers Guide            ( Loyd Nelson )         *)
(*                                                                      *)
(*      2.  68000 Manual                        ( Motorola )            *)
(*                                                                      *)
(*      3.  Pascal alpha site ERS               ( Roger Ison )          *)
(*                                                                      *)
(*      4.  Pascal I/O Library ERS              ( Tim Mikkelsen )       *)
(*                                                                      *)
(*      5.  9826 HPL EIO & IOD listings         ( Bob Hallissy )        *)
(*                                                                      *)
(*      6.  9826 HPL Misc. I/O Doc.             ( Bob Hallissy )        *)
(*                                                                      *)
(*      7.  9826 card documentation             ( Mfg. Specs. )         *)
(*                                                                      *)
(*                                                                      *)
(************************************************************************)
$PAGE$
PROGRAM iolibrary_kernel ( INPUT , OUTPUT );



	{ the PROGRAM surrounds the following modules because there needs
	  to be a start address for this set of modules to allow
	  initialization to occur }

$PAGE$
(************************************************************************)
(*                                                                      *)
(*                                                                      *)
(*      GENERAL GROUP           IODECLARATIONS                          *)
(*                                                                      *)
(*                                                                      *)
(************************************************************************)




MODULE iodeclarations ;

	{ by      Tim Mikkelsen
	  date    07/15/81
	  update  03/05/84   by John Schmidt

	  purpose This module contains the common
		  declarations to be used by the
		  rest of the I/O library.

	}



IMPORT  sysglobals;

EXPORT

  CONST
	iominisc   = 0 ;                 { 0 - 7  internal }
	iomaxisc   = 31;                 { 8 - 31 external 8..31 }
	minrealisc = 7 ;
	maxrealisc = 31;                 { 7..31 are real isc.s with temps }

	io_line_feed    = CHR(10);
	io_carriage_rtn = CHR(13);

	$PAGE$

	{ escape code constants }

	ioescapecode    =  -26;

	ioe_no_error    = 0;            { no error                      }
	ioe_no_card     = 1;            { no card at select code        }
	ioe_not_hpib    = 2;            { interface should be hpib      }
	ioe_not_act     = 3;            { not active controller         }
	ioe_not_dvc     = 4;            { should be device not isc      } { BUG 1281 TM 1/8/82}
	ioe_no_space    = 5;            { no space left in buffer       }
	ioe_no_data     = 6;            { no data left in buffer        }
	ioe_bad_tfr     = 7;            { improper transfer attempted   }
	ioe_isc_busy    = 8;            { the select code is busy       }
	ioe_buf_busy    = 9;            { the buffer is busy            }
	ioe_bad_cnt     = 10;           { improper transfer count       }
	ioe_bad_tmo     = 11;           { bad timeout value             }
	ioe_no_driver   = 12;           { no driver for this card       }
	ioe_no_dma      = 13;           { no dma                        }
	ioe_no_word     = 14;           { word operations not allowed   }
	ioe_not_talk    = 15;           { not addressed as talker       }
	ioe_not_lstn    = 16;           { not addressed as listener     }
	ioe_timeout     = 17;           { a timeout has occurred        }
	ioe_not_sctl    = 18;           { not system controller         }
	ioe_rds_wtc     = 19;           { bad status or control         }
	ioe_bad_sct     = 20;           { bad set/clear/test operation  }
	ioe_crd_dwn     = 21;           { interface card is dead        }
	ioe_eod_seen    = 22;           { end/eod has occured           }
	ioe_misc        = 23;           { miscellaneous -               }
					{ value of param error          }

	ioe_sr_toomany  = 304;          { too many chars w/o terminator } { 0364 TM  8/23/82 }
	ioe_dc_fail     = 306;          { dc interface failure          }
	ioe_dc_usart    = 313;          { USART receive buffer overflow }
	ioe_dc_ovfl     = 314;          { receive buffer overflow       }
	ioe_dc_clk      = 315;          { missing clock                 }
	ioe_dc_cts      = 316;          { CTS false too long            }
	ioe_dc_car      = 317;          { lost carrier disconnect       }
	ioe_dc_act      = 318;          { no activity disconnect        }
	ioe_dc_conn     = 319;          { connection not established    }
	ioe_dc_conf     = 325;          { bad data bits/par combination }
	ioe_dc_reg      = 326;          { bad status /control register  }
	ioe_dc_rval     = 327;          { control value out of range    }
	ioe_sr_fail     = 353;          { data link failure             } { 0364 TM  8/23/82 }

	no_isc          = 255;          { used for ioe_isc within io errors }

	$PAGE$
	{ hpib message constants }

	gtl_message     = CHR( 1  );
	sdc_message     = CHR( 4  );
	ppc_message     = CHR( 5  );
	get_message     = CHR( 8  );
	tct_message     = CHR( 9  );
	llo_message     = CHR( 17 );
	dcl_message     = CHR( 20 );
	ppu_message     = CHR( 21 );
	spe_message     = CHR( 24 );
	spd_message     = CHR( 25 );
	unl_message     = CHR( 63 );
	unt_message     = CHR( 95 );
	ppe_message     = CHR( 96 );
	ppd_message     = CHR(112 );


	talk_constant   = 64;
	listen_constant = 32;

$PAGE$

	{ card type constants }

	no_card         = 0 ;
	other_card      = 1 ;
	system_card     = 2 ;
	hpib_card       = 3 ;
	gpio_card       = 4 ;
	serial_card     = 5 ;
	graphics_card   = 6 ;
	srm_card        = 7 ;           { shared resource mgr } { uuuu TM 9/28/82 }
	bubble_card     = 8 ;           { bubble memory       } { jws 3/25/83}
	eprom_prgmr     = 9 ;           { eprom programmer    } { jws 3/25/83}
	scsi_card       = 10;           { 09/89 DEW - added SCSI support}
	pllel_card      = 11;           { 12/89 DEW1 - added Parallel Centronics support}


	{ card id constants             }
	{                               }
	{ positive id's are the actual  }
	{ card id's                     }

	hp98628_dsndl   = -7;           { DSN/DL }              { cccc TM 8/16/82 }
	hp98629         = -6;           { shared resource mgr } { cccc TM 8/16/82 }
	hp_datacomm     = -5;
	hp98620         = -4;
	internal_kbd    = -3;
	internal_crt    = -2;
	internal_hpib   = -1;

	no_id           =  0;

	hp98624         =  1;           { hpib }
	hp98626         =  2;           { serial }
	hp98622         =  3;           { gpio }
	hp98623         =  4;           { bcd }
	hpPARALLEL      =  6;           { parallel centronics } { DEW1 12/89 }
	hp98658         =  7;           { scsi - also includes hp98265 DEW 09/89 - added SCSI support}
	hp98625         =  8;           { disk }
	hp98628_async   = 20;           { hp98628 }
	hpGATOR         = 25;           { bitmap display -- need number jws3 }
	hp98253         = 27;           { EPROM programmer }   { jws 3/25/83 }
	hp98627         = 28;           { graphics }
	hp98259         = 30;           { bubble memory }      { jws 3/25/83 }
	hp98644         = 66;           { serial -- pri. id=2, sec. id=2  jws4 }

  $PAGE$

  TYPE

	{ general declarations }

	type_isc        = iominisc..iomaxisc ;
	type_device     = iominisc..iomaxisc*100+99;
	io_bit          = 0..15 ;
	io_byte         = 0..255 ;
	io_word         = -32768..32767 ;
	io_string       = STRING[255];
	io_proc_type    = PROCEDURE;

	errlnk_type     = PROCEDURE ( errorcode : INTEGER ;     { 0082 TM 7/23/82 }
				      VAR s     : io_string );  { 0082 TM 7/23/82 }

	{ card id and type declarations }

	type_of_card    = io_word;
	type_card_id    = io_word;


	{ hpib type declarations }

	type_hpib_addr  = 0..31 ;
	type_hpib_line  = ( ren_line ,
			    ifc_line ,
			    srq_line ,
			    eoi_line ,
			    nrfd_line ,
			    ndac_line ,
			    dav_line ,
			    atn_line
			  ) ;


	{ serial type declarations }

	type_parity     = ( no_parity ,
			    odd_parity ,
			    even_parity ,
			    zero_parity ,
			    one_parity
			  );
	type_serial_line= ( rts_line ,
			    cts_line ,
			    dcd_line ,
			    dsr_line ,
			    drs_line ,
			    ri_line  ,
			    dtr_line
			  );
	$PAGE$
	{ driver declarations }

	io_proc         = PROCEDURE ( temp  : ANYPTR );
	io_proc_c       = PROCEDURE ( temp  : ANYPTR;
				      v     : CHAR );
	io_proc_vc      = PROCEDURE ( temp  : ANYPTR;
				      VAR v : CHAR);
	io_proc_w       = PROCEDURE ( temp  : ANYPTR;
				      v     : io_word );
	io_proc_vw      = PROCEDURE ( temp  : ANYPTR;
				      VAR v : io_word );
	io_proc_s       = PROCEDURE ( temp  : ANYPTR;
				      reg   : io_word ;
				      v     : io_word );
	io_proc_vs      = PROCEDURE ( temp  : ANYPTR;
				      reg   : io_word ;
				      VAR v : io_word );
	io_proc_l       = PROCEDURE ( temp  : ANYPTR;
				      line  : io_bit );
	io_proc_vl      = PROCEDURE ( temp  : ANYPTR;
				      line  : io_bit ;
				      VAR v : BOOLEAN );
	io_proc_vb      = PROCEDURE ( temp  : ANYPTR;
				      VAR v : BOOLEAN );
	io_proc_ptr     = PROCEDURE ( temp  : ANYPTR;
				      v     : ANYPTR );

	drv_table_type  = RECORD
			    iod_init  : io_proc ;
			    iod_isr   : ISRPROCTYPE ;
			    iod_rdb   : io_proc_vc ;
			    iod_wtb   : io_proc_c ;
			    iod_rdw   : io_proc_vw ;
			    iod_wtw   : io_proc_w ;
			    iod_rds   : io_proc_vs ;
			    iod_wtc   : io_proc_s ;
			    iod_end   : io_proc_vb ;
			    iod_tfr   : io_proc_ptr ;
			    iod_send  : io_proc_c;
			    iod_ppoll : io_proc_vc ;
			    iod_set   : io_proc_l ;
			    iod_clr   : io_proc_l ;
			    iod_test  : io_proc_vl ;
			  END;


	{ procedure definition for DMA termination procedure }
	io_funny_proc   = RECORD
			    CASE BOOLEAN OF
			      TRUE:
				( real_proc : io_proc );
			      FALSE:
				( dummy_pr  : ANYPTR ;
				  dummy_sl  : ANYPTR )
			  END;

	{ procedure definition for user EOT/ISR procedures }

	{ Note that the current definition of EOT / ISR procedures is
	  that they will execute ( probably ) inside an ISR and will
	  therefore be at that interrupt level.  This has several side
	  effects - such as READ from the keyboard not working- since they
	  depend on interrupts occuring.

	  The ISR / EOT procedures will work best if they set a flag that
	  the user program will periodically check.  Basically this means
	  the user needs to implement his own end-of-line searching.

	  The ISR / EOT procedure is allowed to have a NON-ZERO static link.
	  This means it can be a nested procedure.  This is potentially
	  dangerous if the user program is no longer in that chain.
	  CAVEAT EMPTOR.                                                    }


	{ interface driver space }

	io_temp_type    = PACKED RECORD
			    myisrib   : ISRIB ;
			    user_isr  : io_funny_proc;          {JPC 2/22/82}
			    user_parm : ANYPTR ;                {JPC 2/22/82}
			    card_addr : ANYPTR ;
			    in_bufptr : ANYPTR ;
			    out_bufptr: ANYPTR ;
			    eirbyte   : CHAR ;
			    my_isc    : io_byte ;
			    timeout   : INTEGER ;                { in milliseconds }
			    addressed : io_word ;
			    drv_misc  : ARRAY[1..32] OF CHAR ;
			  END;

	io_temp_type2   = PACKED RECORD
			    myisrib   : ISRIB ;
			    user_isr  : io_funny_proc;          {JPC 2/22/82}
			    user_parm : ANYPTR ;                {JPC 2/22/82}
			    card_addr : ANYPTR ;
			    in_bufptr : ANYPTR ;
			    out_bufptr: ANYPTR ;
			    eirbyte   : CHAR ;
			    my_isc    : io_byte ;
			    timeout   : INTEGER ;                { in milliseconds }
			    addressed : io_word ;
			    drv_misc  : ARRAY[1..128] OF CHAR ;
			  END;

	io_temp_type3   = PACKED RECORD                         {jw 7/12/82}
			    myisrib   : ISRIB ;                 {jw 7/12/82}
			    user_isr  : io_funny_proc;          {JPC 2/22/82}
			    user_parm : ANYPTR ;                {JPC 2/22/82}
			    card_addr : ANYPTR ;                {jw 7/12/82}
			    in_bufptr : ANYPTR ;                {jw 7/12/82}
			    out_bufptr: ANYPTR ;                {jw 7/12/82}
			    eirbyte   : CHAR ;                  {jw 7/12/82}
			    my_isc    : io_byte ;               {jw 7/12/82}
			    timeout   : INTEGER ;               { in milliseconds }
			    addressed : io_word ;               {jw 7/12/82}
			    drv_misc  : ARRAY[1..160] OF CHAR ; {jw 7/12/82}
			  END;                                  {jw 7/12/82}

	io_temp_type4   = PACKED RECORD                         {jws5 6/5/85}
			    myisrib   : ISRIB ;                 {jws5 6/5/85}
			    user_isr  : io_funny_proc;          {jws5 6/5/85}
			    user_parm : ANYPTR ;                {jws5 6/5/85}
			    card_addr : ANYPTR ;                {jws5 6/5/85}
			    in_bufptr : ANYPTR ;                {jws5 6/5/85}
			    out_bufptr: ANYPTR ;                {jws5 6/5/85}
			    eirbyte   : CHAR ;                  {jws5 6/5/85}
			    my_isc    : io_byte ;               {jws5 6/5/85}
			    timeout   : INTEGER ;               { in milliseconds }
			    addressed : io_word ;               {jws5 6/5/85}
			    drv_misc  : ARRAY[1..164] OF CHAR ; {jws5 6/5/85}
			  END;                                  {jws5 6/5/85}


	pio_tmp_ptr     = ^io_temp_type;


	isc_table_type  = RECORD
			    io_drv_ptr: ^drv_table_type;
			    io_tmp_ptr: pio_tmp_ptr;
			    card_type : type_of_card;
			    user_time : INTEGER;
			    card_id   : type_card_id;
			    card_ptr  : ANYPTR;
			  END;
	$PAGE$
	{ transfer declarations }

	user_tfr_type   = ( dummy_tfr_1 ,               { serial INTR }
			    serial_DMA ,
			    serial_FHS ,
			    serial_FASTEST ,
			    dummy_tfr_2 ,               { serial OVERLAP }
			    overlap_INTR ,
			    overlap_DMA ,
			    overlap_FHS ,
			    overlap_FASTEST ,
			    OVERLAP ) ;
	actual_tfr_type = ( no_tfr ,
			    INTR_tfr ,
			    DMA_tfr ,
			    BURST_tfr ,
			    FHS_tfr ) ;
	dir_of_tfr      = ( to_memory,                  { input = BOOLEAN false }
			    from_memory                 { output= BOOLEAN true }
			  ) ;

	buf_type        = PACKED ARRAY[0..maxint] OF CHAR;

	buf_info_type   = RECORD
			    drv_tmp_ptr : pio_tmp_ptr;
			    active_isc  : io_byte;
			    act_tfr     : actual_tfr_type ;
			    usr_tfr     : user_tfr_type ;
			    b_w_mode    : BOOLEAN ;             { word = BOOLEAN true }
			    end_mode    : BOOLEAN ;             { eoi  = BOOLEAN true }
			    direction   : dir_of_tfr ;
			    term_char   : -1..255 ;             { -1 = no termination char }
			    term_count  : INTEGER ;
			    buf_ptr     : ^buf_type ;
			    buf_size    : INTEGER ;
			    buf_empty   : ANYPTR ;
			    buf_fill    : ANYPTR ;
			    eot_proc    : io_funny_proc;        {JPC 2/22/82}
			    eot_parm    : ANYPTR ;              {JPC 2/22/82}
			    dma_priority: BOOLEAN;
			  END;
   $PAGE$
   VAR

	{ dma driver variables - used by DMA_DRV module
	  and by assembly language drivers.
	  ---------- DON'T MOVE ---------- }

	dma_ch_0        : io_funny_proc ;
	dma_isc_0       : io_byte ;
	dma_ch_1        : io_funny_proc ;
	dma_isc_1       : io_byte ;
	dma_isrib0      : ISRIB ;
	dma_isrib1      : ISRIB ;
	dma_here        : BOOLEAN;



	io_work_char    : CHAR;


	{ io escape access variables }

	ioe_result      : INTEGER;
	ioe_isc         : INTEGER;      { must be integer because the sc could
					  be no sc ( 255 ) or a device
					  like 701 etc. }


	isc_table       : PACKED ARRAY [type_isc]
			    OF isc_table_type;

	io_revid        : STRING[96];   { revision string - added 2/5/82 - TM

					  meaning - 'IO 1.0 refers to the IO
					  library ( in system.library ) and
					  the kernel code.  Each driver
					  module will append an indication of
					  its revision like 'G1.0' for GPIO.
					  So - a typical system would have a
					  io_revid of 'IO 1.0 : D1.0 H1.0
					  G1.0 S1.0'.

					  known ids -

					  main io lib   'IO 1.0 : '
					  dma driver    ' D1.0'
					  hpib driver   ' H1.0'
					  gpio driver   ' G1.0'
					  628 driver    ' S1.0'
					  626 driver    ' R1.0'
					  Parallel driver ' P1.0'  DEW1 12/89
					}


	io_error_link   : errlnk_type;  { error msg extension } { 0082 TM 7/23/82 }

					{ Will be initialized to a call
					  to a proc in kernal_initialize.
					  To extend error messages, copy old
					  proc value into local var and put in
					  your new proc ( type errlnk_type ).
					  Your proc should see if it can handle
					  code and return the error msg string,
					  if it can't it should call your
					  local link.
					}


  PROCEDURE io_escape   ( my_code    : INTEGER ;
			  select_code: INTEGER);
  FUNCTION  io_find_isc ( iod_temp   : ANYPTR ): io_byte;


$PAGE$
IMPLEMENT

  PROCEDURE io_escape   ( my_code    : INTEGER ;
			  select_code: INTEGER);
  BEGIN
    ioe_isc    := select_code;
    ioe_result := my_code;
    ESCAPE(ioescapecode);
  END; { of io_escape }


  FUNCTION  io_find_isc ( iod_temp   : ANYPTR ): io_byte;
  VAR my_ptr    : pio_tmp_ptr;
  BEGIN
    IF iod_temp = NIL
      THEN BEGIN
	io_find_isc := no_isc ;
      END
      ELSE BEGIN
	my_ptr := iod_temp;
	io_find_isc := my_ptr^.my_isc;
      END; { of IF }
  END; { of io_find_isc }

END;    { of iodeclarations }
$PAGE$
EXTERNAL MODULE iocomasm ;

	{ by      Tim Mikkelsen
	  date    10/29/81
	  update  10/29/81

	  purpose This module contains the iocomasm code
		  ( binary functions & dma control )
	}

IMPORT iodeclarations;

EXPORT

  FUNCTION  dma_request ( temp   : ANYPTR ) : INTEGER;
  PROCEDURE dma_release ( temp   : ANYPTR );
  FUNCTION  bit_set     ( v : INTEGER ;
			  b : INTEGER ) : BOOLEAN ;
  FUNCTION  binand      ( x : INTEGER ;
			  y : INTEGER ) : INTEGER ;
  FUNCTION  binior      ( x : INTEGER ;
			  y : INTEGER ) : INTEGER ;
  FUNCTION  bineor      ( x : INTEGER ;
			  y : INTEGER ) : INTEGER ;
  FUNCTION  bincmp      ( x : INTEGER ) : INTEGER ;


END; { of iocomasm }
$PAGE$
(************************************************************************)
(*                                                                      *)
(*                                                                      *)
(*      GENERAL GROUP           GENERAL_0                               *)
(*                                                                      *)
(*                                                                      *)
(************************************************************************)



MODULE general_0 ;

	{ by      Tim Mikkelsen
	  date    07/15/81
	  update  03/05/84 by  J. Schmidt

	  purpose This module contains the LEVEL 0 GENERAL GROUP procedures.
	}


IMPORT  iodeclarations;

EXPORT

  VAR
    { driver tables }
    kbd_crt_drivers : drv_table_type;
    dummy_drivers   : drv_table_type;



  FUNCTION  ioread_word ( select_code: type_isc ;
			  register   : io_word )
			: io_word ;
  PROCEDURE iowrite_word( select_code: type_isc ;
			  register   : io_word ;
			  value      : io_word);
  FUNCTION  ioread_byte ( select_code: type_isc ;
			  register   : io_word )
			: io_byte ;
  PROCEDURE iowrite_byte( select_code: type_isc ;
			  register   : io_word ;
			  value      : io_byte);
  FUNCTION  iostatus    ( select_code: type_isc ;
			  register   : io_word )
			: io_word ;
  PROCEDURE iocontrol   ( select_code: type_isc ;
			  register   : io_word ;
			  value      : io_word);
  PROCEDURE kernel_initialize;
  PROCEDURE io_system_reset;


IMPLEMENT

  IMPORT sysglobals ,
	 iocomasm  ;



  $PAGE$

  { these are dummy driver procedures used by the kernel }

  PROCEDURE kbd_rdb     ( iod_temp   : ANYPTR ;
			  VAR value  : CHAR );
  BEGIN                                                         { tttt TM 9/22/82 }
    IF EOLN(input)
      THEN BEGIN
	READ(value);
	value:=io_carriage_rtn;
      END
      ELSE BEGIN
	READ(value);
      END; { of IF EOLN }
  END; { of kbd_rdb }                                           { tttt TM 9/22/82 }



  PROCEDURE crt_wtb     ( iod_temp   : ANYPTR ;
			  value      : CHAR );
  BEGIN
    WRITE(value);
  END; { of crt_wtb }



  PROCEDURE simple_init ( temp : ANYPTR );
  BEGIN
    { this initialization will do nothing }
  END; { of simple_init }

  { addition of new dummy drivers                                 0350 TM 8/19/82 }
  PROCEDURE dummy_driver( temp : ANYPTR );                      { 0350 TM 8/19/82 }
  BEGIN                                                         { 0350 TM 8/19/82 }
    io_escape(ioe_no_driver,io_find_isc(temp));
  END;

  PROCEDURE dummy_driver_c( temp : ANYPTR ; dummy : CHAR );
  BEGIN                                                         { 0350 TM 8/19/82 }
    dummy_driver(temp);
  END;

  PROCEDURE dummy_driver_a( temp : ANYPTR ; ANYVAR dummy : ANYPTR );
  BEGIN                                                         { 0350 TM 8/19/82 }
    dummy_driver(temp);
  END;

  PROCEDURE dummy_driver_w( temp : ANYPTR ; dummy : io_word );
  BEGIN                                                         { 0350 TM 8/19/82 }
    dummy_driver(temp);
  END;

  PROCEDURE dummy_driver_dw(temp : ANYPTR ; dummy,d2  : io_word );
  BEGIN                                                         { 0350 TM 8/19/82 }
    dummy_driver(temp);
  END;

  PROCEDURE dummy_driver_wa(temp : ANYPTR ; dummy : io_word ; VAR d2 : io_word );
  BEGIN                                                         { 0350 TM 8/19/82 }
    dummy_driver(temp);
  END;

  PROCEDURE dummy_driver_b( temp : ANYPTR ; dummy : io_bit );
  BEGIN                                                         { 0350 TM 8/19/82 }
    dummy_driver(temp);
  END;

  PROCEDURE dummy_driver_ba(temp : ANYPTR ; dummy : io_bit  ; VAR d2 : BOOLEAN );
  BEGIN                                                         { 0350 TM 8/19/82 }
    dummy_driver(temp);
  END;


  $PAGE$

  FUNCTION  ioread_word ( select_code: type_isc ;
			  register   : io_word )
			: io_word ;
  VAR p : ^io_word;
  BEGIN
    p := ANYPTR(isc_table[select_code].card_ptr);
    IF p = NIL
      THEN BEGIN
	{ error }
	io_escape(ioe_no_card,select_code);
      END
      ELSE BEGIN
	p:=ANYPTR(INTEGER(p)+register);
	ioread_word:=p^;
      END; { of IF }
  END; { of ioread_word }



  PROCEDURE iowrite_word( select_code: type_isc ;
			  register   : io_word ;
			  value      : io_word);
  VAR p : ^io_word;
  BEGIN
    p := ANYPTR(isc_table[select_code].card_ptr);
    IF p = NIL
      THEN BEGIN
	{ error }
	io_escape(ioe_no_card,select_code);
      END
      ELSE BEGIN
	p:=ANYPTR(INTEGER(p)+register);
	p^:=value;
      END; { of IF }
  END; { of iowrite_word }



  FUNCTION  ioread_byte ( select_code: type_isc ;
			  register   : io_word )
			: io_byte ;
  TYPE mycharptr = ^CHAR;
  VAR  p         : ^CHAR;
  BEGIN
    p := ANYPTR(isc_table[select_code].card_ptr);
    IF p = NIL
      THEN BEGIN
	{ error }
	io_escape(ioe_no_card,select_code);
      END
      ELSE BEGIN
	ioread_byte:=ORD(mycharptr(ADDR(p^,register))^);
      END; { of IF }
  END; { of ioread_word }



  PROCEDURE iowrite_byte( select_code: type_isc ;
			  register   : io_word ;
			  value      : io_byte);
  TYPE mycharptr = ^CHAR;
  VAR  p         : ^CHAR;
  BEGIN
    p := ANYPTR(isc_table[select_code].card_ptr);
    IF p = NIL
      THEN BEGIN
	{ error }
	io_escape(ioe_no_card,select_code);
      END
      ELSE BEGIN
	p:=ANYPTR(INTEGER(p)+register);
	p^:=CHR(value);
      END; { of IF }
  END; { of iowrite_byte }



  FUNCTION  iostatus    ( select_code: type_isc ;
			  register   : io_word )
			: io_word ;
  VAR value : io_word;
  BEGIN
    WITH isc_table[select_code] DO
    CALL(io_drv_ptr^.iod_rds,
	 io_tmp_ptr,
	 register,
	 value);
    iostatus:=value;
  END; { of iostatus }



  PROCEDURE iocontrol   ( select_code: type_isc ;
			  register   : io_word ;
			  value      : io_word);
  VAR my_value : io_word;
  BEGIN
    my_value:=value;
    WITH isc_table[select_code] DO
    CALL(io_drv_ptr^.iod_wtc,
	 io_tmp_ptr,
	 register,
	 my_value);
  END; { of iocontrol }

  $PAGE$
  PROCEDURE end_error_link ( errorcode : INTEGER ;              { 0082 TM 7/23/82 }
			     VAR s     : io_string );           { 0082 TM 7/23/82 }
  BEGIN                                                         { 0082 TM 7/23/82 }
    s := 'unrecognized error';                                  { 0082 TM 7/23/82 }
  END; { of end_error_link }                                    { 0082 TM 7/23/82 }

  PROCEDURE kernel_initialize;
    VAR io_isc   : type_isc;
	dc_dummy : INTEGER;
	dummy    : INTEGER;
	double   : BOOLEAN;       { indicates an int. that takes 2 s.c. }
	bigtemp  : ^io_temp_type2;
	bigtemp3 : ^io_temp_type3;
	bigtemp4 : ^io_temp_type4;                               { jws5 06/05/85 }

  BEGIN

    io_revid := 'IO 3.2: ';         { io library revision/id -   jws 8/03/83  }

    io_error_link := end_error_link;  { error msg extension }   { 0082 TM 7/23/82 }

    double := FALSE;


    { determine what interfaces are present }

    FOR io_isc:=iominisc TO iomaxisc DO WITH isc_table[io_isc] DO BEGIN
      user_time :=0;
      card_id   := no_id;
      IF io_isc<minrealisc
	THEN BEGIN
	  card_type := system_card;
	  io_tmp_ptr:= NIL;
	  CASE io_isc OF

	    1: BEGIN
		 card_id:=internal_crt;                 { BUG aaaa TM 5/24/82 }
	       END;

	    2: BEGIN
		 card_id:=internal_kbd;                 { BUG aaaa TM 5/24/82 }
	       END;

	    3: BEGIN
		 card_ptr := ANYPTR(5242880);           { dma address $500000 }
		 { let DMA driver module hunt for dma }
		 dma_here := FALSE;
	       END;         { of BEGIN }


	    OTHERWISE  BEGIN END;                     { other internal interfaces }

	  END; { of CASE io_isc }

	END
	ELSE BEGIN
	  card_type:=no_card;
	  IF (io_isc=7) and not(sysflag.nointhpib)     { jws2  6/28/83 }
	    THEN BEGIN
	      NEW(io_tmp_ptr);                      { get temp space }
	      card_type:=hpib_card;
	      card_id  :=internal_hpib;
	      card_ptr :=ANYPTR(HEX('478000'));
	    END
	    ELSE BEGIN
	      IF double
		THEN BEGIN

		  double := FALSE;

		END
		ELSE BEGIN
		  card_ptr  := ANYPTR(HEX('600000')+((io_isc MOD 32)*65536));
		  TRY
		    dummy := ioread_byte(io_isc,1);
		    dummy := dummy MOD 128;       { mask off remote id bit }

		    IF dummy <= 8 THEN CASE dummy OF

		      1: BEGIN
			   card_type:=hpib_card;
			   card_id  :=hp98624;
			   NEW(io_tmp_ptr);                    { get temp space }
			 END;

		      2: BEGIN
			   card_type:=serial_card;
			   card_id  :=hp98626;
			   NEW(bigtemp4);                      {jws5 6/5/85}
							       { get temp space }
			   io_tmp_ptr := ANYPTR(bigtemp4);     {jws5 6/5/85}
			 END;

		      3: BEGIN
			   card_type:=gpio_card;
			   card_id  :=hp98622;
			   NEW(io_tmp_ptr);                    { get temp space }
			 END;

		      6:  BEGIN                                { DEW1 12/89 added centronics
								 parallel support }
			   card_type:= pllel_card;
			   card_id  := hpPARALLEL;
			   NEW(bigtemp);                       { get temp space type 2 }
			   io_tmp_ptr := ANYPTR(bigtemp);
			 END;

		      7: BEGIN                                 { 09/89 DEW - added SCSI support }
			   card_type:=scsi_card;
			   card_id  :=hp98658;
			   NEW(io_tmp_ptr);                    { get temp space }
			 END;

		      8: BEGIN
			   card_type:=hpib_card;
			   card_id  :=hp98625;
			   NEW(io_tmp_ptr);                    { get temp space }
			 END;

		      OTHERWISE BEGIN
			   NEW(io_tmp_ptr);                    { get temp space }
			   card_type:=other_card;
			   { note - this card will get TEMP space }
			 END;

		    END { of CASE }
		    ELSE BEGIN

		      IF dummy <= 30 THEN                      { jws 3/25/83 }

			CASE dummy of                           { jws 3/25/83 }

			  25: BEGIN                            { jws3 2/09/84 }
				card_id:=hpGATOR;              { jws3 2/09/84 }
				card_type:=graphics_card;      { jws3 2/09/84 }
				NEW(io_tmp_ptr);               { jws3 2/09/84 }
			      END;                             { jws3 2/09/84 }

			  27: BEGIN                             { jws 3/25/83 }
				card_id:=hp98253;               { jws 3/25/83 }
				card_type:=eprom_prgmr;         { jws 3/25/83 }
				NEW(io_tmp_ptr);                { jws 3/25/83 }
			      END;                              { jws 3/25/83 }

			  28: BEGIN
				card_id := hp98627;
				card_type := graphics_card;
				double := TRUE;
				NEW(io_tmp_ptr);               { get temp space }
			      END;

			  29: BEGIN
			   { id=29 is also set aside for double wide cards }
				double := TRUE;
				NEW(bigtemp3);                  { jws 3/25/83}
				io_tmp_ptr:=ANYPTR(bigtemp3);   { jws 3/25/83}
				card_type:=other_card;          { jws 3/25/83}
			      END;

			  30: BEGIN                             { jws 3/25/83 }
				card_id:=hp98259;               { jws 3/25/83 }
				card_type:=bubble_card;         { jws 3/25/83 }
				NEW(bigtemp);                   { jws 3/25/83 }
				io_tmp_ptr:=ANYPTR(bigtemp);    { jws 3/25/83 }
			      END;

			  OTHERWISE                             { jws 3/25/83 }
			      BEGIN                             { jws 3/25/83 }
			       NEW(bigtemp3);                   { jws 3/25/83 }
				io_tmp_ptr:=ANYPTR(bigtemp3);   { jws 3/25/83 }
				card_type:=other_card;          { jws 3/25/83 }
			      END;                              { jws 3/25/83 }

			END;  { of case  }                      { jws 3/25/83 }


		      IF dummy = 39
			THEN BEGIN                              { 09/89 DEW - added SCSI support }
			   card_type:=scsi_card;
			   card_id  :=hp98658;
			   NEW(io_tmp_ptr);                    { get temp space }
			 END;

		     IF dummy=52
		       THEN BEGIN
			 dc_dummy := ioread_byte(io_isc,16395)*256+ioread_byte(io_isc,16393);
			 IF dc_dummy < 32768
			   THEN BEGIN
			     dc_dummy := ioread_byte(io_isc,dc_dummy*2+1);
			     IF (dc_dummy MOD 128) = 1
			       THEN BEGIN
				 card_id := hp_datacomm;        { since I don't know yet }
				 card_type := serial_card;
			       END; { of IF }
			   END; { of IF }
			 NEW(bigtemp);
			 io_tmp_ptr:=ANYPTR(bigtemp);
		       END; { of BEGIN }

		     IF dummy=66                               { jws4  3/5/84 }
		       THEN BEGIN                              { jws4  3/5/84 }
			 card_id:=hp98644;                     { jws4  3/5/84 }
			 card_type:=serial_card;               { jws4  3/5/84 }
			 NEW(bigtemp4);                        { jws5  6/5/85 }
			 io_tmp_ptr:=ANYPTR(bigtemp4);         { jws5  6/5/85 }
		       END;                                    { jws4  3/5/84 }

		     IF ( dummy > 30 ) AND                     { jws4 3/5/84 }
			( dummy <> 52 ) AND ( dummy<>66 ) AND ( dummy <> 39 )
		       THEN BEGIN
			 NEW(bigtemp3);                         {      TM 8/20/82 }
			 io_tmp_ptr := ANYPTR(bigtemp3);        {      TM 8/20/82 }
			 { note - this card WILL get LARGE temp space }
			 card_type:=other_card;
		       END;

		    END; { of IF dummy <= 8 }

		  RECOVER
		    BEGIN
		      IF ( escapecode=-11 ) OR ( escapecode=-12 )
			THEN BEGIN
			  { no card at this address }
			END
			ELSE BEGIN
			  { some other problem }
			  ESCAPE(escapecode);
			END;
		    END; { of RECOVER BEGIN }


		END; { of IF double }
	    END;     { of IF io_isc=7 }
	END;         { of IF io_isc<minrealisc THEN/ELSE }
    END;             { of FOR WITH isc_table[io_isc] DO BEGIN }


    { set up the driver tables }                                { 0350 TM 8/19/82 }
								{ 0350 TM 8/19/82 }
    WITH dummy_drivers DO BEGIN                                 { 0350 TM 8/19/82 }
      iod_init  :=              dummy_driver ;
      iod_isr   := ISRPROCTYPE (dummy_driver);
      iod_rdb   := io_proc_vc  (dummy_driver_a);
      iod_wtb   :=              dummy_driver_c ;
      iod_rdw   := io_proc_vw  (dummy_driver_a);
      iod_wtw   :=              dummy_driver_w ;
      iod_rds   := io_proc_vs  (dummy_driver_wa);
      iod_wtc   :=              dummy_driver_dw ;
      iod_end   := io_proc_vb  (dummy_driver_a);
      iod_tfr   := io_proc_ptr (dummy_driver_a);
      iod_send  :=              dummy_driver_c ;
      iod_ppoll := io_proc_vc  (dummy_driver_a);
      iod_set   :=              dummy_driver_b ;
      iod_clr   :=              dummy_driver_b ;
      iod_test  :=              dummy_driver_ba ;               { 0350 TM 8/19/82 }
    END; { of WITH }                                            { 0350 TM 8/19/82 }



    { initialize the temp space }
    FOR io_isc := iominisc TO iomaxisc DO BEGIN

      { set up dummy drivers for the interfaces }
      isc_table[io_isc].io_drv_ptr:=ADDR(dummy_drivers);

      IF isc_table[io_isc].io_tmp_ptr <> NIL
	THEN WITH isc_table[io_isc].io_tmp_ptr^ DO BEGIN
	  card_addr := isc_table[io_isc].card_ptr;
	  eirbyte   := CHR( 0 );
	  my_isc    := io_isc ;
	  timeout   := 0 ;
	  addressed := -1;
	  in_bufptr := NIL ;
	  out_bufptr:= NIL ;
	  user_isr.dummy_sl := NIL;
	  user_isr.dummy_pr := NIL;
	  user_parm         := NIL;                     {JPC 2/22/82}
	  myisrib.INTREGADDR:= NIL;
	END; { of IF  WITH io_tmp_ptr^ DO }
    END; { of FOR DO BEGIN }

    dma_isrib0.INTREGADDR := NIL;
    dma_isrib1.INTREGADDR := NIL;


    { note - because of the ISRs - this routine can only be called
	     once - at INITLIB time.  If it is called again after that
	     invocation the ISR structure will be in very bad shape and
	     will probably hang the machine }



    kbd_crt_drivers:=dummy_drivers;
    WITH kbd_crt_drivers DO BEGIN
      iod_rdb   := kbd_rdb;
      iod_wtb   := crt_wtb;
      iod_init  := simple_init;
    END; { of WITH }


    isc_table[1].io_drv_ptr := ADDR(kbd_crt_drivers);
    isc_table[2].io_drv_ptr := ADDR(kbd_crt_drivers);


    { set up clear i/o hook to do an io system reset }
    cleariohook := io_system_reset;



  END; { of kernel_initialize }

  $PAGE$

PROCEDURE io_system_reset;
  VAR io_isc     : type_isc;
  BEGIN

    { initialize the interfaces }

    FOR io_isc:=iominisc TO iomaxisc DO
      WITH isc_table[io_isc] DO BEGIN

	user_time := 0;                                 { user timeout }

	IF io_tmp_ptr <> NIL
	  THEN WITH io_tmp_ptr^ DO BEGIN
	    eirbyte   := CHR( 0 );
	    my_isc    := io_isc ;
	    timeout   := 0 ;                            { driver timeout }
	    user_isr.dummy_sl := NIL;
	    user_isr.dummy_pr := NIL;
	    user_parm         := NIL;                   {JPC 2/22/82}
	  END; { of IF THEN WITH BEGIN  }

      END; { of FOR WITH BEGIN }

    { these two FOR blocks are seperate in case two HPIB interfaces are
      connected in one machine - no funny user isr's will happen.        }

    FOR io_isc:=iominisc TO iomaxisc DO
      WITH isc_table[io_isc] DO BEGIN

	IF io_drv_ptr^.iod_init <> dummy_driver
	  THEN BEGIN
	    CALL ( io_drv_ptr^.iod_init ,
		   io_tmp_ptr );
	  END; { of IF }

      END; { of FOR WITH BEGIN }


    { In case - for some messed up reason ( typically this is when the user
      doesn't call ioinitialize/iouninitialize ) - the dma resources are not
      relinquished by the init routines then this will free the resources.  }

    IF dma_isc_0 <> no_isc
      THEN BEGIN
	dma_release(isc_table[dma_isc_0].io_tmp_ptr);
      END; { of IF }

    IF dma_isc_1 <> no_isc
      THEN BEGIN
	dma_release(isc_table[dma_isc_1].io_tmp_ptr);
      END; { of IF }



  END; { of io_system_reset }




END;    { of general_0 }
$PAGE$
(************************************************************************)
(*                                                                      *)
(*                                                                      *)
(*      IOLIBRARY_KERNEL                                                *)
(*                                                                      *)
(*                                                                      *)
(************************************************************************)



IMPORT  general_0 ,
	LOADER  ;                                               { 367 TM 9/22/82 }


BEGIN

  kernel_initialize;
  MARKUSER;                                                     { 367 TM 9/22/82 }
END. { of iolibrary_kernel }

@


56.2
log
@
pws2rcs automatic delta on Wed Jan 27 11:57:27 MST 1993
@
text
@d1 1385
@


56.1
log
@Automatic bump of revision number for PWS version 3.25
@
text
@a0 1385

					      (*

 (c) Copyright Hewlett-Packard Company, 1985.
All rights are reserved.  Copying or other
reproduction of this program except for archival
purposes is prohibited without the prior
written consent of Hewlett-Packard Company.


	    RESTRICTED RIGHTS LEGEND

Use, duplication, or disclosure by the Government
is subject to restrictions as set forth in
paragraph (b) (3) (B) of the Rights in Technical
Data and Computer Software clause in
DAR 7-104.9(a).

HEWLETT-PACKARD COMPANY
Fort Collins, Colorado                         *)


$MODCAL ON$
$PARTIAL_EVAL ON$
$RANGE OFF$
$DEBUG OFF$
$OVFLCHECK OFF$
$STACKCHECK OFF$
$PAGE$
(************************************************************************)
(*                                                                      *)
(*      RELEASED        VERSION         3.1                             *)
(*                                                                      *)
(************************************************************************)
(*                                                                      *)
(*                                                                      *)
(*      IOLIB           KERNEL                                          *)
(*                                                                      *)
(*                                                                      *)
(************************************************************************)
(*                                                                      *)
(*                                                                      *)
(*      library      -  IOLIB                                           *)
(*      name         -  KERNEL                                          *)
(*      module(s)    -  iodeclarations                                  *)
(*                   -  iocomasm                                        *)
(*                   -  general_0                                       *)
(*                                                                      *)
(*      author       -  Tim Mikkelsen                                   *)
(*      phone        -  303-226-3800   ext. 2910                        *)
(*                                                                      *)
(*      date         -  June  1 , 1981                                  *)
(*      update       -  June  5 , 1985                                  *)
(*      release      -  Jul  12 , 1985                                  *)
(*                                                                      *)
(*      source       -  IOLIB:KERNEL.TEXT                               *)
(*      object       -  IOLIB:KERNEL.CODE                               *)
(*                                                                      *)
(************************************************************************)
$PAGE$
(************************************************************************)
(*                                                                      *)
(*                                                                      *)
(*      This is the source code for an external procedures library      *)
(*      to be used for general purpose interfacing on the HP 9826.      *)
(*                                                                      *)
(*      The library consists of 3 primary sets of modules -             *)
(*                                                                      *)
(*              1.      KERNEL modules                                  *)
(*              2.      driver modules                                  *)
(*              3.      IOLIB  modules                                  *)
(*                                                                      *)
(*      The KERNEL modules consist of the following modules -           *)
(*                                                                      *)
(*              1.      iodeclarations  ( contains static r/w space )   *)
(*              2.      iocomasm                                        *)
(*              3.      general_0       ( initialization & low level    *)
(*                                        routines like ioread/iowrite) *)
(*      The KERNEL modules also have an executable program segement     *)
(*      that gets executed at the time it is loaded.  This program      *)
(*      initializes the static read/write memory.  This program also    *)
(*      allocates the temporary storage for any card that exists -      *)
(*      independent of whether there is or is not a driver for it.      *)
(*                                                                      *)
(*      The driver modules consist of the actual assembly or PASCAL     *)
(*      routines that deal with a specific interface card.  There is    *)
(*      also an executable program segment for each driver module.      *)
(*      This program searches the select code table in the static r/w   *)
(*      initialized by the KERNEL general_0 module for all select codes *)
(*      that have the right interface card ( HPIB drivers will search   *)
(*      for the 98624 interface ).  This program will then set up the   *)
(*      driver tables to point to the correct drivers.                  *)
(*                                                                      *)
(*      The rest of the IOLIB modules are high-level modules that are   *)
(*      used by an end user in his/her application program.             *)
(*                                                                      *)
(*      The KERNEL and some set of driver modules will exist in the     *)
(*      INITLIB file as object code ( not EXPORT text ).  The           *)
(*      export text will reside on the IO file.  The rest               *)
(*      of the library will reside on the IO file.                      *)
(*                                                                      *)
(************************************************************************)
$PAGE$
(************************************************************************)
(*                                                                      *)
(*                                                                      *)
(*      BUG FIX HISTORY         - after release 1.0                     *)
(*                                                                      *)
(*                                                                      *)
(*      BUG #   BY  / ON        LOC             DESCRIPTION             *)
(*      -----   -----------     --------------  ----------------------  *)
(*                                                                      *)
(*      1281    T Mikkelsen     IODECLARATIONS  bad error message.      *)
(*              01/08/82                        No code change in this  *)
(*                                              module - code change in *)
(*                                              GENERAL_3.              *)
(*                                                                      *)
(*      aaaa    T Mikkelsen     kernel_         No bug sheet.           *)
(*              05/24/82        initialize      The CRT and keyboard    *)
(*                                              select codes were       *)
(*                                              interchanged.  Should   *)
(*                                              have no effect.         *)
(*                                                                      *)
(*      bbbb    T Mikkelsen     kernel_         No bug sheet.           *)
(*              07/09/82        initialize      Adding machine id info  *)
(*                              iodeclarations  for Bob Morain and the  *)
(*                                              Ganglia drivers.        *)
(*                                                                      *)
(*      jw      Jeff Wu         kernel_         No bug sheet.           *)
(*              07/12/82        initialize      Adding temp type for    *)
(*                              iodeclarations  626 drivers.            *)
(*                                                                      *)
(*      0082    T Mikkelsen     kernel_         Adding a link for the   *)
(*              07/23/82        initialize      error message function. *)
(*                              iodeclarations  See also GENERAL_3.     *)
(*                              end_error_link                          *)
(*                                                                      *)
(*      cccc    T Mikkelsen     iodeclarations  Allowing the 98629 card *)
(*              08/16/82                        and the 98628_dsndl as  *)
(*                                              identifiable cards.     *)
(*                                              See DC_DRV modules also.*)
(*                                                                      *)
(*      0350    T Mikkelsen     general_0       Fundamental flaw with   *)
(*              08/19/82                        the dummy drivers.      *)
(*                                                                      *)
(*      0364    T Mikkelsen     iodeclarations  Addition of SRM errors. *)
(*              08/23/82                        See also GENERAL_3.     *)
(*                                                                      *)
(*      0367    T Mikkelsen     iolibrary_kernel                        *)
(*              09/22/82                        Allow kernel to install *)
(*                                              itself - probably will  *)
(*                                              not be used much.       *)
(*                                                                      *)
(*      tttt    T Mikkelsen     kbd_rdb         Change in the handling  *)
(*              09/22/82                        of the keyboard end of  *)
(*                                              line condition from 1.0.*)
(*                                                                      *)
(*      uuuu    T Mikkelsen     iodeclarations  Differentiate between a *)
(*              09/28/82                        628 async and 629 srm   *)
(*                                              card type (srm/serial). *)
(*                                              See also DC_DRV.        *)
(*    ------- changes for release 3.0                                   *)
(*                                                                      *)
(*       jws    J Schmidt       iodeclarations  Add card id's and types *)
(*              03/25/83        general_0       for EPROM programmer    *)
(*                                              and bubble cards.       *)
(*                                              Add initialization code.*)
(*                                                                      *)
(*       jws2   J Schmidt       general_0       Add test for internal   *)
(*              06/28/83                         HP-IB present.         *)
(*                                                                      *)
(*       jws3   J Schmidt       iodeclarations  Deleted io_model_number *)
(*              02/09/84        general_0       and io_model_name stuff *)
(*                                              Added GATOR id, init.   *)
(*       jws4   J Schmidt       iodeclarations  Added id and init for   *)
(*              03/05/84        general_0       98644 card              *)
(*                                                                      *)
(*    ----------- changes for release 3.1                               *)
(*       jws5   J Schmidt       iodeclarations   added new temp type    *)
(*              06/05/85                        to allow space for      *)
(*                                              default settings on     *)
(*                                              98644, 98626            *)
(*                                                                      *)
(*    ----------- changes for release 3.23                              *)
(*       DEW    Dave Willis     iodeclarations  added support for the   *)
(*              09/89                           scsi interfaces.        *)
(*                                                                      *)
(*       DEW1   Dave Willis     iodeclarations  added support for the   *)
(*              12/89                           HP Parallel interfaces  *)
(*                                                                      *)
(************************************************************************)

$PAGE$
(************************************************************************)
(*                                                                      *)
(*                                                                      *)
(*      REFERENCES :                                                    *)
(*                                                                      *)
(*                                                                      *)
(*      1.  9826 I/O Designers Guide            ( Loyd Nelson )         *)
(*                                                                      *)
(*      2.  68000 Manual                        ( Motorola )            *)
(*                                                                      *)
(*      3.  Pascal alpha site ERS               ( Roger Ison )          *)
(*                                                                      *)
(*      4.  Pascal I/O Library ERS              ( Tim Mikkelsen )       *)
(*                                                                      *)
(*      5.  9826 HPL EIO & IOD listings         ( Bob Hallissy )        *)
(*                                                                      *)
(*      6.  9826 HPL Misc. I/O Doc.             ( Bob Hallissy )        *)
(*                                                                      *)
(*      7.  9826 card documentation             ( Mfg. Specs. )         *)
(*                                                                      *)
(*                                                                      *)
(************************************************************************)
$PAGE$
PROGRAM iolibrary_kernel ( INPUT , OUTPUT );



	{ the PROGRAM surrounds the following modules because there needs
	  to be a start address for this set of modules to allow
	  initialization to occur }

$PAGE$
(************************************************************************)
(*                                                                      *)
(*                                                                      *)
(*      GENERAL GROUP           IODECLARATIONS                          *)
(*                                                                      *)
(*                                                                      *)
(************************************************************************)




MODULE iodeclarations ;

	{ by      Tim Mikkelsen
	  date    07/15/81
	  update  03/05/84   by John Schmidt

	  purpose This module contains the common
		  declarations to be used by the
		  rest of the I/O library.

	}



IMPORT  sysglobals;

EXPORT

  CONST
	iominisc   = 0 ;                 { 0 - 7  internal }
	iomaxisc   = 31;                 { 8 - 31 external 8..31 }
	minrealisc = 7 ;
	maxrealisc = 31;                 { 7..31 are real isc.s with temps }

	io_line_feed    = CHR(10);
	io_carriage_rtn = CHR(13);

	$PAGE$

	{ escape code constants }

	ioescapecode    =  -26;

	ioe_no_error    = 0;            { no error                      }
	ioe_no_card     = 1;            { no card at select code        }
	ioe_not_hpib    = 2;            { interface should be hpib      }
	ioe_not_act     = 3;            { not active controller         }
	ioe_not_dvc     = 4;            { should be device not isc      } { BUG 1281 TM 1/8/82}
	ioe_no_space    = 5;            { no space left in buffer       }
	ioe_no_data     = 6;            { no data left in buffer        }
	ioe_bad_tfr     = 7;            { improper transfer attempted   }
	ioe_isc_busy    = 8;            { the select code is busy       }
	ioe_buf_busy    = 9;            { the buffer is busy            }
	ioe_bad_cnt     = 10;           { improper transfer count       }
	ioe_bad_tmo     = 11;           { bad timeout value             }
	ioe_no_driver   = 12;           { no driver for this card       }
	ioe_no_dma      = 13;           { no dma                        }
	ioe_no_word     = 14;           { word operations not allowed   }
	ioe_not_talk    = 15;           { not addressed as talker       }
	ioe_not_lstn    = 16;           { not addressed as listener     }
	ioe_timeout     = 17;           { a timeout has occurred        }
	ioe_not_sctl    = 18;           { not system controller         }
	ioe_rds_wtc     = 19;           { bad status or control         }
	ioe_bad_sct     = 20;           { bad set/clear/test operation  }
	ioe_crd_dwn     = 21;           { interface card is dead        }
	ioe_eod_seen    = 22;           { end/eod has occured           }
	ioe_misc        = 23;           { miscellaneous -               }
					{ value of param error          }

	ioe_sr_toomany  = 304;          { too many chars w/o terminator } { 0364 TM  8/23/82 }
	ioe_dc_fail     = 306;          { dc interface failure          }
	ioe_dc_usart    = 313;          { USART receive buffer overflow }
	ioe_dc_ovfl     = 314;          { receive buffer overflow       }
	ioe_dc_clk      = 315;          { missing clock                 }
	ioe_dc_cts      = 316;          { CTS false too long            }
	ioe_dc_car      = 317;          { lost carrier disconnect       }
	ioe_dc_act      = 318;          { no activity disconnect        }
	ioe_dc_conn     = 319;          { connection not established    }
	ioe_dc_conf     = 325;          { bad data bits/par combination }
	ioe_dc_reg      = 326;          { bad status /control register  }
	ioe_dc_rval     = 327;          { control value out of range    }
	ioe_sr_fail     = 353;          { data link failure             } { 0364 TM  8/23/82 }

	no_isc          = 255;          { used for ioe_isc within io errors }

	$PAGE$
	{ hpib message constants }

	gtl_message     = CHR( 1  );
	sdc_message     = CHR( 4  );
	ppc_message     = CHR( 5  );
	get_message     = CHR( 8  );
	tct_message     = CHR( 9  );
	llo_message     = CHR( 17 );
	dcl_message     = CHR( 20 );
	ppu_message     = CHR( 21 );
	spe_message     = CHR( 24 );
	spd_message     = CHR( 25 );
	unl_message     = CHR( 63 );
	unt_message     = CHR( 95 );
	ppe_message     = CHR( 96 );
	ppd_message     = CHR(112 );


	talk_constant   = 64;
	listen_constant = 32;

$PAGE$

	{ card type constants }

	no_card         = 0 ;
	other_card      = 1 ;
	system_card     = 2 ;
	hpib_card       = 3 ;
	gpio_card       = 4 ;
	serial_card     = 5 ;
	graphics_card   = 6 ;
	srm_card        = 7 ;           { shared resource mgr } { uuuu TM 9/28/82 }
	bubble_card     = 8 ;           { bubble memory       } { jws 3/25/83}
	eprom_prgmr     = 9 ;           { eprom programmer    } { jws 3/25/83}
	scsi_card       = 10;           { 09/89 DEW - added SCSI support}
	pllel_card      = 11;           { 12/89 DEW1 - added Parallel Centronics support}


	{ card id constants             }
	{                               }
	{ positive id's are the actual  }
	{ card id's                     }

	hp98628_dsndl   = -7;           { DSN/DL }              { cccc TM 8/16/82 }
	hp98629         = -6;           { shared resource mgr } { cccc TM 8/16/82 }
	hp_datacomm     = -5;
	hp98620         = -4;
	internal_kbd    = -3;
	internal_crt    = -2;
	internal_hpib   = -1;

	no_id           =  0;

	hp98624         =  1;           { hpib }
	hp98626         =  2;           { serial }
	hp98622         =  3;           { gpio }
	hp98623         =  4;           { bcd }
	hpPARALLEL      =  6;           { parallel centronics } { DEW1 12/89 }
	hp98658         =  7;           { scsi - also includes hp98265 DEW 09/89 - added SCSI support}
	hp98625         =  8;           { disk }
	hp98628_async   = 20;           { hp98628 }
	hpGATOR         = 25;           { bitmap display -- need number jws3 }
	hp98253         = 27;           { EPROM programmer }   { jws 3/25/83 }
	hp98627         = 28;           { graphics }
	hp98259         = 30;           { bubble memory }      { jws 3/25/83 }
	hp98644         = 66;           { serial -- pri. id=2, sec. id=2  jws4 }

  $PAGE$

  TYPE

	{ general declarations }

	type_isc        = iominisc..iomaxisc ;
	type_device     = iominisc..iomaxisc*100+99;
	io_bit          = 0..15 ;
	io_byte         = 0..255 ;
	io_word         = -32768..32767 ;
	io_string       = STRING[255];
	io_proc_type    = PROCEDURE;

	errlnk_type     = PROCEDURE ( errorcode : INTEGER ;     { 0082 TM 7/23/82 }
				      VAR s     : io_string );  { 0082 TM 7/23/82 }

	{ card id and type declarations }

	type_of_card    = io_word;
	type_card_id    = io_word;


	{ hpib type declarations }

	type_hpib_addr  = 0..31 ;
	type_hpib_line  = ( ren_line ,
			    ifc_line ,
			    srq_line ,
			    eoi_line ,
			    nrfd_line ,
			    ndac_line ,
			    dav_line ,
			    atn_line
			  ) ;


	{ serial type declarations }

	type_parity     = ( no_parity ,
			    odd_parity ,
			    even_parity ,
			    zero_parity ,
			    one_parity
			  );
	type_serial_line= ( rts_line ,
			    cts_line ,
			    dcd_line ,
			    dsr_line ,
			    drs_line ,
			    ri_line  ,
			    dtr_line
			  );
	$PAGE$
	{ driver declarations }

	io_proc         = PROCEDURE ( temp  : ANYPTR );
	io_proc_c       = PROCEDURE ( temp  : ANYPTR;
				      v     : CHAR );
	io_proc_vc      = PROCEDURE ( temp  : ANYPTR;
				      VAR v : CHAR);
	io_proc_w       = PROCEDURE ( temp  : ANYPTR;
				      v     : io_word );
	io_proc_vw      = PROCEDURE ( temp  : ANYPTR;
				      VAR v : io_word );
	io_proc_s       = PROCEDURE ( temp  : ANYPTR;
				      reg   : io_word ;
				      v     : io_word );
	io_proc_vs      = PROCEDURE ( temp  : ANYPTR;
				      reg   : io_word ;
				      VAR v : io_word );
	io_proc_l       = PROCEDURE ( temp  : ANYPTR;
				      line  : io_bit );
	io_proc_vl      = PROCEDURE ( temp  : ANYPTR;
				      line  : io_bit ;
				      VAR v : BOOLEAN );
	io_proc_vb      = PROCEDURE ( temp  : ANYPTR;
				      VAR v : BOOLEAN );
	io_proc_ptr     = PROCEDURE ( temp  : ANYPTR;
				      v     : ANYPTR );

	drv_table_type  = RECORD
			    iod_init  : io_proc ;
			    iod_isr   : ISRPROCTYPE ;
			    iod_rdb   : io_proc_vc ;
			    iod_wtb   : io_proc_c ;
			    iod_rdw   : io_proc_vw ;
			    iod_wtw   : io_proc_w ;
			    iod_rds   : io_proc_vs ;
			    iod_wtc   : io_proc_s ;
			    iod_end   : io_proc_vb ;
			    iod_tfr   : io_proc_ptr ;
			    iod_send  : io_proc_c;
			    iod_ppoll : io_proc_vc ;
			    iod_set   : io_proc_l ;
			    iod_clr   : io_proc_l ;
			    iod_test  : io_proc_vl ;
			  END;


	{ procedure definition for DMA termination procedure }
	io_funny_proc   = RECORD
			    CASE BOOLEAN OF
			      TRUE:
				( real_proc : io_proc );
			      FALSE:
				( dummy_pr  : ANYPTR ;
				  dummy_sl  : ANYPTR )
			  END;

	{ procedure definition for user EOT/ISR procedures }

	{ Note that the current definition of EOT / ISR procedures is
	  that they will execute ( probably ) inside an ISR and will
	  therefore be at that interrupt level.  This has several side
	  effects - such as READ from the keyboard not working- since they
	  depend on interrupts occuring.

	  The ISR / EOT procedures will work best if they set a flag that
	  the user program will periodically check.  Basically this means
	  the user needs to implement his own end-of-line searching.

	  The ISR / EOT procedure is allowed to have a NON-ZERO static link.
	  This means it can be a nested procedure.  This is potentially
	  dangerous if the user program is no longer in that chain.
	  CAVEAT EMPTOR.                                                    }


	{ interface driver space }

	io_temp_type    = PACKED RECORD
			    myisrib   : ISRIB ;
			    user_isr  : io_funny_proc;          {JPC 2/22/82}
			    user_parm : ANYPTR ;                {JPC 2/22/82}
			    card_addr : ANYPTR ;
			    in_bufptr : ANYPTR ;
			    out_bufptr: ANYPTR ;
			    eirbyte   : CHAR ;
			    my_isc    : io_byte ;
			    timeout   : INTEGER ;                { in milliseconds }
			    addressed : io_word ;
			    drv_misc  : ARRAY[1..32] OF CHAR ;
			  END;

	io_temp_type2   = PACKED RECORD
			    myisrib   : ISRIB ;
			    user_isr  : io_funny_proc;          {JPC 2/22/82}
			    user_parm : ANYPTR ;                {JPC 2/22/82}
			    card_addr : ANYPTR ;
			    in_bufptr : ANYPTR ;
			    out_bufptr: ANYPTR ;
			    eirbyte   : CHAR ;
			    my_isc    : io_byte ;
			    timeout   : INTEGER ;                { in milliseconds }
			    addressed : io_word ;
			    drv_misc  : ARRAY[1..128] OF CHAR ;
			  END;

	io_temp_type3   = PACKED RECORD                         {jw 7/12/82}
			    myisrib   : ISRIB ;                 {jw 7/12/82}
			    user_isr  : io_funny_proc;          {JPC 2/22/82}
			    user_parm : ANYPTR ;                {JPC 2/22/82}
			    card_addr : ANYPTR ;                {jw 7/12/82}
			    in_bufptr : ANYPTR ;                {jw 7/12/82}
			    out_bufptr: ANYPTR ;                {jw 7/12/82}
			    eirbyte   : CHAR ;                  {jw 7/12/82}
			    my_isc    : io_byte ;               {jw 7/12/82}
			    timeout   : INTEGER ;               { in milliseconds }
			    addressed : io_word ;               {jw 7/12/82}
			    drv_misc  : ARRAY[1..160] OF CHAR ; {jw 7/12/82}
			  END;                                  {jw 7/12/82}

	io_temp_type4   = PACKED RECORD                         {jws5 6/5/85}
			    myisrib   : ISRIB ;                 {jws5 6/5/85}
			    user_isr  : io_funny_proc;          {jws5 6/5/85}
			    user_parm : ANYPTR ;                {jws5 6/5/85}
			    card_addr : ANYPTR ;                {jws5 6/5/85}
			    in_bufptr : ANYPTR ;                {jws5 6/5/85}
			    out_bufptr: ANYPTR ;                {jws5 6/5/85}
			    eirbyte   : CHAR ;                  {jws5 6/5/85}
			    my_isc    : io_byte ;               {jws5 6/5/85}
			    timeout   : INTEGER ;               { in milliseconds }
			    addressed : io_word ;               {jws5 6/5/85}
			    drv_misc  : ARRAY[1..164] OF CHAR ; {jws5 6/5/85}
			  END;                                  {jws5 6/5/85}


	pio_tmp_ptr     = ^io_temp_type;


	isc_table_type  = RECORD
			    io_drv_ptr: ^drv_table_type;
			    io_tmp_ptr: pio_tmp_ptr;
			    card_type : type_of_card;
			    user_time : INTEGER;
			    card_id   : type_card_id;
			    card_ptr  : ANYPTR;
			  END;
	$PAGE$
	{ transfer declarations }

	user_tfr_type   = ( dummy_tfr_1 ,               { serial INTR }
			    serial_DMA ,
			    serial_FHS ,
			    serial_FASTEST ,
			    dummy_tfr_2 ,               { serial OVERLAP }
			    overlap_INTR ,
			    overlap_DMA ,
			    overlap_FHS ,
			    overlap_FASTEST ,
			    OVERLAP ) ;
	actual_tfr_type = ( no_tfr ,
			    INTR_tfr ,
			    DMA_tfr ,
			    BURST_tfr ,
			    FHS_tfr ) ;
	dir_of_tfr      = ( to_memory,                  { input = BOOLEAN false }
			    from_memory                 { output= BOOLEAN true }
			  ) ;

	buf_type        = PACKED ARRAY[0..maxint] OF CHAR;

	buf_info_type   = RECORD
			    drv_tmp_ptr : pio_tmp_ptr;
			    active_isc  : io_byte;
			    act_tfr     : actual_tfr_type ;
			    usr_tfr     : user_tfr_type ;
			    b_w_mode    : BOOLEAN ;             { word = BOOLEAN true }
			    end_mode    : BOOLEAN ;             { eoi  = BOOLEAN true }
			    direction   : dir_of_tfr ;
			    term_char   : -1..255 ;             { -1 = no termination char }
			    term_count  : INTEGER ;
			    buf_ptr     : ^buf_type ;
			    buf_size    : INTEGER ;
			    buf_empty   : ANYPTR ;
			    buf_fill    : ANYPTR ;
			    eot_proc    : io_funny_proc;        {JPC 2/22/82}
			    eot_parm    : ANYPTR ;              {JPC 2/22/82}
			    dma_priority: BOOLEAN;
			  END;
   $PAGE$
   VAR

	{ dma driver variables - used by DMA_DRV module
	  and by assembly language drivers.
	  ---------- DON'T MOVE ---------- }

	dma_ch_0        : io_funny_proc ;
	dma_isc_0       : io_byte ;
	dma_ch_1        : io_funny_proc ;
	dma_isc_1       : io_byte ;
	dma_isrib0      : ISRIB ;
	dma_isrib1      : ISRIB ;
	dma_here        : BOOLEAN;



	io_work_char    : CHAR;


	{ io escape access variables }

	ioe_result      : INTEGER;
	ioe_isc         : INTEGER;      { must be integer because the sc could
					  be no sc ( 255 ) or a device
					  like 701 etc. }


	isc_table       : PACKED ARRAY [type_isc]
			    OF isc_table_type;

	io_revid        : STRING[96];   { revision string - added 2/5/82 - TM

					  meaning - 'IO 1.0 refers to the IO
					  library ( in system.library ) and
					  the kernel code.  Each driver
					  module will append an indication of
					  its revision like 'G1.0' for GPIO.
					  So - a typical system would have a
					  io_revid of 'IO 1.0 : D1.0 H1.0
					  G1.0 S1.0'.

					  known ids -

					  main io lib   'IO 1.0 : '
					  dma driver    ' D1.0'
					  hpib driver   ' H1.0'
					  gpio driver   ' G1.0'
					  628 driver    ' S1.0'
					  626 driver    ' R1.0'
					  Parallel driver ' P1.0'  DEW1 12/89
					}


	io_error_link   : errlnk_type;  { error msg extension } { 0082 TM 7/23/82 }

					{ Will be initialized to a call
					  to a proc in kernal_initialize.
					  To extend error messages, copy old
					  proc value into local var and put in
					  your new proc ( type errlnk_type ).
					  Your proc should see if it can handle
					  code and return the error msg string,
					  if it can't it should call your
					  local link.
					}


  PROCEDURE io_escape   ( my_code    : INTEGER ;
			  select_code: INTEGER);
  FUNCTION  io_find_isc ( iod_temp   : ANYPTR ): io_byte;


$PAGE$
IMPLEMENT

  PROCEDURE io_escape   ( my_code    : INTEGER ;
			  select_code: INTEGER);
  BEGIN
    ioe_isc    := select_code;
    ioe_result := my_code;
    ESCAPE(ioescapecode);
  END; { of io_escape }


  FUNCTION  io_find_isc ( iod_temp   : ANYPTR ): io_byte;
  VAR my_ptr    : pio_tmp_ptr;
  BEGIN
    IF iod_temp = NIL
      THEN BEGIN
	io_find_isc := no_isc ;
      END
      ELSE BEGIN
	my_ptr := iod_temp;
	io_find_isc := my_ptr^.my_isc;
      END; { of IF }
  END; { of io_find_isc }

END;    { of iodeclarations }
$PAGE$
EXTERNAL MODULE iocomasm ;

	{ by      Tim Mikkelsen
	  date    10/29/81
	  update  10/29/81

	  purpose This module contains the iocomasm code
		  ( binary functions & dma control )
	}

IMPORT iodeclarations;

EXPORT

  FUNCTION  dma_request ( temp   : ANYPTR ) : INTEGER;
  PROCEDURE dma_release ( temp   : ANYPTR );
  FUNCTION  bit_set     ( v : INTEGER ;
			  b : INTEGER ) : BOOLEAN ;
  FUNCTION  binand      ( x : INTEGER ;
			  y : INTEGER ) : INTEGER ;
  FUNCTION  binior      ( x : INTEGER ;
			  y : INTEGER ) : INTEGER ;
  FUNCTION  bineor      ( x : INTEGER ;
			  y : INTEGER ) : INTEGER ;
  FUNCTION  bincmp      ( x : INTEGER ) : INTEGER ;


END; { of iocomasm }
$PAGE$
(************************************************************************)
(*                                                                      *)
(*                                                                      *)
(*      GENERAL GROUP           GENERAL_0                               *)
(*                                                                      *)
(*                                                                      *)
(************************************************************************)



MODULE general_0 ;

	{ by      Tim Mikkelsen
	  date    07/15/81
	  update  03/05/84 by  J. Schmidt

	  purpose This module contains the LEVEL 0 GENERAL GROUP procedures.
	}


IMPORT  iodeclarations;

EXPORT

  VAR
    { driver tables }
    kbd_crt_drivers : drv_table_type;
    dummy_drivers   : drv_table_type;



  FUNCTION  ioread_word ( select_code: type_isc ;
			  register   : io_word )
			: io_word ;
  PROCEDURE iowrite_word( select_code: type_isc ;
			  register   : io_word ;
			  value      : io_word);
  FUNCTION  ioread_byte ( select_code: type_isc ;
			  register   : io_word )
			: io_byte ;
  PROCEDURE iowrite_byte( select_code: type_isc ;
			  register   : io_word ;
			  value      : io_byte);
  FUNCTION  iostatus    ( select_code: type_isc ;
			  register   : io_word )
			: io_word ;
  PROCEDURE iocontrol   ( select_code: type_isc ;
			  register   : io_word ;
			  value      : io_word);
  PROCEDURE kernel_initialize;
  PROCEDURE io_system_reset;


IMPLEMENT

  IMPORT sysglobals ,
	 iocomasm  ;



  $PAGE$

  { these are dummy driver procedures used by the kernel }

  PROCEDURE kbd_rdb     ( iod_temp   : ANYPTR ;
			  VAR value  : CHAR );
  BEGIN                                                         { tttt TM 9/22/82 }
    IF EOLN(input)
      THEN BEGIN
	READ(value);
	value:=io_carriage_rtn;
      END
      ELSE BEGIN
	READ(value);
      END; { of IF EOLN }
  END; { of kbd_rdb }                                           { tttt TM 9/22/82 }



  PROCEDURE crt_wtb     ( iod_temp   : ANYPTR ;
			  value      : CHAR );
  BEGIN
    WRITE(value);
  END; { of crt_wtb }



  PROCEDURE simple_init ( temp : ANYPTR );
  BEGIN
    { this initialization will do nothing }
  END; { of simple_init }

  { addition of new dummy drivers                                 0350 TM 8/19/82 }
  PROCEDURE dummy_driver( temp : ANYPTR );                      { 0350 TM 8/19/82 }
  BEGIN                                                         { 0350 TM 8/19/82 }
    io_escape(ioe_no_driver,io_find_isc(temp));
  END;

  PROCEDURE dummy_driver_c( temp : ANYPTR ; dummy : CHAR );
  BEGIN                                                         { 0350 TM 8/19/82 }
    dummy_driver(temp);
  END;

  PROCEDURE dummy_driver_a( temp : ANYPTR ; ANYVAR dummy : ANYPTR );
  BEGIN                                                         { 0350 TM 8/19/82 }
    dummy_driver(temp);
  END;

  PROCEDURE dummy_driver_w( temp : ANYPTR ; dummy : io_word );
  BEGIN                                                         { 0350 TM 8/19/82 }
    dummy_driver(temp);
  END;

  PROCEDURE dummy_driver_dw(temp : ANYPTR ; dummy,d2  : io_word );
  BEGIN                                                         { 0350 TM 8/19/82 }
    dummy_driver(temp);
  END;

  PROCEDURE dummy_driver_wa(temp : ANYPTR ; dummy : io_word ; VAR d2 : io_word );
  BEGIN                                                         { 0350 TM 8/19/82 }
    dummy_driver(temp);
  END;

  PROCEDURE dummy_driver_b( temp : ANYPTR ; dummy : io_bit );
  BEGIN                                                         { 0350 TM 8/19/82 }
    dummy_driver(temp);
  END;

  PROCEDURE dummy_driver_ba(temp : ANYPTR ; dummy : io_bit  ; VAR d2 : BOOLEAN );
  BEGIN                                                         { 0350 TM 8/19/82 }
    dummy_driver(temp);
  END;


  $PAGE$

  FUNCTION  ioread_word ( select_code: type_isc ;
			  register   : io_word )
			: io_word ;
  VAR p : ^io_word;
  BEGIN
    p := ANYPTR(isc_table[select_code].card_ptr);
    IF p = NIL
      THEN BEGIN
	{ error }
	io_escape(ioe_no_card,select_code);
      END
      ELSE BEGIN
	p:=ANYPTR(INTEGER(p)+register);
	ioread_word:=p^;
      END; { of IF }
  END; { of ioread_word }



  PROCEDURE iowrite_word( select_code: type_isc ;
			  register   : io_word ;
			  value      : io_word);
  VAR p : ^io_word;
  BEGIN
    p := ANYPTR(isc_table[select_code].card_ptr);
    IF p = NIL
      THEN BEGIN
	{ error }
	io_escape(ioe_no_card,select_code);
      END
      ELSE BEGIN
	p:=ANYPTR(INTEGER(p)+register);
	p^:=value;
      END; { of IF }
  END; { of iowrite_word }



  FUNCTION  ioread_byte ( select_code: type_isc ;
			  register   : io_word )
			: io_byte ;
  TYPE mycharptr = ^CHAR;
  VAR  p         : ^CHAR;
  BEGIN
    p := ANYPTR(isc_table[select_code].card_ptr);
    IF p = NIL
      THEN BEGIN
	{ error }
	io_escape(ioe_no_card,select_code);
      END
      ELSE BEGIN
	ioread_byte:=ORD(mycharptr(ADDR(p^,register))^);
      END; { of IF }
  END; { of ioread_word }



  PROCEDURE iowrite_byte( select_code: type_isc ;
			  register   : io_word ;
			  value      : io_byte);
  TYPE mycharptr = ^CHAR;
  VAR  p         : ^CHAR;
  BEGIN
    p := ANYPTR(isc_table[select_code].card_ptr);
    IF p = NIL
      THEN BEGIN
	{ error }
	io_escape(ioe_no_card,select_code);
      END
      ELSE BEGIN
	p:=ANYPTR(INTEGER(p)+register);
	p^:=CHR(value);
      END; { of IF }
  END; { of iowrite_byte }



  FUNCTION  iostatus    ( select_code: type_isc ;
			  register   : io_word )
			: io_word ;
  VAR value : io_word;
  BEGIN
    WITH isc_table[select_code] DO
    CALL(io_drv_ptr^.iod_rds,
	 io_tmp_ptr,
	 register,
	 value);
    iostatus:=value;
  END; { of iostatus }



  PROCEDURE iocontrol   ( select_code: type_isc ;
			  register   : io_word ;
			  value      : io_word);
  VAR my_value : io_word;
  BEGIN
    my_value:=value;
    WITH isc_table[select_code] DO
    CALL(io_drv_ptr^.iod_wtc,
	 io_tmp_ptr,
	 register,
	 my_value);
  END; { of iocontrol }

  $PAGE$
  PROCEDURE end_error_link ( errorcode : INTEGER ;              { 0082 TM 7/23/82 }
			     VAR s     : io_string );           { 0082 TM 7/23/82 }
  BEGIN                                                         { 0082 TM 7/23/82 }
    s := 'unrecognized error';                                  { 0082 TM 7/23/82 }
  END; { of end_error_link }                                    { 0082 TM 7/23/82 }

  PROCEDURE kernel_initialize;
    VAR io_isc   : type_isc;
	dc_dummy : INTEGER;
	dummy    : INTEGER;
	double   : BOOLEAN;       { indicates an int. that takes 2 s.c. }
	bigtemp  : ^io_temp_type2;
	bigtemp3 : ^io_temp_type3;
	bigtemp4 : ^io_temp_type4;                               { jws5 06/05/85 }

  BEGIN

    io_revid := 'IO 3.2: ';         { io library revision/id -   jws 8/03/83  }

    io_error_link := end_error_link;  { error msg extension }   { 0082 TM 7/23/82 }

    double := FALSE;


    { determine what interfaces are present }

    FOR io_isc:=iominisc TO iomaxisc DO WITH isc_table[io_isc] DO BEGIN
      user_time :=0;
      card_id   := no_id;
      IF io_isc<minrealisc
	THEN BEGIN
	  card_type := system_card;
	  io_tmp_ptr:= NIL;
	  CASE io_isc OF

	    1: BEGIN
		 card_id:=internal_crt;                 { BUG aaaa TM 5/24/82 }
	       END;

	    2: BEGIN
		 card_id:=internal_kbd;                 { BUG aaaa TM 5/24/82 }
	       END;

	    3: BEGIN
		 card_ptr := ANYPTR(5242880);           { dma address $500000 }
		 { let DMA driver module hunt for dma }
		 dma_here := FALSE;
	       END;         { of BEGIN }


	    OTHERWISE  BEGIN END;                     { other internal interfaces }

	  END; { of CASE io_isc }

	END
	ELSE BEGIN
	  card_type:=no_card;
	  IF (io_isc=7) and not(sysflag.nointhpib)     { jws2  6/28/83 }
	    THEN BEGIN
	      NEW(io_tmp_ptr);                      { get temp space }
	      card_type:=hpib_card;
	      card_id  :=internal_hpib;
	      card_ptr :=ANYPTR(HEX('478000'));
	    END
	    ELSE BEGIN
	      IF double
		THEN BEGIN

		  double := FALSE;

		END
		ELSE BEGIN
		  card_ptr  := ANYPTR(HEX('600000')+((io_isc MOD 32)*65536));
		  TRY
		    dummy := ioread_byte(io_isc,1);
		    dummy := dummy MOD 128;       { mask off remote id bit }

		    IF dummy <= 8 THEN CASE dummy OF

		      1: BEGIN
			   card_type:=hpib_card;
			   card_id  :=hp98624;
			   NEW(io_tmp_ptr);                    { get temp space }
			 END;

		      2: BEGIN
			   card_type:=serial_card;
			   card_id  :=hp98626;
			   NEW(bigtemp4);                      {jws5 6/5/85}
							       { get temp space }
			   io_tmp_ptr := ANYPTR(bigtemp4);     {jws5 6/5/85}
			 END;

		      3: BEGIN
			   card_type:=gpio_card;
			   card_id  :=hp98622;
			   NEW(io_tmp_ptr);                    { get temp space }
			 END;

		      6:  BEGIN                                { DEW1 12/89 added centronics
								 parallel support }
			   card_type:= pllel_card;
			   card_id  := hpPARALLEL;
			   NEW(bigtemp);                       { get temp space type 2 }
			   io_tmp_ptr := ANYPTR(bigtemp);
			 END;

		      7: BEGIN                                 { 09/89 DEW - added SCSI support }
			   card_type:=scsi_card;
			   card_id  :=hp98658;
			   NEW(io_tmp_ptr);                    { get temp space }
			 END;

		      8: BEGIN
			   card_type:=hpib_card;
			   card_id  :=hp98625;
			   NEW(io_tmp_ptr);                    { get temp space }
			 END;

		      OTHERWISE BEGIN
			   NEW(io_tmp_ptr);                    { get temp space }
			   card_type:=other_card;
			   { note - this card will get TEMP space }
			 END;

		    END { of CASE }
		    ELSE BEGIN

		      IF dummy <= 30 THEN                      { jws 3/25/83 }

			CASE dummy of                           { jws 3/25/83 }

			  25: BEGIN                            { jws3 2/09/84 }
				card_id:=hpGATOR;              { jws3 2/09/84 }
				card_type:=graphics_card;      { jws3 2/09/84 }
				NEW(io_tmp_ptr);               { jws3 2/09/84 }
			      END;                             { jws3 2/09/84 }

			  27: BEGIN                             { jws 3/25/83 }
				card_id:=hp98253;               { jws 3/25/83 }
				card_type:=eprom_prgmr;         { jws 3/25/83 }
				NEW(io_tmp_ptr);                { jws 3/25/83 }
			      END;                              { jws 3/25/83 }

			  28: BEGIN
				card_id := hp98627;
				card_type := graphics_card;
				double := TRUE;
				NEW(io_tmp_ptr);               { get temp space }
			      END;

			  29: BEGIN
			   { id=29 is also set aside for double wide cards }
				double := TRUE;
				NEW(bigtemp3);                  { jws 3/25/83}
				io_tmp_ptr:=ANYPTR(bigtemp3);   { jws 3/25/83}
				card_type:=other_card;          { jws 3/25/83}
			      END;

			  30: BEGIN                             { jws 3/25/83 }
				card_id:=hp98259;               { jws 3/25/83 }
				card_type:=bubble_card;         { jws 3/25/83 }
				NEW(bigtemp);                   { jws 3/25/83 }
				io_tmp_ptr:=ANYPTR(bigtemp);    { jws 3/25/83 }
			      END;

			  OTHERWISE                             { jws 3/25/83 }
			      BEGIN                             { jws 3/25/83 }
			       NEW(bigtemp3);                   { jws 3/25/83 }
				io_tmp_ptr:=ANYPTR(bigtemp3);   { jws 3/25/83 }
				card_type:=other_card;          { jws 3/25/83 }
			      END;                              { jws 3/25/83 }

			END;  { of case  }                      { jws 3/25/83 }


		      IF dummy = 39
			THEN BEGIN                              { 09/89 DEW - added SCSI support }
			   card_type:=scsi_card;
			   card_id  :=hp98658;
			   NEW(io_tmp_ptr);                    { get temp space }
			 END;

		     IF dummy=52
		       THEN BEGIN
			 dc_dummy := ioread_byte(io_isc,16395)*256+ioread_byte(io_isc,16393);
			 IF dc_dummy < 32768
			   THEN BEGIN
			     dc_dummy := ioread_byte(io_isc,dc_dummy*2+1);
			     IF (dc_dummy MOD 128) = 1
			       THEN BEGIN
				 card_id := hp_datacomm;        { since I don't know yet }
				 card_type := serial_card;
			       END; { of IF }
			   END; { of IF }
			 NEW(bigtemp);
			 io_tmp_ptr:=ANYPTR(bigtemp);
		       END; { of BEGIN }

		     IF dummy=66                               { jws4  3/5/84 }
		       THEN BEGIN                              { jws4  3/5/84 }
			 card_id:=hp98644;                     { jws4  3/5/84 }
			 card_type:=serial_card;               { jws4  3/5/84 }
			 NEW(bigtemp4);                        { jws5  6/5/85 }
			 io_tmp_ptr:=ANYPTR(bigtemp4);         { jws5  6/5/85 }
		       END;                                    { jws4  3/5/84 }

		     IF ( dummy > 30 ) AND                     { jws4 3/5/84 }
			( dummy <> 52 ) AND ( dummy<>66 ) AND ( dummy <> 39 )
		       THEN BEGIN
			 NEW(bigtemp3);                         {      TM 8/20/82 }
			 io_tmp_ptr := ANYPTR(bigtemp3);        {      TM 8/20/82 }
			 { note - this card WILL get LARGE temp space }
			 card_type:=other_card;
		       END;

		    END; { of IF dummy <= 8 }

		  RECOVER
		    BEGIN
		      IF ( escapecode=-11 ) OR ( escapecode=-12 )
			THEN BEGIN
			  { no card at this address }
			END
			ELSE BEGIN
			  { some other problem }
			  ESCAPE(escapecode);
			END;
		    END; { of RECOVER BEGIN }


		END; { of IF double }
	    END;     { of IF io_isc=7 }
	END;         { of IF io_isc<minrealisc THEN/ELSE }
    END;             { of FOR WITH isc_table[io_isc] DO BEGIN }


    { set up the driver tables }                                { 0350 TM 8/19/82 }
								{ 0350 TM 8/19/82 }
    WITH dummy_drivers DO BEGIN                                 { 0350 TM 8/19/82 }
      iod_init  :=              dummy_driver ;
      iod_isr   := ISRPROCTYPE (dummy_driver);
      iod_rdb   := io_proc_vc  (dummy_driver_a);
      iod_wtb   :=              dummy_driver_c ;
      iod_rdw   := io_proc_vw  (dummy_driver_a);
      iod_wtw   :=              dummy_driver_w ;
      iod_rds   := io_proc_vs  (dummy_driver_wa);
      iod_wtc   :=              dummy_driver_dw ;
      iod_end   := io_proc_vb  (dummy_driver_a);
      iod_tfr   := io_proc_ptr (dummy_driver_a);
      iod_send  :=              dummy_driver_c ;
      iod_ppoll := io_proc_vc  (dummy_driver_a);
      iod_set   :=              dummy_driver_b ;
      iod_clr   :=              dummy_driver_b ;
      iod_test  :=              dummy_driver_ba ;               { 0350 TM 8/19/82 }
    END; { of WITH }                                            { 0350 TM 8/19/82 }



    { initialize the temp space }
    FOR io_isc := iominisc TO iomaxisc DO BEGIN

      { set up dummy drivers for the interfaces }
      isc_table[io_isc].io_drv_ptr:=ADDR(dummy_drivers);

      IF isc_table[io_isc].io_tmp_ptr <> NIL
	THEN WITH isc_table[io_isc].io_tmp_ptr^ DO BEGIN
	  card_addr := isc_table[io_isc].card_ptr;
	  eirbyte   := CHR( 0 );
	  my_isc    := io_isc ;
	  timeout   := 0 ;
	  addressed := -1;
	  in_bufptr := NIL ;
	  out_bufptr:= NIL ;
	  user_isr.dummy_sl := NIL;
	  user_isr.dummy_pr := NIL;
	  user_parm         := NIL;                     {JPC 2/22/82}
	  myisrib.INTREGADDR:= NIL;
	END; { of IF  WITH io_tmp_ptr^ DO }
    END; { of FOR DO BEGIN }

    dma_isrib0.INTREGADDR := NIL;
    dma_isrib1.INTREGADDR := NIL;


    { note - because of the ISRs - this routine can only be called
	     once - at INITLIB time.  If it is called again after that
	     invocation the ISR structure will be in very bad shape and
	     will probably hang the machine }



    kbd_crt_drivers:=dummy_drivers;
    WITH kbd_crt_drivers DO BEGIN
      iod_rdb   := kbd_rdb;
      iod_wtb   := crt_wtb;
      iod_init  := simple_init;
    END; { of WITH }


    isc_table[1].io_drv_ptr := ADDR(kbd_crt_drivers);
    isc_table[2].io_drv_ptr := ADDR(kbd_crt_drivers);


    { set up clear i/o hook to do an io system reset }
    cleariohook := io_system_reset;



  END; { of kernel_initialize }

  $PAGE$

PROCEDURE io_system_reset;
  VAR io_isc     : type_isc;
  BEGIN

    { initialize the interfaces }

    FOR io_isc:=iominisc TO iomaxisc DO
      WITH isc_table[io_isc] DO BEGIN

	user_time := 0;                                 { user timeout }

	IF io_tmp_ptr <> NIL
	  THEN WITH io_tmp_ptr^ DO BEGIN
	    eirbyte   := CHR( 0 );
	    my_isc    := io_isc ;
	    timeout   := 0 ;                            { driver timeout }
	    user_isr.dummy_sl := NIL;
	    user_isr.dummy_pr := NIL;
	    user_parm         := NIL;                   {JPC 2/22/82}
	  END; { of IF THEN WITH BEGIN  }

      END; { of FOR WITH BEGIN }

    { these two FOR blocks are seperate in case two HPIB interfaces are
      connected in one machine - no funny user isr's will happen.        }

    FOR io_isc:=iominisc TO iomaxisc DO
      WITH isc_table[io_isc] DO BEGIN

	IF io_drv_ptr^.iod_init <> dummy_driver
	  THEN BEGIN
	    CALL ( io_drv_ptr^.iod_init ,
		   io_tmp_ptr );
	  END; { of IF }

      END; { of FOR WITH BEGIN }


    { In case - for some messed up reason ( typically this is when the user
      doesn't call ioinitialize/iouninitialize ) - the dma resources are not
      relinquished by the init routines then this will free the resources.  }

    IF dma_isc_0 <> no_isc
      THEN BEGIN
	dma_release(isc_table[dma_isc_0].io_tmp_ptr);
      END; { of IF }

    IF dma_isc_1 <> no_isc
      THEN BEGIN
	dma_release(isc_table[dma_isc_1].io_tmp_ptr);
      END; { of IF }



  END; { of io_system_reset }




END;    { of general_0 }
$PAGE$
(************************************************************************)
(*                                                                      *)
(*                                                                      *)
(*      IOLIBRARY_KERNEL                                                *)
(*                                                                      *)
(*                                                                      *)
(************************************************************************)



IMPORT  general_0 ,
	LOADER  ;                                               { 367 TM 9/22/82 }


BEGIN

  kernel_initialize;
  MARKUSER;                                                     { 367 TM 9/22/82 }
END. { of iolibrary_kernel }

@


55.1
log
@Automatic bump of revision number for PWS version 3.25A
@
text
@@


54.1
log
@Automatic bump of revision number for PWS version 3.24
@
text
@@


53.1
log
@Automatic bump of revision number for PWS version 3.24B
@
text
@@


52.1
log
@Automatic bump of revision number for PWS version 3.24A
@
text
@@


51.1
log
@Automatic bump of revision number for PWS version 3.24d
@
text
@@


50.1
log
@Automatic bump of revision number for PWS version 3.23c
@
text
@@


49.1
log
@Automatic bump of revision number for PWS version 3.24b
@
text
@@


48.1
log
@Automatic bump of revision number for PWS version 3.24a
@
text
@@


47.1
log
@Automatic bump of revision number for PWS version 3.23
@
text
@@


46.1
log
@Automatic bump of revision number for PWS version 3.23
@
text
@@


45.1
log
@Automatic bump of revision number for PWS version 3.23C
@
text
@@


44.1
log
@Automatic bump of revision number for PWS version 3.23B
@
text
@@


43.1
log
@Automatic bump of revision number for PWS version 3.23aA
@
text
@@


42.1
log
@Automatic bump of revision number for PWS version 3.23e
@
text
@@


41.1
log
@Automatic bump of revision number for PWS version 3.23d
@
text
@@


40.2
log
@Added support for the new HP Parallel (centronics) interface.
@
text
@@


40.1
log
@Automatic bump of revision number for PWS version 3.23c
@
text
@d183 8
d349 1
d371 1
d671 1
d1089 8
@


39.1
log
@Automatic bump of revision number for PWS version 3.23b
@
text
@@


38.4
log
@
    Removed a constant for SRM-UX source control. Decided that
  maybe this wasn't such a good place to put it after all.
@
text
@@


38.3
log
@

        Added constant SRMUX_ON to the constants exported
     from iodeclarations. Used for keeping SRM-UX unique
     source out of the 3.23 release. This constant should
     be removed from the first release that includes SRM-UX.
@
text
@a247 1
	SRMUX_ON   = FALSE;     { JWH 9/89 }
@


38.2
log
@Added support for SCSI
@
text
@d248 1
@


38.1
log
@Automatic bump of revision number for PWS version 3.23a
@
text
@d340 1
d362 1
d1080 5
d1149 6
d1181 1
a1181 1
			( dummy <> 52 ) AND ( dummy<>66 )
@


37.1
log
@Automatic bump of revision number for PWS version 3.3a
@
text
@@


36.1
log
@Automatic bump of revision number for PWS version 3.22
@
text
@@


35.1
log
@Automatic bump of revision number for PWS version 3.22
@
text
@@


34.1
log
@Automatic bump of revision number for PWS version 3.22
@
text
@@


33.1
log
@Automatic bump of revision number for PWS version 3.22D
@
text
@@


32.1
log
@Automatic bump of revision number for PWS version 3.22C
@
text
@@


31.1
log
@Automatic bump of revision number for PWS version 3.22B
@
text
@@


30.1
log
@Automatic bump of revision number for PWS version 3.22A
@
text
@@


29.1
log
@Automatic bump of revision number for PWS version 3.22b
@
text
@@


28.1
log
@Automatic bump of revision number for PWS version 3.3b
@
text
@@


27.1
log
@Automatic bump of revision number for PWS version 3.3a
@
text
@@


26.1
log
@Automatic bump of revision number for PWS version 3.3 Synch
@
text
@@


25.1
log
@Automatic bump of revision number for PWS version 3.2Y
@
text
@@


24.1
log
@Automatic bump of revision number for PWS version 3.2
@
text
@@


23.1
log
@Automatic bump of revision number for PWS version 3.2P
@
text
@@


22.2
log
@Pws2unix automatic delta on Tue Aug 25 18:23:33 MDT 1987
@
text
@@


22.1
log
@Automatic bump of revision number for PWS version 3.2N
@
text
@d996 1
a996 1
    io_revid := 'IO 3.1: ';         { io library revision/id -   jws 8/03/83  }
@


21.1
log
@Automatic bump of revision number for PWS version 3.2M
@
text
@@


20.1
log
@Automatic bump of revision number for PWS version 3.2L
@
text
@@


19.1
log
@Automatic bump of revision number for PWS version 3.2K
@
text
@@


18.1
log
@Automatic bump of revision number for PWS version 3.2J
@
text
@@


17.1
log
@Automatic bump of revision number for PWS version 3.2I+
@
text
@@


16.1
log
@Automatic bump of revision number for PWS version 3.2I
@
text
@@


15.1
log
@Automatic bump of revision number for PWS version 3.2H
@
text
@@


14.1
log
@Automatic bump of revision number for PWS version 3.2G
@
text
@@


13.1
log
@Automatic bump of revision number for PWS version 3.2F
@
text
@@


12.1
log
@Automatic bump of revision number for PWS version 3.2E
@
text
@@


11.1
log
@Automatic bump of revision number for PWS version 3.2D
@
text
@@


10.1
log
@Automatic bump of revision number for PWS version 3.2C
@
text
@@


9.1
log
@Automatic bump of revision number for PWS version 3.2B
@
text
@@


8.1
log
@Automatic bump of revision number for PWS version 3.2A
@
text
@@


7.1
log
@Automatic bump of revision number for PWS version 3.2l
@
text
@@


6.1
log
@Automatic bump of revision number for PWS version 3.2k
@
text
@@


5.1
log
@Automatic bump of revision number for PWS version 3.2j
@
text
@@


4.1
log
@Automatic bump of revision number for PWS version 3.2i
@
text
@@


3.1
log
@Automatic bump of revision number for PWS version 3.2h
@
text
@@


2.1
log
@Auto bump rev number to 2.1 for sys 3.2e.
@
text
@@


1.1
log
@Initial revision
@
text
@@
