
                               					 6-Jan-1983 11:07:31	VAX-11 FORTRAN V3.1-23              Page   1
								 5-Jan-1983 17:16:56	[CAMAC.SOURCE.KS30202]CAMSUPORT.FOR;1       

0001    C+++
0002    C
0003    C FACILITY
0004    C	OAK RIDGE NATIONAL LABORATORY
0005    C	FUSION ENERGY DIVISION
0006    C	TOKAMAK SECTION
0007    C
0008    C ABSTRACT
0009    C	This FORTRAN procedure library provides several support procedures
0010    C	for the FED VAX CAMAC system. The procedures included presently fall
0011    C	into one of two categories, namely (1) access to privileged CAMAC
0012    C	ACP functions and (2) CAMAC status display. Specifically, the library
0013    C	contains the following procedures:
0014    C
0015    C	CAM$CONL
0016    C	-Request ACP set CAMAC crate unit 'ON-LINE',
0017    C	CAM$ENLAMS
0018    C	-Request ACP to enable LAM support for a specified CAMAC
0019    C	 crate unit,
0020    C	CAM$COFL
0021    C	-Request ACP to set a specified CAMAC crate unit 'OFF-LINE',
0022    C	CAM$DABLAMS
0023    C	-Request ACP to disable LAM support for a specified CAMAC
0024    C	 crate unit,
0025    C
0026    C AUTHOR
0027    C	E.T. Blair
0028    C
0029    C REVISION HISTORY
0030    C	V01-001,E.T. Blair,25-AUG-1982
0031    C	Added documentation for internal procedure CAM_SUPINIT.
0032    C
0033    C	Modified CAM$CONL, CAM$COFL, CAM$ENLAMS, CAM$DABLAMS procedures
0034    C	to return the CAMAC IOSB resulting from QIO's to the CAMAC ACP
0035    C	to the calling program. These procedures no longer try to interpret
0036    C	the CAMAC IOSB for success/error indication. This now becomes the
0037    C	responsibility of the caller, just as for the standard CAMAC access
0038    C	calls.
0039    C
0040    C---
0041    C+++
0042    C
0043    C	Procedure:
0044    C	CAM$CONL(UNIT_NAME,IOSB)
0045    C
0046    C	Description:
0047    C	This procedure makes a request to the CAMAC ACP to set the
0048    C	specified CAMAC crate unit 'ON-LINE'. The ACP performs the
0049    C	necessary CAMAC commands to bring the CAMAC crate controller 
0050    C	to an operational state and performs the necessary internal 
0051    C	data structure manipulation to set the crate UCB 'ON-LINE'.
0052    C
0053    C	Parameters:
0054    C	UNIT_NAME- address of a CHARACTER string descriptor specifying
0055    C		an ASCII string identifying the crate unit to be set
0056    C		on-line.
0057    C	IOSB- address of a quadword buffer to be used as the CAMAC I/O

                               					 6-Jan-1983 11:07:31	VAX-11 FORTRAN V3.1-23              Page   2
								 5-Jan-1983 17:16:56	[CAMAC.SOURCE.KS30202]CAMSUPORT.FOR;1       

