Revision: - Author:
One device handles one CUB card and its’ mezzanine card.
The server communicates to the card thanks to CUB linux device driver (see: /segfs/linux/drivers/cubdrv/v0.3/doc), and actually does not work with interrupt handling but make polling instead.
The incoming data from the Machine timing can come at 1 Hz or 10 Hz, therefore the polling rate has been set to 50 milli-seconds. Internal to the device server the polling is handled by a thread.
1.
CUB card interface
Only the IMBs and OMBs registers (see: AMCC documentation) of the CUB card are used to communicates and are assigned like the following:
q OMB1: Not used
q OMB2: Bits 3-0: Interlock value
Bit 4: Interlock sign
q OMB3: Bits 15-0: SR2 Convolution window delay (16 bits unsigned)
Bits 23-16: SR1 Convolution window delay (8 bits unsigned)
Bits 31-24: TL2 Convolution window delay (8 bits unsigned)
q OMB4: Bits 6-0: Analog Input 1 value (7 bits unsigned)
Bit2 14-8: Analog Input 2 value (7 bits unsigned)
Bit2 19-16: Analog Input 3 value (4 bits unsigned)
Bit2 30-24: Analog Input 4 value (7 bits unsigned)
q IMB1: Bits 15-0: SR2 – SR1 (16 bits signed)
Bits 31-16: Empty
q IMB2: Bits 15-0: TL2 Load (16 bits signed)
Bits 31-16: TL2 * TL2 (16 bits unsigned)
q IMB3: Bits 15-0: Current Average (16 bits unsigned)
Bits 31-16: Current Delta (16 bits signed)
q IMB4: Card Status Register
· Bit 0: Overflow Analog Input 1 (reserved)
· Bit 1: Overflow Analog Input 2
· Bit 2: Overflow Analog Input 3
· Bit 3: Overflow Analog Input 4 (reserved)
· Bit 4: Interlock relay 1
· Bit 5: Interlock relay 2 (reserved)
·
Bit 6: Injection
mode
· Bit 14: Can’t read IMBs registers (added by software)
· Bit 15: Software detect an overrun ( added by software)
· Bit 16-23: Synchronisation counter. This counter is incremented by one when new data arrives. The polling thread checks this value. If the value is the same than the previous one, there is no new data. If the value has been incremented by more than one, that means that the software has lost data, therefore an error is reported in bit 15 on the status register.
· Bit 24: Power supplies status
2.
Internal data organisation, commands and attribute data return format.
When the polling thread detects that a new set of data is valid, it read all the raw data from the CUB card (see definition above), calculates some results and store them in an internal circular buffer. This buffer can be read by the commands DevReadValues() or DevReadLastValue() and also with the Data attribute. The DevReadValues() command and read attribut Data returns all the acquired data and discard them, therefore the client should paid attention if the two reading methods are used at the same time.
If the client does not read enough faster the oldest values are destroyed.
The DevReadLastValue() command read only the last acquired data set and the data are not discarded.
The internal organisation and also the data organisation format returned form that commands and attribute are the following:
[0]:
CUB status: Read
from CUB + Bits 14 and 15 added
from the device server
[1]: SR2 - SR1: Extracted
from CUB IMB1 -LSW
[2]: TL2 * TL2: Extracted
from CUB IMB2 -LSW
[3]: TL2 Load: Extracted
from CUB IMB2 -MSW
[4]: Current
Average Extracted
from CUB IMB3 -LSW
[5]: Current
Delta Extracted
from CUB IMB3 -MSW
[6]: Averaged
Current Delta Value averaged on the N last values (N=120 per default)
[7]: Transfer
Efficiency * 1000000
Calculated with: (SR2minusSR1 * CalibrationFactor) / TL2multTL2. With CalibrationFactor
equal 1.0 at the moment.
[8]: - In
injection mode at 10 Hz: Averaged
Transfer Efficiency * 1000000
- In injection mode at 1 Hz: Transfer Efficiency calculated with the max of TL2 * TL2 and SR2-SR1 of the last N values
(N=10 per default)
-
In Lifetime mode: Empty
[9]: Lifetime * 1000000 in Lifetime mode. Otherwise empty
[10]: Max of TL2 * TL2 in Injection mode at 1 Hz. Otherwise empty
[11]: SR2 - SR1 corresponding to the max of TL2 * TL2 in Injection mode at 1 Hz. Otherwise empty
3.
Errors handling
The device server memorise the errors and warnings occurring during the run time. These errors are cumulated and returned when the DevStatus() command is issued in the form of a sting like the following one: “WARNING: OVERRUN, OVF CH2, OVF CH4”.
These errors are reset by this command.