25 #include <linux/sched.h>
33 #define DRV_VERSION "2.10"
34 #define SYNTH_IO_EXTENT 0x04
35 #define SWAIT udelay(70)
36 #define PROCSPEECH 0x1f
37 #define SYNTH_CLEAR 0x03
40 static void keynote_release(
void);
45 static int synth_port;
46 static int port_forced;
47 static unsigned int synth_portlist[] = { 0x2a8, 0 };
49 static struct var_t vars[] = {
52 {
RATE, .u.n = {
"\04%c ", 8, 0, 10, 81, -8,
NULL } },
53 {
PITCH, .u.n = {
"[f%d]", 5, 0, 9, 40, 10,
NULL } },
85 static struct attribute *synth_attrs[] = {
86 &caps_start_attribute.
attr,
87 &caps_stop_attribute.
attr,
88 &pitch_attribute.
attr,
90 &delay_time_attribute.
attr,
91 &direct_attribute.
attr,
92 &full_time_attribute.
attr,
93 &jiffy_delta_attribute.
attr,
94 &trigger_time_attribute.
attr,
101 .long_name =
"Keynote PC",
102 .init =
"[t][n7,1][n8,0]",
112 .probe = synth_probe,
113 .release = keynote_release,
115 .catch_up = do_catch_up,
116 .flush = synth_flush,
118 .synth_adjust =
NULL,
119 .read_buff_add =
NULL,
128 .attrs = synth_attrs,
133 static inline bool synth_writable(
void)
138 static inline bool synth_full(
void)
143 static char *oops(
void)
146 s1 =
inb_p(synth_port);
147 s2 =
inb_p(synth_port+1);
148 s3 =
inb_p(synth_port+2);
149 s4 =
inb_p(synth_port+3);
150 pr_warn(
"synth timeout %d %d %d %d\n", s1, s2, s3, s4);
158 while ((ch = *buf)) {
164 while (synth_writable())
174 static void do_catch_up(
struct spk_synth *synth)
179 unsigned long jiff_max;
180 struct var_t *jiffy_delta;
181 struct var_t *delay_time;
182 struct var_t *full_time;
191 jiffy_delta_val = jiffy_delta->
u.
n.value;
194 jiff_max =
jiffies + jiffy_delta_val;
208 full_time_val = full_time->
u.
n.value;
216 while (synth_writable())
230 if ((jiffies >= jiff_max) && (ch ==
SPACE)) {
232 while (synth_writable())
241 jiffy_delta_val = jiffy_delta->
u.
n.value;
242 delay_time_val = delay_time->
u.
n.value;
245 jiff_max =
jiffies+jiffy_delta_val;
249 while (synth_writable())
258 static void synth_flush(
struct spk_synth *synth)
263 static int synth_probe(
struct spk_synth *synth)
265 unsigned int port_val = 0;
269 synth_port = port_forced;
270 pr_info(
"probe forced to %x by kernel command line\n",
273 pr_warn(
"sorry, port already reserved\n");
276 port_val =
inb(synth_port);
278 for (i = 0; synth_portlist[
i]; i++) {
282 (
"request_region: failed with 0x%x, %d\n",
286 port_val =
inb(synth_portlist[i]);
287 if (port_val == 0x80) {
288 synth_port = synth_portlist[
i];
293 if (port_val != 0x80) {
306 static void keynote_release(
void)
319 static int __init keypc_init(
void)
324 static void __exit keypc_exit(
void)