0058    C		status block for the I/O request.
0059    C
0060    C	Operational Notes:
0061    C	1. Successful execution of this procedure requires that the
0062    C	   process executing the image using CAM$CONL have PHYS_IO
0063    C	   privilege.
0064    C
0065    C
0066    C	Return Status:
0067    C	SS$_NORMAL- CAMAC request successful,
0068    C	Any other system status indicates faliure(see system
0069    C		status message definitions for explicit error
0070    C		message).
0071    C
0072    C---
0073    	INTEGER FUNCTION CAM$CONL(UNIT_NAME,IOSB)
0074    	IMPLICIT INTEGER(A-Z)
0075    	EXTERNAL IO$_SETCHAR,IO$M_CONLINE
0076    	INTEGER*4 IOSB(*)
0077    	CHARACTER UNIT_NAME*(*),HSU_NAME*6
0078    	INTEGER*2 HSU_CHAN
0079    C++
0080    C
0081    C	CAM$CONL INITIALIZATION
0082    C
0083    C--
0084    	IOSB(1)=0
0085    	IOSB(2)=0
0086    C++
0087    C
0088    C	DECODE SPECIFIED UNIT AND ASSIGN CHANNEL TO ASSOCIATED HSU.
0089    C
0090    C--
0091    	CAM$CONL=CAM$CSU(UNIT_NAME,HSU_NAME,CRATE_NUMBER)
0092    	IF (.NOT.CAM$CONL) THEN
0093    		RETURN
0094    	END IF
0095    C++
0096    C
0097    C	ASSIGN I/O CHANNEL TO CAMAC HIGHWAY UNIT
0098    C
0099    C--
0100    	CAM$CONL=SYS$ASSIGN(HSU_NAME,HSU_CHAN,,)
0101    	IF (.NOT.CAM$CONL) THEN
0102    		RETURN
0103    	END IF
0104    C++
0105    C
0106    C	QIO TO CAMAC ACP TO SET CRATE ON-LINE
0107    C
0108    C--
0109    	CAM$CONL=SYS$QIOW(%VAL(0),%VAL(HSU_CHAN),
0110    	9	%VAL(%LOC(IO$_SETCHAR)+%LOC(IO$M_CONLINE)),
0111    	9	IOSB,,,%VAL(CRATE_NUMBER),,,,,)
0112 C  D	TYPE 2999,CAM$CONL,IOSB(1),IOSB(2)
0113 C  D2999	FORMAT(1X,'R0=',Z8,' IOSB=',Z8,2X,Z8)
0114    C++

CAM$CONL                       					 6-Jan-1983 11:07:31	VAX-11 FORTRAN V3.1-23              Page   3
								 5-Jan-1983 17:16:56	[CAMAC.SOURCE.KS30202]CAMSUPORT.FOR;1       

0115    C
0116    C	RELEASE VMS I/O CHANNEL ASSIGNMENT
0117    C
0118    C--
0119    	CALL SYS$DASSGN(%VAL(HSU_CHAN))
0120    	RETURN
0121    	END




PROGRAM SECTIONS

    Name				 Bytes   Attributes

  0 $CODE                                  141   PIC CON REL LCL   SHR   EXE   RD NOWRT LONG
  2 $LOCAL                                 148   PIC CON REL LCL NOSHR NOEXE   RD   WRT LONG

    Total Space Allocated                  289


ENTRY POINTS

    Address  Type  Name          

  0-00000000  I*4  CAM$CONL      


VARIABLES

    Address  Type  Name              Address  Type  Name              Address  Type  Name              Address  Type  Name          

  2-0000000C  I*4  CRATE_NUMBER    2-00000006  I*2  HSU_CHAN        2-00000000  CHAR HSU_NAME       AP-00000004@ CHAR UNIT_NAME     


ARRAYS

    Address  Type  Name                Bytes  Dimensions

 AP-00000008@ I*4  IOSB                   **  (*)


FUNCTIONS AND SUBROUTINES REFERENCED

  Type  Name            Type  Name            Type  Name            Type  Name            Type  Name            Type  Name          

   I*4  CAM$CSU               IO$M_CONLINE          IO$_SETCHAR      I*4  SYS$ASSIGN            SYS$DASSGN       I*4  SYS$QIOW      

                               					 6-Jan-1983 11:07:31	VAX-11 FORTRAN V3.1-23              Page   4
								 5-Jan-1983 17:16:56	[CAMAC.SOURCE.KS30202]CAMSUPORT.FOR;1       

