drivers/gpib/ni_usb/ni_usb_gpib.h

Source file repositories/reference/linux-study-clean/drivers/gpib/ni_usb/ni_usb_gpib.h

File Facts

System
Linux kernel
Corpus path
drivers/gpib/ni_usb/ni_usb_gpib.h
Extension
.h
Size
5501 bytes
Lines
227
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 ni_usb_urb_ctx {
	struct completion complete;
	unsigned timed_out : 1;
};

// struct which defines private_data for ni_usb devices
struct ni_usb_priv {
	struct usb_interface *bus_interface;
	int bulk_out_endpoint;
	int bulk_in_endpoint;
	int interrupt_in_endpoint;
	u8 eos_char;
	unsigned short eos_mode;
	unsigned int monitored_ibsta_bits;
	struct urb *bulk_urb;
	struct urb *interrupt_urb;
	u8 interrupt_buffer[0x11];
	struct mutex addressed_transfer_lock;	// protect transfer lock
	struct mutex bulk_transfer_lock;	// protect bulk message sends
	struct mutex control_transfer_lock;	// protect control messages
	struct mutex interrupt_transfer_lock;	//  protect interrupt messages
	struct timer_list bulk_timer;
	struct ni_usb_urb_ctx context;
	int product_id;
	unsigned short ren_state;
};

struct ni_usb_status_block {
	short id;
	unsigned short ibsta;
	short error_code;
	unsigned short count;
};

struct ni_usb_register {
	enum ni_usb_device device;
	short address;
	unsigned short value;
};

enum ni_usb_bulk_ids {
	NIUSB_IBCAC_ID = 0x1,
	NIUSB_UNKNOWN3_ID = 0x3, // device level function id?
	NIUSB_TERM_ID = 0x4,
	NIUSB_IBGTS_ID = 0x6,
	NIUSB_IBRPP_ID = 0x7,
	NIUSB_REG_READ_ID = 0x8,
	NIUSB_REG_WRITE_ID = 0x9,
	NIUSB_IBSIC_ID = 0xf,
	NIUSB_REGISTER_READ_DATA_START_ID = 0x34,
	NIUSB_REGISTER_READ_DATA_END_ID = 0x35,
	NIUSB_IBRD_DATA_ID = 0x36,
	NIUSB_IBRD_EXTENDED_DATA_ID = 0x37,
	NIUSB_IBRD_STATUS_ID = 0x38
};

enum ni_usb_error_codes {
	NIUSB_NO_ERROR = 0,
	/*
	 * NIUSB_ABORTED_ERROR occurs when I/O is interrupted early by
	 * doing a NI_USB_STOP_REQUEST on the control endpoint.
	 */
	NIUSB_ABORTED_ERROR = 1,
	/*
	 * NIUSB_READ_ATN_ERROR occurs when you do a board read while
	 * ATN is set
	 */
	NIUSB_ATN_STATE_ERROR = 2,
	/*
	 * NIUSB_ADDRESSING_ERROR occurs when you do a board
	 * read/write as CIC but are not in LACS/TACS
	 */
	NIUSB_ADDRESSING_ERROR = 3,
	/*
	 * NIUSB_EOSMODE_ERROR occurs on reads if any eos mode or char
	 * bits are set when REOS is not set.
	 * Have also seen error 4 if you try to send more than 16
	 * command bytes at once on a usb-b.
	 */
	NIUSB_EOSMODE_ERROR = 4,
	/*
	 * NIUSB_NO_BUS_ERROR occurs when you try to write a command
	 * byte but there are no devices connected to the gpib bus
	 */
	NIUSB_NO_BUS_ERROR = 5,
	/*
	 * NIUSB_NO_LISTENER_ERROR occurs when you do a board write as
	 * CIC with no listener
	 */
	NIUSB_NO_LISTENER_ERROR = 8,

Annotation

Implementation Notes