Library of functions

From PolWiki
Revision as of 08:49, 28 January 2010 by Narayan (talk | contribs) (New page: These are the library of functions for the v1495 slave boards. v1495cpInit(''laddr''): This function initializes the board by # reseting all the buffers # checking board ID's # check...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

These are the library of functions for the v1495 slave boards.

v1495cpInit(laddr):

This function initializes the board by

  1. reseting all the buffers
  2. checking board ID's
  3. checking firmware revision number

(as a first level sanity check to ensure that the board has got the correct address)

Parameter: laddr corresponds to the local address on the VME bus that will be used to identify this board physically in the crate. This can be obtained by using the sysBusToLocalAddrs function of VxWrks

Return: nothing

v1495cpBufReset()

This function explicitly flushes the buffers of v1495 and can be used in the 'GO' routine of the corresponding ROC.

Parameter: none

Return: none

v1495cpFirmwareRevision() 

This function explicitly states out the firmware revision number, this information should go in each CODA run, to cover for the possibility of a subsequent change in the firmware after we start taking data.

Parameter: none

Return: none

v1495cpStatusPrint()

This function prints out

  1. the current Mask for A, B, D & E ports (normally should be 0xFFFFFFFF)
  2. the current pulse-width of the Trigger logic signal (in terms of no.of clock ticks 25 ns wide)
  3. the current pulse-width of the Pipeline delay signal(in terms of no.of clock ticks 25 ns wide)
  4. the current pulse-width of the Holdoff signaland (in terms of no.of clock ticks 25 ns wide)
  5. the set Delay for Pipeline delay (in terms of no.of clock ticks 25 ns wide)
  6. the no.of planes we are triggering on currently (1, 2, 3 or 4)

Parameter: none

Return: none

v1495cpSetWidth(PWTL, PWDL, HoldOff, Delay)

This function sets the:

  1. pulse-width of Trigger signal (*1)=> a max of 15 (equivalent to 375 ns)
  2. pulse-width of the signal in Pipeline delay => a max of 15
  3. HoldOff time of the circuit => a max of 256 (equivalent to 6.4 us)
  4. Delay induced through the Pipeline-delay => a max of 256

Parameters: integer values for PWTL, PWDL, HoldOff and Delay (PWTL & PWDL stand for Pulse Width of Trigger-Logic and Delay-Line signal)

Return: 4


v1495cpTrigChoice(Trigger choice)

This function sets the number of board which we use to form the trigger decision.

Parameter: accepts an integer number from 1 to 4 and directly corresponds to the number of board required for forming the Trigger.

Return: the value of Trigger choice as entered is returned.


v1495cpSetMask (A-MASK, B-MASK, D-MASK, E-MASK) 

This function sets the Mask for respective ports to disable any particular strip number of a particular plane.

Parameters: It takes exact masking pattern as an input in hexadecimal format.

Return: none

v1495cpBufStat()

This function finds the number of words currently stored in the buffer, which are ready to be read. This needs to be called every time before a data read function is called

Parameter: none

Return: '0' if the Buffer status is okay and a finite number if the buffer has overflown or if there is no data while it is trying to be read.

v1495cpRdBufA(pointer bufferA)

The function v1495cpBufStat() needs to be called before calling this set of functions.

This function is called by the ROC when it gets a valid trigger.

This function reads out the 32 bit hit pattern out of the VME backplane from the buffer for the A-port of v1495 board.

In case, while trying to read out the data the buffer is found empty, a fixed hexadecimal word 0xFFFFFFF0 is put into the data stream corresponding to this trigger.

Parameter: a 32 bit pointer address of the data buffer, where you want to store this data.

Return: 1, if successfully executed.

v1495cpRdBufB(pointer bufferB)

This function reads out the 32 bit hit pattern out of the VME backplane from the buffer for the B-port of v1495 board.

In case, while trying to read out the data the buffer is found empty, a fixed hexadecimal word 0xFFFFFFF1 is put into the data stream corresponding to this trigger.

Parameter: a 32 bit pointer address of the data buffer, where you want to store this data.

Return: 1, if successfully executed.

v1495cpRdBufD(pointer bufferD)

This function reads out the 32 bit hit pattern out of the VME backplane from the buffer for the D-port of v1495 board.

In case, while trying to read out the data the buffer is found empty, a fixed hexadecimal word 0xFFFFFFF2 is put into the data stream corresponding to this trigger.

Parameter: a 32 bit pointer address of the data buffer, where you want to store this data.

Return: 1, if successfully executed.

v1495cpRdBufE(pointer bufferE)

This function reads out the 32 bit hit pattern out of the VME backplane from the buffer for the E-port of v1495 board.

In case, while trying to read out the data the buffer is found empty, a fixed hexadecimal word 0xFFFFFFF3 is put into the data stream corresponding to this trigger.

Parameter: a 32 bit pointer address of the data buffer, where you want to store this data.

Return: 1, if successfully executed.

v1495cpDatainA(pointer A)

This function reads out the accumulated counts in all of the 32 strips going into A-port. The counts accumulated, starting from the (say)0th strip of detector (say plane 1) goes at the top of the address pointed by this data buffer pointer and increments successively.

Parameter: a 32 bit pointer address of the data buffer, from where the next consecutive 31 address spaces can be occupied by the data from the next 31 strips.

Return: 1 , if executed successfully

v1495cpDatainB(pointer B)

This function reads out the accumulated counts in all of the 32 strips going into B-port. The counts that are accumulated, starting from the (say)0th strip of detector (say plane 2) goes at the top of the address pointed by this data buffer pointer and increments successively.

Parameter: a 32 bit pointer address of the data buffer, from where the next consecutive 31 address spaces can be occupied by the data from the next 31 strips.

Return: 1 , if executed successfully

v1495cpDatainD(pointer D)

This function reads out the accumulated counts in all of the 32 strips going into D-port. The counts that are accumulated, starting from the (say)0th strip of detector (say plane 3) goes at the top of the address pointed by this data buffer pointer and increments successively.

Parameter: a 32 bit pointer address of the data buffer, from where the next consecutive 31 address spaces can be occupied by the data from the next 31 strips.

Return: 1 , if executed successfully


v1495cpDatainE(pointer E)	

This function reads out the accumulated counts in all of the 32 strips going into E-port. The counts that are accumulated, starting from the (say)0th strip of detector (say plane 4) goes at the top of the address pointed by this data buffer pointer and increments successively.

Parameter: a 32 bit pointer address of the data buffer, from where the next consecutive 31 address spaces can be occupied by the data from the next 31 strips.

Return: 1 , if executed successfully

                                       ... some temporary test functions