0001    C+++
0002    C
0003    C	Procedure:
0004    C	CAM$ENLAMS(UNIT_NAME,LAMG_N,IOSB)
0005    C
0006    C	Description:
0007    C	This procedure makes a request to the CAMAC ACP to enable LAM
0008    C	support for the specified CAMAC crate unit. The ACP performs the
0009    C	necessary CAMAC commands to bring the CAMAC crate controller 
0010    C	and LAM grader/encoder to a state capable of generating CAMAC
0011    C	demands to the associated VAX highway driver. The ACP also allocates
0012    C	and initializes the necessary internal data structures to allow
0013    C	LAM AST requests to be queued to specific stations within the
0014    C	crate. Each crate is considered to have a total of 24 LAM stations
0015    C	numbered 0-23, where station 0 corresponds to the internal LAM
0016    C	associated with serial CAMAC L2 crate controllers. Attempts to
0017    C	perform LAM service requests to a crate without LAM support enabled
0018    C	will result in failure status from the CAMAC system.
0019    C
0020    C	Parameters:
0021    C	UNIT_NAME- address of a CHARACTER string descriptor specifying
0022    C		an ASCII string identifying the crate unit to be set
0023    C		on-line.
0024    C	LAMG_N- value of the CAMAC station to be used to address the
0025    C		LAM grader/encoder module.
0026    C	IOSB- address of a quadword buffer to be used as the CAMAC I/O
0027    C		status block for the I/O request.
0028    C
0029    C	Operational Notes:
0030    C	1. Successful execution of this procedure requires that the
0031    C	   process executing the image using CAM$ENLAMS have PHYS_IO
0032    C	   privilege.
0033    C	2. The VAX CAMAC LAM management philosophy assumes the use of
0034    C	   LAM grader/encoder modules to provide application independent
0035    C	   control over the generation of CAMAC demands. In this way, system
0036    C	   integrity is not compromised by a failure to clear an existing LAM.
0037    C
0038    C
0039    C	Return Status:
0040    C	SS$_NORMAL- CAMAC request successful,
0041    C	Any other system status indicates faliure(see system
0042    C		status message definitions for explicit error
0043    C		message).
0044    C
0045    C---
0046    	INTEGER FUNCTION CAM$ENLAMS(UNIT_NAME,LAMG_N,IOSB)
0047    	IMPLICIT INTEGER(A-Z)
0048    	EXTERNAL IO$_SETCHAR,IO$M_ENLAMS
0049    	INTEGER*4 IOSB(*)
0050    	CHARACTERUNIT_NAME*(*),HSU_NAME*6
0051    	INTEGER*2 HSU_CHAN
0052    C++
0053    C
0054    C	CAM$ENLAMS INITIALIZATION
0055    C
0056    C--
0057    	IOSB(1)=0

CAM$ENLAMS                     					 6-Jan-1983 11:07:31	VAX-11 FORTRAN V3.1-23              Page   5
								 5-Jan-1983 17:16:56	[CAMAC.SOURCE.KS30202]CAMSUPORT.FOR;1       

0058    	IOSB(2)=0
0059    C++
0060    C
0061    C	DECODE SPECIFIED UNIT AND ASSIGN CHANNEL TO ASSOCIATED HSU.
0062    C
0063    C--
0064    	CAM$ENLAMS=CAM$CSU(UNIT_NAME,HSU_NAME,CRATE_NUMBER)
0065    	IF (.NOT.CAM$ENLAMS) THEN
0066    		RETURN
0067    	END IF
0068    C++
0069    C
0070    C	ASSIGN I/O CHANNEL TO CAMAC HIGHWAY UNIT
0071    C
0072    C--
0073    	CAM$ENLAMS=SYS$ASSIGN(HSU_NAME,HSU_CHAN,,)
0074    	IF (.NOT.CAM$ENLAMS) THEN
0075    		RETURN
0076    	END IF
0077    C++
0078    C
0079    C	QIO TO CAMAC ACP TO ENABLE LAM SUPPORT FOR CRATE
0080    C
0081    C--
0082    	CAM$ENLAMS=SYS$QIOW(%VAL(0),%VAL(HSU_CHAN),
0083    	9	%VAL(%LOC(IO$_SETCHAR)+%LOC(IO$M_ENLAMS)),
0084    	9	IOSB,,,%VAL(CRATE_NUMBER),LAMG_N,,,,)
0085 C  D	TYPE 2999,CAM$ENLAMS,IOSB(1),IOSB(2)
0086 C  D2999	FORMAT(1X,'R0=',Z8,' IOSB=',Z8,2X,Z8)
0087    C++
0088    C
0089    C	RELEASE VMS I/O CHANNEL ASSIGNMENT
0090    C
0091    C--
0092    	CALL SYS$DASSGN(%VAL(HSU_CHAN))
0093    	RETURN
0094    	END

