palio.devices
Class Quantis

java.lang.Object
  extended by palio.devices.Quantis

public class Quantis
extends java.lang.Object

Klasa reazlizująca dostęp do urządzenia Quantis - sprzętowy generator liczb losowych


Constructor Summary
Quantis()
           
 
Method Summary
static void main(java.lang.String[] args)
           
 int quantisBoardReset(int cardNumber)
          This function takes the card number as a parameter.
 int quantisBoardVersion(int cardNumber)
          This function takes the card number as a parameter and returns the version of the board, or 0 (which is an invalid version number) when an error occurred.
 int quantisCount()
          Returns the number of cards installed in the system.
 int quantisDriverVersion(int cardNumber)
          This function returns the version of the Quantis driver.
 int quantisGetModules(int cardNumber)
          This function takes the card number as a parameter.
 int quantisLibVersion(int cardNumber)
          This function returns the version of the library.
 int quantisModulesDisable(int cardNumber, int moduleMask)
          This function takes the card number as first parameter, and the mask of the modules to disable as second parameter.
 int quantisModulesEnable(int cardNumber, int moduleMask)
          This function takes the card number as first parameter, and the mask of the modules to enable as second parameter.
 int quantisModulesReset(int cardNumber, int moduleMask)
          This function takes the card number as first parameter, and the mask of the modules to reset as second parameter.
 int quantisModulesStatus(int cardNumber)
          This function takes the card number as first parameter.
 int quantisRead(int cardNumber, byte[] buffer, int size)
          This function takes the card number as first parameter, a pointer to a destination buffer in memory as second argument, and the number of bytes to read from the board as third parameter.
 int quantisSetTestMode(int cardNumber, int enable)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Quantis

public Quantis()
Method Detail

quantisCount

public int quantisCount()
Returns the number of cards installed in the system. If an error occured, the function returns 0 (we assume that no card are installed in the system)


quantisGetModules

public int quantisGetModules(int cardNumber)
This function takes the card number as a parameter. The return value is a bitmask of the modules present on the card. Bit 0 is set when module 0 is present, bit 1 when module 1 is present, bit 2 when module 2 is present and bit 3 when module 3 is present. For example, a return value of `101' in binary (5 in decimal) shows that module 0 and module 2 are present. If the card is not present or an error occured, a bitmask of 0 is returned (no modules installed).


quantisBoardReset

public int quantisBoardReset(int cardNumber)
This function takes the card number as a parameter. It resets the board, setting all values to their initial state and enabling all the modules present on the card. The function returns 0 on success, and a negative value on error. Normally, this function does not need to be called, as the board is reset on driver loading (on unix systems) or dll loading (on windows systems).


quantisModulesEnable

public int quantisModulesEnable(int cardNumber,
                                int moduleMask)
This function takes the card number as first parameter, and the mask of the modules to enable as second parameter. The mask is similar to the bitmask given as second argument to `quantisModulesReset'. This function returns 0 on success, and -1 if an error occured. After a call to `quantisModulesEnable', reading from the Quantis board using `quantisRead' will also read from the enabled modules in addition to the already enabled modules.


quantisModulesDisable

public int quantisModulesDisable(int cardNumber,
                                 int moduleMask)
This function takes the card number as first parameter, and the mask of the modules to disable as second parameter. The mask is similar to the bitmask given as second argument to `quantisModulesReset'. This function returns 0 on success, and -1 if an error occured. After a call to `quantisModulesDisable', reading from the Quantis board using `quantisRed' will not read from the disabled modules anymore.


quantisModulesReset

public int quantisModulesReset(int cardNumber,
                               int moduleMask)
This function takes the card number as first parameter, and the mask of the modules to reset as second parameter. The mask is similar to the bitmask returned by the `quantisGetModules' function, bit 0 corresponds to module 0, bit 1 to module 1, bit 2 to module 2, bit 3 to module 3. The modules for which the bitmask is set are reset. This function returns 0 on success, and -1 if an error occured. This function first disables the modules by calling `quantisModulesDisable' and then enables the modules by calling `quantisModulesEnable'. Thus, only the reset modules will be enabled after a call to `quantisModulesReset'.


quantisBoardVersion

public int quantisBoardVersion(int cardNumber)
This function takes the card number as a parameter and returns the version of the board, or 0 (which is an invalid version number) when an error occurred. The version is a 4 bytes number in the format: `[year][month][day][r]' `31..24 23..16 15..8 7..0' where `r' indicates the release number of the day.


quantisLibVersion

public int quantisLibVersion(int cardNumber)
This function returns the version of the library. The version is a decimal number composed of the major number and the minor version: `version = major * 10 + minor'.


quantisDriverVersion

public int quantisDriverVersion(int cardNumber)
This function returns the version of the Quantis driver. The version is a decimal number composed of the major number and the minor version: `version = major * 10 + minor'. It returns 0 (which is an invalid version number) when an error occured or no card could be found.


quantisRead

public int quantisRead(int cardNumber,
                       byte[] buffer,
                       int size)
This function takes the card number as first parameter, a pointer to a destination buffer in memory as second argument, and the number of bytes to read from the board as third parameter. This function returns the number of bytes read on success, and -1 on error. In case of success, it always returns the exact number of bytes requested. Please note with PCI version that reading a single random byte is inefficient, as the FIFO of the PCI board is read in 32 bytes chunk. For high-throughput, multiples of 4 bytes should be read from the PCI board or the USB device.


quantisSetTestMode

public int quantisSetTestMode(int cardNumber,
                              int enable)

quantisModulesStatus

public int quantisModulesStatus(int cardNumber)
This function takes the card number as first parameter. This function returns the status of the modules on the card as a bitmask similar to the second argument to `quantisModulesReset'. A set bit signals the module is in a correct state. It returns -1 on error. This function returns only the status of the modules that are currently enabled.


main

public static void main(java.lang.String[] args)