drivers/gpib/hp_82341/hp_82341.c
Source file repositories/reference/linux-study-clean/drivers/gpib/hp_82341/hp_82341.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpib/hp_82341/hp_82341.c- Extension
.c- Size
- 26527 bytes
- Lines
- 909
- Domain
- Driver Families
- Bucket
- drivers/gpib
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
hp_82341.hlinux/delay.hlinux/ioport.hlinux/sched.hlinux/module.hlinux/slab.hlinux/init.hlinux/isapnp.h
Detected Declarations
function hp_82341_accel_readfunction restart_write_fifofunction hp_82341_accel_writefunction hp_82341_readfunction hp_82341_writefunction hp_82341_commandfunction hp_82341_take_controlfunction hp_82341_go_to_standbyfunction hp_82341_request_system_controlfunction hp_82341_interface_clearfunction hp_82341_remote_enablefunction hp_82341_enable_eosfunction hp_82341_disable_eosfunction hp_82341_update_statusfunction hp_82341_primary_addressfunction hp_82341_secondary_addressfunction hp_82341_parallel_pollfunction hp_82341_parallel_poll_configurefunction hp_82341_parallel_poll_responsefunction hp_82341_serial_poll_responsefunction hp_82341_serial_poll_statusfunction hp_82341_line_statusfunction hp_82341_t1_delayfunction hp_82341_return_to_localfunction hp_82341_allocate_privatefunction hp_82341_free_privatefunction hp_82341_read_bytefunction hp_82341_write_bytefunction hp_82341_find_isapnp_boardfunction xilinx_readyfunction xilinx_donefunction irq_validfunction hp_82341_load_firmware_arrayfunction hp_82341_load_firmwarefunction set_xilinx_not_progfunction clear_xilinxfunction hp_82341_attachfunction hp_82341_detachfunction hp_82341_init_modulefunction hp_82341_exit_modulefunction read_and_clear_event_statusfunction hp_82341_interruptfunction read_transfer_counterfunction set_transfer_countermodule init hp_82341_init_module
Annotated Snippet
module_init(hp_82341_init_module);
module_exit(hp_82341_exit_module);
/*
* GPIB interrupt service routines
*/
static unsigned short read_and_clear_event_status(struct gpib_board *board)
{
struct hp_82341_priv *hp_priv = board->private_data;
unsigned long flags;
unsigned short status;
spin_lock_irqsave(&board->spinlock, flags);
status = hp_priv->event_status_bits;
hp_priv->event_status_bits = 0;
spin_unlock_irqrestore(&board->spinlock, flags);
return status;
}
static irqreturn_t hp_82341_interrupt(int irq, void *arg)
{
int status1, status2;
struct gpib_board *board = arg;
struct hp_82341_priv *hp_priv = board->private_data;
struct tms9914_priv *tms_priv = &hp_priv->tms9914_priv;
unsigned long flags;
irqreturn_t retval = IRQ_NONE;
int event_status;
spin_lock_irqsave(&board->spinlock, flags);
event_status = inb(hp_priv->iobase[0] + EVENT_STATUS_REG);
if (event_status & INTERRUPT_PENDING_EVENT_BIT)
retval = IRQ_HANDLED;
// write-clear status bits
if (event_status & (TI_INTERRUPT_EVENT_BIT | POINTERS_EQUAL_EVENT_BIT |
BUFFER_END_EVENT_BIT | TERMINAL_COUNT_EVENT_BIT)) {
outb(event_status & (TI_INTERRUPT_EVENT_BIT | POINTERS_EQUAL_EVENT_BIT |
BUFFER_END_EVENT_BIT | TERMINAL_COUNT_EVENT_BIT),
hp_priv->iobase[0] + EVENT_STATUS_REG);
hp_priv->event_status_bits |= event_status;
}
if (event_status & TI_INTERRUPT_EVENT_BIT) {
status1 = read_byte(tms_priv, ISR0);
status2 = read_byte(tms_priv, ISR1);
tms9914_interrupt_have_status(board, tms_priv, status1, status2);
}
spin_unlock_irqrestore(&board->spinlock, flags);
return retval;
}
static int read_transfer_counter(struct hp_82341_priv *hp_priv)
{
int lo, mid, value;
lo = inb(hp_priv->iobase[1] + TRANSFER_COUNT_LOW_REG);
mid = inb(hp_priv->iobase[1] + TRANSFER_COUNT_MID_REG);
value = (lo & 0xff) | ((mid << 8) & 0x7f00);
value = ~(value - 1) & 0x7fff;
return value;
}
static void set_transfer_counter(struct hp_82341_priv *hp_priv, int count)
{
int complement = -count;
outb(complement & 0xff, hp_priv->iobase[1] + TRANSFER_COUNT_LOW_REG);
outb((complement >> 8) & 0xff, hp_priv->iobase[1] + TRANSFER_COUNT_MID_REG);
// I don't think the hi count reg is even used, but oh well
outb((complement >> 16) & 0xf, hp_priv->iobase[1] + TRANSFER_COUNT_HIGH_REG);
}
Annotation
- Immediate include surface: `hp_82341.h`, `linux/delay.h`, `linux/ioport.h`, `linux/sched.h`, `linux/module.h`, `linux/slab.h`, `linux/init.h`, `linux/isapnp.h`.
- Detected declarations: `function hp_82341_accel_read`, `function restart_write_fifo`, `function hp_82341_accel_write`, `function hp_82341_read`, `function hp_82341_write`, `function hp_82341_command`, `function hp_82341_take_control`, `function hp_82341_go_to_standby`, `function hp_82341_request_system_control`, `function hp_82341_interface_clear`.
- Atlas domain: Driver Families / drivers/gpib.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.