CAM$ENLAMS                     					 6-Jan-1983 11:07:31	VAX-11 FORTRAN V3.1-23              Page   6
								 5-Jan-1983 17:16:56	[CAMAC.SOURCE.KS30202]CAMSUPORT.FOR;1       

PROGRAM SECTIONS

    Name				 Bytes   Attributes

  0 $CODE                                  146   PIC CON REL LCL   SHR   EXE   RD NOWRT LONG
  2 $LOCAL                                 148   PIC CON REL LCL NOSHR NOEXE   RD   WRT LONG

    Total Space Allocated                  294


ENTRY POINTS

    Address  Type  Name          

  0-00000000  I*4  CAM$ENLAMS    


VARIABLES

    Address  Type  Name              Address  Type  Name              Address  Type  Name              Address  Type  Name          

  2-0000000C  I*4  CRATE_NUMBER    2-00000006  I*2  HSU_CHAN        2-00000000  CHAR HSU_NAME       AP-00000008@ I*4  LAMG_N        
 AP-00000004@ CHAR UNIT_NAME     


ARRAYS

    Address  Type  Name                Bytes  Dimensions

 AP-0000000C@ I*4  IOSB                   **  (*)


FUNCTIONS AND SUBROUTINES REFERENCED

  Type  Name            Type  Name            Type  Name            Type  Name            Type  Name            Type  Name          

   I*4  CAM$CSU               IO$M_ENLAMS           IO$_SETCHAR      I*4  SYS$ASSIGN            SYS$DASSGN       I*4  SYS$QIOW      

                               					 6-Jan-1983 11:07:31	VAX-11 FORTRAN V3.1-23              Page   7
								 5-Jan-1983 17:16:56	[CAMAC.SOURCE.KS30202]CAMSUPORT.FOR;1       

0001    C+++
0002    C
0003    C	Procedure:
0004    C	CAM$COFL(UNIT_NAME,IOSB)
0005    C
0006    C	Description:
0007    C	This procedure makes a request to the CAMAC ACP to set the
0008    C	specified CAMAC crate unit 'OFF-LINE'. The ACP performs the
0009    C	necessary CAMAC commands to disable further CAMAC crate controller
0010    C	activity and performs the necessary internal data structure
0011    C	manipulation to set the crate UCB 'OFF-LINE'.
0012    C
0013    C	Parameters:
0014    C	UNIT_NAME- address of a CHARACTER string descriptor specifying
0015    C		an ASCII string identifying the crate unit to be set
0016    C		on-line.
0017    C	IOSB- address of a quadword buffer to be used as the CAMAC I/O
0018    C		status block for the I/O request.
0019    C
0020    C	Operational Notes:
0021    C	1. Successful execution of this procedure requires that the
0022    C	   process executing the image using CAM$COFL have PHYS_IO
0023    C	   privilege.
0024    C
0025    C
0026    C	Return Status:
0027    C	SS$_NORMAL- CAMAC request successful,
0028    C	Any other system status indicates faliure(see system
0029    C		status message definitions for explicit error
0030    C		message).
0031    C
0032    C---
0033    	INTEGER FUNCTION CAM$COFL(UNIT_NAME,IOSB)
0034    	IMPLICIT INTEGER(A-Z)
0035    	EXTERNAL IO$_SETCHAR,IO$M_COFFLINE
0036    	INTEGER*4 IOSB(*)
0037    	CHARACTERUNIT_NAME*(*),HSU_NAME*6
0038    	INTEGER*2 HSU_CHAN
0039    C++
0040    C
0041    C	CAM$COFL INITIALIZATION
0042    C
0043    C--
0044    	IOSB(1)=0
0045    	IOSB(2)=0
0046    C++
0047    C
0048    C	DECODE SPECIFIED UNIT AND ASSIGN CHANNEL TO HSU.
0049    C
0050    C--
0051    	CAM$COFL=CAM$CSU(UNIT_NAME,HSU_NAME,CRATE_NUMBER)
0052    	IF (.NOT.CAM$COFL) THEN
0053    		RETURN
0054    	END IF
0055    C++
0056    C
0057    C	ASSIGN I/O CHANNEL TO CAMAC HIGHWAY UNIT

