26 #include <linux/poll.h>
27 #include <linux/sched.h>
32 #define DRV_VERSION "2.6"
33 #define SOFTSYNTH_MINOR 26
34 #define PROCSPEECH 0x0d
35 #define CLEAR_SYNTH 0x18
38 static void softsynth_release(
void);
44 static int misc_registered;
46 static struct var_t vars[] = {
49 {
RATE, .u.n = {
"\x01%ds", 2, 0, 9, 0, 0,
NULL } },
50 {
PITCH, .u.n = {
"\x01%dp", 5, 0, 9, 0, 0,
NULL } },
51 {
VOL, .u.n = {
"\x01%dv", 5, 0, 9, 0, 0,
NULL } },
52 {
TONE, .u.n = {
"\x01%dx", 1, 0, 2, 0, 0,
NULL } },
53 {
PUNCT, .u.n = {
"\x01%db", 0, 0, 2, 0, 0,
NULL } },
54 {
VOICE, .u.n = {
"\x01%do", 0, 0, 7, 0, 0,
NULL } },
104 static struct attribute *synth_attrs[] = {
105 &caps_start_attribute.
attr,
106 &caps_stop_attribute.
attr,
107 &freq_attribute.
attr,
109 &pitch_attribute.
attr,
110 &punct_attribute.
attr,
111 &rate_attribute.
attr,
112 &tone_attribute.
attr,
113 &voice_attribute.
attr,
115 &delay_time_attribute.
attr,
116 &direct_attribute.
attr,
117 &full_time_attribute.
attr,
118 &jiffy_delta_attribute.
attr,
119 &trigger_time_attribute.
attr,
126 .long_name =
"software synth",
127 .init =
"\01@\x01\x31y\n",
136 .probe = softsynth_probe,
137 .release = softsynth_release,
138 .synth_immediate =
NULL,
141 .is_alive = softsynth_is_alive,
142 .synth_adjust =
NULL,
143 .read_buff_add =
NULL,
146 .command =
"\x01%di",
152 .attrs = synth_attrs,
157 static char *get_initstring(
void)
163 memset(buf, 0,
sizeof(buf));
165 var = synth_soft.
vars;
169 cp = cp +
sprintf(cp, var->
u.
n.synth_fmt,
183 if (synth_soft.
alive) {
187 synth_soft.
alive = 1;
192 static int softsynth_close(
struct inode *inode,
struct file *fp)
196 synth_soft.
alive = 0;
235 init = get_initstring();
236 while (chars_sent < count) {
242 }
else if (init[init_pos]) {
243 ch = init[init_pos++];
264 static int last_index;
266 static ssize_t softsynth_write(
struct file *fp,
const char *buf,
size_t count,
269 unsigned long supplied_index = 0;
277 last_index = supplied_index;
281 static unsigned int softsynth_poll(
struct file *fp,
286 poll_wait(fp, &speakup_event, wait);
295 static unsigned char get_index(
void)
305 .poll = softsynth_poll,
306 .read = softsynth_read,
307 .write = softsynth_write,
308 .open = softsynth_open,
309 .release = softsynth_close,
316 if (misc_registered != 0)
318 memset(&synth_device, 0,
sizeof(synth_device));
320 synth_device.name =
"softsynth";
321 synth_device.fops = &softsynth_fops;
323 pr_warn(
"Couldn't initialize miscdevice /dev/softsynth.\n");
328 pr_info(
"initialized device: /dev/softsynth, node (MAJOR 10, MINOR 26)\n");
332 static void softsynth_release(
void)
336 pr_info(
"unregistered /dev/softsynth\n");
339 static int softsynth_is_alive(
struct spk_synth *synth)
341 if (synth_soft.
alive)
351 static int __init soft_init(
void)
356 static void __exit soft_exit(
void)