⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tty.h

📁 别人的根据linux0.11改的一个小的操作系统
💻 H
字号:
/* 
 * tty.h
 *
 */
#ifndef	_TTY_H
#define _TTY_H
/*************************************************
 *queue
 *used for console read and write
 ************************************************/
#define MAX_CHAR	64         /* Max buffer count is 64. */
struct _queue{
	char data[MAX_CHAR];       /* Queue data area. */
	char head;                 /* Head pointer,point to the queue first element. */
	char tail;                 /* Tail pointer,point to the queue last element. */
};
#define	EMPTY(q)	(((q).head%MAX_CHAR)==((q).tail%MAX_CHAR))
#define FULL(q)		((((q).tail%MAX_CHAR)-((q).head%MAX_CHAR))==MAX_CHAR)
void put_queue(struct _queue *,char);   /* Write a element into the queue. */
char get_queue(struct _queue *);        /* Read a element from the queue. */

/************************************************
 *terminal flags
 *mark the flags whether be seted...
 ***********************************************/
struct _termflags{
	unsigned char f_echo;
};
/************************************************
 *tty structure
 *
 ***********************************************/
struct _tty_struct{
	struct _termflags flags;
	struct _queue raw;
	struct _queue final;
	void (*write)();
};

struct _tty_struct tty[3];

void tty_init();
void con_read(struct _tty_struct *);
void con_write(struct _tty_struct *);

void con_init();
void drv_init();

extern void kb_interrupt();                 /* Keyboard interrupt routine. */
void do_kb_interrupt(char);                 /* Keyboard interrupt will call this routine. */
void do_tty_interrupt(struct _tty_struct *);/* Process tty. */

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -