New developer version 0.6.8; added select () function; added demonstrating example...
[ZeXOS.git] / kernel / include / tty.h
blobd017d9bb5305a69a8bd3e7315dd9592b19113fa4
1 /*
2 * ZeX/OS
3 * Copyright (C) 2007 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
4 * Copyright (C) 2008 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
5 * Copyright (C) 2009 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
6 * Copyright (C) 2010 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #ifndef _TTY_H
24 #define _TTY_H
26 #include <task.h>
27 #include <user.h>
28 #include <mytypes.h>
30 #define FD_TERM 0x2000
32 #define TTY_CON_BUF 16000
33 #define TTY_COUNT_MAX 1024
34 #define TTY_SCREEN_RES_VGA 4000
35 #define TTY_SCREEN_RES_VESA 4000
37 /* font type, size */
38 typedef struct {
39 unsigned char *c;
40 unsigned char x;
41 unsigned char y;
42 } tty_font_t;
44 /* character array resolution - 80x25 */
45 typedef struct {
46 unsigned short x;
47 unsigned short y;
48 } tty_char_t;
50 /* log for read () op purposes */
51 typedef struct {
52 char *buf;
53 unsigned short len;
54 unsigned short pos;
55 } tty_log_t;
57 /* Device structure */
58 typedef struct tty_context {
59 struct tty_context *next, *prev;
61 task_t *task;
62 char *name;
63 char *screen;
64 unsigned char screen_x;
65 unsigned char screen_y;
66 user_t *user;
67 char shell[64];
68 unsigned shell_len;
69 bool logged;
70 char pwd[64];
71 bool active;
72 tty_log_t *log;
73 } tty_t;
75 /* externs */
76 extern tty_font_t tty_font; /* global font settings */
77 extern tty_char_t tty_char; /* global character array settings */
79 extern unsigned int init_tty ();
80 extern bool tty_write (tty_t *tty, char *str, unsigned len);
81 extern bool tty_putch (char c);
82 extern bool tty_putnch (tty_t *tty, char c);
83 extern bool tty_change (tty_t *tty);
84 extern tty_t *tty_find (char *name);
85 extern tty_t *tty_findbytask (task_t *task);
86 extern tty_t *gtty_init ();
87 extern tty_t *tty_create ();
88 extern void tty_listview ();
90 #endif