drivers/gpib/include/tms9914.h

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

File Facts

System
Linux kernel
Corpus path
drivers/gpib/include/tms9914.h
Extension
.h
Size
11131 bytes
Lines
281
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 tms9914_priv {
#ifdef CONFIG_HAS_IOPORT
	u32 iobase;
#endif
	void __iomem *mmiobase;
	unsigned int offset;	// offset between successive tms9914 io addresses
	unsigned int dma_channel;
	// software copy of bits written to interrupt mask registers
	u8 imr0_bits, imr1_bits;
	// bits written to address mode register
	u8 admr_bits;
	u8 auxa_bits;		// bits written to auxiliary register A
	// used to keep track of board's state, bit definitions given below
	unsigned long state;
	u8 eos;			// eos character
	short eos_flags;
	u8 spoll_status;
	enum tms9914_holdoff_mode holdoff_mode;
	unsigned int ppoll_line;
	enum talker_function_state talker_state;
	enum listener_function_state listener_state;
	unsigned ppoll_sense : 1;
	unsigned ppoll_enable : 1;
	unsigned ppoll_configure_state : 1;
	unsigned primary_listen_addressed : 1;
	unsigned primary_talk_addressed : 1;
	unsigned holdoff_on_end : 1;
	unsigned holdoff_on_all : 1;
	unsigned holdoff_active : 1;
	// wrappers for outb, inb, readb, or writeb
	u8 (*read_byte)(struct tms9914_priv *priv, unsigned int register_number);
	void (*write_byte)(struct tms9914_priv *priv, u8 byte, unsigned int
			   register_number);
};

// slightly shorter way to access read_byte and write_byte
static inline u8 read_byte(struct tms9914_priv *priv, unsigned int register_number)
{
	return priv->read_byte(priv, register_number);
}

static inline void write_byte(struct tms9914_priv *priv, u8 byte, unsigned int register_number)
{
	priv->write_byte(priv, byte, register_number);
}

// struct tms9914_priv.state bit numbers
enum {
	PIO_IN_PROGRESS_BN,		// pio transfer in progress
	DMA_READ_IN_PROGRESS_BN,	// dma read transfer in progress
	DMA_WRITE_IN_PROGRESS_BN,	// dma write transfer in progress
	READ_READY_BN,			// board has data byte available to read
	WRITE_READY_BN,			// board is ready to send a data byte
	COMMAND_READY_BN,		// board is ready to send a command byte
	RECEIVED_END_BN,		// received END
	BUS_ERROR_BN,			// bus error
	DEV_CLEAR_BN,			// device clear received
};

// interface functions
int tms9914_read(struct gpib_board *board, struct tms9914_priv *priv, u8 *buffer,
		 size_t length, int *end, size_t *bytes_read);
int tms9914_write(struct gpib_board *board, struct tms9914_priv *priv, u8 *buffer,
		  size_t length, int send_eoi, size_t *bytes_written);
int tms9914_command(struct gpib_board *board, struct tms9914_priv *priv, u8 *buffer,
		    size_t length, size_t *bytes_written);
int tms9914_take_control(struct gpib_board *board, struct tms9914_priv *priv, int syncronous);
/*
 * alternate version of tms9914_take_control which works around buggy tcs
 * implementation.
 */
int tms9914_take_control_workaround(struct gpib_board *board, struct tms9914_priv *priv,
				    int syncronous);
int tms9914_go_to_standby(struct gpib_board *board, struct tms9914_priv *priv);
int tms9914_request_system_control(struct gpib_board *board, struct tms9914_priv *priv,
				   int request_control);
void tms9914_interface_clear(struct gpib_board *board, struct tms9914_priv *priv, int assert);
void tms9914_remote_enable(struct gpib_board *board, struct tms9914_priv *priv, int enable);
int tms9914_enable_eos(struct gpib_board *board, struct tms9914_priv *priv, u8 eos_bytes,
		       int compare_8_bits);
void tms9914_disable_eos(struct gpib_board *board, struct tms9914_priv *priv);
unsigned int tms9914_update_status(struct gpib_board *board, struct tms9914_priv *priv,
				   unsigned int clear_mask);
int tms9914_primary_address(struct gpib_board *board,
			    struct tms9914_priv *priv, unsigned int address);
int tms9914_secondary_address(struct gpib_board *board, struct tms9914_priv *priv,
			      unsigned int address, int enable);
int tms9914_parallel_poll(struct gpib_board *board, struct tms9914_priv *priv, u8 *result);
void tms9914_parallel_poll_configure(struct gpib_board *board,
				     struct tms9914_priv *priv, u8 config);

Annotation

Implementation Notes