aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/speakup/serialio.c
diff options
context:
space:
mode:
authorOkash Khawaja <okash.khawaja@gmail.com>2017-03-16 08:10:17 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-03-17 15:19:09 +0900
commit98c1fda752b604c68f2d7c9a0e10c6aaa3bd2a17 (patch)
tree11e506767710a24def484f98717dfb8be18e55a7 /drivers/staging/speakup/serialio.c
parentStaging: goldfish: use __func__ instead of embedded function names (diff)
downloadlinux-dev-98c1fda752b604c68f2d7c9a0e10c6aaa3bd2a17.tar.xz
linux-dev-98c1fda752b604c68f2d7c9a0e10c6aaa3bd2a17.zip
staging: speakup: move those functions which do outgoing serial comms, into serialio.c
This moves spk_synth_immediate and spk_serial_synth_probe functions into serialio.c. These functions do outgoing serial comms. The move is a step towards collecting all serial comms in serialio.c. This also renames spk_synth_immediate to spk_serial_synth_immediate. Code inside those functions has not been changed. Along the way, this patch also fixes a couple of spots which were calling spk_synth_immediate directly, so that the calls now happen via the spk_syth struct. Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/speakup/serialio.c')
-rw-r--r--drivers/staging/speakup/serialio.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/staging/speakup/serialio.c b/drivers/staging/speakup/serialio.c
index e197200dcd31..e860e48818a4 100644
--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -136,6 +136,35 @@ static void start_serial_interrupt(int irq)
outb(1, speakup_info.port_tts + UART_FCR); /* Turn FIFO On */
}
+int spk_serial_synth_probe(struct spk_synth *synth)
+{
+ const struct old_serial_port *ser;
+ int failed = 0;
+
+ if ((synth->ser >= SPK_LO_TTY) && (synth->ser <= SPK_HI_TTY)) {
+ ser = spk_serial_init(synth->ser);
+ if (!ser) {
+ failed = -1;
+ } else {
+ outb_p(0, ser->port);
+ mdelay(1);
+ outb_p('\r', ser->port);
+ }
+ } else {
+ failed = -1;
+ pr_warn("ttyS%i is an invalid port\n", synth->ser);
+ }
+ if (failed) {
+ pr_info("%s: not found\n", synth->long_name);
+ return -ENODEV;
+ }
+ pr_info("%s: ttyS%i, Driver Version %s\n",
+ synth->long_name, synth->ser, synth->version);
+ synth->alive = 1;
+ return 0;
+}
+EXPORT_SYMBOL_GPL(spk_serial_synth_probe);
+
void spk_stop_serial_interrupt(void)
{
if (speakup_info.port_tts == 0)
@@ -223,6 +252,23 @@ int spk_serial_out(struct spk_synth *in_synth, const char ch)
return 0;
}
+const char *spk_serial_synth_immediate(struct spk_synth *synth, const char *buff)
+{
+ u_char ch;
+
+ while ((ch = *buff)) {
+ if (ch == '\n')
+ ch = synth->procspeech;
+ if (spk_wait_for_xmitr(synth))
+ outb(ch, speakup_info.port_tts);
+ else
+ return buff;
+ buff++;
+ }
+ return NULL;
+}
+EXPORT_SYMBOL_GPL(spk_serial_synth_immediate);
+
void spk_serial_release(void)
{
spk_stop_serial_interrupt();