This source file includes following definitions.
- atari_nosound
- atari_microwire_cmd
- atari_mksound
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #include <linux/sched.h>
18 #include <linux/timer.h>
19 #include <linux/major.h>
20 #include <linux/config.h>
21 #include <linux/fcntl.h>
22 #include <linux/errno.h>
23 #include <linux/mm.h>
24
25 #include <asm/atarihw.h>
26 #include <asm/system.h>
27 #include <asm/irq.h>
28 #include <asm/pgtable.h>
29 #include <asm/atariints.h>
30 #include <asm/bootinfo.h>
31
32
33
34
35
36
37
38 static void atari_nosound (unsigned long ignored)
39 {
40 unsigned char tmp;
41 unsigned long flags;
42
43
44 save_flags(flags);
45 cli();
46 sound_ym.rd_data_reg_sel = 7;
47 tmp = sound_ym.rd_data_reg_sel;
48 sound_ym.wd_data = tmp | 0x39;
49 restore_flags(flags);
50 }
51
52
53 void atari_microwire_cmd (int cmd)
54 {
55 tt_microwire.mask = 0x7ff;
56 tt_microwire.data = MW_LM1992_ADDR | cmd;
57
58
59 while( tt_microwire.mask != 0x7ff)
60 ;
61 }
62
63
64 #define PC_FREQ 1192180
65 #define PSG_FREQ 125000
66
67
68 void atari_mksound (unsigned int count, unsigned int ticks)
69 {
70 static struct timer_list sound_timer = { NULL, NULL, 0, 0,
71 atari_nosound };
72
73
74
75
76 unsigned long flags;
77 unsigned char tmp;
78
79 save_flags(flags);
80 cli();
81
82 if (count == 750 && ticks == HZ/8) {
83
84
85
86
87
88
89
90
91 sound_ym.rd_data_reg_sel = 11;
92 sound_ym.wd_data = 0;
93 sound_ym.rd_data_reg_sel = 12;
94 sound_ym.wd_data = 15;
95
96 sound_ym.rd_data_reg_sel = 13;
97 sound_ym.wd_data = 9;
98
99 sound_ym.rd_data_reg_sel = 2;
100 sound_ym.wd_data = 52;
101 sound_ym.rd_data_reg_sel = 3;
102 sound_ym.wd_data = 0;
103
104 sound_ym.rd_data_reg_sel = 9;
105 sound_ym.wd_data = 0x10;
106
107 sound_ym.rd_data_reg_sel = 7;
108 tmp = sound_ym.rd_data_reg_sel;
109 sound_ym.wd_data = (tmp & ~0x02) | 0x38;
110
111 restore_flags(flags);
112 return;
113 }
114
115 del_timer( &sound_timer );
116
117 if (!count) {
118 atari_nosound( 0 );
119 }
120 else {
121
122
123
124
125 int period = (PSG_FREQ * count + PC_FREQ/2) / PC_FREQ;
126
127 if (period > 0xfff) period = 0xfff;
128
129
130 sound_ym.rd_data_reg_sel = 0;
131 sound_ym.wd_data = period & 0xff;
132 sound_ym.rd_data_reg_sel = 1;
133 sound_ym.wd_data = (period >> 8) & 0xf;
134
135
136 sound_ym.rd_data_reg_sel = 7;
137 tmp = sound_ym.rd_data_reg_sel;
138 sound_ym.wd_data = (tmp & ~0x01) | 0x38;
139
140 sound_ym.rd_data_reg_sel = 8;
141 sound_ym.wd_data = 15;
142
143 if (ticks) {
144 sound_timer.expires = jiffies + ticks;
145 add_timer( &sound_timer );
146 }
147 }
148
149 restore_flags(flags);
150 }