[SLAC Controls Software Group [SLAC Controls Department] [SLAC Home Page]

Go to bottom of page



2.1 "NESTING" OF INTERNAL ROUTINES . . . . . . . . . . 2-3

2.1.1 CAMIO (Vax) . . . . . . . . . . . . . . . . . . 2-3

2.1.2 CAMIO (Micro) . . . . . . . . . . . . . . . . . 2-3

2.1.3 CAMALO (Vax & Micro) . . . . . . . . . . . . . . 2-4

2.1.4 CAMADD (Vax & Micro) . . . . . . . . . . . . . . 2-4

2.1.5 CAMGO (Vax) . . . . . . . . . . . . . . . . . . 2-4

2.1.6 CAMGO (Micro) . . . . . . . . . . . . . . . . . 2-4

2.1.7 CAMDEL (Vax & Micro) . . . . . . . . . . . . . . 2-4

2.1.8 CAMFAG (Vax) . . . . . . . . . . . . . . . . . . 2-5

2.1.9 CAMFAG (Micro) . . . . . . . . . . . . . . . . . 2-5

2.1.10 CAMMOD (Vax & Micro) . . . . . . . . . . . . . . 2-5

2.1.11 CAMALO_RESET (Vax & Micro) . . . . . . . . . . . 2-5

2.1.12 CAMEXIT (Vax Only) . . . . . . . . . . . . . . . 2-5

2.2 CAMAC DATA STRUCTURES . . . . . . . . . . . . . . 2-6

2.2.1 Camac Package Structure . . . . . . . . . . . . 2-6

2.2.1.1 Control Block Structure . . . . . . . . . . . 2-7

2.2.1.2 MBCD Packet Structure . . . . . . . . . . . . 2-8

2.2.1.3 EMASK Storage . . . . . . . . . . . . . . . . 2-8

2.2.2 VAX-VMS To MICRO Message Structure . . . . . . . 2-9

2.2.3 MICRO To VAX-VMS Message Structure . . . . . . 2-10

2.3 ROUTINES . . . . . . . . . . . . . . . . . . . . 2-11

2.3.1 CAMIO . . . . . . . . . . . . . . . . . . . . 2-11

2.3.2 CAMIO_V . . . . . . . . . . . . . . . . . . . 2-12

2.3.3 CAMALO . . . . . . . . . . . . . . . . . . . . 2-12

2.3.4 CAMAL1 . . . . . . . . . . . . . . . . . . . . 2-12

2.3.5 CAMADD . . . . . . . . . . . . . . . . . . . . 2-13

2.3.6 CAMAD1 . . . . . . . . . . . . . . . . . . . . 2-13

2.3.7 CAMGO (Micro) . . . . . . . . . . . . . . . . 2-14

2.3.8 CAMGO (Vax) . . . . . . . . . . . . . . . . . 2-14

2.3.9 CAMGO_R (Vax) . . . . . . . . . . . . . . . . 2-15

2.3.10 CAMGO_V . . . . . . . . . . . . . . . . . . . 2-15

2.3.11 CAMMOD . . . . . . . . . . . . . . . . . . . . 2-16

2.3.12 CAMALO_RESET . . . . . . . . . . . . . . . . . 2-16

2.3.13 CAMEXIT . . . . . . . . . . . . . . . . . . . 2-16

2.3.14 CAMVMAIN . . . . . . . . . . . . . . . . . . . 2-17

2.3.15 CAMAC_DRVR (Micro) . . . . . . . . . . . . . . 2-17 CHAPTER 2 8086 CAMAC INTERNALS Camac operations on the SLC Micro (8086 Microcomputer) are usually preformed by calling some or all of the following routines: o CAMIO -- for single packet CAMAC transfers with all the dirty work done for the user already. o CAMALO -- Allocates a control block for a CAMAC "package". o CAMADD -- Adds a "packet" to the allocated CAMAC "package". o CAMGO -- Executes a prepared CAMAC "package". o CAMGO_R-- Executes a prepared CAMAC "package", and sends the SLC micro a message to continue executing the package "forever". o CAMDEL -- Deletes the control block of an allocated package. o CAMFAG -- Modifies the F-code and sub-address of a single "packet" camac "package" and executes the packet (via CAMGO). o CAMMOD -- Modifies the CTLW's of an existing (ie: address) of an existing package, and executes the package (via CAMGO). o CAMALO_RESET -- Re-initializes an allocated "package". o CAMEXIT -- Sends a message to the indicated micro to stop executing this users repeat function. The above routines are described for the user in depth in the "SLC Basic Users Guide" (BUG). The casual user of SLC CAMAC is referred to the BUG for information concerning the use of the above routines.


8086 CAMAC INTERNALS Page 2-2 This chapter decsribes the internal structures of the command and data formatting used by the above routines, as well as a host of internal routines used by the above. Note that only the above listed routines are available as entry points into the shared VMS run-time library.
8086 CAMAC INTERNALS Page 2-3

2.1 "NESTING" OF INTERNAL ROUTINES The "nesting" of the various CAMAC routines is shown schematically below. Note that the returned status may come from any of the nested routines, or from an ERRCHK following a system service.

2.1.1 CAMIO (Vax) CAMIO_V CAMALO | LIB$GET_VM | (First time only) CAMAL1 | LIB$GET_VM (If BCNT > 270) CAMAL1 CAMADD CAMAD1 CAMGO_V LIB$GET_VM (if needed for RE_PACK) MSG_ONE CAMVMAIN (Micro) CAMAC_DRVR (Micro) CAMALO (Micro) RQ$CREATE$SEGMENT CAMAL1 (Micro) CAMGO (Micro) RQ$CREATE$SEGMENT (For P8 or RE_PACK) RQ$DELETE$SEGMENT (For P8 or RE_PACK) CAMDEL (Micro) RQ$DELETE$SEGMENT MMSG_SEND (Micro) LIB$FREE_VM (if needed for RE_PACK) LIB$FREE_VM (If BCNT > 270)

2.1.2 CAMIO (Micro) CAMALO | RQ$CREATE$SEGMENT | (First time only) CAMAL1 | RQ$CREATE$SEGMENT (If BCNT > 20) CAMALO_RESET CAMADD CAMAD1 CAMGO RQ$CREATE$SEGMENT (For P8 or RE_PACK) RQ$DELETE$SEGMENT (For P8 or RE_PACK)


8086 CAMAC INTERNALS Page 2-4 RQ$DELETE$SEGMENT (If BCNT > 20)

2.1.3 CAMALO (Vax & Micro) LIB$GET_VM (Vax only) RQ$CREATE$SEGMENT (Micro only) CAMAL1

2.1.4 CAMADD (Vax & Micro) CAMAD1

2.1.5 CAMGO (Vax) CAMGO_1 CAMGO_V LIB$GET_VM (if needed for RE_PACK) MSG_ONE CAMVMAIN (Micro) CAMAC_DRVR (Micro) CAMALO (Micro) RQ$CREATE$SEGMENT CAMAL1 (Micro) CAMGO (Micro) RQ$CREATE$SEGMENT (For P8 or RE_PACK) RQ$DELETE$SEGMENT (For P8 or RE_PACK) CAMDEL (Micro) RQ$DELETE$SEGMENT MMSG_SEND (Micro) LIB$FREE_VM (if needed for RE_PACK)

2.1.6 CAMGO (Micro) RQ$CREATE$SEGMENT (For P8 or RE_PACK) RQ$DELETE$SEGMENT (For P8 or RE_PACK)

2.1.7 CAMDEL (Vax & Micro) LIB$FREE_VM (Vax only)


8086 CAMAC INTERNALS Page 2-5 RQ$DELETE$SEGMENT (Micro only)

2.1.8 CAMFAG (Vax) CAMFA1 CAMGO_V (See CAMGO (Vax) for the rest of the nesting sequence)

2.1.9 CAMFAG (Micro) CAMFA1 CAMGO (See CAMGO (Micro) for the rest of the nesting sequence)

2.1.10 CAMMOD (Vax & Micro) CAMMOD1 CAMGO (See CAMGO for the rest of the nesting sequence)

2.1.11 CAMALO_RESET (Vax & Micro) (Does not call any routine)

2.1.12 CAMEXIT (Vax Only) CAMEXIT MSG_ONE CAMVMAIN (Micro)


8086 CAMAC INTERNALS Page 2-6

2.2 CAMAC DATA STRUCTURES The following is a description of the data structure used by the Camac routines, and by the MultiBus Camac Driver (MBCD). Also shown is the Vax->Micro and Micro->Vax message structures. Note that although the Vax routines do not directly do any Camac -- the structure of the Camac Package Structure it the same as in the micro.

2.2.1 Camac Package Structure The Camac Package is comprised of 1 control block, NOPS MBCD Packets, and NOPS EMASKs. These are contigious in memory, and (in the micro) start on a segment boundry. Word # Item +-------+----------+ <--- CAMAC Token Points Here | 0 | Control | | | Block | +-------+----------+ +-------+----------+ Repeat| 1 | MBCD | | | Packet | NOPS +-------+----------+ | | MBCD | Times | | Packet | +-------+----------+ +-------+----------+ Repeat| | EMASK | | | Storage | NOPS +-------+----------+ | | EMASK | Times | | Storage | +-------+----------+


8086 CAMAC INTERNALS Page 2-7

2.2.1.1 Control Block Structure - Word # Item +-------+----------+ | 0 | KEY | (the literal 'FR') +-------+----------+ | 1 | NOPS | Max. number of camac packets to follow +-------+----------+ | 2 | IOP | Actual number of camac packets +-------+----------+ | 3 | TBYTES | Maximum data byte count for this package +-------+----------+ ( approximate ) | 4 | Spare | Spare word +-------+----------+ | 5 |Bit Summary Bit Summary ( as P8 or RE_PACK ) +-------+----------+ | 6 | Spare 1 | Spare word 1 +-------+----------+ | 7 | Spare 2 | Spare word 2 +-------+----------+ The last two words are available for use by applications code. The current users are: o VAX-VMS Camac Support 1. Micro-Name (A*4) o TIME Job If words 6 and 7 are non-zero, they will be interpreted by the TIME job as a mbx token and and a msg token, respectivaly. The TIME job will put the supplied message token in the supplied mbx when the package has completed execution. 1. Segment Token for Mailbox 2. Segment Token for Message


8086 CAMAC INTERNALS Page 2-8

2.2.1.2 MBCD Packet Structure - Word # Item +-------+----------+ | 0 | | Low-order camac control word +-------+ CTLW | | 1 | | High-order camac control word +-------+----------+ | 2 | | Stat/dat buffer address offset +-------+ Data Ptr | | 3 | | Stat/dat buffer address segment +-------+----------+ | 4 | WC_MAX | Maximum word count +-------+----------+ | 5 | CIC | Completion interrupt code +-------+----------+

2.2.1.3 EMASK Storage - Word # Item +-------+----------+ | 0 | EMASK | EMASK for the IOP'th Packet +-------+----------+


8086 CAMAC INTERNALS Page 2-9

2.2.2 VAX-VMS To MICRO Message Structure Word # Item +-------+----------+ | 0 | Control | | | Block | +-------+----------+ +-------+----------+ Repeat| 1 | MBCD | | | Packet | NOPS +-------+----------+ | | MBCD | Times | | Packet | +-------+----------+ +-------+----------+ Repeat| | EMASK | | | Storage | NOPS +-------+----------+ | | EMASK | Times | | Storage | +-------+----------+ +-------+----------+ Once | | | Low-order MBCD Status For +-------+ STATUS | Every | | | Hi-order MBCD Status MBCD +-------+----------+ Write | | DATA | First data word +-------+... ... | | | | Last data word +-------+----------+ +-------+----------+ Once | | | Low-order MBCD Status For +-------+ STATUS | Every | | | Hi-order MBCD Status MBCD +-------+----------+ Write | | DATA | First data word +-------+... ... | | | | Last data word +-------+----------+


8086 CAMAC INTERNALS Page 2-10

2.2.3 MICRO To VAX-VMS Message Structure Word # Item +-------+----------+ | 0 | CAMGO | Low-order VMS Message +-------+ Return | | 1 | Status | Hi-order VMS Message +-------+----------+ +-------+----------+ | 2 | MBCD | Low-order MBCD Status +-------+ STATUS | | 3 | | Hi-order MBCD Status +-------+----------+ | | DATA | First data word (read only) +-------+... ... | | | (If read)| Last data word '' '' +-------+----------+ +-------+----------+ | | MBCD | Low-order MBCD Status +-------+ STATUS | | | | Hi-order MBCD Status +-------+----------+


8086 CAMAC INTERNALS Page 2-11

2.3 ROUTINES

2.3.1 CAMIO CAMIO performs a single-packet CAMAC operation: ISS = CAMIO(BRCH,CTLW[,DATA[,BCNT [,STATUS[,EMASK]]]]) Integer*4 CAMIO returned status Integer*4 BRCH micro name, required but not used in micro Integer*4 CTLW control word (Array) DATA unspecified data array (Optional on VAX non-data) Integer*2 BCNT byte count (Optional on VAX non-data) Integer*4 STATUS returned MBCD status (Optional on VAX) Integer*2 EMASK error mask (Optional on VAX) This is the general purpose "camac" routine. Routines in both the Vax and the Micro do essentially the same functions. Specifically: o Allocates a CAMAC package with a CAMALO first time called. o Gets some memory if it's default array is too small. (VAX version's default array size is 270 bytes, while MICRO's is 20 bytes.) o Copies DATA into stat_data, if camac write. o Initializes CAMAC package: CAMAL1 (Vax) with a new BRCH destination, or, CAMALO_RESET (Micro). o Prepares MBCD packet with CAMADD to load CTLW, STAT_DATA pointer, etc. o Executes the packet with a CAMGO (Vax code, with a CAMGO_V). o Copies STATUS from stat_data. o Copies DATA from stat_data, if camac read. o Deallocates memory. Vax version calls CAMIO_V after determining that CAMAC is SLC type, with all 6 arguments to do the above dirty work.


8086 CAMAC INTERNALS Page 2-12

2.3.2 CAMIO_V CAMIO_V receives ALL arguments form CAMIO. (Vax only). ISS = CAMIO(BRCH,CTLW[,DATA[,BCNT [,STATUS[,EMASK]]]]) Integer*4 CAMIO returned status Integer*4 BRCH micro name, required but not used in micro Integer*4 CTLW control word (Array) DATA unspecified data array (Optional on VAX non-data) Integer*2 BCNT byte count (Optional on VAX non-data) Integer*4 STATUS returned MBCD status (Optional on VAX) Integer*2 EMASK error mask (Optional on VAX) See product description under CAMIO.

2.3.3 CAMALO Allocates and initializes a block for NOPS camac packets. ISS = CAMALO(BRCH,NOPS,PTR) Integer*4 CAMALO returned status Integer*4 BRCH micro name, required but not used in micro Integer*2 NOPS maximum number of operations allowed Addr.Token PTR pointer to control block The size required for a CAMAC package is 1 control block plus NOPS each MBCD Packets and EMASK's. Or in numbers: 8 + NOPS*(6 + 1) words. CAMALO calls on CAMAL1 to initialize the package, calling with the PTR by value: ISS = CAMAL1(PTR, ... )

2.3.4 CAMAL1 Initializes the Control Block with the Key ('FR'), BRCH (Vax only),


8086 CAMAC INTERNALS Page 2-13 NOPS, and zeros the rest of the package. ISS = CAMAL1(CTLBLK,WC,NOPS,BRCH) Integer*4 CAMALO returned status Integer*4 CTLBLK control block, by referance Integer*2 WC size of camac package block (words) Integer*2 NOPS maximum number of operations allowed Integer*4 BRCH micro name, required but not used in micro

2.3.5 CAMADD Dummy routine to call CAMAD1 to add a single packet to a Camac package. ISS = CAMADD(CTLW,STAT_DATA,BCNT ,EMASK,PTR) Integer*4 CAMADD returned status Integer*4 CTLW control word (Array) STAT_DATA unspecified data array Integer*2 BCNT byte count Integer*2 EMASK error mask Addr.Token PTR pointer to control block CAMADD calls on CAMAD1 to initialize the package, calling with the PTR by value: ISS = CAMAD1( .... ,PTR)

2.3.6 CAMAD1 Routine to add a single packet to the Camac package. ISS = CAMAD1(CTLW,STAT_DATA,BCNT ,EMASK,CTLBLK) Integer*4 CAMAD1 returned status Integer*4 CTLW control word (Array) STAT_DATA unspecified data array Integer*2 BCNT byte count Integer*2 EMASK error mask Integer*4 CTLBLK control block, by referance This routine adds a packet to the Camac package (Whose address was


8086 CAMAC INTERNALS Page 2-14 passed as the last argument). Routines in the Vax and the Micro do essencially the same functions. Specifically: o Check the Control Block KEY to verify that it is 'FR'. o Increment the packet count IOP, and verify that is does not exceed the limit of NOPS. o Check that RE_PACK option is only requested on a single packet. o Calculate the MBCD Packet WC_MAX, with proper accounting for the pack 8 (P8) option. o Check against ODD byte counts, and excessivly long transfers. o Load the MBCD Packet with: 1. CTLW 2. STAT_DATA Pointer 3. WC Maximum 4. CIC (Completion interrupt code, not used) o Clears the CIC and sets MPC (more packets coming) of the previous MBCD Packet.

2.3.7 CAMGO (Micro) Executes an already prepared Camac package, and checks the results for errors against the EMASK error mask. ISS = CAMGO(PTR) Integer*4 CAMGO returned status Addr.Token PTR pointer to control block See comments in code for concise documentation of this routine.

2.3.8 CAMGO (Vax) CAMGO calls CAMGO_1(%val(PTR),...) which calls CAMGO_V(CTLBLK) after


8086 CAMAC INTERNALS Page 2-15 determining that CAMAC is SLC type. ISS = CAMGO(PTR) Integer*4 CAMGO returned status Addr.Token PTR pointer to control block

2.3.9 CAMGO_R (Vax) CAMGO_R calls CAMGO_V(%val(PTR), .true.) after determining that CAMAC is SLC type. ISS = CAMGO(PTR) Integer*4 CAMGO returned status Addr.Token PTR pointer to control block

2.3.10 CAMGO_V Builds outgoing Vax-to-Micro Message requesting the micro to execute a Camac package. ISS = CAMGO_V(CTLBLK, REPEAT_FLAG) Integer*4 CAMGO_V returned status Integer*4 CTLBLK control block, by referance Integer*4 REPEAT_FLAG signals that package repeats (Optional) Refer to section on CAMAC DATA STRUCTURES while reading the following. o CAMGO_V sends to the micro a message containing the entire camac package, and all write data associated with the Camac operation. o The data is sent to the micro via MSG_ONE, and a response is expected within a 2 second timeout. o The returned message consists of the returned status (VMS), and all STAT_ for non-read or STAT_DATA for read commands. o CAMGO_V copies the STAT_ or STAT_DATA into the previously declared locations (via camadd calls) and returns with the VMS status from the micro.


8086 CAMAC INTERNALS Page 2-16 If the REPEAT_FLAG is asserted, the micro keeps the generated CAMAC blocks and repeats the transaction until either it 1) reaches it's repeat count, or 2) receives any other CAMAC message from the same VAX process.

