xref: /linux/drivers/staging/gpib/cec/cec.h (revision c34e9ab9a612ee8b18273398ef75c207b01f516d)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 /***************************************************************************
4  *    copyright            : (C) 2002 by Frank Mori Hess
5  ***************************************************************************/
6 
7 #include "nec7210.h"
8 #include "gpibP.h"
9 #include "plx9050.h"
10 
11 struct cec_priv  {
12 	struct nec7210_priv nec7210_priv;
13 	struct pci_dev *pci_device;
14 	// base address for plx9052 pci chip
15 	unsigned long plx_iobase;
16 	unsigned int irq;
17 };
18 
19 // interfaces
20 extern gpib_interface_t cec_pci_interface;
21 extern gpib_interface_t cec_pcmcia_interface;
22 
23 // interface functions
24 int cec_read(gpib_board_t *board, uint8_t *buffer, size_t length, int *end, size_t *bytes_read);
25 int cec_write(gpib_board_t *board, uint8_t *buffer, size_t length, int send_eoi,
26 	      size_t *bytes_written);
27 int cec_command(gpib_board_t *board, uint8_t *buffer, size_t length, size_t *bytes_written);
28 int cec_take_control(gpib_board_t *board, int synchronous);
29 int cec_go_to_standby(gpib_board_t *board);
30 void cec_request_system_control(gpib_board_t *board, int request_control);
31 void cec_interface_clear(gpib_board_t *board, int assert);
32 void cec_remote_enable(gpib_board_t *board, int enable);
33 int cec_enable_eos(gpib_board_t *board, uint8_t eos_byte, int compare_8_bits);
34 void cec_disable_eos(gpib_board_t *board);
35 unsigned int cec_update_status(gpib_board_t *board, unsigned int clear_mask);
36 int cec_primary_address(gpib_board_t *board, unsigned int address);
37 int cec_secondary_address(gpib_board_t *board, unsigned int address, int enable);
38 int cec_parallel_poll(gpib_board_t *board, uint8_t *result);
39 void cec_parallel_poll_configure(gpib_board_t *board, uint8_t configuration);
40 void cec_parallel_poll_response(gpib_board_t *board, int ist);
41 void cec_serial_poll_response(gpib_board_t *board, uint8_t status);
42 void cec_return_to_local(gpib_board_t *board);
43 
44 // interrupt service routines
45 irqreturn_t cec_interrupt(int irq, void *arg);
46 
47 // utility functions
48 void cec_free_private(gpib_board_t *board);
49 int cec_generic_attach(gpib_board_t *board);
50 void cec_init(struct cec_priv *priv, const gpib_board_t *board);
51 
52 // offset between consecutive nec7210 registers
53 static const int cec_reg_offset = 1;
54