1 #include <linux/types.h>
2 #include <linux/ctype.h>
5 #include <linux/errno.h>
12 #include <linux/sched.h>
24 static int module_status;
33 static int do_synth_init(
struct spk_synth *in_synth);
51 pr_warn(
"ttyS%i is an invalid port\n", synth->
ser);
57 pr_info(
"%s: ttyS%i, Driver Version %s\n",
74 unsigned long jiff_max;
75 struct var_t *delay_time;
76 struct var_t *full_time;
77 struct var_t *jiffy_delta;
87 jiffy_delta_val = jiffy_delta->
u.
n.value;
90 jiff_max =
jiffies + jiffy_delta_val;
105 full_time_val = full_time->
u.
n.value;
115 jiffy_delta_val = jiffy_delta->
u.
n.value;
116 delay_time_val = delay_time->
u.
n.value;
117 full_time_val = full_time->
u.
n.value;
125 jiff_max =
jiffies + jiffy_delta_val;
139 while ((ch = *buff)) {
185 static DEFINE_TIMER(thread_timer, thread_wake_up, 0, 0);
189 struct var_t *trigger_time;
196 if (!timer_pending(&thread_timer))
225 unsigned char buf[160], *
p;
229 r =
vsnprintf(buf,
sizeof(buf), fmt, args);
231 if (r >
sizeof(buf) - 1)
241 static int index_count;
242 static int sentence_count;
246 static int first = 1;
275 out = synth->
indexing.currindex * 10 + sent_num;
284 sentence_count = ind % 10;
286 if ((ind / 10) <= synth->
indexing.currindex)
287 index_count = synth->
indexing.currindex-(ind/10);
289 index_count = synth->
indexing.currindex
291 + synth->
indexing.highindex-(ind/10)+1;
294 *sentcount = sentence_count;
295 *linecount = index_count;
303 memset(&synth_res, 0,
sizeof(synth_res));
304 synth_res.name = synth->
name;
305 synth_res.start =
start;
306 synth_res.end = start + n - 1;
333 if (synth_name ==
NULL)
336 if (
strcmp(synth_name,
"none") == 0) {
351 ret = do_synth_init(synth);
360 static int do_synth_init(
struct spk_synth *in_synth)
370 if (synth->
probe(synth) < 0) {
371 pr_warn(
"%s: device probe failed\n", in_synth->
name);
375 synth_time_vars[0].
u.
n.value =
376 synth_time_vars[0].
u.
n.default_val = synth->
delay;
377 synth_time_vars[1].
u.
n.value =
378 synth_time_vars[1].
u.
n.default_val = synth->
trigger;
379 synth_time_vars[2].
u.
n.value =
380 synth_time_vars[2].
u.
n.default_val = synth->
jiffies;
381 synth_time_vars[3].
u.
n.value =
382 synth_time_vars[3].
u.
n.default_val = synth->
full;
384 for (var = synth->
vars;
428 if (in_synth == synths[i]) {
432 if (i == MAXSYNTHS) {
433 pr_warn(
"Error: attempting to add a synth past end of array\n");
437 synths[i++] = in_synth;
440 status = do_synth_init(in_synth);
450 if (synth == in_synth)
452 for (i = 0; synths[
i] !=
NULL; i++) {
453 if (in_synth == synths[i])
456 for ( ; synths[
i] !=
NULL; i++)
457 synths[i] = synths[i+1];