Thats_Me_Processing IDNT ; Title of Thats_Me Processing ; program section. SECTION Sect_Thats_Me_Processing,4,C ; Declare a noncommon code ; section. Align to Longwords. *************************************************************************** * * * Thats_Me Processing Rev. 17-MAY-1995 * * * * * * * * This routine uses and does not restore Registers: D1, D2, D3, D4, * * D5, D6 and D7. * * * * This routine sends out the following information in the following * * registers: * * * * D1 holds the List of Specific Trig's Fired 15:0 for the * * Frame Code Section of the L15CT Data Block. * * * * D2 holds the Masks of Terms (i.e. the 5th longword of the * * Frame Code Section. It holds: * * in 0:7 the Mask of Terms that were to be Evaluated * * in 15:8 all zeros * * in 23:16 the Mask of Term that for which their evaluation is * * Incomplete (all zeros in this version of 68k_Service). * * in 31:24 the Mask of Terms that were returned to L15 FW M103. * * Set to $FF for MFP events else set $00 until later * * when we learn the Term Answers from the Global DSP. * * * * D3 holds the 2nd longword of the Type 0 Entry of the DeBug Section.* * * * D5 holds the Term Answers that we received from the Global DSP. * * * * D6 holds the Mark and Force Pass Mask for the Crate Header in D.B. * * * * D7 Holds the TAS Number for the Crate Header in the L15CT Data Blk.* * * *************************************************************************** *************************************************************************** * * * This section defines program-specific macros: * * * * RdIO: Read bit(s) from the IRONICS I/O card. * * * *************************************************************************** RdIO MACRO ; Read the byte from the Ironics I/O Port. Move.B \1,\2 ; Move to the byte from the Ironics port ENDM ; at address \1 to the location ; specified by \2. ************************************************************************* * * * We arrive here if there has been a new L1 Trigger with >=1 L15CT * * Terms that need to be evaluated. ----- * * * * Read the TAS Number. We might just as well read the TAS Number in * * a way that puts it into Crate Header Sync Word format (in case we * * transfer this event). Build this in register D7 and keep it for * * later use. * * * * Register D7 will now be in use until the TAS Number is used * * in the That's_Me_Readout_Required routine or until this * * event is rejected. * * * ************************************************************************* Begin_Thats_Me_Processing: Move.L #$FFFFFFFF,D7 ; Read the TAS Number ; Get the MSByte of TAS Number. Move.B Readout_Ctrl_Port_5,D7 ; Shift it up. LSL.L #8,D7 ; Get the LSByte of TAS Number. ; Swap 0:15 with 16:31. D7 now Move.B Readout_Ctrl_Port_6,D7 ; holds the TAS Number in the Swap D7 ; Crate Header Sync Word format. ; Retain TAS Number in reg D7. ************************************************************************* * * * The next step is to form the new Wake_Up_Word. We will build this * * in register D2 but do not send it to the DSP's until we check that * * all DSP's are at Setp D0. * * * * To make the new Wake_Up_Word we need to know which L15CT Terms * * need to be evaluated during this L15CT cycle (read this from the * * Terms Select P2), we need to know if this is a normal event or * * an MFP event, and we need the LSByte of the TAS Number. * * * * We still have the TAS Number in Sync. Word format in register D7. * * * * Save the Wake_Up_Word in register D2 until later on in this routine * * when we are building the Masks of Terms for the Frame Code * * Section of the L15CT Data Block. * ************************************************************************* Move.L D7,D2 ; Build the Wake_Up_Word in D2. LSL.L #8,D2 ; The MSByte of the WUW is the AndI.L #$FF000000,D2 ; LSByte of the 16 bit TAS Number. ; Get from the Term Select P2 the ; mask of Terms that need to be RdIO Term_Select_Port_4,D2 ; evaluated in this L15CT cycle. ; See if this is an MFP event IF.B MFP_Event #Flag_SET THEN.S ; i.e. is the MFP_Event ; software flag set? ORI.L #$00000100,D2 ; If it is an MFP event then set ; the flag in the Wake_Up_Word. ENDI ; D6 now cantains the new WUW ; for both Local and Global DSP's. ************************************************************************* * * * The next step is to verify that all 12 DSP's are at Step D0. If * * they are not all at Step D0 then wait here and work to get then * * all to this Step. * ************************************************************************* ; Test to see if TstAgn IF.B All_DSPs_at_Step_D0 #Flag_CLR THEN.S ; all 12 DSP's ; are at Step D0 ? JSR Begin_All_DSPs_to_Step_D0 ; If they are NOT all at JMP TstAgn ; Step D0, try to move ; them there and test ENDI ; again. ************************************************************************* * * * Now that we have a new Wake_Up_Word and we have all 12 DSP's at * * Step D0, the next task is to send out the Wake_Up_Word; first to * * the Local DSP's and then to the Global DSP. * * * * As soon as this is done, then CLEAR the All_DSPs_at_Step_D0 * * software flag. * ************************************************************************* Move.L D2,Ser68_to_Hydra_B_Adrs ; WUW to Local DSP's Hydra-II B. Move.L D2,Ser68_to_Hydra_A_Adrs ; WUW to Local DSP's Hydra-II A. Move.L D2,Ser68_to_Hydra_C_Adrs ; WUW to Local DSP's Hydra-II C. Move.L D2,Ser68_to_Hydra_B_Adrs+4 ; WUW to Global DSP Hydra-II B. Clr.B All_DSPs_at_Step_D0 ; CLEAR All_DSPs_at_Step_D0 flag ************************************************************************* * * * OK, things should be under control for about 70 usec. Thus, we * * have time to get started on some other work. * * * * Let's start by: * * * * 1. Build the dynamic words of the Crate Header. Recall that reg * * D7 currently holds the SYNC word. Do NOT try to load any of * * these words into a 214 Load buffer yet. * * * * 2. If the MFP_Event software flag is set then do the following: * * Clear the MFP_Event software flag. * * Load the MFP_Ratio (given to us by TCC) into the MFP_Counter. * * Set the If_Transfer_Want_MFP_Transfer software flag. * * Set all Term Answers Hi and then set all Term DONEs active. * * * * 3. Decrement the MFP_Counter and if it now reads zero then: * * Set the MFP_Event software flag to "flag" the next event. * * * ************************************************************************* ************************************************************************* * * * Build dynamic words of the Crate Header. We still have the SYNC * * word in D7. We do not know enough yet to build the Data Validity * * Word. We can build the Mark and Force Pass Mask Word. Lets build * * it in register D6 and keep it there until we are ready to move it * * to the Load Buffer. * * * * Register D6 will now be in use until the Mark and Force Pass Mask * * is used in the That's_Me_Readout_Required routine or until this * * event is rejected. * * * ************************************************************************* IF.B MFP_Event #Flag_SET THEN.S ; Test to see if this event is Move.L #$0000000F,D6 ; an MFP event. If it is then ELSE.S ; set the Mark and Force Pass Clr.L D6 ; Mask Word to indicate this ENDI ; else clear the MFP Mask word ; Retain reg D6 holding the ; data for the MFP MASK Word. ************************************************************************* * * * The DSP's are still at work so continue 68k_Service work by: * * * * If the MFP_Event software flag is set then do the following: * * Clear the MFP_Event software flag. * * Load the MFP_Ratio (given to us by TCC) into the MFP_Counter. * * Set the If_Transfer_Want_MFP_Transfer software flag. * * Set all Term Answers Hi and then set all Term DONEs active. * * * ************************************************************************* IF.B MFP_Event #Flag_SET THEN.S ; Test to see if this event is ; an MFP event. If it is then: Clr.B MFP_Event ; CLEAR MFP_Event Move.L MFP_Ratio_Term_0,MFP_Counter_Term_0 ; Load MFP Counter Move.B #Flag_SET,If_Transfer_Want_MFP_Transfer ; SET Want MFP Trns Move.B #$00,Terms_to_M103_Port_4 ; Set all Term Answers Hi. Move.B #$FF,Terms_to_M103_Port_5 ; All Term DONEs set LOW. Move.B #$00,Terms_to_M103_Port_5 ; All Term DONEs set HI. ENDI ************************************************************************* * * * The DSP's are still at work so continue 68k_Service work by: * * * * Decrement the MFP_Counter and if it now reads zero then: * * Set the MFP_Event software flag to "flag" that the * * NEXT event will be MFP. * ************************************************************************* SubQ.L #1,MFP_Counter_Term_0 ; Decriment the MFP Counter for Term 0. ; Is MFP_Counter IF.L MFP_Counter_Term_0 #$00000000 THEN.S ; now at zero ? ; If yes then set Move.B #Flag_SET,MFP_Event ; the flag to ; indicate that ENDI ; the NEXT event ; will be MFP. ************************************************************************* * * * The DSP's are still at work so continue 68k_Service work by: * * * * Get the List of Spec Trig's Fired 15:0 by reading the Term_Select * * P2 Card. This List of Spec Trig's Fired is stored in register * * D1 for possible use in the That's_Me_Readout_Req routine. We * * do not know yet whether or not we will readout this event but we * * have time right now to prepair this Spec Trig's Fired List just * * in case we do readout. * * * * Recall the layout of data in the Term_Select P2 Card. * * * * Term_Select_Port_1 reads Spec Trig Fired List 7:0. * * Term_Select_Port_6 reads Spec Trig Fired List 15:8. * * * * Register D1 will now be in use until the Spec Trig's Fired List * * is used in the That's_Me_Readout_Required routine or until this * * event is rejected. * * * ************************************************************************* ; Build the Spec Trig's Fired List ; 15:0 in Register D1 15:0. Get Clr.L D1 ; the Spec Trig's Fired List 15:8 ; into reg D1 7:0. Shift it up Move.B Term_Select_Port_6,D1 ; into reg D1 15:8. Get the Spec LSL.L #8,D1 ; Trig's Fired List 7:0 into reg Move.B Term_Select_Port_1,D1 ; D1 7:0. Save D1 as the Spec ; Trigs Fired word for the Frame ; Code section ofthe L15 CT Data ; Block. ************************************************************************* * * * The DSP's are still at work so continue 68k_Service work by: * * * * The L15CT Data Block DeBug section always has a Type 0 Entry that * * comes from 68k_Services. The first longword of this Type 0 Entry * * is event to event static and is put in the 214 Buffers by the * * Initialize Data Structures routine. The second (and last) * * longword of the Type 0 Entry is event to event dynamic. * * * * The value of this second longword depends on whether or not this * * transfer (event) has MFP data. We can tell if this is a MFP * * event by looking at the If_Transfer_Want_MFP_Transfer software * * flag. * * * * We prepare this second longword of the Type 0 Entry of the DeBug * * Section of the L15CT Data Block at this time so that it is * * ready if we do indead readout this event. We store it in the * * register D3. We get it ready now so that we do not need to * * calculate it during the busy readout period. * * * * Register D3 will now be in use until the 2nd longword of the * * Type 0 Entry of the DeBug Section is used in the * * That's_Me_Readout_Required routine or until this event is rejected. * * * ************************************************************************* IF.B If_Transfer_Want_MFP_Transfer #Flag_SET THEN.S ; Test to see ; if this Move.L #$FFFFFFFF,D3 ; transfer is for a MFP ; event. If it is then Set ELSE.S ; the Type 0 Entry 2nd LW ; to all $F's. For normal Clr.L D3 ; events clear the 2nd LW. ; Build this 2nd LW of the ENDI ; Type 0 Entry in reg D3. ; If we do readout this ; event it will be loaded ; into the 214 later in the ; "That's_Me_Readout_Req" ; routine. ************************************************************************* * * * The DSP's are still at work so continue 68k_Service work by: * * * * Building as much as we can of the "Masks of Terms" longword that * * is part of the Frame Code section of the L15CT Data Block. * * * * We will build this Masks of Terms in register D2 and keep it * * for use in the That's Me Readout Req routine if we do indead * * readout this event. Note that we arrive here with the Wake_Up_ * * _Word in register D2. This is nice because the Wake_Up_Word * * contains some of the information that we will need to make the * * Masks of Terms longword. * * * * Build Register D2 to hold the Masks of Terms (i.e. the 5th longword * * of the Frame Code Section as follows: * * in 0:7 the Mask of Terms that were to be Evaluated * * in 15:8 all zeros until later when we learn the Term Answers * * from the Global DSP. * * in 23:16 the Mask of Term that for which their evaluation * * is Incomplete (all zeros in this version of 68k_Service). * * in 31:24 the Mask of Terms that were returned to L15 FW M103. * * Set to $FF for MFP events else set $00 until later * * when we learn the Term Answers from the Global DSP. * * * * If this event is confirmed and readout then later on in the * * That's Me Readout Required section, bits 15:8 of this longword * * will be set to indicate which Terms actually passed this cycle * * of the L15CT. * * * * Register D2 will now be in use until the Masks of Terms longword * * of the Frame Code Section of the L15CT Data Block is used in the * * That's_Me_Readout_Required routine or until this event is rejected. * * * ************************************************************************* ; We arrive here with D2 containing ; the Wake_Up_Word. This is ; perfect because the Wake_Up_Word ; has in 7:0 the list of Terms to ; be evaluated which is just what ; we need to build bits 7:0 of ; the Masks of Terms longword And.L #$000000FF,D2 ; Save only the Terms Evaluated ; Now test to see if this is an ; MFP event. IF.B If_Transfer_Want_MFP_Transfer #Flag_SET THEN.S ORI.L #$FF000000,D2 ; If this is an MFP event then set ; the Mask of Terms (Answers) ENDI ; returned to L15 Framework M103 ; to be all high. If this is not ; an MFP event then leave the Mask ; of Terms Returned all zeros to be ; filled in later when we learn from ; the Global DSP which terms passed. ************************************************************************* * * * Disable the ExtEnb Signal to Ch #7 of the L15CT MTG * * * * We still have a little time before we need to start checking on the * * Global DSP. We need to disable the External Enable signal to Ch #7 * * of the L15CT MTG, i.e. disable any more Transmit Triggers from being * * sent to the ERPB's. We need to do this because soon we will answer * * to M103 FW and remove the Front-End Busy but the Local DSP's will * * still be moving their Object Lists or MFP data to the GDSP and we * * do not want to over write the LDSP Trigger Tower data until they are * * ready for a new event. We disable the sending out of a new Transmit * * Trigger but we let L1 Cal Trig start looking for a new event as soon * * as possible. Ch #7 of the L15CT MTG will remember if there has been * * a new L1 Trigger and whether or not it needs to send out a new * * Transmit Trigger when it is re-enabled. * * * ************************************************************************* Move.B #$01,Path_Select_Port_1 ************************************************************************* * * * Now wait for Global DSP to reach Step D3. * * * * OK, we hope that we have arrived here before the DSP's have * * finished their processing. We will wait here until the Global * * DSP says that it has reached Step D3. Once the Global DSP is * * at Step D3 then it is sending back to us the results from its * * evaluation of the L15CT Terms. As soon as Global DSP says that it * * is at Step D3 then we read the Term results from its GDSP to EC * * Status Word and send these Term Answers to M103 L15 FW. Once the * * Term Answers and sent to M103 L15 FW then set the Term Dones to * * M103 L15 FW. * * * * NOTE that once Global DSP reaches Step D3, we only want to send * * Term Answers and Dones back to L15 Framework M103 if this is * * NOT and MFP event. We can tell if this event is an MFP event by * * testing the If_Transfer_Want_MFP_Transfer software flag. * * * * While waiting for GDSP to reach Step D3 we count the number of * * loops that we make testing it. If we have waited for the * * Max_Wait_GDSP loop count then give up and JMP to an Error Recovery * * routine. * * * * Note when the Global DSP has finished evaluating the L15CT Terms, * * it will wait at Step D3 until it hears from us as to whether or * * not it should transfer data to the 214 Load Buffer. * * * * Register D5 will now be in use until the Terms Answers are used * * to finish building the Masks of Terms longword of the Frame Code * * Section of the L15CT Data Block is used in the That's_Me_Readout_ * * _Required routine or until this event is rejected. * * * ************************************************************************* Begin_Wait_GDSP: ; Clear the register that is ; used to count the number of CLR.L D4 ; loops we make waiting for ; GDSP to reach Step D3. This ; counter is used to control ; the time-out waiting for ; GDSP to reach Step D3. Test_GDSP Move.L GDSP_B2_Status_Adrs,D5 ; Read the Global DSP's Status. ; Test to see if the Global IF.W D5 #GDSP_at_D3 THEN.S ; DSP has reached Step D3 ? JMP Answers_to_M103 ; If it HAS REACHED Step D3 ENDI ; then jump to the routine ; where we continue processing ; by sending L15CT terms ; answers back to M103 L15FW. ADDQ.L #1,D4 ; If it has NOT reached Step ; D3 then test to see if we IF.L D4 #Max_Wait_GDSP THEN.S ; have waited too long. JMP Begin_Step_D3_Error_Recovery ; If we HAVE waited too long ENDI ; then jump to Error Recovery ; processing. If we have NOT ; waited too long then test JMP Test_GDSP ; again to see if GDSP has ; now reached Step D3. Answers_to_M103: ; Register D5 holds the Status ; from the GDSP. The GDSP's ; Term Answers are in bits ; 23:16 and we need them in SWAP D5 ; in the LSB of reg D5 ; independent of whether or ; not this is a Normal or MFP ; event. ; OK, we are now ready to ; send the Term Answers to ; the L15 Framework M103, BUT ; we only want to send Answers ; and Dones back to L15 FW if ; this is NOT a MFP event. ; Test if this is an MFP event. IF.B If_Transfer_Want_MFP_Transfer #Flag_SET THEN.S JMP Test_RC ; If this IS an MFP event then ; skip sending Answers and ENDI ; Dones back to L15 FW, i.e. ; jump to waiting for Readout ; Control P2 to tell us ; readout or dump. If this is ; NOT MFP then continue on and ; send Answers and Dones back ; to L15 Framework. ; OK, this is NOT an MFP event ; and GDSP is at Step D3 and ; register D5 holds the status ; from the GDSP with its Term ; Answers now in bits 7:0. ; Send the GDSP's Term Answers Not.B D5 ; to the Terms Returned to ; M103 P2 Ironics Port #4. Move.B D5,Terms_to_M103_Port_4 ; Retain the Term Answers in ; register D5 in case we need Not.B D5 ; them in the That's Me Readout ; Required routine to build ; the Frame Code section of ; the L15CT Data Block. Dones_to_M103: ; Send the Term Dones to ; M103 L15 Framework. Move.B #$FF,Terms_to_M103_Port_5 ; Take the DONEs all LOW. Move.B #$00,Terms_to_M103_Port_5 ; Take the DONEs all HI. ************************************************************************* * * * Now wait to to find out from the Readout Control paddle card if * * this event is going to be "dumped" i.e. L15 FW Rejected or if * * this event is going to be readout to L2. * * * * Review the layout of the Readout Control P2 Ironics Port #3. * * * * Readout Control Ironics Port #3 all Input bits. * * * * Bit 0 Flag indicating that Readout is Required for this event. * * * * Bit 1 Flag indicating that this event is to be Dumped. * * * * Bits 2,3 Not used. * * * * Bit 4 VBD DONE hardware signal. * * * * Bits 5:7 Not used. * ************************************************************************* Test_RC RdIO Readout_Ctrl_Port_3,D4 ; Get the contents of RC Port 3. AndI.B #$03,D4 ; Select only bits 0 and 1. IF.B #$01 D4 THEN.S ; Test if Readout Required flag JMP Begin_Thats_Me_Readout_Req ; is set. If so jump. ENDI IF.B #$02 D4 THEN.S ; Test if the Dump Event flag JMP Begin_Thats_Me_Dump_Event ; is set. If so jump. ENDI JMP Test_RC ; Neither bit was set so read ; RC again and test it again. ************************************************************************* * * * Define Constants: * * * ************************************************************************* ALIGN 4 ; Align to longword address. GDSP_at_D3 EQU $00000008 ; Global DSP to EC Status Word ; indicating that this DSP has ; reached Step D3. Max_Wait_GDSP EQU 10000 ; This is the maximum number of ; times that we will go around ; the loop waiting for GDSP to ; reach Step D3 before starting ; the Error Recovery routine. ; 10000 is very approximately ; 10 mill sec waiting for GDSP. ************************************************************************* * * * Define symbols that are imported from other modules or exported * * to other modules. * * * ************************************************************************* XDEF Begin_Thats_Me_Processing ; Symbol exported to XDEF Dones_to_M103 ; other modules. XREF Readout_Ctrl_Port_3 ; Symbols used in this XREF Readout_Ctrl_Port_5 ; module but defined in XREF Readout_Ctrl_Port_6 ; another program module. XREF Terms_to_M103_Port_4 XREF Terms_to_M103_Port_5 XREF Term_Select_Port_1 XREF Term_Select_Port_4 XREF Term_Select_Port_6 XREF Path_Select_Port_1 XREF Flag_CLR XREF Flag_SET XREF MFP_Event XREF If_Transfer_Want_MFP_Transfer XREF All_DSPs_at_Step_D0 XREF Begin_Thats_Me_Readout_Req XREF Begin_Thats_Me_Dump_Event XREF Begin_All_DSPs_to_Step_D0 XREF Begin_Step_D3_Error_Recovery XREF Ser68_to_Hydra_C_Adrs XREF Ser68_to_Hydra_A_Adrs XREF Ser68_to_Hydra_B_Adrs XREF GDSP_B2_Status_Adrs XREF MFP_Ratio_Term_0 XREF MFP_Counter_Term_0 END