This source file includes following definitions.
- atari_microwire_cmd
- atari_mksound
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #include <linux/sched.h>
20 #include <linux/timer.h>
21 #include <linux/major.h>
22 #include <linux/fcntl.h>
23 #include <linux/errno.h>
24 #include <linux/mm.h>
25 #include <linux/module.h>
26
27 #include <asm/atarihw.h>
28 #include <asm/irq.h>
29 #include <asm/pgtable.h>
30 #include <asm/atariints.h>
31
32
33
34
35
36
37 void atari_microwire_cmd (int cmd)
38 {
39 tt_microwire.mask = 0x7ff;
40 tt_microwire.data = MW_LM1992_ADDR | cmd;
41
42
43 while( tt_microwire.mask != 0x7ff)
44 ;
45 }
46 EXPORT_SYMBOL(atari_microwire_cmd);
47
48
49
50 #define PSG_FREQ 125000
51
52 #define PSG_ENV_FREQ_10 78125
53
54 void atari_mksound (unsigned int hz, unsigned int ticks)
55 {
56
57
58 unsigned long flags;
59 unsigned char tmp;
60 int period;
61
62 local_irq_save(flags);
63
64
65
66 sound_ym.rd_data_reg_sel = 7;
67 tmp = sound_ym.rd_data_reg_sel;
68 tmp |= 011;
69 sound_ym.wd_data = tmp;
70
71 if (hz) {
72
73
74
75 period = PSG_FREQ / hz;
76
77 if (period > 0xfff) period = 0xfff;
78
79
80 sound_ym.rd_data_reg_sel = 0;
81 sound_ym.wd_data = period & 0xff;
82 sound_ym.rd_data_reg_sel = 1;
83 sound_ym.wd_data = (period >> 8) & 0xf;
84 if (ticks) {
85
86 int length = (ticks * PSG_ENV_FREQ_10) / HZ / 10;
87
88 if (length > 0xffff) length = 0xffff;
89 sound_ym.rd_data_reg_sel = 11;
90 sound_ym.wd_data = length & 0xff;
91 sound_ym.rd_data_reg_sel = 12;
92 sound_ym.wd_data = length >> 8;
93
94 sound_ym.rd_data_reg_sel = 13;
95 sound_ym.wd_data = 0;
96
97 sound_ym.rd_data_reg_sel = 8;
98 sound_ym.wd_data = 0x10;
99 } else {
100
101 sound_ym.rd_data_reg_sel = 8;
102 sound_ym.wd_data = 15;
103 }
104
105 sound_ym.rd_data_reg_sel = 7;
106 tmp &= ~1;
107 sound_ym.wd_data = tmp;
108 }
109 local_irq_restore(flags);
110 }