!Template file for CAMAC 192 cards !Prepared by Glenn C. Johnson ! ! 192 MULTIWIRE CONTROLLER ! ! There are two types of database devices for 192: those which retrive ! single calculated values for the parameter page (d75) and those which ! support specialized multiwire programs (d76). These two types of devices ! are supported by different type of front end device drivers. ! !----------------------------------------------------------------------- ! ! * Multiwire Single-Value Calculation * ! ! Each of these devices has baked into its SSDN: ! ! Crate & Slot (for a particular 192 card) ! Channel (0-3) ! Calculation Buffer Offset (which calculated value) ! Orientation (horizontal or vertical) ! ! The essential problem with these devices is to return the calculated ! data for each scan exactly once, except that we 'stick' on the last ! scan after the last booster batch has gone by. The 192 card collects ! data on clock events, but it calculates at its own speed. We have to ! examine its 'calculation bits', which identify for which scans it ! has calculated data available. ! ! Another arabesque is the 'orientation' bit. Each channel can be ! either completely out of the beam, in the beam horizontally, or in ! the beam vertically. There are 2 sets of devices per channel, one ! for each orientation. The general scheme is to return data only if ! wires are in the beam with the proper orientation. ! ! The 192 has two function codes for this service: one returns ! data only if the channel is in the beam horizontally, the other is ! for vertical data. Unfortunately the only way it signals an error ! is to return no-Q. This is indistinguishable from a dead 192 card, ! so when this happens we interrogate the positions and return a ! more meaningful error code if the card is, in fact, alive. ! ! The SSDN for this device looks like this: ! +------------------------------------------+ ! | Dev. type=4B (hex) | FF (hex) | ! |------------------------------------------| ! | 'N' slot | 'C' - crate number | ! |------------------------------------------| ! | 00 | subaddress | ! |------------------------------------------| ! | 00 | 00 | ! +------------------------------------------+ ! ! Subaddress consists of several bit fields: ! ! xx 0 000 00 ! | | | ! | | +- channel (0 - 3) ! | +----- offset in calculation buffer requested: ! | Word 0: Mean * 10 ! | Word 1: Sigma * 10 ! | Word 2: Area (low) ! | Word 3: Area (high) ! | Word 4: Maximum ADC value ! | Word 5: Chi squared per degree ! | of freedom * 10 ! | Word 6: Zero adjustment ! | Word 7: Out/Horizontal/Vertical ! +-------- orientation (0 = horiz., 1 = vert.) ! !Database Entry Template: ! ADD X:XXXXXX ( " " , node, , 7FFFFFE ) ! \/ \/ \/ \/ \/ ! device name 24 character description node sibling cons. mask SSDNHX READNG (4BFF/nncc/00ss/0000) ! \/\/ \/\/ \/ ! | | | | subaddress (channel, offset, orientation) ! | | | crate number ! | | slot number ! | camac front end standard driver ! driver code PRO READNG ( 2 , 2 , ftd) ! \/ \/ \/ ! | | FTD ! | Max data size ! default data size PDB READNG ( "pu" , "cu" , pt , ct , 2 , dsn , 0 , 0 , ct1 , ! \/ \/ \/ \/ \/ \/ \/ \/ \/ ! | | | | | | | | common transform 1 ! | | | | | | | motor controller flag ! | | | | | | long or short display ! | | | | | decimal or scientific notation ! | | | | input data length ! | | | common transform ! | | primary transform ! | common units ! primary units ct2 , ct3 ) ! \/ \/ ! | common transform 3 ! common transform 2 PRO SAVE ( listnum , hcode , dcode , prop1 , prop2 , ...) ! \/ \/ \/ \/ ! | | | properties to be saved ! | | display handler code ! | handler code ! save list number (0-255) !----------------------------------------------------------------------- ! ! * Specialized Multiwire Support * ! ! 192 BUFFERS AND PARAMETERS. ! ! This device has 4 subtypes: ! ! 1 READING Retrieves Profile Average Buffer, using ! special offset (see below) ! SETTING Sets or retrieves the 192 operating parameter ! buffer (11 16-bit words) ! STATUS Retrieves paddle orientations ! CONTROL Control paddle orientations. The low order ! 4 bits of the data are used: ! 00 00 ! | | ! | +- channel (0 - 3) ! +---- Position (0 = out, 1 = ! horz. in, 3 = vert. in) ! ! 2 READING Retrieves previous cycle Raw Data Buffer, ! using special offset (see below) ! ! 3 SETTING Sets or retrieves 'TRIGGER' clock events and ! 'CLEAR' clock events. The 'CLEAR' clock ! events are specified in the low byte of each ! word, and the 'TRIGGER' clock events are in ! the high byte. ! CONTROL reset 192 card and set up 15Hz clears ! ! 4 SETTING Sets or retrieves 'PREPULSE' clock events ! ! The SSDN for this device looks like this: ! +------------------------------------------+ ! | Dev. type=4C (hex) | FF (hex) | ! |------------------------------------------| ! | 'N' slot | 'C' - crate number | ! |------------------------------------------| ! | 00 | subcode | ! |------------------------------------------| ! | 00 | 00 | ! +------------------------------------------+ ! ! The "Special Offset" used with the READING properties is ! constructed in binary as follows: ! ! SSS/SCC0 ! S = Scan number (0-15) ! C = Channel number (0-3) ! Note that the Average Profile Buffer does not need a scan ! number, so only the channel number is specified. The zero ! in the LS bit is due to Mike Glass' superstition. ! ! The Average Profile Buffer has the following structure: ! ! Word 0: Descriptor word 1 ! Bits 0-6: Number of wires ! Bits 7-8: Channel number ! Bits 13-15: Buffer type ! 1: Profile Average Buffer ! Word 1: Status word ! Bits 0-3: Cycle number ! Bits 9-11: Horizontal/Vertical/Out ! Bits 12-14: Prepulse selection number ! Bit 15: Set if Average Calculation not finished ! Word 2: Average Scan Mask ! Bits 0-15: Bit set if corresponding scan is ! included in the average ! Word 3: Mean * 10 ! Word 4: Sigma * 10 ! Word 5: Area (low) ! Word 6: Area (high) ! Word 7: Maximum ADC value (with zero adjustment added) ! Word 8: Chi squared per degree of freedom * 10 ! Word 9: Zero adjustment (see below) ! Words 10-73: One word per wire: ! Bit 0: Set if calculation has determined ! this wire to be missing ! Bit 1: Set if calculation has determined ! this wire to be noisy ! Bits 4-15: ADC value (may be negative) ! ! The Raw Data Buffer has the following structure, which is ! repeated for each scan: ! ! Word 0: Descriptor word ! Bits 0-6: Number of wires ! Bits 7-8: Channel number ! Bits 9-12: Scan number ! Bits 13-15: Buffer type ! 0: Raw Data Buffer ! Word 1: Status word ! Bits 0-3: Cycle number ! Bits 9-11: Horizontal/Vertical/Out ! Bits 12-14: Prepulse selection number ! Bit 15: Data and calculation are uncorrelated. ! This bit is set initially, and then reset ! after calculations are done and verified. ! Word 2: Mean * 10 ! Word 3: Sigma * 10 ! Word 4: Area (low) ! Word 5: Area (high) ! Word 6: Maximum ADC value (with zero adjustment added) ! Word 7: Chi squared per degree of freedom * 10 ! Word 8: Zero adjustment -- amount added to each ADC ! value during calculation so that all values ! are greater than or equal to zero. ! Note: all calculated values reflect this ! addition, but the data in the buffer does not. ! Words 9-72: One word per wire: ! Bit 0: Set if calculation has determined ! this wire to be missing ! Bit 1: Set if calculation has determined ! this wire to be noisy ! Bits 4-15: ADC value (may be negative) ! ! The 11-Word Operating Parameter Buffer has the following structure: ! ! Word 0: Various Items (CAMAC F19 A9) ! Bits 0-3: Number of scans minus 1 ! Bits 4-5: Number of channels minus 1 ! Bits 6-8: LAM Select (read-only) ! 0: No LAMS ! 1: LAM on Data Collection Buffer bits ! (LAM Mask Register && Data Collection ! Buffer Bits) ! 2: LAM on Data Collection Buffer ! Calculation Bits ( LAM Mask Register ! && Data Collection Buffer ! Calculation Bits) ! 3: LAM on Buffer Switch ! Bits 9-11: Prepulse Scan Selection ! 0: No prepulse ! 1: Take prepulse and subtract from data ! 2: Take prepulse but only subtract from ! data when doing calculations (raw ! data remains the same) ! 3: Take prepulse but do no subtraction ! Bits 12-13: Buffer Switch Select (read-only) ! 0: Switch on Clear or calculations ! done with all scans ! 1: Switch on Clear only ! 2: Do not switch -- Previous Cycle ! Buffer disabled -- Average Sum ! Buffer is still switched with the ! Average Read Buffer on a Clear ! Bits 14-15: Data Acquisition Buffer No-Q Selection (read-only) ! 0: No-Q if no data for a particular scan ! 1: No-Q if calculations are not done for ! a particular scan ! 2: No-Q only if reach the end of Scan 15 ! Word 1: Trigger Delay (CAMAC F19 A11) ! Word 2: Data Sample Period (CAMAC F19 A12) ! Word 3: Various Items (CAMAC F19 A13) ! Bits 0-6: Limit on number of iterations ! Bit 7: Limit flag ! 0: After reaching limit, calculated values ! are to reflect the last iteration ! 1: After reaching limit, all calculated ! values are to be cleared to zero ! Bits 8-15: Multiplexor address of wire 1 ! Word 4: Beginning and Ending Scan Numbers (CAMAC F19 A14) ! Bits 0-3: Beginning scan number (0 is first) ! Bits 8-11: Ending scan number (15 is last) ! Bit 15: Set to turn on averaging ! Word 5: Sources (CAMAC F19 A15) ! Bits 0-2: Clear Source (enable triggers, clear data, ! reset scan number to zero) ! 0: No operation ! 1: Manual clear immediately -- Trigger and ! Prepulse Source must be zero ! 2: Clear on clock decoder source ! 3: Clear on external source ! 4: Clear on clock decoder source but take ! only one cycle ! 5: Clear on external source but take only ! one cycle ! 6: Go to Manual ! 7: Cancel data acquisition ! Bits 8-10: Trigger Source (take data) ! [NOTE: values 3-6 take effect on next ! Clear Trigger] ! 0: No operation ! 1: Manual Trigger immediately taking scans ! on internal timer -- Clear and Prepulse ! Source must be zero ! 2: Manual Trigger immediately, but only one ! scan -- Clear and Prepulse Source must ! be zero ! 3: Trigger sample collection on clock ! taking scans on internal timer ! 4: Trigger sample collection on clock, but ! only one scan at a time ! 5: Trigger sample collection on external ! source taking scans on internal timer ! 6: Trigger sample collection on external ! source, but only one scan at a time ! 7: Go to Manual ! Bits 12-14: Prepulse Source ! 0: No operation ! 1: Trigger prepulse on Tev clock ! 2: Trigger prepulse on external source ! 3: Go to Manual ! 4: Manual prepulse trigger -- Clear and ! Trigger Source must be zero ! Word 6: Firmware Version (CAMAC F6 A1) -- Read-only ! Word 7: Number of wires for channel 0 (CAMAC F19 A10) ! Word 8: Number of wires for channel 1 (CAMAC F19 A10) ! Word 9: Number of wires for channel 2 (CAMAC F19 A10) ! Word 10: Number of wires for channel 3 (CAMAC F19 A10) ! ! The Clear/Trigger Clock Events Buffer has the following structure: ! ! Word 0: Count of clock events ! Bits 0-7: Number of Clear clock events ! Bits 8-15: Number of Trigger clock events ! Word 1: First event ! Bits 0-7: First Clear event number ! Bits 8-15: First Trigger event number ! Word 2: Second event ! Bits 0-7: Second Clear event number ! Bits 8-15: Second Trigger event number ! Word N: N-th event ! Bits 0-7: N-th Clear event number ! Bits 8-15: N-th Trigger event number ! ! The Extended Clock Events Buffer has the following structure: ! ! Word 0: Count of clock events ! Word 1: First Prepulse event number ! Word 2: Second Prepulse event number ! Word N: N-th Prepulse event number ! !Database Entry Template: ! ADD X:XXXXXX ( "192 Average Profile " , node, , 7FFFFFE ) ! \/ \/ \/ \/ \/ ! device name 24 character description node sibling cons. mask SSDNHX BCNTRL (4CFF/nncc/0001/0000) ! \/\/ \/\/ \/ ! | | | | Subcode ! | | | crate number ! | | slot number OF COMPANION 184 MODULE! ! | camac front end standard driver ! driver code PRO BCNTRL ( 2 , 2 , 120) ! \/ \/ \/ ! | | FTD ! | Max data size (paddle orientation control word) ! default data size SSDNHX BASTAT (4CFF/nncc/0001/0000) ! \/\/ \/\/ \/ ! | | | | Subcode ! | | | crate number ! | | slot number of 192 card ! | camac front end standard driver ! driver code PRO BASTAT ( 2 , 2 , 60) ! \/ \/ \/ ! | | FTD ! | Max data size (space for paddle orientations) ! default data size SSDNHX READNG (4CFF/nncc/0001/0000) ! \/\/ \/\/ \/ ! | | | | Subcode ! | | | crate number ! | | slot number of 192 card ! | camac front end standard driver ! driver code PRO READNG ( 2 , 160 , 120) ! \/ \/ \/ ! | | FTD ! | Max data size (space for Profile Average Buffer, ! | plus padding to compensate for "Special Offset" ! default data size SSDNHX SETTNG (4CFF/nncc/0001/0000) ! \/\/ \/\/ \/ ! | | | | Subcode ! | | | crate number ! | | slot number of 192 card ! | camac front end standard driver ! driver code PRO SETTNG ( 2 , 22 , 120) ! \/ \/ \/ ! | | FTD ! | Max data size (space for Operating Parameter Buffer) ! default data size PRO SAVE ( 4, 0000, 0600, READNG, SETTNG, BASTAT) PRO SAVE ( listnum , 0000 , 0600 , READNG , SETTNG , BASTAT) ! \/ \/ \/ \/ ! | | | properties to be saved ! | | display handler code ! | handler code ! save list number (0-255) ! ADD X:XXXXXX ( "192 Raw Profile " , node, , 7FFFFFE ) ! \/ \/ \/ \/ \/ ! device name 24 character description node sibling cons. mask SSDNHX READNG (4CFF/nncc/0002/0000) ! \/\/ \/\/ \/ ! | | | | Subcode ! | | | crate number ! | | slot number of 192 card ! | camac front end standard driver ! driver code PRO READNG ( 2 , 2400, 120) ! \/ \/ \/ ! | | FTD ! | Max data size ! | Max data size (space for 16 Raw Data Buffers, ! | plus padding to compensate for "Special Offset" ! default data size PRO SAVE ( listnum , 0000 , 0600 , READNG ) ! \/ \/ \/ \/ ! | | | properties to be saved ! | | display handler code ! | handler code ! save list number (0-255) ! ADD X:XXXXXX ( "192 Clock Events " , node, , 7FFFFFE ) ! \/ \/ \/ \/ \/ ! device name 24 character description node sibling cons. mask SSDNHX BCNTRL (4CFF/nncc/0003/0000) ! \/\/ \/\/ \/ ! | | | | Subcode ! | | | crate number ! | | slot number of 192 card ! | camac front end standard driver ! driver code PRO BCNTRL ( 2 , 2 , 120) ! \/ \/ \/ ! | | FTD ! | Max data size (reset 192 card -- contents of data ! | word are ignored) ! default data size SSDNHX SETTNG (4CFF/nncc/0003/0000) ! \/\/ \/\/ \/ ! | | | | Subcode ! | | | crate number ! | | slot number of 192 card ! | camac front end standard driver ! driver code PRO SETTNG ( 2 , 200 , 120) ! \/ \/ \/ ! | | FTD ! | Max data size (space for 99 Clear and Trigger events) ! default data size ! ADD X:XXXXXX ( "192 Extended Events " , node, , 7FFFFFE ) ! \/ \/ \/ \/ \/ ! device name 24 character description node sibling cons. mask SSDNHX SETTNG (4CFF/nncc/0004/0000) ! \/\/ \/\/ \/ ! | | | | Subcode ! | | | crate number ! | | slot number of 192 card ! | camac front end standard driver ! driver code PRO SETTNG ( 2 , 200 , 120) ! \/ \/ \/ ! | | FTD ! | Max data size (space for 99 Prepulse event numbers) ! default data size !