CAM$COFL                       					 6-Jan-1983 11:07:31	VAX-11 FORTRAN V3.1-23              Page   8
								 5-Jan-1983 17:16:56	[CAMAC.SOURCE.KS30202]CAMSUPORT.FOR;1       

0058    C
0059    C--
0060    	CAM$COFL=SYS$ASSIGN(HSU_NAME,HSU_CHAN,,)
0061    	IF (.NOT.CAM$COFL) THEN
0062    		RETURN
0063    	END IF
0064    C++
0065    C
0066    C	QIO TO CAMAC ACP TO SET CRATE OFF-LINE.
0067    C
0068    C--
0069    	CAM$COFL=SYS$QIOW(%VAL(0),%VAL(HSU_CHAN),
0070    	9	%VAL(%LOC(IO$_SETCHAR)+%LOC(IO$M_COFFLINE)),
0071    	9	IOSB,,,%VAL(CRATE_NUMBER),,,,,)
0072 C  D	TYPE 2999,CAM$COFL,IOSB(1),IOSB(2)
0073 C  D2999	FORMAT(1X,'R0=',Z8,' IOSB=',Z8,2X,Z8)
0074    C++
0075    C
0076    C	RELEASE VMS I/O CHANNEL ASSIGNMENT
0077    C
0078    C--
0079    	CALL SYS$DASSGN(%VAL(HSU_CHAN))
0080    	RETURN
0081    	END




PROGRAM SECTIONS

    Name				 Bytes   Attributes

  0 $CODE                                  141   PIC CON REL LCL   SHR   EXE   RD NOWRT LONG
  2 $LOCAL                                 148   PIC CON REL LCL NOSHR NOEXE   RD   WRT LONG

    Total Space Allocated                  289


ENTRY POINTS

    Address  Type  Name          

  0-00000000  I*4  CAM$COFL      


VARIABLES

    Address  Type  Name              Address  Type  Name              Address  Type  Name              Address  Type  Name          

  2-0000000C  I*4  CRATE_NUMBER    2-00000006  I*2  HSU_CHAN        2-00000000  CHAR HSU_NAME       AP-00000004@ CHAR UNIT_NAME     

CAM$COFL                       					 6-Jan-1983 11:07:31	VAX-11 FORTRAN V3.1-23              Page   9
								 5-Jan-1983 17:16:56	[CAMAC.SOURCE.KS30202]CAMSUPORT.FOR;1       

ARRAYS

    Address  Type  Name                Bytes  Dimensions

 AP-00000008@ I*4  IOSB                   **  (*)


FUNCTIONS AND SUBROUTINES REFERENCED

  Type  Name            Type  Name            Type  Name            Type  Name            Type  Name            Type  Name          

   I*4  CAM$CSU               IO$M_COFFLINE         IO$_SETCHAR      I*4  SYS$ASSIGN            SYS$DASSGN       I*4  SYS$QIOW      

                               					 6-Jan-1983 11:07:31	VAX-11 FORTRAN V3.1-23              Page  10
								 5-Jan-1983 17:16:56	[CAMAC.SOURCE.KS30202]CAMSUPORT.FOR;1       

