Products 35 & 36: Cis events  
 DESC:	CIS Products: monitor rates P35 and selected events P36.  
 HIST: 	96-02-05  DWC  	Created file (based on P-MASS.ASM)
       	96-02-07  DWC/CAI  Debug P35. v2.05
       	96-02-08  DWC/CAI  Fix seq count mask (now C3FF was C0FF). v2.05
       	96-03-26  DWC  	Add P36. v2.06
       	96-04-01  CAI  	Debug P36. v2.06
       	96-04-11  CAI  	Redefine P35 product as one 256-word pkt;
                      	add sweep number as first (257th) word; fix
                      	pointer errors; add sweep_collect update for 
                      	P36 alone; adj sweep/e-step logic. v2.06
       	96-04-24  CAI  	Change sweep_b_i to SRP-relative. v2.07
       	96-04-30  CAI  	Fix errors in P36 event select; ignore events
                     	during retrace.  v2.08
       	96-05-02  CAI  	Revise GET_CIS logic.  v2.08
       	96-05-07  CAI  	Fill P36 tlm pkt from as many sweeps as
                      	necessary (major rev of GET_CIS).  v2.08
         
   	07-06-96  AMD  	Ported the code to ESIC. Replaced everywhere P27 by
                      	P35 and P28 by P36. Reduced the expected sweeps to 16.
   	03-14-97  AMD  	V2.23 Removed last step contribute according to 
                      	CIS-1 v2.15  
 NOTE: PRODUCT 35 GENERATION  
       Product 35 (Monitor Rates) collects 16 rate counters for the
       selected half (LS or HS) of the analyzer.  Only the first 16 
       of 24 counters are read.  The counters are read out each 
       e-step (32 times per sweep), but are averaged into 16 energy 
       bins for each counter.  After 2 spins, a  telemetry packet containing 
       2 blocks is generated.  Counters in the telemetry packet are log-compressed 
       to 8 bits, giving a product size of 256 data words plus one sweep number word 
       (0, 1..15).  
       Product 35 uses a single summation buffer of 512 16-bit words  
       At the end of 32 spins, collection suspends until the end 
       of the product interval, and then restarts.  Because this 
       product uses single buffering, the minimum achievable 
       product interval is about 18 spins.  
       P35 SUMMATION BUFFER  
           Buffer   Sweep  E-bin Counter
           Offset    No.    No.    No.
           ------   ----- ------ -------
               0     0,1      0     0
               1     0,1      0     1
               2     0,1      0     2
             ...    ...     ...    ..
              15     0,1      0    15
              16     0,1      1     0
              17     0,1      1     1
             ...    ...     ...    ..
             255     0,1     15    15
             256     2,3      0     0
             ...    ...     ...    ..
             511     2,3     15    15  
       P35 TELEMETRY PACKET FORMAT
         
       The packet buffer contains compressed, summed rate counters 
       from four sweeps (four spins).  The first half of the buffer 
       holds 16 energies by 16 rate counters for the first  sweep
       (spin), and the second half similarly reports the second 
       sweep (spin).  A 257th word is added at the beginning of 
       the packet just after the packet header; this word is the 
       number of the first of the four sweeps contained in the packet.  
       Since each product covers two sweeps, eight products are 
       needed to cover all 16 sweeps.    
                    Rel.                           Word   Sweep 
           Packet  Sweep Energy Counter              0   Numbers
           Offset   No.    No.    No.              (hex)  (dec)
           ------  ----- ------ -------            ----- --------
               0  (sweep number 0,4,8,...,28)       0000   0-3 
               1    0,1     0    0:1 (MSH:LSH)      0004   4-7 
               2    0,1     0    2:3                0008   8-11
               3    0,1     0    4:5                000C  12-15
             ...    ...    ...   ...                0010  16-19
               8    0,1     0   14:15               0014  20-23
               9    0,1     1    0:1                0018  24-27
              10    0,1     1    2:3                001C  28-31
             ...    ...   ...    ...                  
             128    0,1    15   14:15
             129    2,3     0    0:1
             ...    ...    ...   ...
             256    2,3    15   14:15  
          CODIF Rate Counters Reference:
             No.    Name   Description
           ------  ------  ---------------------------------
              0      PF1   Start Position 1
              1      PF2   Start Position 2
              2      PF3   Start Position 3
              3      PF4   Start Position 4
              4      PF5   Start Position 5
              5      PF6   Start Position 6
              6      PF7   Start Position 7
              7      PF8   Start Position 8
              8      PR1   Stop Position 1
              9      PR2   Stop Position 2
             10     CSEV   Single Valid Event Flag
             11    VALID   Valid Event Flag
             12     VALN   Not Valid Event Flag
             13    CPOLL   Event Poll Flag (total starts)
             14      CNT   Single Events Missed by Immed I/O
             15       SF   TAC Start Flag  
    P35 MEMORY USE
         
       The summation buffer memory is reused for the telemetry 
       packet buffer.  In addition four words are allocated just 
       before the summation buffer for a 2-word packet handling 
       structure and 2-word packet header.  Memory use is:  
            Length
           (words)   Description
            ------   ---------------
                2    packet handling structure
                2    packet header
              512    summation buffer
            ------   
              516    total per product buffer
                6    product variables
            ------
              522    1-buffer allocation
               27    task tss (at prod task creation)
            ------   
              549    total allocation for P35
  
       PRODUCT 36 GENERATION
         
       Product 36, Selected Events, collects TOF during specified
       sweeps, synchronous with Monitor Rate collection (if P35
       is active).  P36 monitors the TOF event interface via DMA data
       collection.  Up to 512 events are stored in the event buffer.    
       After each spin, a telemetry packet containing events from 
       one sweep is generated.  If the events from one sweep do 
       not fill the packet, events from succeeding sweeps are 
       processed until the packet is full.  At the end of 16 spins, 
       collection suspends until the end of the product interval, 
       and then restarts.  
       P36 MEMORY USE
         
       The event buffer memory is not reused for the telemetry 
       packet buffer.  Instead, a separate packet buffer is used.  
       Four words are allocated just before the packet buffer for 
       a 2-word packet handling structure and 2-word packet header.  
       Memory use is:  
            Length
           (words)   Description
            ------   ---------------
                2    tlm packet handling structure
                2    tlm packet header
               72    tlm packet buffer
              512    event buffer
            ------   
              588    total per product buffer
                6    product variables
            ------
              594    allocation
               27    task tss (at prod task creation)
            ------   
              621    total RAM allocation for P36  
       P36 DATA COLLECTION
         
       The events are collected from the DPU Event board via a 
       DMA interface.  The DMA interface is configured to prevent 
       periods of extremely high event frequency from excessively 
       preempting the CPU by monopolizing the bus.  The event 
       buffer size is 512 words, the max # of events per 
       22.5 degree period.  
       The 16-bit TOF event data in the DMA event buffer is:  
                          DMA TOF EVENT BIT DEFINITIONS
       *-------*---*---*---*-----------*-------------------------------*
       | 0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15 |
       *-------|---|---|---|-----------|-------------------------------*
       | 0   0  ps  sen ep      es                    tof              |
       *-------*---*---*---*-----------*-------------------------------*  
       MSbits: 00z = TOF event data; 11z = HV sector marker  
       ps  = proton suppression (0 = all, 1 = 1/16)
       sen = selected sensitivity (0 = L, 1 = H) (ignored by P35/P36)
       ep  = event stop address - (ignored by P35/P36)
       es  = event start address (anode #, 0-7)
       tof = time of flight (00-FFh)  
       If the two MSbits equal 00z, the word is a TOF event 
       (defined above).
       If the two MSbits equal 11z, the word is a HV sector marker 
       (defined below).  
                          DMA HV MARKER BIT DEFINITIONS
       *---------------*-----------------------------------------------*
       | 0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15 |
       *---------------|-----------------------------------------------*
       | 1   1   1   1                   sector                        |
       *---------------*-----------------------------------------------*  
       sector = HV step number since SRP+phase (0000-7FFh,0- 2047),
                encompassing 4 HV steps per e-step, 32 e-steps per sweep,
                and 16 sweeps per spin as follows:  
       *---------------*-----------------------------------------------*
       | 0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15 |
       *---------------|-------------------|-------------------|-------*
       | 1   1   1   1   0   sweep (0-15)      e-step (0-31)    HVstep |
       *---------------*-------------------*-------------------*-------*  
       P36 TELEMETRY PACKET FORMAT
         
       The 24-bit events are formatted for the packet buffer as 
       follows:  
        MSb
       *---------------*---------*------------------------*
       | 0  1  2  3  4   5  6  7   8  9 10 11 12 13 14 15 |...
       *---------------|---------|------------------------*
       |     sweep         es                tof          |...
       *---------------*---------*------------------------*
                                                                  LSb
                                   *----*----------------------------*
                                ...| 16   17  18  19  20  21  22  23 |
                                   *----|----------------------------*
                                ...| ps           energy             |
                                   *----*----------------------------*  
       sweep  = sweep number, 0-31
       es     = event start address (anode #, 0-7)
       tof    = time of flight
       ps     = proton suppression (0 = all, 1 = 1/16)
       energy = energy step number, 0-123 (of 0-127)  
       A 72-word telemetry packet contains 48 events.  Two 24-bit 
       events are packed into three 16-bit packet words as follows:  
       Pkt Word 0, bits 0-15:       Event 0, bits  0-15 (MSbits)
       Pkt Word 1, bits 0-7  (MSH): Event 0, bits 16-23 (LSbits)
       Pkt Word 1, bits 8-15 (LSH): Event 1, bits   0-7 (MSbits)
       Pkt Word 2, bits 0-15:       Event 1, bits  8-23 (LSbits)
  
       P35 AND P36 DATA COLLECTION
         
       The SECTOR_ISR routine calls GET_CIS every sector interrupt
       to collect data from the TOF counters (for P35) and Event
       register (for P36).  Data is collected during only one sweep
       each spin.  The selected sweep is rotated by one each spin,
       covering all 16 sweeps in 32 spins.  
       If both P35 and P36 are active, GET_CIS synchronizes data
       collection as follows: wait for P35 ready and P36 ready
       and correct sweep; then collect for one sweep.  If the 
       P36 tlm pkt is not full, continue P36 collection until
       full.

  

Home Page