OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uClinux-2.0.x/] [arch/] [armnommu/] [drivers/] [char/] [vt-dummy.c] - Blame information for rev 1775

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/*
2
 * linux/arch/arm/drivers/char/vt-dummy.c
3
 *
4
 * VT routines
5
 *
6
 * Changelog:
7
 *  05-Sep-1996 RMK     Fixed race condition between VT switch & initialisation
8
 *  08-Sep-1996 RMK     Adapted Brad Pepers (ramparts@agt.net) console buffering code
9
 *                      (vt_put_char & vt_flush_chars).
10
 *  20-Sep-1996 RMK     Cut down version for StrongARM eval board.
11
 */
12
 
13
#include <linux/sched.h>
14
#include <linux/tty.h>
15
#include <linux/kd.h>
16
#include <linux/errno.h>
17
#include <linux/malloc.h>
18
#include <linux/mm.h>
19
#include <linux/tty.h>
20
#include <linux/major.h>
21
 
22
#include <asm/segment.h>
23
 
24
#include "kbd_kern.h"
25
#include "vt_kern.h"
26
 
27
/*
28
 * VCD functions
29
 */
30
extern int              vcd_init (struct vt *, int kmallocok, unsigned long *kmem);
31
extern int              vcd_ioctl (struct vt *, int cmd, unsigned long arg);
32
extern unsigned long    vcd_pre_init (unsigned long kmem, struct vt *);
33
 
34
static int vt_refcount;
35
static struct tty_driver vt_driver;
36
static struct tty_struct *vt_table[MAX_NR_CONSOLES];
37
static struct termios *vt_termios[MAX_NR_CONSOLES];
38
static struct termios *vt_termios_locked[MAX_NR_CONSOLES];
39
 
40
int shift_state = 0;
41
struct vt_data vtdata;
42
struct vt vt_con_data[1];
43
 
44
extern void vt_do_blankscreen (int nopowersave);
45
extern void vt_do_unblankscreen (void);
46
 
47
/*
48
 * last_console is the last used console
49
 */
50
struct vt *last_console;
51
 
52
int vt_deallocate (int arg)
53
{
54
    return 0;
55
}
56
 
57
void vt_pokeblankedconsole (void)
58
{
59
}
60
 
61
/*
62
 * for tty_io.c
63
 */
64
void vt_do_unblankscreen (void)
65
{
66
}
67
 
68
int sel_loadlut (const unsigned long arg)
69
{
70
        return 0;
71
}
72
 
73
int set_selection (const unsigned long arg, struct tty_struct *tty)
74
{
75
        return 0;
76
}
77
 
78
int paste_selection (struct tty_struct *tty)
79
{
80
        return 0;
81
}
82
 
83
/*
84
 * for panic.c
85
 */
86
void do_unblank_screen (void)
87
{
88
}
89
 
90
static int vt_open (struct tty_struct *tty, struct file *filp)
91
{
92
    return 0;
93
}
94
 
95
static int vt_write (struct tty_struct *tty, int from_user,
96
                        const unsigned char *buf, int count)
97
{
98
    return vcd_write (NULL, from_user, buf, count);
99
}
100
 
101
static void vt_put_char (struct tty_struct *tty, unsigned char ch)
102
{
103
    vcd_write (NULL, 0, &ch, 1);
104
}
105
 
106
static int vt_write_room (struct tty_struct *tty)
107
{
108
    return 4096;
109
}
110
 
111
static int vt_chars_in_buffer (struct tty_struct *tty)
112
{
113
    return 0;
114
}
115
 
116
static int vt_ioctl (struct tty_struct *tty, struct file *filp,
117
                        unsigned int cmd, unsigned long arg)