0001    C+++
0002    C
0003    C	Procedure:
0004    C	CAM$DABLAMS(UNIT_NAME,IOSB)
0005    C
0006    C	Description:
0007    C	This procedure makes a request to the CAMAC ACP to disable LAM
0008    C	support for the specified CAMAC crate unit. The ACP performs the
0009    C	necessary CAMAC commands to take the CAMAC crate controller 
0010    C	and LAM grader/encoder to a state incapable of generating CAMAC
0011    C	demands to the associated VAX highway driver. The ACP then flushes
0012    C	all pending AST requests for the specified CAMAC crate, accounting
0013    C	for the AST charged aganist the process in the process AST quota.
0014    C	Then the associated internal data structure used by the ACP for
0015    C	LAM management support is deallocated back to non-paged pool.
0016    C
0017    C	Parameters:
0018    C	UNIT_NAME- address of a CHARACTER string descriptor specifying
0019    C		an ASCII string identifying the crate unit to be set
0020    C		on-line.
0021    C	IOSB- address of a quadword buffer to be used as the CAMAC I/O
0022    C		status block for the I/O request.
0023    C
0024    C	Operational Notes:
0025    C	1. Successful execution of this procedure requires that the
0026    C	   process executing the image using CAM$DABLAMS have PHYS_IO
0027    C	   privilege.
0028    C	2. The VAX CAMAC LAM management philosophy assumes the use of
0029    C	   LAM grader/encoder modules to provide application independent
0030    C	   control over the generation of CAMAC demands. In this way, system
0031    C	   integrity is not compromised by a failure to clear an existing LAM.
0032    C
0033    C
0034    C	Return Status:
0035    C	SS$_NORMAL- CAMAC request successful,
0036    C	Any other system status indicates faliure(see system
0037    C		status message definitions for explicit error
0038    C		message).
0039    C
0040    C---
0041    	INTEGER FUNCTION CAM$DABLAMS(UNIT_NAME,IOSB)
0042    	IMPLICIT INTEGER(A-Z)
0043    	EXTERNAL IO$_SETCHAR,IO$M_DABLAMS
0044    	INTEGER*4 IOSB(*)
0045    	CHARACTER UNIT_NAME*(*),HSU_NAME*6
0046    	INTEGER*2 HSU_CHAN
0047    C++
0048    C
0049    C	CAM$DABLAMS INITIALIZATION
0050    C
0051    C--
0052    	IOSB(1)=0
0053    	IOSB(2)=0
0054    C++
0055    C
0056    C	DECODE SPECIFIED UNIT AND ASSIGN CHANNEL TO ASSOCIATED HSU.
0057    C

CAM$DABLAMS                    					 6-Jan-1983 11:07:31	VAX-11 FORTRAN V3.1-23              Page  11
								 5-Jan-1983 17:16:56	[CAMAC.SOURCE.KS30202]CAMSUPORT.FOR;1       

0058    C--
0059    	CAM$DABLAMS=CAM$CSU(UNIT_NAME,HSU_NAME,CRATE_NUMBER)
0060    	IF (.NOT.CAM$DABLAMS) THEN
0061    		RETURN
0062    	END IF
0063    C++
0064    C
0065    C	ASSIGN I/O CHANNEL TO CAMAC HIGHWAY UNIT
0066    C
0067    C--
0068    	CAM$DABLAMS=SYS$ASSIGN(HSU_NAME,HSU_CHAN,,)
0069    	IF (.NOT.CAM$DABLAMS) THEN
0070    		RETURN
0071    	END IF
0072    C++
0073    C
0074    C	QIO TO CAMAC ACP TO DISABLE LAM SUPPORT FOR CRATE.
0075    C
0076    C--
0077    	CAM$DABLAMS=SYS$QIOW(%VAL(0),%VAL(HSU_CHAN),
0078    	9	%VAL(%LOC(IO$_SETCHAR)+%LOC(IO$M_DABLAMS)),
0079    	9	IOSB,,,%VAL(CRATE_NUMBER),,,,,)
0080 C  D	TYPE 2999,CAM$DABLAMS,IOSB(1),IOSB(2)
0081 C  D2999	FORMAT(1X,'R0=',Z8,' IOSB=',Z8,2X,Z8)
0082    C++
0083    C
0084    C	RELEASE VMS I/O CHANNEL ASSIGNMENT
0085    C
0086    C--
0087    	CALL SYS$DASSGN(%VAL(HSU_CHAN))
0088    	RETURN
0089    	END

