arch/m68k/atari/atasound.c
Source file repositories/reference/linux-study-clean/arch/m68k/atari/atasound.c
File Facts
- System
- Linux kernel
- Corpus path
arch/m68k/atari/atasound.c- Extension
.c- Size
- 2675 bytes
- Lines
- 111
- 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.
Dependency Surface
linux/sched.hlinux/timer.hlinux/major.hlinux/fcntl.hlinux/errno.hlinux/mm.hlinux/module.hasm/atarihw.hasm/irq.hasm/atariints.hatari.h
Detected Declarations
function atari_microwire_cmdfunction atari_mksoundexport atari_microwire_cmd
Annotated Snippet
#include <linux/sched.h>
#include <linux/timer.h>
#include <linux/major.h>
#include <linux/fcntl.h>
#include <linux/errno.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <asm/atarihw.h>
#include <asm/irq.h>
#include <asm/atariints.h>
#include "atari.h"
/*
* stuff from the old atasound.c
*/
void atari_microwire_cmd (int cmd)
{
tt_microwire.mask = 0x7ff;
tt_microwire.data = MW_LM1992_ADDR | cmd;
/* Busy wait for data being completely sent :-( */
while( tt_microwire.mask != 0x7ff)
;
}
EXPORT_SYMBOL(atari_microwire_cmd);
/* PSG base frequency */
#define PSG_FREQ 125000
/* PSG envelope base frequency times 10 */
#define PSG_ENV_FREQ_10 78125
void atari_mksound (unsigned int hz, unsigned int ticks)
{
/* Generates sound of some frequency for some number of clock
ticks. */
unsigned long flags;
unsigned char tmp;
int period;
local_irq_save(flags);
/* Disable generator A in mixer control. */
sound_ym.rd_data_reg_sel = 7;
tmp = sound_ym.rd_data_reg_sel;
tmp |= 011;
sound_ym.wd_data = tmp;
if (hz) {
/* Convert from frequency value to PSG period value (base
frequency 125 kHz). */
period = PSG_FREQ / hz;
if (period > 0xfff) period = 0xfff;
/* Set generator A frequency to hz. */
sound_ym.rd_data_reg_sel = 0;
sound_ym.wd_data = period & 0xff;
sound_ym.rd_data_reg_sel = 1;
sound_ym.wd_data = (period >> 8) & 0xf;
if (ticks) {
/* Set length of envelope (max 8 sec). */
int length = (ticks * PSG_ENV_FREQ_10) / HZ / 10;
if (length > 0xffff) length = 0xffff;
sound_ym.rd_data_reg_sel = 11;
sound_ym.wd_data = length & 0xff;
sound_ym.rd_data_reg_sel = 12;
sound_ym.wd_data = length >> 8;
/* Envelope form: max -> min single. */
sound_ym.rd_data_reg_sel = 13;
sound_ym.wd_data = 0;
/* Use envelope for generator A. */
sound_ym.rd_data_reg_sel = 8;
sound_ym.wd_data = 0x10;
} else {
/* Set generator A level to maximum, no envelope. */
sound_ym.rd_data_reg_sel = 8;
sound_ym.wd_data = 15;
}
/* Turn on generator A in mixer control. */
sound_ym.rd_data_reg_sel = 7;
tmp &= ~1;
sound_ym.wd_data = tmp;
}
Annotation
- Immediate include surface: `linux/sched.h`, `linux/timer.h`, `linux/major.h`, `linux/fcntl.h`, `linux/errno.h`, `linux/mm.h`, `linux/module.h`, `asm/atarihw.h`.
- Detected declarations: `function atari_microwire_cmd`, `function atari_mksound`, `export atari_microwire_cmd`.
- Atlas domain: Architecture Layer / arch/m68k.
- Implementation status: integration implementation candidate.
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.