drivers/gpib/include/gpib_types.h

Source file repositories/reference/linux-study-clean/drivers/gpib/include/gpib_types.h

File Facts

System
Linux kernel
Corpus path
drivers/gpib/include/gpib_types.h
Extension
.h
Size
13672 bytes
Lines
390
Domain
Driver Families
Bucket
drivers/gpib
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct gpib_board_config {
	/* firmware blob */
	void *init_data;
	int init_data_length;
	/* IO base address to use for non-pnp cards (set by core, driver should make local copy) */
	u32 ibbase;
	void __iomem *mmibbase;
	/* IRQ to use for non-pnp cards (set by core, driver should make local copy) */
	unsigned int ibirq;
	/* dma channel to use for non-pnp cards (set by core, driver should make local copy) */
	unsigned int ibdma;
	/*
	 * pci bus of card, useful for distinguishing multiple identical pci cards
	 * (negative means don't care)
	 */
	int pci_bus;
	/*
	 * pci slot of card, useful for distinguishing multiple identical pci cards
	 * (negative means don't care)
	 */
	int pci_slot;
	/* sysfs device path of hardware to attach */
	char *device_path;
	/* serial number of hardware to attach */
	char *serial_number;
};

/*
 * struct gpib_interface defines the interface
 * between the board-specific details dealt with in the drivers
 * and generic interface provided by gpib-common.
 * This really should be in a different header file.
 */
struct gpib_interface {
	/* name of board */
	char *name;
	/* attach() initializes board and allocates resources */
	int (*attach)(struct gpib_board *board, const struct gpib_board_config *config);
	/* detach() shuts down board and frees resources */
	void (*detach)(struct gpib_board *board);
	/*
	 * read() should read at most 'length' bytes from the bus into
	 * 'buffer'.  It should return when it fills the buffer or
	 * encounters an END (EOI and or EOS if appropriate).  It should set 'end'
	 * to be nonzero if the read was terminated by an END, otherwise 'end'
	 * should be zero.
	 * Ultimately, this will be changed into or replaced by an asynchronous
	 * read.  Zero return value for success, negative
	 * return indicates error.
	 * nbytes returns number of bytes read
	 */
	int (*read)(struct gpib_board *board, u8 *buffer, size_t length, int *end,
		    size_t *bytes_read);
	/*
	 * write() should write 'length' bytes from buffer to the bus.
	 * If the boolean value send_eoi is nonzero, then EOI should
	 * be sent along with the last byte.  Returns number of bytes
	 * written or negative value on error.
	 */
	int (*write)(struct gpib_board *board, u8 *buffer, size_t length, int send_eoi,
		     size_t *bytes_written);
	/*
	 * command() writes the command bytes in 'buffer' to the bus
	 * Returns zero on success or negative value on error.
	 */
	int (*command)(struct gpib_board *board, u8 *buffer, size_t length,
		       size_t *bytes_written);
	/*
	 * Take control (assert ATN).  If 'asyncronous' is nonzero, take
	 * control asyncronously (assert ATN immediately without waiting
	 * for other processes to complete first).  Should not return
	 * until board becomes controller in charge.  Returns zero no success,
	 * nonzero on error.
	 */
	int (*take_control)(struct gpib_board *board, int asyncronous);
	/*
	 * De-assert ATN.  Returns zero on success, nonzer on error.
	 */
	int (*go_to_standby)(struct gpib_board *board);
	/* request/release control of the IFC and REN lines (system controller) */
	int (*request_system_control)(struct gpib_board *board, int request_control);
	/*
	 * Asserts or de-asserts 'interface clear' (IFC) depending on
	 * boolean value of 'assert'
	 */
	void (*interface_clear)(struct gpib_board *board, int assert);
	/*
	 * Sends remote enable command if 'enable' is nonzero, disables remote mode
	 * if 'enable' is zero
	 */

Annotation

Implementation Notes