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

📄 tty_io.c

📁 os arm os arm os arm os arm os arm os arm os arm os arm os arm os arm os arm os arm os arm os arm
💻 C
字号:
#include "../../include/kernel/tty.h"

extern void console_write(char *string);
extern void rs_read(struct tty_struct *tty);
extern void rs_write(struct tty_struct *tty);

struct tty_struct tty_table[] = 
{
	{
		{ICRNL,	/* change incoming CR to NL */
		OPOST|ONLCR,	/* change outgoing NL to CRNL */
		0,
		ISIG | ICANON | ECHO | ECHOCTL | ECHOKE,
		0,	/* console termio */
		INIT_C_CC},
		0,	/* initial pgrp */
		0,	/* initial stopped */
		console_write,
		{0,0,0,0,""},	/* console read-queue */
		{0,0,0,0,""},	/* console write-queue */
		{0,0,0,0,""}	/* console secondary queue */
	},{
	{
		0, /* no translation */
		0,  /* no translation */
		B2400 | CS8,
		0,
		0,
		INIT_C_CC},
		0,
		0,
		rs_write,
		{0x3f8,0,0,0,""},       /* rs 1 */
		{0x3f8,0,0,0,""},
		{0,0,0,0,""}
	},{
		{0, /* no translation */
		0,  /* no translation */
		B2400 | CS8,
		0,
		0,
		INIT_C_CC},
		0,
		0,
		rs_write,
		{0x2f8,0,0,0,""},       /* rs 2 */
		{0x2f8,0,0,0,""},
		{0,0,0,0,""}
	}
};

int tty_read(int chanel,char* buf,int nr)
{
	return nr;
}

int tty_write(int chanel,char* buf,int nr)
{
	if(chanel<0||chanel>2)
		return -1;
	struct tty_struct *tty=tty_table+chanel;
		
	ENTER_CRITICAL();//进入临界区
	tty->write(buf);
	EXIT_CRITICAL();//退出临界区
	
	return nr;
}

⌨️ 快捷键说明

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