[Index] [Back] [Next]

4. On-board SiVMEXI Drivers & Primitives

This library of on-board firmware routines enables programmers to build their own applications to run on top of the SiVMEXI system. They are intended for expert access through Assembler calls where arguments are passed via 68K registers at fixed offsets to the code origin. LW refers to Long-Word, ie a 32-bit integer.

In addition to the primitives described in the VMEXI_SSP, for the Silicon Readout the following routines are added. Remember that up to 16 OnSiRoCs are numbered from 0 through 15 within a single crate. Naturally all access to the OnSiRoC system is made through the VMEtaxi, so allowing the latter to remain the primary data acquisition master of the complete readout chain.

4.1. Local Primitive Routines

Routine Name	Description	Entry & Exit Arguments (Registers)


SI_INIT 	Initialise OnSiRoC	
			Enter	D7.L	=	OnSiRoC number
			Exit	D0.B	=	0 if executed normally
				D0.B	=	$FF Invalid OnSiRoC number
				D0.B	=	$BE Bus Error accessing OnSiRoC
SI_ALL_INIT 	Initialise all OnSiRoCs in a crate	
			Exit	D7.L	=	Bit pattern of OnSiRoCs found
SI_STAT 	Status of OnSiRoC	
			Enter	D7.L	=	OnSiRoC number
 			Exit	D0.B	=	0 if executed normally
				D0.B	=	$FF Invalid OnSiRoC number
				D0.B	=	$BE Bus Error accessing OnSiRoC
				D1.W	=	Status word
				D2.L	=	Channel + Pipeline Counter 1
				D3.L	=	Channel + Pipeline Counter 2
				D4.L	=	Hit Detector Threshold
				D5.W	=	Cluster Detector Threshold
SI_SET_VOLTS 	Set Bias Voltages	
			Enter	D7.L	=	OnSiRoC number
				D1.W	=	Bias Voltage 1 (8-bit)
				D2.W	=	Bias Voltage 2 (8-bit)
				D3.W	=	Bias Voltage 3 (8-bit)
				D4.W	=	Bias Voltage 4 (8-bit)
 			Exit	D0.B	=	0 if executed normally
				D0.B	=	$FF Invalid OnSiRoC number
				D0.B	=	$BE Bus Error accessing OnSiRoC
				D0.B	=	$02 Invalid setting
	Note that if a value of -1 is requested, that particular voltage is skipped.

SI_READ_CURR 	Read 8-bit currents	
			Enter	D7.L	=	OnSiRoC number
	 		Exit	D0.B	=	0 if executed normally
				D0.B	=	$FF Invalid OnSiRoC number
				D0.B	=	$BE Bus Error accessing OnSiRoC
				D1.W	=	Current 1
				D2.W	=	Current 2 
				D3.W	=	Current 3 
				D4.W	=	Current 4 

SI_CTRL 	Set Control Registers	
			Enter	D7.L	=	OnSiRoC number
				D1.W	=	Control Register 1
				D2.W	=	Control Register 2
	 		Exit	D0.B	=	0 if executed normally
				D0.B	=	$FF Invalid OnSiRoC number
				D0.B	=	$BE Bus Error accessing OnSiRoC

SI_CCPIC 	Set Channel & Pipeline Counters	
			Enter	D7.L	=	OnSiRoC number
				D1.W	=	Channel Counter 1 (11-bit)
				D2.W	=	Channel Counter 2 (11-bit)
				D4.W	=	Pipeline Counter (5-bit)
	 		Exit	D0.B	=	0 if executed normally
				D0.B	=	$FF Invalid OnSiRoC number
				D0.B	=	$BE Bus Error accessing OnSiRoC
				D0.B	=	$01 Counters incorrectly set
	Note that if a PIC value of -1 is requested, only the channel counters are set.

SI_THRESH 	Set Thresholds	
			Enter	D7.L	=	OnSiRoC number
				D4.L	=	Hit Detector Threshold
				D5.L	=	Cluster Detector Threshold
	 		Exit	D0.B	=	0 if executed normally
				D0.B	=	$FF Invalid OnSiRoC number
				D0.B	=	$BE Bus Error accessing OnSiRoC
				D0.B	=	$03 Hit Threshold incorrectly set
				D0.B	=	$0C Cluster Threshold incorrectly set
				D0.B	=	$0F Both Thresholds incorrectly set