CAM$DABLAMS                    					 6-Jan-1983 11:07:31	VAX-11 FORTRAN V3.1-23              Page  12
								 5-Jan-1983 17:16:56	[CAMAC.SOURCE.KS30202]CAMSUPORT.FOR;1       

PROGRAM SECTIONS

    Name				 Bytes   Attributes

  0 $CODE                                  141   PIC CON REL LCL   SHR   EXE   RD NOWRT LONG
  2 $LOCAL                                 148   PIC CON REL LCL NOSHR NOEXE   RD   WRT LONG

    Total Space Allocated                  289


ENTRY POINTS

    Address  Type  Name          

  0-00000000  I*4  CAM$DABLAMS   


VARIABLES

    Address  Type  Name              Address  Type  Name              Address  Type  Name              Address  Type  Name          

  2-0000000C  I*4  CRATE_NUMBER    2-00000006  I*2  HSU_CHAN        2-00000000  CHAR HSU_NAME       AP-00000004@ CHAR UNIT_NAME     


ARRAYS

    Address  Type  Name                Bytes  Dimensions

 AP-00000008@ I*4  IOSB                   **  (*)


FUNCTIONS AND SUBROUTINES REFERENCED

  Type  Name            Type  Name            Type  Name            Type  Name            Type  Name            Type  Name          

   I*4  CAM$CSU               IO$M_DABLAMS          IO$_SETCHAR      I*4  SYS$ASSIGN            SYS$DASSGN       I*4  SYS$QIOW      

                               					 6-Jan-1983 11:07:31	VAX-11 FORTRAN V3.1-23              Page  13
								 5-Jan-1983 17:16:56	[CAMAC.SOURCE.KS30202]CAMSUPORT.FOR;1       

0001    C+++
0002    C
0003    C	Procedure:
0004    C	CAM$CSU(UNIT_NAME,HSU_NAME,CRATE_NUMBER)
0005    C
0006    C	Description:
0007    C	This procedure parses the CAMAC Crate Support Unit name input
0008    C	in the CHARACTER variable UNIT_NAME, returning the name of the
0009    C	CAMAC Highway Support Unit for the CSU and the crate number
0010    C	from the CSU.
0011    C
0012    C	Parameters:
0013    C	UNIT_NAME- address of a descriptor for a CHARACTER variable containing
0014    C	     a valid CAMAC Crate Support Unit name,
0015    C	HSU_NAME- address of a descriptor for a CHARACTER variable to receive
0016    C	     the Highway Support Unit name for the input CSU,
0017    C	CRATE_NUMBER- address of a longword to receive the CAMAC crate number
0018    C	     taken from the CSU name.
0019    C
0020    C---
0021    	INTEGER FUNCTION CAM$CSU(UNIT_NAME,HSU_NAME,CRATE_NUMBER)
0022    	IMPLICIT INTEGER(A-Z)
0023    	EXTERNAL SS$_NORMAL,SS$_IVDEVNAM
0024    	CHARACTER UNIT_NAME*(*),HSU_NAME*(*)
0025    C++
0026    C	ASSUME SUCCESS
0027    C
0028    C--
0029    	CAM$CSU=%LOC(SS$_NORMAL)
0030    C++
0031    C
0032    C	VERIFY CSU PREFIX
0033    C
0034    C--
0035    	IF (UNIT_NAME(1:2).NE.'SH' .AND.
0036    	9	UNIT_NAME(1:2).NE.'PH') THEN
0037    		CAM$CSU=%LOC(SS$_IVDEVNAM)
0038    		RETURN
0039    	END IF
0040    C++
0041    C
0042    C	EXAMINE UNIT MNEMONIC FOR CRATE NUMBER
0043    C
0044    C--
0045    	COLON_POS=INDEX(UNIT_NAME,':')
0046    	IF (COLON_POS.NE.LEN(UNIT_NAME) .OR. 
0047    	9	COLON_POS.LT.5) THEN
0048    		CAM$CSU=%LOC(SS$_IVDEVNAM)
0049    		RETURN
0050    	END IF
0051    	DECODE(COLON_POS-4,1999,UNIT_NAME(4:)) CRATE_NUMBER
0052    1999	FORMAT(I)
0053    C++
0054    C
0055    C	CONSTRUCT CAMAC HIGHWAY SUPPORT UNIT NAME FROM
0056    C	SPECIFIED UNIT NAME.
0057    C

