arch/m68k/atari/stdma.c
Source file repositories/reference/linux-study-clean/arch/m68k/atari/stdma.c
File Facts
- System
- Linux kernel
- Corpus path
arch/m68k/atari/stdma.c- Extension
.c- Size
- 5623 bytes
- Lines
- 221
- Domain
- Architecture Layer
- Bucket
- arch/m68k
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
Dependency Surface
linux/types.hlinux/kdev_t.hlinux/sched.hlinux/init.hlinux/interrupt.hlinux/wait.hlinux/module.hasm/atari_stdma.hasm/atariints.hasm/atarihw.hasm/io.hasm/irq.h
Detected Declarations
function stdma_try_lockfunction stdma_lockfunction stdma_releasefunction stdma_is_locked_byfunction stdma_islockedfunction stdma_initfunction stdma_lockexport stdma_try_lockexport stdma_lockexport stdma_releaseexport stdma_is_locked_byexport stdma_islocked
Annotated Snippet
#include <linux/types.h>
#include <linux/kdev_t.h>
#include <linux/sched.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/wait.h>
#include <linux/module.h>
#include <asm/atari_stdma.h>
#include <asm/atariints.h>
#include <asm/atarihw.h>
#include <asm/io.h>
#include <asm/irq.h>
static int stdma_locked; /* the semaphore */
/* int func to be called */
static irq_handler_t stdma_isr;
static void *stdma_isr_data; /* data passed to isr */
static DECLARE_WAIT_QUEUE_HEAD(stdma_wait); /* wait queue for ST-DMA */
/***************************** Prototypes *****************************/
static irqreturn_t stdma_int (int irq, void *dummy);
/************************* End of Prototypes **************************/
/**
* stdma_try_lock - attempt to acquire ST DMA interrupt "lock"
* @handler: interrupt handler to use after acquisition
* @data: cookie passed to the interrupt handler function
*
* Returns !0 if lock was acquired; otherwise 0.
*/
int stdma_try_lock(irq_handler_t handler, void *data)
{
unsigned long flags;
local_irq_save(flags);
if (stdma_locked) {
local_irq_restore(flags);
return 0;
}
stdma_locked = 1;
stdma_isr = handler;
stdma_isr_data = data;
local_irq_restore(flags);
return 1;
}
EXPORT_SYMBOL(stdma_try_lock);
/*
* Function: void stdma_lock( isrfunc isr, void *data )
*
* Purpose: Tries to get a lock on the ST-DMA chip that is used by more
* then one device driver. Waits on stdma_wait until lock is free.
* stdma_lock() may not be called from an interrupt! You have to
* get the lock in your main routine and release it when your
* request is finished.
*
* Inputs: A interrupt function that is called until the lock is
* released.
*
* Returns: nothing
*
*/
void stdma_lock(irq_handler_t handler, void *data)
{
/* Since the DMA is used for file system purposes, we
have to sleep uninterruptible (there may be locked
buffers) */
wait_event(stdma_wait, stdma_try_lock(handler, data));
}
EXPORT_SYMBOL(stdma_lock);
/*
* Function: void stdma_release( void )
*
* Purpose: Releases the lock on the ST-DMA chip.
*
* Inputs: none
*
Annotation
- Immediate include surface: `linux/types.h`, `linux/kdev_t.h`, `linux/sched.h`, `linux/init.h`, `linux/interrupt.h`, `linux/wait.h`, `linux/module.h`, `asm/atari_stdma.h`.
- Detected declarations: `function stdma_try_lock`, `function stdma_lock`, `function stdma_release`, `function stdma_is_locked_by`, `function stdma_islocked`, `function stdma_init`, `function stdma_lock`, `export stdma_try_lock`, `export stdma_lock`, `export stdma_release`.
- Atlas domain: Architecture Layer / arch/m68k.
- Implementation status: integration 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.