File: reg.h

package info (click to toggle)
gcpegg 5.1-14
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 324 kB
  • ctags: 439
  • sloc: ansic: 3,726; makefile: 97; sh: 33; csh: 21
file content (76 lines) | stat: -rw-r--r-- 2,255 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*

	Random event generator definitions

	This file contains definitions common to all random
	event generators.  All implement the interface defined
	here.

*/


typedef struct {
    uint16 type;		      /* Device type code (allows supporting
					 multiple devices with common driver
					 code). */
    uint16 port;		      /* Port ID.  Meaning depends on nature
					 of hardware, and may mean nothing at
					 all. */
    uint32 baud;		      /* Baud rate for devices connected to
					 a serial port.  This may have a
					 different meaning for devices
					 connected to, for example, a
					 parallel port or SCSI string. */
} DevOpts;

typedef struct {
    char *reg_name;		      /* Name of REG, corresponding to
					 the name on the REG statement
					 in .eggrc */
    uint16 reg_type;		      /* REG type code, corresponding
					 to type field in the DevOpts
					 structure. */

    /* The following functions are used to call the methods
       of the REG device driver. */

    /* Open a device. 

       DevOpts should contain any necessary information to determine how
       this is to be done.  The return value, if >= 0, is a device handle.
       Otherwise it indicates an error. */

    int32 (*reg_OpenDev)(DevOpts *opts);

    /* Evaluate speed.

       dd is the device handle returned by opening the device.	The
       function returns the estimated number of bits/second that the
       device will produce, which should be used as a limit in setting the
       data rate. */

    int32 (*reg_EvalSpeed)(int32 dd);

    /* Sample from a device.

       dd is the device handle returned by opening the device.	The number
       of bits requested will be sampled from the device immediately
       (waiting as needed to collect the data, with no discards) and the
       result will be returned. */

    int32 (*reg_Sample)(int32 dd, uint16 bits);

    /* Discard spare data from device.

       dd is the device handle returned by opening the device.	The input
       stream is consumed until a wait would be required.  The number of
       bits discarded is returned. */

    int32 (*reg_Discard)(int32 dd);

    /* Close a device.

       Closes a specified device handle. */

    int32 (*reg_CloseDev)(int32 dd);
} REG_driver;