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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

41.1
date     89.12.22.11.30.47;  author jwh;  state Exp;
branches ;
next     40.1;

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

39.1
date     89.09.26.16.36.59;  author dew;  state Exp;
branches ;
next     38.1;

38.1
date     89.08.29.11.29.06;  author jwh;  state Exp;
branches ;
next     37.3;

37.3
date     89.08.23.13.55.40;  author jwh;  state Exp;
branches ;
next     37.2;

37.2
date     89.08.23.13.53.21;  author jwh;  state Exp;
branches ;
next     37.1;

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

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

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

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

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

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

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

30.1
date     88.12.09.13.48.33;  author dew;  state Exp;
branches ;
next     29.3;

29.3
date     88.12.09.09.47.39;  author dew;  state Exp;
branches ;
next     29.2;

29.2
date     88.12.09.09.35.39;  author dew;  state Exp;
branches ;
next     29.1;

29.1
date     88.10.31.15.33.34;  author bayes;  state Exp;
branches ;
next     28.3;

28.3
date     88.10.31.10.56.56;  author bayes;  state Exp;
branches ;
next     28.2;

28.2
date     88.10.27.10.15.07;  author quist;  state Exp;
branches ;
next     28.1;

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

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

26.1
date     88.09.28.13.15.21;  author bayes;  state Exp;
branches ;
next     25.2;

25.2
date     88.03.15.15.14.05;  author quist;  state Exp;
branches ;
next     25.1;

25.1
date     88.03.02.09.31.52;  author bayes;  state Exp;
branches ;
next     24.2;

24.2
date     88.03.01.09.45.10;  author bayes;  state Exp;
branches ;
next     24.1;

24.1
date     88.02.04.11.05.30;  author quist;  state Exp;
branches ;
next     1.1;

