merge 64-bit fixes from Fernando Lucas Rodriguez <fernando_lr@terra.es>
[debian/gcpegg] / reg.h
1 /*
2
3         Random event generator definitions
4
5         This file contains definitions common to all random
6         event generators.  All implement the interface defined
7         here.
8
9 */
10
11
12 typedef struct {
13     uint16 type;                      /* Device type code (allows supporting
14                                          multiple devices with common driver
15                                          code). */
16     uint16 port;                      /* Port ID.  Meaning depends on nature
17                                          of hardware, and may mean nothing at
18                                          all. */
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. */
24 } DevOpts;
25
26 typedef struct {
27     char *reg_name;                   /* Name of REG, corresponding to
28                                          the name on the REG statement
29                                          in .eggrc */
30     uint16 reg_type;                  /* REG type code, corresponding
31                                          to type field in the DevOpts
32                                          structure. */
33
34     /* The following functions are used to call the methods
35        of the REG device driver. */
36
37     /* Open a device. 
38
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. */
42
43     int32 (*reg_OpenDev)(DevOpts *opts);
44
45     /* Evaluate speed.
46
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
50        data rate. */
51
52     int32 (*reg_EvalSpeed)(int32 dd);
53
54     /* Sample from a device.
55
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. */
60
61     int32 (*reg_Sample)(int32 dd, uint16 bits);
62
63     /* Discard spare data from device.
64
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. */
68
69     int32 (*reg_Discard)(int32 dd);
70
71     /* Close a device.
72
73        Closes a specified device handle. */
74
75     int32 (*reg_CloseDev)(int32 dd);
76 } REG_driver;