2.3.11 CAMMOD An intresting little routine with a pleasent color. Modifies the CTLW's of a existing package, and executes it (via CAMGO). ISS = CAMCAM(CTLW,MASK,PTR) Integer*4 CAMCAM returned status Integer*4 CTLW control word Integer*4 MASK mask of CTLW bits to modify Addr.Token PTR pointer to control block

2.3.12 CAMALO_RESET Resets the package to the virgin state, allowing a new set of camac packets to be added. ISS = CAMALO_RESET()

2.3.13 CAMEXIT Sends a request to the Micro to stop this process's CAMAC activity started with a CAMGO_R request. ISS = CAMEXIT(BRCH) Integer*4 BRCH micro name Note: Process ID is determined from the user's SLCNET interrupt ID number, and may not be the same after a process exits and runs again.


8086 CAMAC INTERNALS Page 2-17

2.3.14 CAMVMAIN The main job in the micro, receives the message from CAMGO_V and then: o Allocates memory for the return response message. o Calls CAMAC_DRVR ISS = CAMAC_DRVR(INMSG,OUTMSG). o Sends back response message. o Deallocates memory.

2.3.15 CAMAC_DRVR (Micro) Executes CAMGO_V Package from Vax. ISS = CAMAC_DRVR(INMSG, OUTMSG) (Array) INMSG incoming message (Array) OUTMSG outgoing message Routine's function is primarly as an interface between the Vax and the internal CAMGO. Routines functions are: o Allocate a Camac Package. (via Camalo). o Copy VAX's package into our own (thereby forcing paragraph allignment). o Adjust all the MBCD Packet's STAT_DATA Pointers to point to either: 1. Stat_data locations in INMSG (for camac writes). 2. Stat_data locations in OUTMSG buffer. Note that holes were left for write stat_ data in OUTMSG. o Execute CAMGO on our package. o Copy returned Camgo status into OUTMSG. o Copy all write Stat_'s into previously left holes in OUTMSG. o Deallocate our Camac Package. (via camdel).


 
Go to top of page
Contact (until Aug. 15, 1996): Jeffrey Miller
Owner: Bob Sass

Converted from VAX Runoff output using doc2webset.pl