1.1
date     88.02.04.10.41.07;  author larry;  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
@{ LAN CARD DECLARATIONS }
{ changes/bug fix history
  rev 3.22c
    added DRIVER_BUFFER to LAN_INFO_REC
    moved CARD_STATE to preserve long word alignment
}
$SYSPROG$
$SEARCH 'IOLIB:KERNEL.CODE'$
MODULE LANDECS;
  IMPORT
    sysglobals, iodeclarations;
  EXPORT

    CONST
      HP98643     = 21;
      memory_size = hex('4000'); { total ram on the card }
      init_size   = 24;  { 24 bytes in the init_block }
      init_words  = init_size div 2;  { 12 words in the init_block }

    TYPE
      UNS3      = 0..7;
      HEX_DIGIT = 0..15;
      UNSWORD   = 0..65535;
      LINK_ADDRESS_TYPE = PACKED ARRAY[1..6] OF CHAR;
      BPOINTER  = ^CHAR;

      { lan card interface types }

      ID_REG_TYPE = PACKED RECORD
		      BYTE0 : BYTE;
		      CASE INTEGER OF
		      1: (IDB : BYTE);
		      2: (RL  : BOOLEAN;
			  ID  : 0..127);
		      3: (BIT7: BOOLEAN;
			  PID : 0..3;
			  SID : 0..31);
		      4: (RESET : BYTE);
		    END;
      SC_REG_TYPE = PACKED RECORD
		      BYTE2 : BYTE;
		      CASE INTEGER OF
		      1:(CONTROL: BYTE);
		      2:(STATUS : BYTE);
		      3:(IE : BOOLEAN;
			 IR : BOOLEAN;
			 INTLEVEL : 0..3;
			 LOCK : BOOLEAN;
			 ACK  : BOOLEAN;
			 JAB  : BOOLEAN;
			 REV  : BOOLEAN);
		    END;
      CSR0_TYPE = PACKED RECORD
		    CASE INTEGER OF
		    1:(UW   : UNSWORD);
		    2:(ERR  : BOOLEAN; { read }
		       BABL : BOOLEAN; { read, clear only } { clear by 1 }
		       CERR : BOOLEAN; { read, clear only }
		       MISS : BOOLEAN; { read, clear only }
		       MERR : BOOLEAN; { read, clear only }
		       RINT : BOOLEAN; { read, clear only }
		       TINT : BOOLEAN; { read, clear only }
		       IDON : BOOLEAN; { read, clear only }
		       INTR : BOOLEAN; { read }
		       INEA : BOOLEAN; { read, write }
		       RXON : BOOLEAN; { read }
		       TXON : BOOLEAN; { read }
		       TDMD : BOOLEAN; { read, set by 1 }
		       STOP : BOOLEAN; { read, set by 1 }
		       STRT : BOOLEAN; { read, set by 1 }
		       INIT : BOOLEAN  { read, set by 1 }
		       );
		  END;
      MODE_TYPE = PACKED RECORD  { INIT BLOCK MODE WORD }
		    CASE INTEGER OF
		    1:(PROM : BOOLEAN;
		       RES  : BYTE;
		       INTL : BOOLEAN;
		       DRTY : BOOLEAN;
		       COLL : BOOLEAN;
		       DTRC : BOOLEAN;
		       LOOP : BOOLEAN;
		       DTX  : BOOLEAN;
		       DRX  : BOOLEAN);
		     2:(ALL : UNSWORD);
		  END;
      LADRF_TYPE = PACKED RECORD
		     CASE INTEGER OF
		     1:(BITS : PACKED ARRAY [0..63] OF BOOLEAN);
		     2:(INT1,INT2 :INTEGER);
		   END;
      INIT_BLOCK_TYPE = PACKED RECORD
			  case integer of
			  0:(all24 : packed array[1..init_size] of char);
			  1:(all12 : packed array[1..init_words] of unsword);
			  2:(MODE : MODE_TYPE;
			     PADR : LINK_ADDRESS_TYPE;
			     LADRF: LADRF_TYPE;
			     RDRAL: UNSWORD;
			     RLEN : UNS3;
			     zip0 : 0..31;
			     RDRAH: BYTE;
			     TDRAL: UNSWORD;
			     TLEN : UNS3;
			     zip1 : 0..31;
			     TDRAH: BYTE);
			END;
      rx_status_type = PACKED RECORD  { also built into rx_ring_elt_type }
			 OWN   : BOOLEAN;
			 ERR   : BOOLEAN;
			 FRAM  : BOOLEAN;
			 OFLO  : BOOLEAN;
			 CRC   : BOOLEAN;
			 BUFF  : BOOLEAN;
			 STP   : BOOLEAN;
			 ENP   : BOOLEAN;
		       END;
      rx_ring_elt_type = PACKED RECORD
			   CASE INTEGER OF
			   1:(RMD0_0:BYTE;
			      RMD0_1:BYTE;
			      RMD1_0:BYTE;
			      RMD1_1:BYTE;
			      RMD2_0:BYTE;
			      RMD2_1:BYTE;
			      RMD3_0:BYTE;
			      RMD3_1:BYTE);
			   2:(LADR  : UNSWORD;
			      OWN   : BOOLEAN;
			      ERR   : BOOLEAN;
			      FRAM  : BOOLEAN;
			      OFLO  : BOOLEAN;
			      CRC   : BOOLEAN;
			      BUFF  : BOOLEAN;
			      STP   : BOOLEAN;
			      ENP   : BOOLEAN;
			      HADR  : BYTE;
			      BCNT  : SHORTINT;
			      MCNT  : SHORTINT);   { MESSAGE SIZE }
			 END;
      tx_status1_type = PACKED RECORD  { built into tx_ring_elt_type }
			  OWN   : BOOLEAN;
			  ERR   : BOOLEAN;
			  res0  : BOOLEAN;
			  MORE  : BOOLEAN;
			  ONE   : BOOLEAN;
			  DEF   : BOOLEAN;
			  STP   : BOOLEAN;
			  ENP   : BOOLEAN;
			END;
      tx_status2_type = PACKED RECORD  { built into tx_ring_elt_type }
			  BUFF  : BOOLEAN;
			  UFLO  : BOOLEAN;
			  res1  : BOOLEAN;
			  LCOL  : BOOLEAN;
			  LCAR  : BOOLEAN;
			  RTRY  : BOOLEAN;
			  zz    : 0..3; { 2 bits of TDR }
			END;
      tx_ring_elt_type  = PACKED RECORD
			    CASE INTEGER OF
			    1:(TMD0_0:BYTE;
			       TMD0_1:BYTE;
			       TMD1_0:BYTE;
			       TMD1_1:BYTE;
			       TMD2_0:BYTE;
			       TMD2_1:BYTE;
			       TMD3  :UNSWORD);
			    2:(LADR  : UNSWORD;
			       OWN   : BOOLEAN;
			       ERR   : BOOLEAN;
			       res0  : BOOLEAN;
			       MORE  : BOOLEAN;
			       ONE   : BOOLEAN;
			       DEF   : BOOLEAN;
			       STP   : BOOLEAN;
			       ENP   : BOOLEAN;
			       HADR  : BYTE;
			       BCNT  : SHORTINT;
			       BUFF  : BOOLEAN;
			       UFLO  : BOOLEAN;
			       res1  : BOOLEAN;
			       LCOL  : BOOLEAN;
			       LCAR  : BOOLEAN;
			       RTRY  : BOOLEAN;
			       TDR   : 0..1023);
			  END;
    CONST
      max_ring_elts           = 128;
      default_rx_buffer_size  = 320;
      default_num_rx_buffers  = 32;
      default_num_tx_buffers  = 4;
      default_mode            = 0;

    TYPE
      RX_BUFFERS = ARRAY [1..max_ring_elts] OF RX_RING_ELT_TYPE;
      TX_BUFFERS = ARRAY [1..max_ring_elts] OF TX_RING_ELT_TYPE;
      LBUFFER_TYPE  = PACKED ARRAY[1..(MEMORY_SIZE-INIT_SIZE)] OF CHAR;
      RAM_AREA_TYPE = PACKED RECORD
			INIT_BLOCK  : INIT_BLOCK_TYPE;
			BUFFERS     : LBUFFER_TYPE;
		      END;
      NOVBYTE = PACKED RECORD
		  N0   : BYTE;
		  N1   : HEX_DIGIT;
		  DATA1: HEX_DIGIT;
		  N2   : BYTE;
		  N3   : HEX_DIGIT;
		  DATA2: HEX_DIGIT;
		END;
      NOVBANK_TYPE = PACKED RECORD
		       FLAG    : NOVBYTE;
		       ZEROES1 : NOVBYTE;
		       STATION : ARRAY[1..6] OF NOVBYTE;
		       ZEROES2 : ARRAY[1..7] OF NOVBYTE;
		       CHECK   : NOVBYTE;
		     END;
      NOVRAM_TYPE = PACKED RECORD
		      CASE INTEGER OF
		      1:( NRAM : ARRAY[1..32] OF NOVBYTE);
		      2:( BANK1: NOVBANK_TYPE;
			  BANK2: NOVBANK_TYPE);
		    END;
      RDP_TYPE = PACKED RECORD
		   CASE INTEGER OF
		   1:(UW : UNSWORD);
		   2:(CSR0 : CSR0_TYPE);
		 END;
      LANCARD_TYPE = PACKED RECORD
		       ID_REG : ID_REG_TYPE;
		       SC_REG : SC_REG_TYPE;
		       NOVRAM_STORE : SHORTINT;
		       gap1   : PACKED ARRAY[0..16376] OF BYTE;
		       RDP    : RDP_TYPE; { LANCE DATA PORT }
		       RAP    : UNSWORD;  { LANCE ADDRESS PORT }
		       gap2   : PACKED ARRAY[0..16378] OF BYTE;
		       RAM_AREA : RAM_AREA_TYPE;
		       NOVRAM : NOVRAM_TYPE;
		     END;
      CARD_BASE_PTR = ^LANCARD_TYPE;

      CARD_STATE_TYPE = (CS_PRE_INIT,
			 CS_INIT_FAILED,
			 CS_ACK_ERROR,
			 CS_CARD_RESET,
			 CS_LANCE_READY,
			 CS_HW_FAILED
			 );

      RX_RING_ELT_PTR  = ^RX_RING_ELT_TYPE;
      RX_RING_PTR      = ^RX_BUFFERS;
      TX_RING_ELT_PTR  = ^TX_RING_ELT_TYPE;
      TX_RING_PTR      = ^TX_BUFFERS;

    { LAN FRAME HEADERS }
      ENET_HDR_PTR      = ^ETHERNET_HDR_TYPE;
      ETHERNET_HDR_TYPE = PACKED RECORD
			    DESTINATION : LINK_ADDRESS_TYPE;
			    SOURCE      : LINK_ADDRESS_TYPE;
			    ETYPE       : UNSWORD;
			  END;
      IEEE_HDR_PTR      = ^IEEE802_HDR_TYPE;
      IEEE802_HDR_TYPE  = PACKED RECORD
			    DESTINATION : LINK_ADDRESS_TYPE;
			    SOURCE      : LINK_ADDRESS_TYPE;
			    LENGTH      : UNSWORD;
			    DSAP,SSAP,CNTRL : BYTE;
			  END;
      IEEE_EXT_HDR_PTR    = ^IEEE802_HP_EXT_TYPE;
      IEEE802_HP_EXT_TYPE = PACKED RECORD
			      DESTINATION : LINK_ADDRESS_TYPE;
			      SOURCE      : LINK_ADDRESS_TYPE;
			      LENGTH      : UNSWORD;
			      DSAP,SSAP,CNTRL : BYTE;
			      HF1,HF2,HF3 : BYTE; { FILLERS }
			      DXSAP,SXSAP : UNSWORD;
			    END;

      GPADDR = PACKED RECORD
		 CASE INTEGER OF
		 0:(PAD : BYTE;
		    H8  : BYTE;
		    L16 : UNSWORD);
		 1:(INT : INTEGER);
		 2:(RXR : RX_RING_PTR);
		 3:(TXR : TX_RING_PTR);
		 4:(ENH : ENET_HDR_PTR);
		 5:(IEE1: IEEE_HDR_PTR);
		 6:(IEE2: IEEE_EXT_HDR_PTR);
		 7:(PTR : ANYPTR);
	       END;

    CONST
      LAN_MAX_FRAME_LEN = 1514;
      LAN_MIN_FRAME_LEN = 60;
      CRC_SIZE = 4;
      { io_control/io_status operation codes }
      { available codes are 5,6,7 }
      L_GET_INTLEVEL    =  8; { read only }
      L_CARD_STATE      =  9;
      L_FORCE_INTERRUPT = 10; { write only }
      L_RECONFIG        = 11;
      L_MODE            = 12;
      L_NUM_RX_BUFS     = 13;
      L_RX_BUF_SIZE     = 14;
      L_NUM_TX_BUFS     = 15;
      L_GET_TX_BUF_SIZE = 16; { read only }
      L_SET_MULTICAST_ALL=17; { write only }
      L_INIT_STATS      = 18; { write only }
      L_GET_STATS_LSW   = 18; { read only }
      L_GET_STATS_MSW   = 19; { read only }
      L_REJECT_FRAME    = 20; { write only }
      L_GET_FRAME_SIZE  = 20; { read only }
      L_LINK_ADDR1      = 21; { ..26 }
      L_SET_MMASK       = 27; { set multicast mask bit }
      L_CLR_MMASK       = 28; { clear milticast mask bit }
      {                 = 29;  currently unused }
      L_SET_UISR        = 30;
      L_CLEAR_UISR      = 31;
      L_INPUT_BUSY      = 32;
      L_OUTPUT_BUSY     = 33;
      L_ABORT           = 34;  L_INPUT = 0; L_OUTPUT = 1; L_ALL_IO = 2;
      L_SET_DEFAULT_CONFIG = 35;
      L_SKIP_BYTES      = 36;
      {                 = 37..39 currently unused }
      L_MMASK0          = 40; { base value of multicast mask bits }
			      { covers 40..103 ie 64 values }

      { term_char values set for eot_proc examination }
      LB_PENDING        = -1; { io in progress }
      LB_EOT            =  0; { buffer sent/received from card }
      LB_SHORT          =  1; { buffer was not big enough to
				receive all of the in comming frame }
      LB_TX_ERROR       =  2; { transmit failed on card }
      LB_ABORT          =  3; { transmit abort called for, probably stop key }
			      { this eot call can be ignored }
			      { output operations can be attempted }
      LB_RESET          =  4; { card reset, buffer may not have been sent }
			      { output operations can be attempted }
      LB_HW_FAILED      =  5; { buffer may not have been sent }
			      { don't try to do I/O with the card }
    TYPE
      LAN_STATS_TYPE = (LHW_MERR, LHW_BABL, LHW_RESTARTS,
			{receiver stats}
			LRX_NO_ERRORS, LRX_FRAME_ERR, LRX_OFLO_ERR,
			LRX_CRC_ERR, LRX_BUFF_ERR, LRX_MISS_ERR, LRX_OTHER_ERR,
			{transmit stats}
			LTX_REQUESTS, LTX_NO_ERRORS, LTX_NO_HEART,
			LTX_ONE, LTX_MORE, LTX_DEF, LTX_UFLO_ERR,
			LTX_LCOL_ERR, LTX_LCAR_ERR, LTX_RETRY_ERR
			);
      LAN_STATS_PTR = ^LAN_STATS_DATA;
      LAN_STATS_DATA= ARRAY[LAN_STATS_TYPE] OF INTEGER;
      LAN_BUFS_PTR  = ^LAN_BUFS;
      LAN_BUFS      = ARRAY[0..max_ring_elts-1] OF ANYPTR;
      LAN_INFO_PTR  = ^LAN_INFO_REC;
      LAN_SC_PROC   = PROCEDURE (SC:INTEGER);
      LAN_FUNNY_PROC = RECORD
			 CASE BOOLEAN OF
			 TRUE : ( REAL_PROC : LAN_SC_PROC );
			 FALSE: ( DUMMY_PR  : ANYPTR;
				  DUMMY_SL  : ANYPTR);
		       END;

      LAN_INFO_REC = RECORD
		       io_temps   : pio_tmp_ptr;
		       outbuf_proc : lan_funny_proc;
		       perm_isr   : io_funny_proc;
		       {-----DON'T MESS WITH ANYTHING BELOW HERE-----}
		       {----------USE IOSTATUS AND IOCONTROL---------}
		       lan_stats  : lan_stats_ptr;
		       local_link_address : link_address_type;
		       card_state : card_state_type;
		       init_block : init_block_type; {for use on next init}
		       {-----------card config params-------------}
		       rx_buffer_size : integer; { size of one rx_buffer }
		       num_rx_buffers : integer; { number of rx buffers }
		       num_tx_buffers : integer; { max tx buffers }
		       {-----------reciever params----------------}
		       rxr_1,rxr_n,rx_ring  : rx_ring_elt_ptr;
		       {-----------transmitter params-------------}
		       tx_buffer_size : integer; { entire tx buffer space }
		       txr_1,txr_n,tx_ring_f,tx_ring_l : tx_ring_elt_ptr;
		       txd_1,txd_n : gpaddr; { first and end of tx data space }
		       tx_count : integer;{ number of outstanding tx requests }
		       tx_used  : gpaddr; { start of oldest data space }
		       tx_next  : gpaddr; { next usable data space }
		       tx_user_buffs : lan_bufs_ptr;{outstanding user buffers}
		       tx_ub_in,tx_ub_out  : integer;
		       {-----------misc info-----------------------}
		       driver_buffer : anyptr;
		       last_rx_size  : shortint; { size of current frame }
		       skip_bytes    : shortint;
		       copy_bytes    : shortint;
		       card_intlevel : shortint;
		       do_card_start : boolean;
		       alloc_ok      : boolean;
		     END;

  IMPLEMENT
END.
@


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


56.1
log
@Automatic bump of revision number for PWS version 3.25
@
text
@a0 401
{ LAN CARD DECLARATIONS }
{ changes/bug fix history
  rev 3.22c
    added DRIVER_BUFFER to LAN_INFO_REC
    moved CARD_STATE to preserve long word alignment
}
$SYSPROG$
$SEARCH 'IOLIB:KERNEL.CODE'$
MODULE LANDECS;
  IMPORT
    sysglobals, iodeclarations;
  EXPORT

    CONST
      HP98643     = 21;
      memory_size = hex('4000'); { total ram on the card }
      init_size   = 24;  { 24 bytes in the init_block }
      init_words  = init_size div 2;  { 12 words in the init_block }

    TYPE
      UNS3      = 0..7;
      HEX_DIGIT = 0..15;
      UNSWORD   = 0..65535;
      LINK_ADDRESS_TYPE = PACKED ARRAY[1..6] OF CHAR;
      BPOINTER  = ^CHAR;

      { lan card interface types }

      ID_REG_TYPE = PACKED RECORD
		      BYTE0 : BYTE;
		      CASE INTEGER OF
		      1: (IDB : BYTE);
		      2: (RL  : BOOLEAN;
			  ID  : 0..127);
		      3: (BIT7: BOOLEAN;
			  PID : 0..3;
			  SID : 0..31);
		      4: (RESET : BYTE);
		    END;
      SC_REG_TYPE = PACKED RECORD
		      BYTE2 : BYTE;
		      CASE INTEGER OF
		      1:(CONTROL: BYTE);
		      2:(STATUS : BYTE);
		      3:(IE : BOOLEAN;
			 IR : BOOLEAN;
			 INTLEVEL : 0..3;
			 LOCK : BOOLEAN;
			 ACK  : BOOLEAN;
			 JAB  : BOOLEAN;
			 REV  : BOOLEAN);
		    END;
      CSR0_TYPE = PACKED RECORD
		    CASE INTEGER OF
		    1:(UW   : UNSWORD);
		    2:(ERR  : BOOLEAN; { read }
		       BABL : BOOLEAN; { read, clear only } { clear by 1 }
		       CERR : BOOLEAN; { read, clear only }
		       MISS : BOOLEAN; { read, clear only }
		       MERR : BOOLEAN; { read, clear only }
		       RINT : BOOLEAN; { read, clear only }
		       TINT : BOOLEAN; { read, clear only }
		       IDON : BOOLEAN; { read, clear only }
		       INTR : BOOLEAN; { read }
		       INEA : BOOLEAN; { read, write }
		       RXON : BOOLEAN; { read }
		       TXON : BOOLEAN; { read }
		       TDMD : BOOLEAN; { read, set by 1 }
		       STOP : BOOLEAN; { read, set by 1 }
		       STRT : BOOLEAN; { read, set by 1 }
		       INIT : BOOLEAN  { read, set by 1 }
		       );
		  END;
      MODE_TYPE = PACKED RECORD  { INIT BLOCK MODE WORD }
		    CASE INTEGER OF
		    1:(PROM : BOOLEAN;
		       RES  : BYTE;
		       INTL : BOOLEAN;
		       DRTY : BOOLEAN;
		       COLL : BOOLEAN;
		       DTRC : BOOLEAN;
		       LOOP : BOOLEAN;
		       DTX  : BOOLEAN;
		       DRX  : BOOLEAN);
		     2:(ALL : UNSWORD);
		  END;
      LADRF_TYPE = PACKED RECORD
		     CASE INTEGER OF
		     1:(BITS : PACKED ARRAY [0..63] OF BOOLEAN);
		     2:(INT1,INT2 :INTEGER);
		   END;
      INIT_BLOCK_TYPE = PACKED RECORD
			  case integer of
			  0:(all24 : packed array[1..init_size] of char);
			  1:(all12 : packed array[1..init_words] of unsword);
			  2:(MODE : MODE_TYPE;
			     PADR : LINK_ADDRESS_TYPE;
			     LADRF: LADRF_TYPE;
			     RDRAL: UNSWORD;
			     RLEN : UNS3;
			     zip0 : 0..31;
			     RDRAH: BYTE;
			     TDRAL: UNSWORD;
			     TLEN : UNS3;
			     zip1 : 0..31;
			     TDRAH: BYTE);
			END;
      rx_status_type = PACKED RECORD  { also built into rx_ring_elt_type }
			 OWN   : BOOLEAN;
			 ERR   : BOOLEAN;
			 FRAM  : BOOLEAN;
			 OFLO  : BOOLEAN;
			 CRC   : BOOLEAN;
			 BUFF  : BOOLEAN;
			 STP   : BOOLEAN;
			 ENP   : BOOLEAN;
		       END;
      rx_ring_elt_type = PACKED RECORD
			   CASE INTEGER OF
			   1:(RMD0_0:BYTE;
			      RMD0_1:BYTE;
			      RMD1_0:BYTE;
			      RMD1_1:BYTE;
			      RMD2_0:BYTE;
			      RMD2_1:BYTE;
			      RMD3_0:BYTE;
			      RMD3_1:BYTE);
			   2:(LADR  : UNSWORD;
			      OWN   : BOOLEAN;
			      ERR   : BOOLEAN;
			      FRAM  : BOOLEAN;
			      OFLO  : BOOLEAN;
			      CRC   : BOOLEAN;
			      BUFF  : BOOLEAN;
			      STP   : BOOLEAN;
			      ENP   : BOOLEAN;
			      HADR  : BYTE;
			      BCNT  : SHORTINT;
			      MCNT  : SHORTINT);   { MESSAGE SIZE }
			 END;
      tx_status1_type = PACKED RECORD  { built into tx_ring_elt_type }
			  OWN   : BOOLEAN;
			  ERR   : BOOLEAN;
			  res0  : BOOLEAN;
			  MORE  : BOOLEAN;
			  ONE   : BOOLEAN;
			  DEF   : BOOLEAN;
			  STP   : BOOLEAN;
			  ENP   : BOOLEAN;
			END;
      tx_status2_type = PACKED RECORD  { built into tx_ring_elt_type }
			  BUFF  : BOOLEAN;
			  UFLO  : BOOLEAN;
			  res1  : BOOLEAN;
			  LCOL  : BOOLEAN;
			  LCAR  : BOOLEAN;
			  RTRY  : BOOLEAN;
			  zz    : 0..3; { 2 bits of TDR }
			END;
      tx_ring_elt_type  = PACKED RECORD
			    CASE INTEGER OF
			    1:(TMD0_0:BYTE;
			       TMD0_1:BYTE;
			       TMD1_0:BYTE;
			       TMD1_1:BYTE;
			       TMD2_0:BYTE;
			       TMD2_1:BYTE;
			       TMD3  :UNSWORD);
			    2:(LADR  : UNSWORD;
			       OWN   : BOOLEAN;
			       ERR   : BOOLEAN;
			       res0  : BOOLEAN;
			       MORE  : BOOLEAN;
			       ONE   : BOOLEAN;
			       DEF   : BOOLEAN;
			       STP   : BOOLEAN;
			       ENP   : BOOLEAN;
			       HADR  : BYTE;
			       BCNT  : SHORTINT;
			       BUFF  : BOOLEAN;
			       UFLO  : BOOLEAN;
			       res1  : BOOLEAN;
			       LCOL  : BOOLEAN;
			       LCAR  : BOOLEAN;
			       RTRY  : BOOLEAN;
			       TDR   : 0..1023);
			  END;
    CONST
      max_ring_elts           = 128;
      default_rx_buffer_size  = 320;
      default_num_rx_buffers  = 32;
      default_num_tx_buffers  = 4;
      default_mode            = 0;

    TYPE
      RX_BUFFERS = ARRAY [1..max_ring_elts] OF RX_RING_ELT_TYPE;
      TX_BUFFERS = ARRAY [1..max_ring_elts] OF TX_RING_ELT_TYPE;
      LBUFFER_TYPE  = PACKED ARRAY[1..(MEMORY_SIZE-INIT_SIZE)] OF CHAR;
      RAM_AREA_TYPE = PACKED RECORD
			INIT_BLOCK  : INIT_BLOCK_TYPE;
			BUFFERS     : LBUFFER_TYPE;
		      END;
      NOVBYTE = PACKED RECORD
		  N0   : BYTE;
		  N1   : HEX_DIGIT;
		  DATA1: HEX_DIGIT;
		  N2   : BYTE;
		  N3   : HEX_DIGIT;
		  DATA2: HEX_DIGIT;
		END;
      NOVBANK_TYPE = PACKED RECORD
		       FLAG    : NOVBYTE;
		       ZEROES1 : NOVBYTE;
		       STATION : ARRAY[1..6] OF NOVBYTE;
		       ZEROES2 : ARRAY[1..7] OF NOVBYTE;
		       CHECK   : NOVBYTE;
		     END;
      NOVRAM_TYPE = PACKED RECORD
		      CASE INTEGER OF
		      1:( NRAM : ARRAY[1..32] OF NOVBYTE);
		      2:( BANK1: NOVBANK_TYPE;
			  BANK2: NOVBANK_TYPE);
		    END;
      RDP_TYPE = PACKED RECORD
		   CASE INTEGER OF
		   1:(UW : UNSWORD);
		   2:(CSR0 : CSR0_TYPE);
		 END;
      LANCARD_TYPE = PACKED RECORD
		       ID_REG : ID_REG_TYPE;
		       SC_REG : SC_REG_TYPE;
		       NOVRAM_STORE : SHORTINT;
		       gap1   : PACKED ARRAY[0..16376] OF BYTE;
		       RDP    : RDP_TYPE; { LANCE DATA PORT }
		       RAP    : UNSWORD;  { LANCE ADDRESS PORT }
		       gap2   : PACKED ARRAY[0..16378] OF BYTE;
		       RAM_AREA : RAM_AREA_TYPE;
		       NOVRAM : NOVRAM_TYPE;
		     END;
      CARD_BASE_PTR = ^LANCARD_TYPE;

      CARD_STATE_TYPE = (CS_PRE_INIT,
			 CS_INIT_FAILED,
			 CS_ACK_ERROR,
			 CS_CARD_RESET,
			 CS_LANCE_READY,
			 CS_HW_FAILED
			 );

      RX_RING_ELT_PTR  = ^RX_RING_ELT_TYPE;
      RX_RING_PTR      = ^RX_BUFFERS;
      TX_RING_ELT_PTR  = ^TX_RING_ELT_TYPE;
      TX_RING_PTR      = ^TX_BUFFERS;

    { LAN FRAME HEADERS }
      ENET_HDR_PTR      = ^ETHERNET_HDR_TYPE;
      ETHERNET_HDR_TYPE = PACKED RECORD
			    DESTINATION : LINK_ADDRESS_TYPE;
			    SOURCE      : LINK_ADDRESS_TYPE;
			    ETYPE       : UNSWORD;
			  END;
      IEEE_HDR_PTR      = ^IEEE802_HDR_TYPE;
      IEEE802_HDR_TYPE  = PACKED RECORD
			    DESTINATION : LINK_ADDRESS_TYPE;
			    SOURCE      : LINK_ADDRESS_TYPE;
			    LENGTH      : UNSWORD;
			    DSAP,SSAP,CNTRL : BYTE;
			  END;
      IEEE_EXT_HDR_PTR    = ^IEEE802_HP_EXT_TYPE;
      IEEE802_HP_EXT_TYPE = PACKED RECORD
			      DESTINATION : LINK_ADDRESS_TYPE;
			      SOURCE      : LINK_ADDRESS_TYPE;
			      LENGTH      : UNSWORD;
			      DSAP,SSAP,CNTRL : BYTE;
			      HF1,HF2,HF3 : BYTE; { FILLERS }
			      DXSAP,SXSAP : UNSWORD;
			    END;

      GPADDR = PACKED RECORD
		 CASE INTEGER OF
		 0:(PAD : BYTE;
		    H8  : BYTE;
		    L16 : UNSWORD);
		 1:(INT : INTEGER);
		 2:(RXR : RX_RING_PTR);
		 3:(TXR : TX_RING_PTR);
		 4:(ENH : ENET_HDR_PTR);
		 5:(IEE1: IEEE_HDR_PTR);
		 6:(IEE2: IEEE_EXT_HDR_PTR);
		 7:(PTR : ANYPTR);
	       END;

    CONST
      LAN_MAX_FRAME_LEN = 1514;
      LAN_MIN_FRAME_LEN = 60;
      CRC_SIZE = 4;
      { io_control/io_status operation codes }
      { available codes are 5,6,7 }
      L_GET_INTLEVEL    =  8; { read only }
      L_CARD_STATE      =  9;
      L_FORCE_INTERRUPT = 10; { write only }
      L_RECONFIG        = 11;
      L_MODE            = 12;
      L_NUM_RX_BUFS     = 13;
      L_RX_BUF_SIZE     = 14;
      L_NUM_TX_BUFS     = 15;
      L_GET_TX_BUF_SIZE = 16; { read only }
      L_SET_MULTICAST_ALL=17; { write only }
      L_INIT_STATS      = 18; { write only }
      L_GET_STATS_LSW   = 18; { read only }
      L_GET_STATS_MSW   = 19; { read only }
      L_REJECT_FRAME    = 20; { write only }
      L_GET_FRAME_SIZE  = 20; { read only }
      L_LINK_ADDR1      = 21; { ..26 }
      L_SET_MMASK       = 27; { set multicast mask bit }
      L_CLR_MMASK       = 28; { clear milticast mask bit }
      {                 = 29;  currently unused }
      L_SET_UISR        = 30;
      L_CLEAR_UISR      = 31;
      L_INPUT_BUSY      = 32;
      L_OUTPUT_BUSY     = 33;
      L_ABORT           = 34;  L_INPUT = 0; L_OUTPUT = 1; L_ALL_IO = 2;
      L_SET_DEFAULT_CONFIG = 35;
      L_SKIP_BYTES      = 36;
      {                 = 37..39 currently unused }
      L_MMASK0          = 40; { base value of multicast mask bits }
			      { covers 40..103 ie 64 values }

      { term_char values set for eot_proc examination }
      LB_PENDING        = -1; { io in progress }
      LB_EOT            =  0; { buffer sent/received from card }
      LB_SHORT          =  1; { buffer was not big enough to
				receive all of the in comming frame }
      LB_TX_ERROR       =  2; { transmit failed on card }
      LB_ABORT          =  3; { transmit abort called for, probably stop key }
			      { this eot call can be ignored }
			      { output operations can be attempted }
      LB_RESET          =  4; { card reset, buffer may not have been sent }
			      { output operations can be attempted }
      LB_HW_FAILED      =  5; { buffer may not have been sent }
			      { don't try to do I/O with the card }
    TYPE
      LAN_STATS_TYPE = (LHW_MERR, LHW_BABL, LHW_RESTARTS,
			{receiver stats}
			LRX_NO_ERRORS, LRX_FRAME_ERR, LRX_OFLO_ERR,
			LRX_CRC_ERR, LRX_BUFF_ERR, LRX_MISS_ERR, LRX_OTHER_ERR,
			{transmit stats}
			LTX_REQUESTS, LTX_NO_ERRORS, LTX_NO_HEART,
			LTX_ONE, LTX_MORE, LTX_DEF, LTX_UFLO_ERR,
			LTX_LCOL_ERR, LTX_LCAR_ERR, LTX_RETRY_ERR
			);
      LAN_STATS_PTR = ^LAN_STATS_DATA;
      LAN_STATS_DATA= ARRAY[LAN_STATS_TYPE] OF INTEGER;
      LAN_BUFS_PTR  = ^LAN_BUFS;
      LAN_BUFS      = ARRAY[0..max_ring_elts-1] OF ANYPTR;
      LAN_INFO_PTR  = ^LAN_INFO_REC;
      LAN_SC_PROC   = PROCEDURE (SC:INTEGER);
      LAN_FUNNY_PROC = RECORD
			 CASE BOOLEAN OF
			 TRUE : ( REAL_PROC : LAN_SC_PROC );
			 FALSE: ( DUMMY_PR  : ANYPTR;
				  DUMMY_SL  : ANYPTR);
		       END;

      LAN_INFO_REC = RECORD
		       io_temps   : pio_tmp_ptr;
		       outbuf_proc : lan_funny_proc;
		       perm_isr   : io_funny_proc;
		       {-----DON'T MESS WITH ANYTHING BELOW HERE-----}
		       {----------USE IOSTATUS AND IOCONTROL---------}
		       lan_stats  : lan_stats_ptr;
		       local_link_address : link_address_type;
		       card_state : card_state_type;
		       init_block : init_block_type; {for use on next init}
		       {-----------card config params-------------}
		       rx_buffer_size : integer; { size of one rx_buffer }
		       num_rx_buffers : integer; { number of rx buffers }
		       num_tx_buffers : integer; { max tx buffers }
		       {-----------reciever params----------------}
		       rxr_1,rxr_n,rx_ring  : rx_ring_elt_ptr;
		       {-----------transmitter params-------------}
		       tx_buffer_size : integer; { entire tx buffer space }
		       txr_1,txr_n,tx_ring_f,tx_ring_l : tx_ring_elt_ptr;
		       txd_1,txd_n : gpaddr; { first and end of tx data space }
		       tx_count : integer;{ number of outstanding tx requests }
		       tx_used  : gpaddr; { start of oldest data space }
		       tx_next  : gpaddr; { next usable data space }
		       tx_user_buffs : lan_bufs_ptr;{outstanding user buffers}
		       tx_ub_in,tx_ub_out  : integer;
		       {-----------misc info-----------------------}
		       driver_buffer : anyptr;
		       last_rx_size  : shortint; { size of current frame }
		       skip_bytes    : shortint;
		       copy_bytes    : shortint;
		       card_intlevel : shortint;
		       do_card_start : boolean;
		       alloc_ok      : boolean;
		     END;

  IMPLEMENT
END.
@


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.1
log
@Automatic bump of revision number for PWS version 3.23c
@
text
@@


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


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


37.3
log
@

           Changes for SRM-UX.
@
text
@@


37.2
log
@
     Changes for SRM-UX.
@
text
@d8 1
a8 1
{$SEARCH 'IOLIB:KERNEL.CODE'$}
@


37.1
log
@Automatic bump of revision number for PWS version 3.3a
@
text
@d8 1
a8 1
$SEARCH 'IOLIB:KERNEL.CODE'$
@


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.3
log
@Automatic bump from pws2rcs.
Search directive was modified.

Added here to correct ci/newci massive diff problem.
DEW, BAYES, QUIST
@
text
@@


29.2
log
@Long word alignment.
@
text
@d8 1
@


29.1
log
@Automatic bump of revision number for PWS version 3.22b
@
text
@d3 3
a5 8
  3 mar 88, removed lan_data, lan_read, lan_write and in_frame from
	    LAN_INFO_REC .
	    added skip_bytes & copy_bytes.
  4 mar 88, added perm_isr & outbuf_proc to LAN_INFO_REC
	    added types LAN_FUNNY_PROC and LAN_SC_PROC
  8 mar 88, changed access codes to multicast mask bits
	    changed access code values for 100 and above.
 24 mar 88, changed access codes for reading multicast mask bits
a7 2
$SEARCH 'IOLIB:KERNEL.CODE'$

@


28.3
log
@
ipws2rcs automatic delta on Mon Oct 31 10:34:17 MST 1988
:w
:q
@
text
@@


28.2
log
@new version to support multiplexed io
@
text
@d12 3
a14 1
$SYSPROG$ $TABLES ON$
@


28.1
log
@Automatic bump of revision number for PWS version 3.3b
@
text
@d10 1
d12 1
a12 1
$SYSPROG$
d305 1
a305 1
      L_FORCE_INTERUPT  = 10; { write only }
d321 1
a321 1
      L_MMASK           = 29; { value of multicast mask bit }
d329 3
d372 1
a373 1
		       perm_isr   : io_funny_proc;
a374 1
		       card_state : card_state_type;
d377 1
d395 1
@


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.2
log
@new interfaces
@
text
@@


25.1
log
@Automatic bump of revision number for PWS version 3.2Y
@
text
@d2 9
d301 1
d317 11
a327 1
      L_LINK_ADDR       = 21;
d332 4
a335 2
      LB_TX_ERROR       =  1; { transmit failed on card }
      LB_ABORT          =  2; { transmit abort called for, probably stop key }
d338 1
a338 1
      LB_RESET          =  3; { card reset, buffer may not have been sent }
d340 1
a340 1
      LB_HW_FAILED      =  4; { buffer may not have been sent }
d357 7
a363 1
      LAN_IO_PROC   = PROCEDURE( INFO : LAN_INFO_PTR );
a365 3
		       lan_data   : anyptr;
		       lan_read   : lan_io_proc;
		       lan_write  : lan_io_proc;
d367 1
d369 1
a380 1
		       in_frame : anyptr;
d391 3
a393 1
		       last_rx_size  : shortint;
@


24.2
log
@Pws2unix automatic delta on Tue Mar  1 09:01:42 MST 1988
@
text
@@


24.1
log
@initial RCS submission
@
text
@d311 1
a311 1
      LB_SENT           =  0; { buffer sent from card }
d368 1
@


1.1
log
@Initial revision
@
text
@@