CAM$CSU                        					 6-Jan-1983 11:07:31	VAX-11 FORTRAN V3.1-23              Page  14
								 5-Jan-1983 17:16:56	[CAMAC.SOURCE.KS30202]CAMSUPORT.FOR;1       

0058    C--
0059    	HSU_NAME(1:1)='_'
0060    	HSU_NAME(2:4)=UNIT_NAME(1:3)
0061    	HSU_NAME(5:6)='0:'
0062    	RETURN
0063    	END




PROGRAM SECTIONS

    Name				 Bytes   Attributes

  0 $CODE                                  185   PIC CON REL LCL   SHR   EXE   RD NOWRT LONG
  1 $PDATA                                  10   PIC CON REL LCL   SHR NOEXE   RD NOWRT LONG
  2 $LOCAL                                  44   PIC CON REL LCL NOSHR NOEXE   RD   WRT LONG

    Total Space Allocated                  239


ENTRY POINTS

    Address  Type  Name          

  0-00000000  I*4  CAM$CSU       


VARIABLES

    Address  Type  Name              Address  Type  Name              Address  Type  Name              Address  Type  Name          

  2-00000004  I*4  COLON_POS      AP-0000000C@ I*4  CRATE_NUMBER   AP-00000008@ CHAR HSU_NAME       AP-00000004@ CHAR UNIT_NAME     


LABELS

    Address   Label   

  1-00000002  1999'   


FUNCTIONS AND SUBROUTINES REFERENCED

  Type  Name            Type  Name            Type  Name          

   I*4  LIB$INDEX             SS$_IVDEVNAM          SS$_NORMAL    

CAM$CSU                        					 6-Jan-1983 11:07:31	VAX-11 FORTRAN V3.1-23              Page  15
								 5-Jan-1983 17:16:56	[CAMAC.SOURCE.KS30202]CAMSUPORT.FOR;1       

COMMAND QUALIFIERS

  FORTRAN /LIS CAMSUPORT

  /CHECK=(NOBOUNDS,OVERFLOW,NOUNDERFLOW)
  /DEBUG=(NOSYMBOLS,TRACEBACK)
  /STANDARD=(NOSYNTAX,NOSOURCE_FORM)
  /SHOW=(NOPREPROCESSOR,NOINCLUDE,MAP)
  /F77  /NOG_FLOATING  /I4  /OPTIMIZE  /WARNINGS  /NOD_LINES  /NOCROSS_REFERENCE  /NOMACHINE_CODE  /CONTINUATIONS=19


COMPILATION STATISTICS

  Run Time:           3.20 seconds
  Elapsed Time:       3.55 seconds
  Page Faults:        714
  Dynamic Memory:     117 pages
