; $Id$: ; this is include file for the main fit program ; ADD the accumulated sums for the third charge window for the channels in the tracklet (start ch is in adc_ch_msk_i) ; and store the result in charge_i (g-registers) ; ; all accumulated ADC values for the channels in the tracklets stored before in RAM by each CPU ; linear code without loops, to gain some CPU clocks ; modified: r1, r2, r6, r13, r15 ; Pairs of Ch 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ; | \ ; PreProc Ch 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ; / | \ ; ADC Ch 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ; / | | ; PASA Ch - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 - - ; ; / | \ represent contributions ; - and - - left and right represent PASA outputs of neighbour MCMs ; ; so if out start channel is ch (from Preprocessor), we have contributions from ADC channels ch, ch+1, ch+2, ch+3, ; which are actually one left channel and two right channels relative to the start channel! special numbering! mov b0000_0111_0000, r7 ; load a mask with bits 4..6 set, all others => cleared mov 3, r3 ; count how many (of the max 3) sums were NOT calculated, use this information to decide ; to make a small refresh mov ADC_Q2_0_4, r13 ; start address of the integrated charges ; this will be repeated for cpu0..2 - 3 times - 16 CPU clocks syt r6 ; copy the sync register andt r6, r7 ; check if some bit 4..6 is still on jmpr cc_nzero, -2 ; if so, loop and wait until cpu0..2 wrote to g4..6 mov adc_ch_msk_0, r2 ; the ADC start channel shl 2, r2, r1 ; multiply by 4 as the address is byte-address, our data are 32-bit! cmp r2, CH_NR_NO_TRCK ; 23, used to mark no tracklet jmp cc_eq, _acq_q2_c1 ; now sum the charge integrated in the third window - add the contributions of the 4 channels together add r13, r1, r15 ; add 4*start channel sub r3, c1, r3 ; one sum was calculated lra rr_dword, r1 lra+ rr_dword, r1 ; read the charge integrated in the first channel nop ; don't change the memory read pointer r15 just before reading! lra rr_dword, r2 ; lra+ rr_dword, r2 ; read the charge integrated in the second channel add r2, r1, r1 ; accumulate the sum lra rr_dword, r2 ; lra+ rr_dword, r2 ; read the charge integrated in the third channel add r2, r1, r1 ; accumulate the sum lra rr_dword, r2 ; lra+ rr_dword, r2 ; read the charge integrated in the fourth channel _acq_q2_c1: add r2, r1, charge_0 ; store the sum in g0, if tracklet0 was skipped, still write something mov adc_ch_msk_1, r1 ; the ADC start channel cmp r1, CH_NR_NO_TRCK ; 23, used to mark no tracklet jmp cc_eq, _acq_q2_c2 shl 2, r1, r1 ; multiply by 4 as the address is byte-address, our data are 32-bit! ; now sum the charge integrated in the third window - add the contributions of the 4 channels together add r13, r1, r15 ; add 4*start channel sub r3, c1, r3 ; one sum was calculated lra rr_dword, r1 lra+ rr_dword, r1 ; read the charge integrated in the first channel nop ; don't change the memory read pointer r15 just before reading! lra rr_dword, r2 ; lra+ rr_dword, r2 ; read the charge integrated in the second channel add r2, r1, r1 ; accumulate the sum lra rr_dword, r2 ; lra+ rr_dword, r2 ; read the charge integrated in the third channel add r2, r1, r1 ; accumulate the sum lra rr_dword, r2 ; lra+ rr_dword, r2 ; read the charge integrated in the fourth channel _acq_q2_c2: ; sample mask and Q2 for cpu2 add r2, r1, charge_1 ; store the sum in g1, if tracklet1 was skipped, still write something mov adc_ch_msk_2, r1 ; the ADC start channel cmp r1, CH_NR_NO_TRCK ; 23, used to mark no tracklet jmp cc_eq, _acq_q2_fin shl 2, r1, r1 ; multiply by 4 as the address is byte-address, our data are 32-bit! ; now sum the charge integrated in the third window - add the contributions of the 4 channels together add r13, r1, r15 ; add the start channel sub r3, c1, r3 ; one sum was calculated lra rr_dword, r1 lra+ rr_dword, r1 ; read the charge integrated in the first channel nop ; don't change the memory read pointer r15 just before reading! lra rr_dword, r2 ; lra+ rr_dword, r2 ; read the charge integrated in the second channel add r2, r1, r1 ; accumulate the sum lra rr_dword, r2 ; lra+ rr_dword, r2 ; read the charge integrated in the third channel add r2, r1, r1 ; accumulate the sum lra rr_dword, r2 ; lra+ rr_dword, r2 ; read the charge integrated in the fourth channel _acq_q2_fin: add r2, r1, charge_2 ; store the sum in g4