]> sigrok.org Git - libsigrok.git/blob - src/scpi/vxi.x
scpi_vxi: fix memory leak for SCPI response data in VXI support code
[libsigrok.git] / src / scpi / vxi.x
1 /* This is taken straight from Appendix C of the specification */
2
3 typedef long Device_Link;
4
5 enum Device_AddrFamily {
6         DEVICE_TCP,
7         DEVICE_UDP
8 };
9
10 typedef long Device_Flags;
11
12 typedef long Device_ErrorCode;
13
14 struct Device_Error {
15         Device_ErrorCode  error;
16 };
17
18 struct Create_LinkParms {
19         long              clientId;      /* implementation specific value */
20         bool              lockDevice;    /* attempt to lock the device */
21         unsigned long     lock_timeout;  /* time to wait on a lock */
22         string            device<>;      /* name of device */
23 };
24
25 struct Create_LinkResp {
26         Device_ErrorCode  error;
27         Device_Link       lid;
28         unsigned short    abortPort;     /* for the abort RPC */
29         unsigned long     maxRecvSize;   /* specifies max data size in bytes
30                                             device will accept on a write */
31 };
32
33 struct Device_WriteParms {
34         Device_Link       lid;           /* link id from create_link */
35         unsigned long     io_timeout;    /* time to wait for I/O */
36         unsigned long     lock_timeout;  /* time to wait for lock */
37         Device_Flags      flags;
38         opaque            data<>;        /* data length and the data itself */
39 };
40
41 struct Device_WriteResp {
42         Device_ErrorCode  error;
43         unsigned          long size;     /* number of bytes written */
44 };
45
46 struct Device_ReadParms {
47         Device_Link       lid;           /* link id from create_link */
48         unsigned long     requestSize;   /* bytes requested */
49         unsigned long     io_timeout;    /* time to wait for I/O */
50         unsigned long     lock_timeout;  /* time to wait for lock */
51         Device_Flags      flags;
52         char              termChar;      /* valid if flags & termchrset */
53 };
54
55 struct Device_ReadResp {
56         Device_ErrorCode  error;
57         long              reason;        /* reason(s) read completed */
58         opaque            data<>;        /* data.len and data.val */
59 };
60
61 struct Device_ReadStbResp {
62         Device_ErrorCode  error;         /* error code */
63         unsigned char     stb;           /* the returned status byte */
64 };
65
66 struct Device_GenericParms {
67         Device_Link       lid;           /* Device_Link id from connect call */
68         Device_Flags      flags;         /* flags with options */
69         unsigned long     lock_timeout;  /* time to wait for lock */
70         unsigned long     io_timeout;    /* time to wait for I/O */
71 };
72
73 struct Device_RemoteFunc {
74         unsigned long     hostAddr;      /* host servicing interrupt */
75         unsigned short    hostPort;      /* valid port # on client */
76         unsigned long     progNum;       /* DEVICE_INTR */
77         unsigned long     progVers;      /* DEVICE_INTR_VERSION */
78         Device_AddrFamily progFamily;    /* DEVICE_UDP | DEVICE_TCP */
79 };
80
81 struct Device_EnableSrqParms {
82         Device_Link       lid;
83         bool              enable;        /* enable or disable interrupts */
84         opaque            handle<40>;    /* host specific data */
85 };
86
87 struct Device_LockParms {
88         Device_Link       lid;           /* link id from create_link */
89         Device_Flags      flags;         /* contains the waitlock flag */
90         unsigned long     lock_timeout;  /* time to wait to acquire lock */
91 };
92
93 struct Device_DocmdParms {
94         Device_Link       lid;           /* link id from create_link */
95         Device_Flags      flags;         /* flags specifying various options */
96         unsigned long     io_timeout;    /* time to wait for I/O to complete */
97         unsigned long     lock_timeout;  /* time to wait on a lock */
98         long              cmd;           /* which command to execute */
99         bool              network_order; /* client's byte order */
100         long              datasize;      /* size of individual data elements */
101         opaque            data_in<>;     /* docmd data parameters */
102 };
103
104 struct Device_DocmdResp {
105         Device_ErrorCode  error;         /* returned status */
106         opaque            data_out<>;    /* returned data parameter */
107 };
108
109 struct Device_SrqParms {
110         opaque            handle<>;
111 };
112
113 program DEVICE_ASYNC{
114         version DEVICE_ASYNC_VERSION {
115                 Device_Error       device_abort(Device_Link)               =  1;
116         } = 1;
117 } = 0x0607B0;
118
119 program DEVICE_CORE {
120         version DEVICE_CORE_VERSION {
121                 Create_LinkResp    create_link(Create_LinkParms)           = 10;
122                 Device_WriteResp   device_write(Device_WriteParms)         = 11;
123                 Device_ReadResp    device_read(Device_ReadParms)           = 12;
124                 Device_ReadStbResp device_readstb(Device_GenericParms)     = 13;
125                 Device_Error       device_trigger(Device_GenericParms)     = 14;
126                 Device_Error       device_clear(Device_GenericParms)       = 15;
127                 Device_Error       device_remote(Device_GenericParms)      = 16;
128                 Device_Error       device_local(Device_GenericParms)       = 17;
129                 Device_Error       device_lock(Device_LockParms)           = 18;
130                 Device_Error       device_unlock(Device_Link)              = 19;
131                 Device_Error       device_enable_srq(Device_EnableSrqParms)= 20;
132                 Device_DocmdResp   device_docmd(Device_DocmdParms)         = 22;
133                 Device_Error       destroy_link(Device_Link)               = 23;
134                 Device_Error       create_intr_chan(Device_RemoteFunc)     = 25;
135                 Device_Error       destroy_intr_chan(void)                 = 26;
136         } = 1;
137 } = 0x0607AF;
138
139 program DEVICE_INTR {
140         version DEVICE_INTR_VERSION {
141                 void               device_intr_srq(Device_SrqParms)        = 30;
142         } = 1;
143 } = 0x0607B1;