Local Loading of Sequencer and Pedestal routines
SI_LOAD_SEQ 	Load Sequencer	
			Enter	D7.L	=	OnSiRoC number
				A1.L	=	Start address of Store (64*4 kbytes)
	 		Exit	D0.B	=	0 if executed normally
				D0.B	=	$FF Invalid OnSiRoC number
				D0.B	=	$BE Bus Error accessing OnSiRoC
				D0.B	=	$BA Bus Error finding store

SI_CHECK_SEQ 	Check  Sequencer	
			Enter	D7.L	=	OnSiRoC number
				A1.L	=	Start address of Store (64*4 kbytes)
	 		Exit	D0.B	=	0 if executed normally
				D0.B	=	$FF Invalid OnSiRoC number
				D0.B	=	$BE Bus Error accessing OnSiRoC
				D0.B	=	$BA Bus Error finding store
				D0.B	=	$CF Check Failure, with
				A0	=	Store address where check failure found
				D3.L	=	Data Sent from Store
				D4.L	=	Data Read back in Sequencer

SI_LOAD_PED 	Load Pedestals	
			Enter	D7.L	=	OnSiRoC number
				A1.L	=	Start address of Store (64*4 kbytes)
	 		Exit	D0.B	=	0 if executed normally
				D0.B	=	$FF Invalid OnSiRoC number
				D0.B	=	$BE Bus Error accessing OnSiRoC
				D0.B	=	$BA Bus Error finding store
	Pedestals are loaded in byte-blocks where each 32-bit word is in the OnSiRoC 4-3-2-1 format.
	First the Channel Counters, then the Pipeline is incremented according to the GAL on the OnSiRoC.
	On exit, if D0=0, then A1 points to next store address.. in case loading consecutive OnSiRoCs.

SI_CHECK_PED 	Check  Pedestals	
			Enter	D7.L	=	OnSiRoC number
				A1.L	=	Start address of Store (64*4 kbytes)
	 		Exit	D0.B	=	0 if executed normally
				D0.B	=	$FF Invalid OnSiRoC number
				D0.B	=	$BE Bus Error accessing OnSiRoC
				D0.B	=	$BA Bus Error finding store
				D0.B	=	$CF Check Failure, with
				A0	=	Store address where check failure found
				D1.L	=	Next value of PIC+CC1
				D3.L	=	Data Sent from Store
				D4.L	=	Data Read back from Pedestal memory
			On exit, if D0=0, then A1 points to next store address.

SI_READ_DATA 	Read Data	"Normal DAQ" Data Type 0	
			Enter	D7.L	=	OnSiRoC number
				A2.L	=	Start address to Store Data
	 		Exit	D0.B	=	0 if executed normally
				D0.B	=	$FF Invalid OnSiRoC number
				D0.B	=	$BE Bus Error accessing OnSiRoC
				D0.B	=	$BA Bus Error finding store
				D0.B	=	$11 Invalid Pointer Counter value read
				D0.B	=	$22 Invalid Cluster size found
				D0.B	=	$77 Invalid Raw Data found
				D6.L	=	Number of 32-bit words transferred
			On exit, if D0=0, then A2 points to next store address.
	This routine reads out the hits and cluster data before transferring to the data store.
	The readout follows the 3-1-4-2 channel sequence of the OnSiRoC. See Appendix for format.

Figure 7a : Normal and Fast data readout types

SI_READ_HITS 	Read Hits only	"Fast DAQ" Data Type 1	
			Enter	D7.L	=	OnSiRoC number
				A2.L	=	Start address to Store Data
	 		Exit	D0.B	=	0 if executed normally
				D0.B	=	$FF Invalid OnSiRoC number
				D0.B	=	$BE Bus Error accessing OnSiRoC
				D0.B	=	$BA Bus Error finding store
				D0.B	=	$11 Invalid Pointer Counter value read
				D6.L	=	Number of 32-bit words transferred
						ie number of hits
			On exit, if D0=0, then A2 points to next store address.
	With this routine, only the Pointer memory is read out and transferred to the data store.
	The readout sequence follows the 3-1-4-2 channel sequence of the OnSiRoC.
	The data format is summarised in the Appendix.


SI_READ_RAW 	Read all Raw data	"Full DAQ" Data Type 2	
			Enter	D7.L	=	OnSiRoC number
				A2.L	=	Start address to Store Data
	 		Exit	D0.B	=	0 if executed normally
				D0.B	=	$FF Invalid OnSiRoC number
				D0.B	=	$BE Bus Error accessing OnSiRoC
				D0.B	=	$BA Bus Error finding store
			On exit, if D0=0, then A2 points to next store address.
	This routine transfers all raw memory data to the store, ie 4096 32-bit words.
	The readout sequence follows the 3+1 - 4+2 channel pairs of the OnSiRoC.
	The data format is summarised in the Appendix.



