TacOS  0.2
 Tout Structures de données Fichiers Fonctions Variables Définitions de type Énumérations Macros
tty.h
Aller à la documentation de ce fichier.
1 
29 #ifndef _TTY_H_
30 #define _TTY_H_
31 
32 #include <types.h>
33 #include <termios_types.h>
34 #include <fd_types.h>
35 
36 #define TIOCGWINSZ 3
37 #define TIOCSCTTY 4
39 #define MAX_INPUT 255
41 #define TTY_DRIVER_TYPE_SYSTEM 1
42 #define TTY_DRIVER_TYPE_CONSOLE 2
43 #define TTY_DRIVER_TYPE_SERIAL 3
44 #define TTY_DRIVER_TYPE_PTY 4
45 
46 struct _tty_driver_t;
47 
48 /* intr=^C quit=^\ erase=bs kill=^U
49  eof=^D vtime=\0 vmin=\1 sxtc=\0
50  start=^Q stop=^S susp=^Z eol=\0
51  reprint=^R discard=^U werase=^W lnext=^V
52  eol2=\0
53 */
54 #define INIT_C_CC {3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 21, 23, 22, 0}
55 
56 extern struct termios tty_std_termios;
57 
61 typedef struct _tty_struct_t {
62  int index;
63  struct termios termios;
64  char buffer[MAX_INPUT];
65  unsigned int p_begin;
66  unsigned int p_end;
67  struct _tty_driver_t *driver;
68  uint8_t sem;
69  int fg_process;
70  int n_open;
71 } tty_struct_t;
72 
76 typedef struct _tty_operations_t {
77  int (*open) (tty_struct_t*, open_file_descriptor*);
78  int (*close) (tty_struct_t*, open_file_descriptor*);
79  size_t (*write)(tty_struct_t*, open_file_descriptor*, const unsigned char*, size_t);
80  void (*put_char)(tty_struct_t *tty, unsigned char ch);
81  size_t (*set_termios)(struct termios*, struct termios*);
82  int (*ioctl)(tty_struct_t *tty, open_file_descriptor*, unsigned int, void *);
84 
85 
89 typedef struct _tty_driver_t {
90  const char * driver_name;
91  const char * devfs_name;
92  int num;
93  short type;
94  short subtype;
96  struct termios init_termios;
97  tty_struct_t **ttys;
98  tty_operations_t *ops;
99 } tty_driver_t;
100 
104 struct winsize {
105  unsigned short ws_row;
106  unsigned short ws_col;
107 };
108 
116 tty_driver_t *alloc_tty_driver(int lines);
117 
125 int tty_register_driver(tty_driver_t *driver);
126 
133 void tty_insert_flip_char(tty_struct_t *tty, unsigned char ch);
134 
138 void tty_init();
139 
140 #endif
void tty_insert_flip_char(tty_struct_t *tty, unsigned char ch)
Definition: tty.c:91
Definition: termios_types.h:98
Definition: tty.h:61
Structure qui contient la taille d'une fenetre.
Definition: tty.h:104
int index
Definition: tty.h:62
unsigned short ws_col
Definition: tty.h:106
short type
Definition: tty.h:93
int tty_register_driver(tty_driver_t *driver)
Definition: tty.c:181
uint32_t flags
Definition: tty.h:95
uint32_t size_t
Definition: types.h:43
int num
Definition: tty.h:92
const char * devfs_name
Definition: tty.h:91
tty_driver_t * alloc_tty_driver(int lines)
Definition: tty.c:174
Structures liées aux fichiers ouverts.
struct _tty_struct_t tty_struct_t
unsigned char uint8_t
Definition: types.h:34
char buffer[MAX_INPUT]
Definition: tty.h:64
Definition: tty.h:76
void tty_init()
Initialisation du système de terminaux.
Definition: tty.c:80
#define MAX_INPUT
Definition: tty.h:39
short subtype
Definition: tty.h:94
struct _tty_driver_t tty_driver_t
struct _tty_operations_t tty_operations_t
unsigned long int uint32_t
Definition: types.h:36
unsigned short ws_row
Definition: tty.h:105
Definition: tty.h:89
const char * driver_name
Definition: tty.h:90
Definition: fd_types.h:91