2 * Copyright (c) 2005 Poul-Henning Kamp
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * This file merely redirects to the file in <dev/ieee488/ugpib.h>
34 #include <sys/types.h>
37 #include <dev/ieee488/ugpib.h>
38 #include <dev/ieee488/ibfoo_int.h>
40 int ibcnt, iberr, ibsta;
45 __ibsubmit(struct ibarg *ap)
50 fd = open("/dev/gpib0ib", O_RDWR);
52 err(1, "Could not open /dev/gpib0ib");
53 i = ioctl(fd, GPIB_IBFOO, ap);
55 err(1, "GPIB_IBFOO(%d, 0x%x) failed", ap->__ident, ap->__field);
59 return (ap->__retval);
63 ibask (int handle, int option, int * retval)
67 io.__ident = __ID_IBASK;
71 io.__field = __F_HANDLE | __F_OPTION | __F_RETVAL;
72 return (__ibsubmit(&io));
76 ibbna (int handle, char * bdname)
80 io.__ident = __ID_IBBNA;
83 io.__field = __F_HANDLE | __F_BDNAME;
84 return (__ibsubmit(&io));
88 ibcac (int handle, int v)
92 io.__ident = __ID_IBCAC;
95 io.__field = __F_HANDLE | __F_V;
96 return (__ibsubmit(&io));
104 io.__ident = __ID_IBCLR;
106 io.__field = __F_HANDLE;
107 return (__ibsubmit(&io));
111 ibcmd (int handle, void * buffer, long cnt)
115 io.__ident = __ID_IBCMD;
119 io.__field = __F_HANDLE | __F_BUFFER | __F_CNT;
120 return (__ibsubmit(&io));
124 ibcmda (int handle, void * buffer, long cnt)
128 io.__ident = __ID_IBCMDA;
132 io.__field = __F_HANDLE | __F_BUFFER | __F_CNT;
133 return (__ibsubmit(&io));
137 ibconfig (int handle, int option, int value)
141 io.__ident = __ID_IBCONFIG;
145 io.__field = __F_HANDLE | __F_OPTION | __F_VALUE;
146 return (__ibsubmit(&io));
150 ibdev (int boardID, int pad, int sad, int tmo, int eot, int eos)
154 io.__ident = __ID_IBDEV;
155 io.boardID = boardID;
161 io.__field = __F_BOARDID | __F_PAD | __F_SAD | __F_TMO | __F_EOT | __F_EOS;
162 return (__ibsubmit(&io));
166 ibdiag (int handle, void * buffer, long cnt)
170 io.__ident = __ID_IBDIAG;
174 io.__field = __F_HANDLE | __F_BUFFER | __F_CNT;
175 return (__ibsubmit(&io));
179 ibdma (int handle, int v)
183 io.__ident = __ID_IBDMA;
186 io.__field = __F_HANDLE | __F_V;
187 return (__ibsubmit(&io));
191 ibeos (int handle, int eos)
195 io.__ident = __ID_IBEOS;
198 io.__field = __F_HANDLE | __F_EOS;
199 return (__ibsubmit(&io));
203 ibeot (int handle, int eot)
207 io.__ident = __ID_IBEOT;
210 io.__field = __F_HANDLE | __F_EOT;
211 return (__ibsubmit(&io));
215 ibevent (int handle, short * event)
219 io.__ident = __ID_IBEVENT;
222 io.__field = __F_HANDLE | __F_EVENT;
223 return (__ibsubmit(&io));
227 ibfind (char * bdname)
231 io.__ident = __ID_IBFIND;
233 io.__field = __F_BDNAME;
234 return (__ibsubmit(&io));
238 ibgts (int handle, int v)
242 io.__ident = __ID_IBGTS;
245 io.__field = __F_HANDLE | __F_V;
246 return (__ibsubmit(&io));
250 ibist (int handle, int v)
254 io.__ident = __ID_IBIST;
257 io.__field = __F_HANDLE | __F_V;
258 return (__ibsubmit(&io));
262 iblines (int handle, short * lines)
266 io.__ident = __ID_IBLINES;
269 io.__field = __F_HANDLE | __F_LINES;
270 return (__ibsubmit(&io));
278 io.__ident = __ID_IBLLO;
280 io.__field = __F_HANDLE;
281 return (__ibsubmit(&io));
285 ibln (int handle, int padval, int sadval, short * listenflag)
289 io.__ident = __ID_IBLN;
293 io.listenflag = listenflag;
294 io.__field = __F_HANDLE | __F_PADVAL | __F_SADVAL | __F_LISTENFLAG;
295 return (__ibsubmit(&io));
303 io.__ident = __ID_IBLOC;
305 io.__field = __F_HANDLE;
306 return (__ibsubmit(&io));
310 ibonl (int handle, int v)
314 io.__ident = __ID_IBONL;
317 io.__field = __F_HANDLE | __F_V;
318 return (__ibsubmit(&io));
322 ibpad (int handle, int v)
326 io.__ident = __ID_IBPAD;
329 io.__field = __F_HANDLE | __F_V;
330 return (__ibsubmit(&io));
338 io.__ident = __ID_IBPCT;
340 io.__field = __F_HANDLE;
341 return (__ibsubmit(&io));
345 ibpoke (int handle, int option, int value)
349 io.__ident = __ID_IBPOKE;
353 io.__field = __F_HANDLE | __F_OPTION | __F_VALUE;
354 return (__ibsubmit(&io));
358 ibppc (int handle, int v)
362 io.__ident = __ID_IBPPC;
365 io.__field = __F_HANDLE | __F_V;
366 return (__ibsubmit(&io));
370 ibrd (int handle, void * buffer, long cnt)
374 io.__ident = __ID_IBRD;
378 io.__field = __F_HANDLE | __F_BUFFER | __F_CNT;
379 return (__ibsubmit(&io));
383 ibrda (int handle, void * buffer, long cnt)
387 io.__ident = __ID_IBRDA;
391 io.__field = __F_HANDLE | __F_BUFFER | __F_CNT;
392 return (__ibsubmit(&io));
396 ibrdf (int handle, char * flname)
400 io.__ident = __ID_IBRDF;
403 io.__field = __F_HANDLE | __F_FLNAME;
404 return (__ibsubmit(&io));
408 ibrdkey (int handle, void * buffer, int cnt)
412 io.__ident = __ID_IBRDKEY;
416 io.__field = __F_HANDLE | __F_BUFFER | __F_CNT;
417 return (__ibsubmit(&io));
421 ibrpp (int handle, char * ppr)
425 io.__ident = __ID_IBRPP;
428 io.__field = __F_HANDLE | __F_PPR;
429 return (__ibsubmit(&io));
433 ibrsc (int handle, int v)
437 io.__ident = __ID_IBRSC;
440 io.__field = __F_HANDLE | __F_V;
441 return (__ibsubmit(&io));
445 ibrsp (int handle, char * spr)
449 io.__ident = __ID_IBRSP;
452 io.__field = __F_HANDLE | __F_SPR;
453 return (__ibsubmit(&io));
457 ibrsv (int handle, int v)
461 io.__ident = __ID_IBRSV;
464 io.__field = __F_HANDLE | __F_V;
465 return (__ibsubmit(&io));
469 ibsad (int handle, int sad)
473 io.__ident = __ID_IBSAD;
476 io.__field = __F_HANDLE | __F_SAD;
477 return (__ibsubmit(&io));
481 ibsgnl (int handle, int v)
485 io.__ident = __ID_IBSGNL;
488 io.__field = __F_HANDLE | __F_V;
489 return (__ibsubmit(&io));
497 io.__ident = __ID_IBSIC;
499 io.__field = __F_HANDLE;
500 return (__ibsubmit(&io));
504 ibsre (int handle, int v)
508 io.__ident = __ID_IBSRE;
511 io.__field = __F_HANDLE | __F_V;
512 return (__ibsubmit(&io));
516 ibsrq (ibsrq_t * func)
520 io.__ident = __ID_IBSRQ;
522 io.__field = __F_FUNC;
523 return (__ibsubmit(&io));
531 io.__ident = __ID_IBSTOP;
533 io.__field = __F_HANDLE;
534 return (__ibsubmit(&io));
538 ibtmo (int handle, int tmo)
542 io.__ident = __ID_IBTMO;
545 io.__field = __F_HANDLE | __F_TMO;
546 return (__ibsubmit(&io));
550 ibtrap (int mask, int mode)
554 io.__ident = __ID_IBTRAP;
557 io.__field = __F_MASK | __F_MODE;
558 return (__ibsubmit(&io));
566 io.__ident = __ID_IBTRG;
568 io.__field = __F_HANDLE;
569 return (__ibsubmit(&io));
573 ibwait (int handle, int mask)
577 io.__ident = __ID_IBWAIT;
580 io.__field = __F_HANDLE | __F_MASK;
581 return (__ibsubmit(&io));
585 ibwrt (int handle, const void *buffer, long cnt)
589 io.__ident = __ID_IBWRT;
591 io.buffer = __DECONST(void *, buffer);
593 io.__field = __F_HANDLE | __F_BUFFER | __F_CNT;
594 return (__ibsubmit(&io));
598 ibwrta (int handle, const void * buffer, long cnt)
602 io.__ident = __ID_IBWRTA;
604 io.buffer = __DECONST(void *, buffer);
606 io.__field = __F_HANDLE | __F_BUFFER | __F_CNT;
607 return (__ibsubmit(&io));
611 ibwrtf (int handle, const char *flname)
615 io.__ident = __ID_IBWRTF;
617 io.flname = __DECONST(void *, flname);
618 io.__field = __F_HANDLE | __F_FLNAME;
619 return (__ibsubmit(&io));
623 ibwrtkey (int handle, const void *buffer, int cnt)
627 io.__ident = __ID_IBWRTKEY;
629 io.buffer = __DECONST(void *, buffer);
631 io.__field = __F_HANDLE | __F_BUFFER | __F_CNT;
632 return (__ibsubmit(&io));
636 ibxtrc (int handle, void * buffer, long cnt)
640 io.__ident = __ID_IBXTRC;
644 io.__field = __F_HANDLE | __F_BUFFER | __F_CNT;
645 return (__ibsubmit(&io));