118
{
119
    struct vt *vt = tty->driver_data;
120
    int perm;
121
 
122
    if (!vt_allocated (vt))     /* impossible ? */
123
        return -ENOIOCTLCMD;
124
    /*
125
     * To have permissions to do most of the vt ioctls, we either
126
     * have to be the owner of the tty, or super-user.
127
     */
128
    perm = 0;
129
    if (current->tty == tty || suser ())
130
        perm = 1;
131
 
132
#define PERM if (!perm) return -EPERM
133
 
134
    switch (cmd) {
135
    case KDGETMODE:
136
    case KDSETMODE:
137
    case VT_GETMODE:
138
    case VT_SETMODE:
139
    case VT_GETSTATE:
140
    case VT_OPENQRY:
141
    case VT_ACTIVATE:
142
    case VT_WAITACTIVE:
143
    case VT_RELDISP:
144
    case VT_GETSCRINFO:
145
        return -EINVAL;
146
 
147
    case VT_RESIZE:
148
    case KIOCSOUND:
149
    case KDMKTONE:
150
        PERM;
151
    case VT_DISALLOCATE:
152
        return 0;
153
 
154
    case KDMAPDISP:
155
    case KDUNMAPDISP:
156
    case KDSKBMODE:
157
    case KDSKBMETA:
158
    case KDSETKEYCODE:
159
    case KDSKBENT:
160
    case KDSKBSENT:
161
    case KDSKBDIACR:
162
    case KDSKBLED:
163
    case KDSETLED:
164
    case KDSIGACCEPT:
165
    case KDGKBTYPE:
166
    case KDADDIO:
167
    case KDDELIO:
168
    case KDENABIO:
169
    case KDDISABIO:
170
    case KDGKBMODE:
171
    case KDGKBMETA:
172
    case KDGETKEYCODE:
173
    case KDGKBENT:
174
    case KDGKBSENT:
175
    case KDGKBDIACR:
176
    case KDGKBLED:
177
    case KDGETLED:
178
        return -EINVAL;
179
 
180
    case VT_SETPALETTE:
181
    case PIO_FONT:
182
    case PIO_SCRNMAP:
183
    case PIO_UNISCRNMAP:
184
    case PIO_UNIMAPCLR:
185
    case PIO_UNIMAP:
186
        PERM;
187
 
188
    case VT_GETPALETTE:
189
    case GIO_FONT:
190
    case GIO_SCRNMAP:
191
    case GIO_UNISCRNMAP:
192
    case GIO_UNIMAP:
193
        return vcd_ioctl (vt, cmd, arg);
194
    }
195
    return -ENOIOCTLCMD;
196
}
197
 
198
static void vt_dummy (struct tty_struct *tty)
199
{
200
}
201
 
202
int vcs_init(void)
203
{
204
    return 0;
205
}
206
 
207
unsigned long vt_pre_init (unsigned long kmem)
208
{
209
    kmem = vcd_pre_init (kmem, NULL);
210
 
211
    memset (vt_con_data, 0, sizeof (vt_con_data));
212
 
213
    vtdata.blanked      = NULL;
214
    vtdata.fgconsole    = vt_con_data;
215
 
216
    vt_con_data->tty = &vt_table[0];
217
    vt_con_data->num = 1;
218
 
219
    return kmem;
220
}
221
 
222
/*
223
 * This is the post initialisation.  We have kmalloc setup so we can use it...
224
 */
225
void vt_post_init (void)
226
{
227
    memset (&vt_driver, 0, sizeof (struct tty_driver));
228
    vt_driver.magic             = TTY_DRIVER_MAGIC;
229
    vt_driver.name              = "tty";
230
    vt_driver.name_base         = 1;
231
    vt_driver.major             = TTY_MAJOR;
232
    vt_driver.minor_start       = 1;
233
    vt_driver.num               = MAX_NR_CONSOLES;
234
    vt_driver.type              = TTY_DRIVER_TYPE_CONSOLE;
235
    vt_driver.init_termios      = tty_std_termios;
236
    vt_driver.flags             = TTY_DRIVER_REAL_RAW;
237
    vt_driver.refcount          = &vt_refcount;
238
    vt_driver.table             = vt_table;
239
    vt_driver.termios           = vt_termios;
240
    vt_driver.termios_locked    = vt_termios_locked;
241
    vt_driver.open              = vt_open;
242
    vt_driver.write             = vt_write;
243
    vt_driver.put_char          = vt_put_char;
244
    vt_driver.flush_chars       = vt_dummy;
245
    vt_driver.write_room        = vt_write_room;
246
    vt_driver.chars_in_buffer   = vt_chars_in_buffer;
247
    vt_driver.ioctl             = vt_ioctl;
248
    vt_driver.stop              = vt_dummy;
249
    vt_driver.start             = vt_dummy;
250
    vt_driver.throttle          = vt_dummy;
251
    vt_driver.unthrottle        = vt_dummy;
252
 
253
    if (tty_register_driver (&vt_driver))
254
        panic ("Couldn't register console driver");
255
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.