drivers/parport/parport_amiga.c
Source file repositories/reference/linux-study-clean/drivers/parport/parport_amiga.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/parport/parport_amiga.c- Extension
.c- Size
- 6518 bytes
- Lines
- 251
- Domain
- Driver Families
- Bucket
- drivers/parport
- 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.
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/init.hlinux/parport.hlinux/ioport.hlinux/interrupt.hlinux/platform_device.hasm/setup.hasm/amigahw.hasm/irq.hasm/io.hasm/amigaints.h
Detected Declarations
function linesfunction amiga_read_datafunction control_amiga_to_pcfunction amiga_write_controlfunction amiga_read_controlfunction amiga_frob_controlfunction status_amiga_to_pcfunction amiga_read_statusfunction amiga_enable_irqfunction amiga_disable_irqfunction amiga_data_forwardfunction amiga_data_reversefunction amiga_init_statefunction amiga_save_statefunction amiga_restore_statefunction amiga_parallel_probefunction amiga_parallel_remove
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/* Low-level parallel port routines for the Amiga built-in port
*
* Author: Joerg Dorchain <joerg@dorchain.net>
*
* This is a complete rewrite of the code, but based heaviy upon the old
* lp_intern. code.
*
* The built-in Amiga parallel port provides one port at a fixed address
* with 8 bidirectional data lines (D0 - D7) and 3 bidirectional status
* lines (BUSY, POUT, SEL), 1 output control line /STROBE (raised automatically
* in hardware when the data register is accessed), and 1 input control line
* /ACK, able to cause an interrupt, but both not directly settable by
* software.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/parport.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <asm/setup.h>
#include <asm/amigahw.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <asm/amigaints.h>
#undef DEBUG
static void amiga_write_data(struct parport *p, unsigned char data)
{
pr_debug("write_data %c\n", data);
/* Triggers also /STROBE. This behavior cannot be changed */
ciaa.prb = data;
mb();
}
static unsigned char amiga_read_data(struct parport *p)
{
/* Triggers also /STROBE. This behavior cannot be changed */
return ciaa.prb;
}
static unsigned char control_amiga_to_pc(unsigned char control)
{
return PARPORT_CONTROL_SELECT |
PARPORT_CONTROL_AUTOFD | PARPORT_CONTROL_STROBE;
/* fake value: interrupt enable, select in, no reset,
no autolf, no strobe - seems to be closest the wiring diagram */
}
static void amiga_write_control(struct parport *p, unsigned char control)
{
pr_debug("write_control %02x\n", control);
/* No implementation possible */
}
static unsigned char amiga_read_control( struct parport *p)
{
pr_debug("read_control\n");
return control_amiga_to_pc(0);
}
static unsigned char amiga_frob_control( struct parport *p, unsigned char mask, unsigned char val)
{
unsigned char old;
pr_debug("frob_control mask %02x, value %02x\n", mask, val);
old = amiga_read_control(p);
amiga_write_control(p, (old & ~mask) ^ val);
return old;
}
static unsigned char status_amiga_to_pc(unsigned char status)
{
unsigned char ret = PARPORT_STATUS_BUSY | PARPORT_STATUS_ACK | PARPORT_STATUS_ERROR;
if (status & 1) /* Busy */
ret &= ~PARPORT_STATUS_BUSY;
if (status & 2) /* PaperOut */
ret |= PARPORT_STATUS_PAPEROUT;
if (status & 4) /* Selected */
ret |= PARPORT_STATUS_SELECT;
/* the rest is not connected or handled autonomously in hardware */
return ret;
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/parport.h`, `linux/ioport.h`, `linux/interrupt.h`, `linux/platform_device.h`, `asm/setup.h`, `asm/amigahw.h`.
- Detected declarations: `function lines`, `function amiga_read_data`, `function control_amiga_to_pc`, `function amiga_write_control`, `function amiga_read_control`, `function amiga_frob_control`, `function status_amiga_to_pc`, `function amiga_read_status`, `function amiga_enable_irq`, `function amiga_disable_irq`.
- Atlas domain: Driver Families / drivers/parport.
- Implementation status: source implementation candidate.
- 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.