linux/drivers/staging/speakup/spk_types.h
<<
>>
Prefs
   1#ifndef SPEAKUP_TYPES_H
   2#define SPEAKUP_TYPES_H
   3
   4/* This file includes all of the typedefs and structs used in speakup. */
   5
   6#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>
  18
  19enum var_type_t {
  20        VAR_NUM = 0,
  21        VAR_TIME,
  22        VAR_STRING,
  23        VAR_PROC
  24};
  25
  26enum {
  27        E_DEFAULT = 0,
  28        E_SET,
  29        E_INC,
  30        E_DEC,
  31        E_NEW_DEFAULT,
  32};
  33
  34enum var_id_t {
  35        VERSION = 0, SYNTH, SILENT, SYNTH_DIRECT,
  36        KEYMAP, CHARS,
  37        PUNC_SOME, PUNC_MOST, PUNC_ALL,
  38        DELIM, REPEATS, EXNUMBER,
  39        DELAY, TRIGGER, JIFFY, FULL, /* all timers must be together */
  40        BLEEP_TIME, CURSOR_TIME, BELL_POS,
  41        SAY_CONTROL, SAY_WORD_CTL, NO_INTERRUPT, KEY_ECHO,
  42        SPELL_DELAY, PUNC_LEVEL, READING_PUNC,
  43        ATTRIB_BLEEP, BLEEPS,
  44        RATE, PITCH, VOL, TONE, PUNCT, VOICE, FREQUENCY, LANG, DIRECT,
  45        CAPS_START, CAPS_STOP, CHARTAB,
  46        MAXVARS
  47};
  48
  49typedef int (*special_func)(struct vc_data *vc, u_char type, u_char ch,
  50                u_short key);
  51
  52#define COLOR_BUFFER_SIZE 160
  53
  54struct spk_highlight_color_track {
  55        /* Count of each background color */
  56        unsigned int bgcount[8];
  57        /* Buffer for characters drawn with each background color */
  58        u16 highbuf[8][COLOR_BUFFER_SIZE];
  59        /* Current index into highbuf */
  60        unsigned int highsize[8];
  61        /* Reading Position for each color */
  62        u_long rpos[8], rx[8], ry[8];
  63        /* Real Cursor Y Position */
  64        ulong cy;
  65};
  66
  67struct st_spk_t {
  68        u_long reading_x, cursor_x;
  69        u_long reading_y, cursor_y;
  70        u_long reading_pos, cursor_pos;
  71        u_long go_x, go_pos;
  72        u_long w_top, w_bottom, w_left, w_right;
  73        u_char w_start, w_enabled;
  74        u_char reading_attr, old_attr;
  75        char parked, shut_up;
  76        struct spk_highlight_color_track ht;
  77        int tty_stopped;
  78};
  79
  80/* now some defines to make these easier to use. */
  81#define spk_shut_up (speakup_console[vc->vc_num]->shut_up)
  82#define spk_killed (speakup_console[vc->vc_num]->shut_up & 0x40)
  83#define spk_x (speakup_console[vc->vc_num]->reading_x)
  84#define spk_cx (speakup_console[vc->vc_num]->cursor_x)
  85#define spk_y (speakup_console[vc->vc_num]->reading_y)
  86#define spk_cy (speakup_console[vc->vc_num]->cursor_y)
  87#define spk_pos (speakup_console[vc->vc_num]->reading_pos)
  88#define spk_cp (speakup_console[vc->vc_num]->cursor_pos)
  89#define goto_pos (speakup_console[vc->vc_num]->go_pos)
  90#define goto_x (speakup_console[vc->vc_num]->go_x)
  91#define win_top (speakup_console[vc->vc_num]->w_top)
  92#define win_bottom (speakup_console[vc->vc_num]->w_bottom)
  93#define win_left (speakup_console[vc->vc_num]->w_left)
  94#define win_right (speakup_console[vc->vc_num]->w_right)
  95#define win_start (speakup_console[vc->vc_num]->w_start)
  96#define win_enabled (speakup_console[vc->vc_num]->w_enabled)
  97#define spk_attr (speakup_console[vc->vc_num]->reading_attr)
  98#define spk_old_attr (speakup_console[vc->vc_num]->old_attr)
  99#define spk_parked (speakup_console[vc->vc_num]->parked)
 100
 101struct st_var_header {
 102        char *name;
 103        enum var_id_t var_id;
 104        enum var_type_t var_type;
 105        void *p_val; /* ptr to programs variable to store value */
 106        void *data;  /* ptr to the vars data */
 107};
 108
 109struct num_var_t {
 110        char *synth_fmt;
 111        int default_val;
 112        int low;
 113        int high;
 114        short offset, multiplier; /* for fiddling rates etc. */
 115        char *out_str;  /* if synth needs char representation of number */
 116        int value;      /* current value */
 117};
 118
 119struct punc_var_t {
 120        enum var_id_t var_id;
 121        short value;
 122};
 123
 124struct string_var_t {
 125        char *default_val;
 126};
 127
 128struct var_t {
 129        enum var_id_t var_id;
 130        union {
 131                struct num_var_t n;
 132                struct string_var_t s;
 133        } u;
 134};
 135
 136struct st_bits_data { /* punc, repeats, word delim bits */
 137        char *name;
 138        char *value;
 139        short mask;
 140};
 141
 142struct synth_indexing {
 143        char *command;
 144        unsigned char lowindex;
 145        unsigned char highindex;
 146        unsigned char currindex;
 147};
 148
 149struct spk_synth;
 150
 151struct spk_io_ops {
 152        int (*synth_out)(struct spk_synth *synth, const char ch);
 153        void (*send_xchar)(char ch);
 154        void (*tiocmset)(unsigned int set, unsigned int clear);
 155        unsigned char (*synth_in)(void);
 156        unsigned char (*synth_in_nowait)(void);
 157        void (*flush_buffer)(void);
 158};
 159
 160struct spk_synth {
 161        const char *name;
 162        const char *version;
 163        const char *long_name;
 164        const char *init;
 165        char procspeech;
 166        char clear;
 167        int delay;
 168        int trigger;
 169        int jiffies;
 170        int full;
 171        int ser;
 172        char *dev_name;
 173        short flags;
 174        short startup;
 175        const int checkval; /* for validating a proper synth module */
 176        struct var_t *vars;
 177        int *default_pitch;
 178        int *default_vol;
 179        struct spk_io_ops *io_ops;
 180        int (*probe)(struct spk_synth *synth);
 181        void (*release)(void);
 182        const char *(*synth_immediate)(struct spk_synth *synth,
 183                                       const char *buff);
 184        void (*catch_up)(struct spk_synth *synth);
 185        void (*flush)(struct spk_synth *synth);
 186        int (*is_alive)(struct spk_synth *synth);
 187        int (*synth_adjust)(struct st_var_header *var);
 188        void (*read_buff_add)(u_char);
 189        unsigned char (*get_index)(struct spk_synth *synth);
 190        struct synth_indexing indexing;
 191        int alive;
 192        struct attribute_group attributes;
 193};
 194
 195/*
 196 * module_spk_synth() - Helper macro for registering a speakup driver
 197 * @__spk_synth: spk_synth struct
 198 * Helper macro for speakup drivers which do not do anything special in module
 199 * init/exit. This eliminates a lot of boilerplate. Each module may only
 200 * use this macro once, and calling it replaces module_init() and module_exit()
 201 */
 202#define module_spk_synth(__spk_synth) \
 203        module_driver(__spk_synth, synth_add, synth_remove)
 204
 205struct speakup_info_t {
 206        spinlock_t spinlock;
 207        int port_tts;
 208        int flushing;
 209};
 210
 211struct bleep {
 212        short freq;
 213        unsigned long jiffies;
 214        int active;
 215};
 216#endif
 217