1 /* SPDX-License-Identifier: GPL-2.0 */
2
3 #ifndef GPIB_PROTO_INCLUDED
4 #define GPIB_PROTO_INCLUDED
5
6 #include <linux/fs.h>
7
8 int ibopen(struct inode *inode, struct file *filep);
9 int ibclose(struct inode *inode, struct file *file);
10 long ibioctl(struct file *filep, unsigned int cmd, unsigned long arg);
11 void os_start_timer(struct gpib_board *board, unsigned int usec_timeout);
12 void os_remove_timer(struct gpib_board *board);
13 void init_gpib_board(struct gpib_board *board);
usec_to_jiffies(unsigned int usec)14 static inline unsigned long usec_to_jiffies(unsigned int usec)
15 {
16 unsigned long usec_per_jiffy = 1000000 / HZ;
17
18 return 1 + (usec + usec_per_jiffy - 1) / usec_per_jiffy;
19 };
20
21 int serial_poll_all(struct gpib_board *board, unsigned int usec_timeout);
22 void init_gpib_descriptor(struct gpib_descriptor *desc);
23 int dvrsp(struct gpib_board *board, unsigned int pad, int sad,
24 unsigned int usec_timeout, u8 *result);
25 int ibcac(struct gpib_board *board, int sync, int fallback_to_async);
26 int ibcmd(struct gpib_board *board, u8 *buf, size_t length, size_t *bytes_written);
27 int ibgts(struct gpib_board *board);
28 int ibonline(struct gpib_board *board);
29 int iboffline(struct gpib_board *board);
30 int iblines(const struct gpib_board *board, short *lines);
31 int ibrd(struct gpib_board *board, u8 *buf, size_t length, int *end_flag, size_t *bytes_read);
32 int ibrpp(struct gpib_board *board, u8 *buf);
33 int ibrsv2(struct gpib_board *board, u8 status_byte, int new_reason_for_service);
34 int ibrsc(struct gpib_board *board, int request_control);
35 int ibsic(struct gpib_board *board, unsigned int usec_duration);
36 int ibsre(struct gpib_board *board, int enable);
37 int ibpad(struct gpib_board *board, unsigned int addr);
38 int ibsad(struct gpib_board *board, int addr);
39 int ibeos(struct gpib_board *board, int eos, int eosflags);
40 int ibwait(struct gpib_board *board, int wait_mask, int clear_mask, int set_mask,
41 int *status, unsigned long usec_timeout, struct gpib_descriptor *desc);
42 int ibwrt(struct gpib_board *board, u8 *buf, size_t cnt, int send_eoi, size_t *bytes_written);
43 int ibstatus(struct gpib_board *board);
44 int general_ibstatus(struct gpib_board *board, const struct gpib_status_queue *device,
45 int clear_mask, int set_mask, struct gpib_descriptor *desc);
46 int io_timed_out(struct gpib_board *board);
47 int ibppc(struct gpib_board *board, u8 configuration);
48
49 #endif /* GPIB_PROTO_INCLUDED */
50