Figure 7b : Normal Plus data readout type


SI_READ_PULSE 	Read "Pulse" Data	"Normal Plus" Data Type 3	
			Enter	D7.L	=	OnSiRoC number
				A2.L	=	Start address to Store Data
				D3.W	=	Length to left of cluster-hit (0-6)
				D4.W	=	Length to right of cluster-hit (0-6)
						Total length must be < 9
	 		Exit	D0.B	=	0 if executed normally
				D0.B	=	$FF Invalid OnSiRoC number
				D0.B	=	$BE Bus Error accessing OnSiRoC
				D0.B	=	$BA Bus Error finding store
				D0.B	=	$E1 Invalid pulse length requested
				D0.B	=	$11 Invalid Pointer Counter value read
				D0.B	=	$22 Invalid Cluster size found
				D0.B	=	$27 Invalid length counter because of bad 						pointer memory value
				D0.B	=	$77 Invalid Raw Data found
				D6.L	=	Number of 32-bit words transferred
			On exit, if D0=0, then A2 points to next store address.
	This routine is the same as SI_READ_DATA but allowing a specified pulse length in software.



Figure 7c : Integrated Software Threshold data readout type


SI_READ_INTEG 	Read Integrated Software Threshold Data	"Extra" Data Type 4	
			Enter	D7.L	=	OnSiRoC number
				A2.L	=	Start address to Store Data
				D6.L	=	Integrated Software Threshold
						(overwritten on exit)
	 		Exit	D0.B	=	0 if executed normally
				D0.B	=	$FF Invalid OnSiRoC number
				D0.B	=	$BE Bus Error accessing OnSiRoC
				D0.B	=	$BA Bus Error finding store
				D0.B	=	$11 Invalid Pointer Counter value read
				D0.B	=	$22 Invalid Cluster size found
				D0.B	=	$27 Invalid length counter because of bad 						pointer memory value
				D0.B	=	$77 Invalid Raw Data found
				D6.L	=	Number of 32-bit words transferred
			On exit, if D0=0, then A2 points to next store address.
	This routine is the same as SI_READ_DATA but allowing a lower Hit detector threshold to be set for
	"glancing" tracks; the integrated sum of the cluster if performed and the hit-cluster only accepted if
 	the sum is greater than the software threshold value.






SI_TEST_SEQ 	Test  Sequencer	
			Enter	D7.L	=	OnSiRoC number
				D6.L	=	First random number
	 		Exit	D6.L	=	Next random number
				D0.B	=	0 if executed normally
				D0.B	=	$FF Invalid OnSiRoC number
				D0.B	=	$BE Bus Error accessing OnSiRoC
				D0.B	=	$CF Check Failure, with
				D3.L	=	Data Sent/written
				D4.L	=	Data Read back in Sequencer
		All tests generate a reproducible 32-bit random number sequence. 
		The more times a routine is called, the more randomised the test sequence.

SI_TEST_PED 	Test  Pedestal Memory
			Enter	D7.L	=	OnSiRoC number
				D6.L	=	First random number
	 		Exit	D6.L	=	Next random number
				D0.B	=	0 if executed normally
				D0.B	=	$FF Invalid OnSiRoC number
				D0.B	=	$BE Bus Error accessing OnSiRoC
				D0.B	=	$C1 Invalid Channel Counter 1
						ie, CC 1 not incremented correctly
				D0.B	=	$CF Check Failure, with
				D1.L	=	Next value of PIC+CC1
				D3.L	=	Data Sent/written
				D4.L	=	Data Read back from Pedestal memory

SI_TEST_POINT 	Test  Pointer Memory
			Enter	D7.L	=	OnSiRoC number
				D6.L	=	First random number
	 		Exit	D6.L	=	Next random number
				D0.B	=	0 if executed normally
				D0.B	=	$FF Invalid OnSiRoC number
				D0.B	=	$BE Bus Error accessing OnSiRoC
				D0.B	=	$C0 Invalid Pointer Counter 
						ie PC not incremented correctly
				D0.B	=	$C2 Invalid Channel Counter 2
						ie CC 2 not incremented correctly
				D0.B	=	$CF Check Failure, with
				D1.W	=	Next value of Channel Counter
				A2	=	Pointer Memory Register Address
				D3.L	=	Data Sent/written
				D4.L	=	Data Read back from Pointer memory

