Path: blob/master/drivers/accessibility/speakup/spk_types.h
25922 views
/* SPDX-License-Identifier: GPL-2.0 */1#ifndef SPEAKUP_TYPES_H2#define SPEAKUP_TYPES_H34/* This file includes all of the typedefs and structs used in speakup. */56#include <linux/types.h>7#include <linux/fs.h>8#include <linux/errno.h>9#include <linux/delay.h>10#include <linux/wait.h> /* for wait_queue */11#include <linux/init.h> /* for __init */12#include <linux/module.h>13#include <linux/vt_kern.h>14#include <linux/spinlock.h>15#include <linux/mutex.h>16#include <linux/io.h> /* for inb_p, outb_p, inb, outb, etc... */17#include <linux/device.h>1819enum var_type_t {20VAR_NUM = 0,21VAR_TIME,22VAR_STRING,23VAR_PROC24};2526enum {27E_DEFAULT = 0,28E_SET,29E_INC,30E_DEC,31E_NEW_DEFAULT,32};3334/*35* Note: add new members at the end, speakupmap.h depends on the values of the36* enum starting from SPELL_DELAY (see inc_dec_var)37*/38enum var_id_t {39VERSION = 0, SYNTH, SILENT, SYNTH_DIRECT,40KEYMAP, CHARS,41PUNC_SOME, PUNC_MOST, PUNC_ALL,42DELIM, REPEATS, EXNUMBER,43DELAY, TRIGGER, JIFFY, FULL, /* all timers must be together */44BLEEP_TIME, CURSOR_TIME, BELL_POS,45SAY_CONTROL, SAY_WORD_CTL, NO_INTERRUPT, KEY_ECHO,46SPELL_DELAY, PUNC_LEVEL, READING_PUNC,47ATTRIB_BLEEP, BLEEPS,48RATE, PITCH, VOL, TONE, PUNCT, VOICE, FREQUENCY, LANG,49DIRECT, PAUSE,50CAPS_START, CAPS_STOP, CHARTAB, INFLECTION, FLUSH,51CUR_PHONETIC, MAXVARS52};5354typedef int (*special_func)(struct vc_data *vc, u_char type, u_char ch,55u_short key);5657#define COLOR_BUFFER_SIZE 1605859struct spk_highlight_color_track {60/* Count of each background color */61unsigned int bgcount[8];62/* Buffer for characters drawn with each background color */63u16 highbuf[8][COLOR_BUFFER_SIZE];64/* Current index into highbuf */65unsigned int highsize[8];66/* Reading Position for each color */67u_long rpos[8], rx[8], ry[8];68/* Real Cursor Y Position */69ulong cy;70};7172struct st_spk_t {73u_long reading_x, cursor_x;74u_long reading_y, cursor_y;75u_long reading_pos, cursor_pos;76u_long go_x, go_pos;77u_long w_top, w_bottom, w_left, w_right;78u_char w_start, w_enabled;79u_char reading_attr, old_attr;80char parked, shut_up;81struct spk_highlight_color_track ht;82int tty_stopped;83};8485/* now some defines to make these easier to use. */86#define spk_shut_up (speakup_console[vc->vc_num]->shut_up)87#define spk_killed (speakup_console[vc->vc_num]->shut_up & 0x40)88#define spk_x (speakup_console[vc->vc_num]->reading_x)89#define spk_cx (speakup_console[vc->vc_num]->cursor_x)90#define spk_y (speakup_console[vc->vc_num]->reading_y)91#define spk_cy (speakup_console[vc->vc_num]->cursor_y)92#define spk_pos (speakup_console[vc->vc_num]->reading_pos)93#define spk_cp (speakup_console[vc->vc_num]->cursor_pos)94#define goto_pos (speakup_console[vc->vc_num]->go_pos)95#define goto_x (speakup_console[vc->vc_num]->go_x)96#define win_top (speakup_console[vc->vc_num]->w_top)97#define win_bottom (speakup_console[vc->vc_num]->w_bottom)98#define win_left (speakup_console[vc->vc_num]->w_left)99#define win_right (speakup_console[vc->vc_num]->w_right)100#define win_start (speakup_console[vc->vc_num]->w_start)101#define win_enabled (speakup_console[vc->vc_num]->w_enabled)102#define spk_attr (speakup_console[vc->vc_num]->reading_attr)103#define spk_old_attr (speakup_console[vc->vc_num]->old_attr)104#define spk_parked (speakup_console[vc->vc_num]->parked)105106struct st_var_header {107char *name;108enum var_id_t var_id;109enum var_type_t var_type;110void *p_val; /* ptr to programs variable to store value */111void *data; /* ptr to the vars data */112};113114struct num_var_t {115char *synth_fmt;116int default_val;117int low;118int high;119short offset, multiplier; /* for fiddling rates etc. */120char *out_str; /* if synth needs char representation of number */121int value; /* current value */122};123124struct punc_var_t {125enum var_id_t var_id;126short value;127};128129struct string_var_t {130char *default_val;131};132133struct var_t {134enum var_id_t var_id;135union {136struct num_var_t n;137struct string_var_t s;138} u;139};140141struct st_bits_data { /* punc, repeats, word delim bits */142char *name;143char *value;144short mask;145};146147struct synth_indexing {148char *command;149unsigned char lowindex;150unsigned char highindex;151unsigned char currindex;152};153154struct spk_synth;155156struct spk_io_ops {157int (*synth_out)(struct spk_synth *synth, const char ch);158int (*synth_out_unicode)(struct spk_synth *synth, u16 ch);159void (*send_xchar)(struct spk_synth *synth, char ch);160void (*tiocmset)(struct spk_synth *synth, unsigned int set, unsigned int clear);161unsigned char (*synth_in)(struct spk_synth *synth);162unsigned char (*synth_in_nowait)(struct spk_synth *synth);163void (*flush_buffer)(struct spk_synth *synth);164int (*wait_for_xmitr)(struct spk_synth *synth);165};166167struct spk_synth {168struct list_head node;169170const char *name;171const char *version;172const char *long_name;173const char *init;174char procspeech;175char clear;176int delay;177int trigger;178int jiffies;179int full;180int flush_time;181int ser;182char *dev_name;183short flags;184short startup;185const int checkval; /* for validating a proper synth module */186struct var_t *vars;187int *default_pitch;188int *default_vol;189struct spk_io_ops *io_ops;190int (*probe)(struct spk_synth *synth);191void (*release)(struct spk_synth *synth);192const char *(*synth_immediate)(struct spk_synth *synth,193const char *buff);194void (*catch_up)(struct spk_synth *synth);195void (*flush)(struct spk_synth *synth);196int (*is_alive)(struct spk_synth *synth);197int (*synth_adjust)(struct spk_synth *synth, struct st_var_header *var);198void (*read_buff_add)(u_char c);199unsigned char (*get_index)(struct spk_synth *synth);200struct synth_indexing indexing;201int alive;202struct attribute_group attributes;203204void *dev;205};206207/*208* module_spk_synth() - Helper macro for registering a speakup driver209* @__spk_synth: spk_synth struct210* Helper macro for speakup drivers which do not do anything special in module211* init/exit. This eliminates a lot of boilerplate. Each module may only212* use this macro once, and calling it replaces module_init() and module_exit()213*/214#define module_spk_synth(__spk_synth) \215module_driver(__spk_synth, synth_add, synth_remove)216217struct speakup_info_t {218spinlock_t spinlock;219int port_tts;220int flushing;221};222223struct bleep {224short freq;225unsigned long jiffies;226int active;227};228#endif229230231