#inc ;############################################################################################ ;# ;# Network Interface (NI) test program using the SCSN for the ALICE TRD ROB Tester ;# Ruprecht-Karls-Universitaet Heidelberg ;# Physikalisches Institut ;# ;# J. Mercado ver. 1.9 latest update: 14.12.2005 ;# ;# V. Angelov ver 2.0 latest update: 16.12.2005 ;# - first working version ;# V. Angelov ver 2.1 latest update: 16.12.2005 ;# - added counters for the strobe pulses ;# - more comments ;# V. Angelov ver 2.2 latest update: 17.12.2005 ;# - second write to the output port using the inverted pattern ;# ;# V. Angelov ver 2.3 latest update: 27.04.2006 ;# - packets of 7 32 bit data words and the inverted data, taken from the ;# constants C8..C14 (programmable over scsn at 0x0C18..0x0C1E) ;# - the number of the packets is programmable as C15 (0x0C1F). ;# ;# Short description of the program ;# 1) CPU3 inits the NI in network mode ;# ;# 2) all CPUs init the privat counters to count the number of strobes ;# ;# 3) CPU3 writes 7 times two words - the cn and not cn to NI output, where n is from 8 to 14 ;# ;# 4) all CPUs read from NI input fifo and write to DBANK ;# ;# 5) all CPUs read the counters and write to DBANK ;# ;# 6) CPU3 switches to low power ;# ;############################################################################################ ; the address in GIO for storing the output data ; #ifdef cpu0 #def DMAD=0xF000 #endif #ifdef cpu1 #def DMAD=0xF040 #endif #ifdef cpu2 #def DMAD=0xF080 #endif #ifdef cpu3 #def DMAD=0xF0C0 #endif #def CTPDINI = 0x0200 #def CTPCTRL = 0x0201 #def CTPDOUT = 0x0202 ORG 0 ; start of the IRQ tst procedure tst: nop nop nop nop nop #ifdef cpu3 ; clear the NI mov b010011 r0; jmpr cc_busy 0 sgio r0 NMOD nop nop ; release clear, set in network mode mov b011011 r0; jmpr cc_busy 0 sgio r0 NMOD #else nop nop nop nop nop nop nop nop #endif ; initilalize the privat counter as up-counter, external source NI strobe mov b0110_0000_0000, r0 spio r0, CTPCTRL mov 0, r0 spio r0, CTPDINI nop nop nop nop #ifdef cpu3 ; writing to the NI mov c15, r1 spack: mov c8, r0 spio r0, 0 not r0, r0; invert the pattern spio r0, 0 mov c9, r0 spio r0, 0 not r0, r0; invert the pattern spio r0, 0 mov c10, r0 spio r0, 0 not r0, r0; invert the pattern spio r0, 0 mov c11, r0 spio r0, 0 not r0, r0; invert the pattern spio r0, 0 mov c12, r0 spio r0, 0 not r0, r0; invert the pattern spio r0, 0 mov c13, r0 spio r0, 0 not r0, r0; invert the pattern spio r0, 0 mov c14, r0 spio r0, 0 not r0, r0; invert the pattern spio r0, 0 nop sub r1, c1, r1 jmp cc_nzero, spack #else shl 3, c15, r1 spdum: sub r1, c1, r1 nop jmp cc_nzero, spdum #endif ; wait until the data are sent and received... nop nop nop nop nop nop ; init the autoincrement GIO pointer iext DMAD mov DMAD, r14 ; read from NI input mov 14, r1 mul32 r1, c15, r1 rfifo: lpio 1 r4 lpio 0 r4 ; write to DBANK jmpr cc_busy 0 sgio+ r4 sub r1, c1, r1 jmp cc_nzero, rfifo ; read the privat counter in NI - the number of strobe pulses and parity errors lpio NLP, r5 lpio NLP, r5 jmpr cc_busy 0 ; write to DBANK sgio+ r5 ; read the privat counter of the CPU - the number of strobe pulses lpio CTPDOUT, r5 jmpr cc_busy 0 ; write to DBANK sgio+ r5 #ifdef cpu3 ; switch to low power mode jmpr cc_busy 0 mov 0x12 r0 sgio r0 0xA04 #endif ; loop jmpr cc_uncond 0 nop