SI_TEST_RAW 	Test  Raw Data Memory
			Enter	D7.L	=	OnSiRoC number
				D6.L	=	First random number
	 		Exit	D6.L	=	Next random number
				D0.B	=	0 if executed normally
				D0.B	=	$FF Invalid OnSiRoC number
				D0.B	=	$BE Bus Error accessing OnSiRoC
				D0.B	=	$C2 Invalid Channel Counter 2
						ie CC 2 not incremented correctly
				D0.B	=	$CF Check Failure, with
				D1.W	=	Next value of Channel Counter
				A2	=	Raw Data Memory Register Address
				D3.L	=	Data Sent/written
				D4.L	=	Data Read back from Raw data memory

4.2. Remote Primitive Routines

The following drivers expand the basic primitive functionality to allow remote VMEtaxi crate access.

Routine Name	Description	Entry & Exit Arguments (Registers)

SI_RINIT 	Initialise OnSiRoC in Remote VMEtaxi crate	
			Enter	D1.L	=	Remote VMEtaxi crate number
				D7.L	=	OnSiRoC number
	 		Exit	D0.B	=	Returned value from XI_TRANSMIT

SI_RALL_INIT 	Initialise all OnSiRoCs in a Remote VMEtaxi crate	
			Enter	D1.L	=	Remote VMEtaxi crate number	
	 		Exit	D0.B	=	Returned value from XI_TRANSMIT
				D7.L	=	Bit pattern of OnSiRoCs found

SI_RSTAT 	Status of Remote OnSiRoC	
			Enter	D1.L	=	Remote VMEtaxi crate number
				D7.L	=	OnSiRoC number
	 		Exit	D0.B	=	Returned value from XI_TRANSMIT
				D1.W	=	Status register
				D2.L	=	Channel + Pipeline Counter 1
				D3.L	=	Channel + Pipeline Counter 2
				D4.L	=	Hit Detector Threshold
				D5.W	=	Cluster Detector Threshold

SI_RSET_VOLTS 	Set Bias Voltages of Remote OnSiRoC
			Enter	D1.L	=	Remote VMEtaxi crate number
				D7.L	=	OnSiRoC number
				D0.W	=	Bias Voltage 1 (8-bit)
				D2.W	=	Bias Voltage 2 (8-bit)
				D3.W	=	Bias Voltage 3 (8-bit)
				D4.W	=	Bias Voltage 4 (8-bit)
	 		Exit	D0.B	=	Returned value from XI_TRANSMIT
		Note that if a value of -1 is requested, that particular voltage is skipped.

SI_READ_CURR 	Read 8-bit currents of Remote OnSiRoC 
			Enter	D1.L	=	Remote VMEtaxi crate number
				D7.L	=	OnSiRoC number
	 		Exit	D0.B	=	Returned value from XI_TRANSMIT
				D1.W	=	Current 1
				D2.W	=	Current 2 
				D3.W	=	Current 3 
				D4.W	=	Current 4 

SI_RCTRL 	Set Control Registers of Remote OnSiRoC	
			Enter	D1.L	=	Remote VMEtaxi crate number
				D7.L	=	OnSiRoC number
				D0.W	=	Control Register 1
				D2.W	=	Control Register 2
	 		Exit	D0.B	=	Returned value from XI_TRANSMIT

