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>
45 __ibsubmit(struct ibfoo_iocarg *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);
58 return (ap->__retval);
62 ibask (int handle, int option, int * retval)
64 struct ibfoo_iocarg io;
66 io.__ident = __ID_IBASK;
70 io.__field = __F_HANDLE | __F_OPTION | __F_RETVAL;
71 return (__ibsubmit(&io));
75 ibbna (int handle, char * bdname)
77 struct ibfoo_iocarg io;
79 io.__ident = __ID_IBBNA;
82 io.__field = __F_HANDLE | __F_BDNAME;
83 return (__ibsubmit(&io));
87 ibcac (int handle, int v)
89 struct ibfoo_iocarg io;
91 io.__ident = __ID_IBCAC;
94 io.__field = __F_HANDLE | __F_V;
95 return (__ibsubmit(&io));
101 struct ibfoo_iocarg io;
103 io.__ident = __ID_IBCLR;
105 io.__field = __F_HANDLE;
106 return (__ibsubmit(&io));
110 ibcmd (int handle, void * buffer, long cnt)
112 struct ibfoo_iocarg io;
114 io.__ident = __ID_IBCMD;
118 io.__field = __F_HANDLE | __F_BUFFER | __F_CNT;
119 return (__ibsubmit(&io));
123 ibcmda (int handle, void * buffer, long cnt)
125 struct ibfoo_iocarg io;
127 io.__ident = __ID_IBCMDA;
131 io.__field = __F_HANDLE | __F_BUFFER | __F_CNT;
132 return (__ibsubmit(&io));
136 ibconfig (int handle, int option, int value)
138 struct ibfoo_iocarg io;
140 io.__ident = __ID_IBCONFIG;
144 io.__field = __F_HANDLE | __F_OPTION | __F_VALUE;
145 return (__ibsubmit(&io));
149 ibdev (int boardID, int pad, int sad, int tmo, int eot, int eos)
151 struct ibfoo_iocarg io;
153 io.__ident = __ID_IBDEV;
154 io.boardID = boardID;
160 io.__field = __F_BOARDID | __F_PAD | __F_SAD | __F_TMO | __F_EOT | __F_EOS;
161 return (__ibsubmit(&io));
165 ibdiag (int handle, void * buffer, long cnt)
167 struct ibfoo_iocarg io;
169 io.__ident = __ID_IBDIAG;
173 io.__field = __F_HANDLE | __F_BUFFER | __F_CNT;
174 return (__ibsubmit(&io));
178 ibdma (int handle, int v)
180 struct ibfoo_iocarg io;
182 io.__ident = __ID_IBDMA;
185 io.__field = __F_HANDLE | __F_V;
186 return (__ibsubmit(&io));
190 ibeos (int handle, int eos)
192 struct ibfoo_iocarg io;
194 io.__ident = __ID_IBEOS;
197 io.__field = __F_HANDLE | __F_EOS;
198 return (__ibsubmit(&io));
202 ibeot (int handle, int eot)
204 struct ibfoo_iocarg io;
206 io.__ident = __ID_IBEOT;
209 io.__field = __F_HANDLE | __F_EOT;
210 return (__ibsubmit(&io));
214 ibevent (int handle, short * event)
216 struct ibfoo_iocarg io;
218 io.__ident = __ID_IBEVENT;
221 io.__field = __F_HANDLE | __F_EVENT;
222 return (__ibsubmit(&io));
226 ibfind (char * bdname)
228 struct ibfoo_iocarg io;
230 io.__ident = __ID_IBFIND;
232 io.__field = __F_BDNAME;
233 return (__ibsubmit(&io));
237 ibgts (int handle, int v)
239 struct ibfoo_iocarg io;
241 io.__ident = __ID_IBGTS;
244 io.__field = __F_HANDLE | __F_V;
245 return (__ibsubmit(&io));
249 ibist (int handle, int v)
251 struct ibfoo_iocarg io;
253 io.__ident = __ID_IBIST;
256 io.__field = __F_HANDLE | __F_V;
257 return (__ibsubmit(&io));
261 iblines (int handle, short * lines)
263 struct ibfoo_iocarg io;
265 io.__ident = __ID_IBLINES;
268 io.__field = __F_HANDLE | __F_LINES;
269 return (__ibsubmit(&io));
275 struct ibfoo_iocarg io;
277 io.__ident = __ID_IBLLO;
279 io.__field = __F_HANDLE;
280 return (__ibsubmit(&io));
284 ibln (int handle, int padval, int sadval, short * listenflag)
286 struct ibfoo_iocarg io;
288 io.__ident = __ID_IBLN;
292 io.listenflag = listenflag;
293 io.__field = __F_HANDLE | __F_PADVAL | __F_SADVAL | __F_LISTENFLAG;
294 return (__ibsubmit(&io));
300 struct ibfoo_iocarg io;
302 io.__ident = __ID_IBLOC;
304 io.__field = __F_HANDLE;
305 return (__ibsubmit(&io));
309 ibonl (int handle, int v)
311 struct ibfoo_iocarg io;
313 io.__ident = __ID_IBONL;
316 io.__field = __F_HANDLE | __F_V;
317 return (__ibsubmit(&io));
321 ibpad (int handle, int v)
323 struct ibfoo_iocarg io;
325 io.__ident = __ID_IBPAD;
328 io.__field = __F_HANDLE | __F_V;
329 return (__ibsubmit(&io));
335 struct ibfoo_iocarg io;
337 io.__ident = __ID_IBPCT;
339 io.__field = __F_HANDLE;
340 return (__ibsubmit(&io));
344 ibpoke (int handle, int option, int value)
346 struct ibfoo_iocarg io;
348 io.__ident = __ID_IBPOKE;
352 io.__field = __F_HANDLE | __F_OPTION | __F_VALUE;
353 return (__ibsubmit(&io));
357 ibppc (int handle, int v)
359 struct ibfoo_iocarg io;
361 io.__ident = __ID_IBPPC;
364 io.__field = __F_HANDLE | __F_V;
365 return (__ibsubmit(&io));
369 ibrd (int handle, void * buffer, long cnt)
371 struct ibfoo_iocarg io;
373 io.__ident = __ID_IBRD;
377 io.__field = __F_HANDLE | __F_BUFFER | __F_CNT;
378 return (__ibsubmit(&io));
382 ibrda (int handle, void * buffer, long cnt)
384 struct ibfoo_iocarg io;
386 io.__ident = __ID_IBRDA;
390 io.__field = __F_HANDLE | __F_BUFFER | __F_CNT;
391 return (__ibsubmit(&io));
395 ibrdf (int handle, char * flname)
397 struct ibfoo_iocarg io;
399 io.__ident = __ID_IBRDF;
402 io.__field = __F_HANDLE | __F_FLNAME;
403 return (__ibsubmit(&io));
407 ibrdkey (int handle, void * buffer, int cnt)
409 struct ibfoo_iocarg io;
411 io.__ident = __ID_IBRDKEY;
415 io.__field = __F_HANDLE | __F_BUFFER | __F_CNT;
416 return (__ibsubmit(&io));
420 ibrpp (int handle, char * ppr)
422 struct ibfoo_iocarg io;
424 io.__ident = __ID_IBRPP;
427 io.__field = __F_HANDLE | __F_PPR;
428 return (__ibsubmit(&io));
432 ibrsc (int handle, int v)
434 struct ibfoo_iocarg io;
436 io.__ident = __ID_IBRSC;
439 io.__field = __F_HANDLE | __F_V;
440 return (__ibsubmit(&io));
444 ibrsp (int handle, char * spr)
446 struct ibfoo_iocarg io;
448 io.__ident = __ID_IBRSP;
451 io.__field = __F_HANDLE | __F_SPR;
452 return (__ibsubmit(&io));
456 ibrsv (int handle, int v)
458 struct ibfoo_iocarg io;
460 io.__ident = __ID_IBRSV;
463 io.__field = __F_HANDLE | __F_V;
464 return (__ibsubmit(&io));
468 ibsad (int handle, int v)
470 struct ibfoo_iocarg io;
472 io.__ident = __ID_IBSAD;
475 io.__field = __F_HANDLE | __F_V;
476 return (__ibsubmit(&io));
480 ibsgnl (int handle, int v)
482 struct ibfoo_iocarg io;
484 io.__ident = __ID_IBSGNL;
487 io.__field = __F_HANDLE | __F_V;
488 return (__ibsubmit(&io));
494 struct ibfoo_iocarg io;
496 io.__ident = __ID_IBSIC;
498 io.__field = __F_HANDLE;
499 return (__ibsubmit(&io));
503 ibsre (int handle, int v)
505 struct ibfoo_iocarg io;
507 io.__ident = __ID_IBSRE;
510 io.__field = __F_HANDLE | __F_V;
511 return (__ibsubmit(&io));
515 ibsrq (ibsrq_t * func)
517 struct ibfoo_iocarg io;
519 io.__ident = __ID_IBSRQ;
521 io.__field = __F_FUNC;
522 return (__ibsubmit(&io));
528 struct ibfoo_iocarg io;
530 io.__ident = __ID_IBSTOP;
532 io.__field = __F_HANDLE;
533 return (__ibsubmit(&io));
537 ibtmo (int handle, int tmo)
539 struct ibfoo_iocarg io;
541 io.__ident = __ID_IBTMO;
544 io.__field = __F_HANDLE | __F_TMO;
545 return (__ibsubmit(&io));
549 ibtrap (int mask, int mode)
551 struct ibfoo_iocarg io;
553 io.__ident = __ID_IBTRAP;
556 io.__field = __F_MASK | __F_MODE;
557 return (__ibsubmit(&io));
563 struct ibfoo_iocarg io;
565 io.__ident = __ID_IBTRG;
567 io.__field = __F_HANDLE;
568 return (__ibsubmit(&io));
572 ibwait (int handle, int mask)
574 struct ibfoo_iocarg io;
576 io.__ident = __ID_IBWAIT;
579 io.__field = __F_HANDLE | __F_MASK;
580 return (__ibsubmit(&io));
584 ibwrt (int handle, const void *buffer, long cnt)
586 struct ibfoo_iocarg io;
588 io.__ident = __ID_IBWRT;
590 io.buffer = __DECONST(void *, buffer);
592 io.__field = __F_HANDLE | __F_BUFFER | __F_CNT;
593 return (__ibsubmit(&io));
597 ibwrta (int handle, const void * buffer, long cnt)
599 struct ibfoo_iocarg io;
601 io.__ident = __ID_IBWRTA;
603 io.buffer = __DECONST(void *, buffer);
605 io.__field = __F_HANDLE | __F_BUFFER | __F_CNT;
606 return (__ibsubmit(&io));
610 ibwrtf (int handle, const char *flname)
612 struct ibfoo_iocarg io;
614 io.__ident = __ID_IBWRTF;
616 io.flname = __DECONST(void *, flname);
617 io.__field = __F_HANDLE | __F_FLNAME;
618 return (__ibsubmit(&io));
622 ibwrtkey (int handle, const void *buffer, int cnt)
624 struct ibfoo_iocarg io;
626 io.__ident = __ID_IBWRTKEY;
628 io.buffer = __DECONST(void *, buffer);
630 io.__field = __F_HANDLE | __F_BUFFER | __F_CNT;
631 return (__ibsubmit(&io));
635 ibxtrc (int handle, void * buffer, long cnt)
637 struct ibfoo_iocarg io;
639 io.__ident = __ID_IBXTRC;
643 io.__field = __F_HANDLE | __F_BUFFER | __F_CNT;
644 return (__ibsubmit(&io));