18
18
* You should have received a copy of the GNU General Public License
19
19
* along with this program; if not, write to the Free Software
20
20
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
22
* this code is specificly written as a driver for the speakup screenreview
23
23
* package and is not a general device driver.
24
* This driver is for the Aicom Acent PC internal synthesizer.
26
27
#include <linux/jiffies.h>
28
#include <linux/sched.h>
29
#include <linux/timer.h>
30
#include <linux/kthread.h>
28
32
#include "spk_priv.h"
29
35
#include "speakup_acnt.h" /* local header file for Accent values */
31
#define DRV_VERSION "1.8"
37
#define DRV_VERSION "2.6"
32
38
#define synth_readable() (inb_p(synth_port_control) & SYNTH_READABLE)
33
39
#define synth_writable() (inb_p(synth_port_control) & SYNTH_WRITABLE)
34
40
#define synth_full() (inb_p(speakup_info.port_tts) == 'F')
37
43
static int synth_probe(struct spk_synth *synth);
38
44
static void accent_release(void);
39
45
static const char *synth_immediate(struct spk_synth *synth, const char *buf);
40
static void do_catch_up(struct spk_synth *synth, unsigned long data);
46
static void do_catch_up(struct spk_synth *synth);
41
47
static void synth_flush(struct spk_synth *synth);
43
49
static int synth_port_control;
44
50
static int port_forced;
45
51
static unsigned int synth_portlist[] = { 0x2a8, 0 };
47
static struct st_string_var stringvars[] = {
48
{ CAPS_START, "\033P8" },
49
{ CAPS_STOP, "\033P5" },
52
static struct st_num_var numvars[] = {
53
{ RATE, "\033R%c", 9, 0, 17, 0, 0, "0123456789abcdefgh" },
54
{ PITCH, "\033P%d", 5, 0, 9, 0, 0, 0 },
55
{ VOL, "\033A%d", 5, 0, 9, 0, 0, 0 },
56
{ TONE, "\033V%d", 5, 0, 9, 0, 0, 0 },
53
static struct var_t vars[] = {
54
{ CAPS_START, .u.s = {"\033P8" }},
55
{ CAPS_STOP, .u.s = {"\033P5" }},
56
{ RATE, .u.n = {"\033R%c", 9, 0, 17, 0, 0, "0123456789abcdefgh" }},
57
{ PITCH, .u.n = {"\033P%d", 5, 0, 9, 0, 0, NULL }},
58
{ VOL, .u.n = {"\033A%d", 5, 0, 9, 0, 0, NULL }},
59
{ TONE, .u.n = {"\033V%d", 5, 0, 9, 0, 0, NULL }},
60
63
static struct spk_synth synth_acntpc = {
97
97
while ((ch = *buf)) {
98
int timeout = SPK_XMITR_TIMEOUT;
100
101
if (synth_full())
102
while (synth_writable())
103
while (synth_writable()) {
104
108
outb_p(ch, speakup_info.port_tts);
110
static void do_catch_up(struct spk_synth *synth, unsigned long data)
114
static void do_catch_up(struct spk_synth *synth)
112
unsigned long jiff_max = jiffies+speakup_info.jiffy_delta;
115
while (speakup_info.buff_out < speakup_info.buff_in) {
119
struct var_t *full_time;
121
while (!kthread_should_stop()) {
123
if (speakup_info.flushing) {
124
speakup_info.flushing = 0;
129
if (synth_buffer_empty()) {
133
set_current_state(TASK_INTERRUPTIBLE);
116
135
if (synth_full()) {
117
synth_delay(speakup_info.full_time);
120
while (synth_writable())
122
ch = *speakup_info.buff_out++;
136
full_time = get_var(FULL);
137
schedule_timeout(msecs_to_jiffies(full_time->u.n.value));
140
set_current_state(TASK_RUNNING);
141
timeout = SPK_XMITR_TIMEOUT;
142
while (synth_writable()) {
148
ch = synth_buffer_getc();
125
152
outb_p(ch, speakup_info.port_tts);
126
if (jiffies >= jiff_max && ch == SPACE) {
127
while (synth_writable())
129
outb_p(PROCSPEECH, speakup_info.port_tts);
130
synth_delay(speakup_info.delay_time);
134
while (synth_writable())
154
timeout = SPK_XMITR_TIMEOUT;
155
while (synth_writable()) {
136
160
outb_p(PROCSPEECH, speakup_info.port_tts);
140
163
static void synth_flush(struct spk_synth *synth)