SI_RCCPIC 	Set Channel & Pipeline Counters of Remote OnSiRoC	
			Enter	D1.L	=	Remote VMEtaxi crate number
				D7.L	=	OnSiRoC number
				D0.W	=	Channel Counter 1 (11-bit)
				D2.W	=	Channel Counter 2 (11-bit)
				D4.W	=	Pipeline Counter (5-bit)
	 		Exit	D0.B	=	Returned value from XI_TRANSMIT
		Note that if a PIC value ((D4) of -1 is requested, only the channel counters are set.

SI_RTHRESH 	Set Thresholds of Remote OnSiRoC
			Enter	D1.L	=	Remote VMEtaxi crate number
				D7.L	=	OnSiRoC number
				D4.L	=	Hit Detector Threshold
				D5.L	=	Cluster Detector Threshold
	 		Exit	D0.B	=	Returned value from XI_TRANSMIT

Remote Loading of Sequencer and Pedestal routines

SI_RLOAD_SEQ 	Load Sequencer of OnSiRoC in Remote VMEtaxi crate ... Remote Load
			Enter	D1.L	=	Remote VMEtaxi crate number
				D7.L	=	OnSiRoC number
				A1.L	=	Start address of Store (64*4 kbytes)
	 		Exit	D0.B	=	Returned value from XI_TRANSMIT
		In this routine the store is in the remote crate, with the address specified as that 		seen by the remote VMEtaxi.

SI_RLOAD_PED 	Load Pedestals of OnSiRoC in Remote VMEtaxi crate ... Remote Load
			Enter	D1.L	=	Remote VMEtaxi crate number
				D7.L	=	OnSiRoC number
				A1.L	=	Start address of Store (64*4 kbytes)
	 		Exit	D0.B	=	Returned value from XI_TRANSMIT
		In this routine the store is in the remote crate, with the address specified as that 		seen by the remote VMEtaxi.
	Pedestals are loaded in byte-blocks where each 32-bit word is in the OnSiRoC 4-3-2-1 format.
	First the Channel Counters, then the Pipeline is incremented according to the GAL on the OnSiRoC.
	On exit, if D0=0, then A1 points to next store address.. in case loading consecutive OnSiRoCs.


Local to Remote Loading of Sequencer and Pedestal routines

SI_LRLOAD_SEQ 	Load Sequencer of Remote OnSiRoC ... Local to Remote Load
			Enter	D1.L	=	Remote VMEtaxi crate number
				D7.L	=	OnSiRoC number
				A1.L	=	Start address of Store (64*4 kbytes)
	 		Exit	D0.B	=	Returned value from XI_TRANSMIT
		In this routine the store is in the local/master crate, with the address specified as 
		that seen by the local/master VMEtaxi.

SI_LRLOAD_PED 	Load Pedestals of Remote OnSiRoC ... Local to Remote Load
			Enter	D1.L	=	Remote VMEtaxi crate number
				D7.L	=	OnSiRoC number
				A1.L	=	Start address of Store (64*4 kbytes)
	 		Exit	D0.B	=	Returned value from XI_TRANSMIT
		In this routine the store is in the local/master crate, with the address specified as 
		that seen by the local/master VMEtaxi.
	On exit, if D0=0, then A1 points to next store address.. in case loading consecutive OnSiRoCs.

SI_LRLOAD_ALL 	Load All OnSiRoCs in a Remote VMEtaxi crate... Local to Remote Load
			Enter	D1.L	=	Remote VMEtaxi crate number
				A1.L	=	Pedestal Store (16*64*4 kbytes)
				A2.L	=	Sequencer Store (64*4 kbytes)
	 		Exit	D0.B	=	Returned value from XI_TRANSMIT
		In this routine the stores are in the local/master crate, with the start addresses 		specified as those seen by the local/master VMEtaxi.
	This primitive loads all pedestals and sequencer code from a common local store into all of the
 	OnSiRoCs found in a remote crate. The pedestal store is assumed continguous for a full 16-OnSiRoC 
	system crate, commencing at OnSiRoC number 0. Controllers not found are skipped by incrementing 
	the store counter appropriately, allowing OnSiRoCs to be removed and re-inserted at will.
	Pedestals are loaded in byte-blocks where each 32-bit word is in the OnSiRoC 4-3-2-1 format.
	Note that the SiDAQ warm-start procedure calls this routine for each VMEtaxi crate set by SIMASK;
	pedestals are assumed stored contiguously starting at the first crate for full consecutive crates.

Remote to Remote Loading of Sequencer and Pedestal routines

SI_RRLOAD_SEQ 	Load Sequencer of Remote OnSiRoC ... Remote to Remote Load
			Enter	D1.L	=	Remote VMEtaxi number; OnSiRoC crate
				D7.L	=	OnSiRoC number
				A1.L	=	Start address of Store (64*4 kbytes)
				D6.L	=	Remote VMEtaxi number; Store address
	 		Exit	D0.B	=	Returned value from XI_TRANSMIT
		In this routine the store is in a separate remote VMEtaxi crate, with the address 		specified as seen by that VMEtaxi.

SI_RRLOAD_PED 	Load Pedestals of Remote OnSiRoC ... Remote to Remote Load
			Enter	D1.L	=	Remote VMEtaxi number; OnSiRoC crate
				D7.L	=	OnSiRoC number
				A1.L	=	Start address of Store (64*4 kbytes)
				D6.L	=	Remote VMEtaxi number; Store address
	 		Exit	D0.B	=	Returned value from XI_TRANSMIT
		In this routine the store is in a separate remote VMEtaxi crate, with the address 		specified as seen by that VMEtaxi.



[Index] [Back] [Next]