3 Random event generator definitions
5 This file contains definitions common to all random
6 event generators. All implement the interface defined
13 uint16 type; /* Device type code (allows supporting
14 multiple devices with common driver
16 uint16 port; /* Port ID. Meaning depends on nature
17 of hardware, and may mean nothing at
19 uint32 baud; /* Baud rate for devices connected to
20 a serial port. This may have a
21 different meaning for devices
22 connected to, for example, a
23 parallel port or SCSI string. */
27 char *reg_name; /* Name of REG, corresponding to
28 the name on the REG statement
30 uint16 reg_type; /* REG type code, corresponding
31 to type field in the DevOpts
34 /* The following functions are used to call the methods
35 of the REG device driver. */
39 DevOpts should contain any necessary information to determine how
40 this is to be done. The return value, if >= 0, is a device handle.
41 Otherwise it indicates an error. */
43 int32 (*reg_OpenDev)(DevOpts *opts);
47 dd is the device handle returned by opening the device. The
48 function returns the estimated number of bits/second that the
49 device will produce, which should be used as a limit in setting the
52 int32 (*reg_EvalSpeed)(int32 dd);
54 /* Sample from a device.
56 dd is the device handle returned by opening the device. The number
57 of bits requested will be sampled from the device immediately
58 (waiting as needed to collect the data, with no discards) and the
59 result will be returned. */
61 int32 (*reg_Sample)(int32 dd, uint16 bits);
63 /* Discard spare data from device.
65 dd is the device handle returned by opening the device. The input
66 stream is consumed until a wait would be required. The number of
67 bits discarded is returned. */
69 int32 (*reg_Discard)(int32 dd);
73 Closes a specified device handle. */
75 int32 (*reg_CloseDev)(int32 dd);