console.h

来自「一个用在mips体系结构中的操作系统」· C头文件 代码 · 共 88 行

H
88
字号
/* * Copyright (C) 1996-1998 by the Board of Trustees *    of Leland Stanford Junior University. *  * This file is part of the SimOS distribution.  * See LICENSE file for terms of the license.  * *//***************************************************************** * sim_console.h * * Very simple console device emulation. * Dan Teodosiu, 07/96 * ****************************************************************/#ifndef _SIM_CONSOLE_H#define _SIM_CONSOLE_H#include "checkpoint.h"#define MAX_CONSOLES 32extern int ConsolePort;         /* console socket no. for slave consoles */extern int SlaveConsoleTimeOut; /* slave console timeout *//*** SimOS interface ***//* Initialize n consoles. When a console wishes to post/clear an interrupt, * it will call the int_f (if any provided). The argument to the function * is 1 if an interrupt is raised, 0 otherwise. */extern void sim_console_init(int n, void (*int_f)(int n, int on));/* Poll all console inputs. Should be called periodically. */extern void sim_console_poll(void);/* Signal a character is available. This function is used by expect to * tell the console (or actually, the OS) it has a character ready for it. */extern void sim_console_has_char(int n);/* Console state checkpointing. Called from startup.c. * version refers to checkpoint version number */extern void sim_console_ckpt(CptDescriptor *cptd);/*** OS interface ***//* Output a character to the console. This never fails, as this device * doesn't model finite buffering capacity. */extern void sim_console_out(int n, char c);/* Outputs a character to the console, without raising any interrupts * - used by the Alpha firmware (not by the OS itself) */extern void sim_console_simpleIO(int n, char c);/* Uses sim_console_out to perform functionality similar to 'write' */extern void sim_console_write(int console, char *buf, unsigned int nbytes);/* Input a character from the console. Returns the character (if any) * or -1 if there is no character pending on this console. If no further * characters are pending, the (input) interrupt is cleared. */extern int  sim_console_in(int n);#define CONS_INT_TX   0x01  /* interrupt enable / state bits */#define CONS_INT_RX   0x02/* Read the current interrupt status of this console. * NOTE: calling this routine has the side effect of clearing any pending * TX interrupt.  * The _noSE version does not have this side-effect */extern int  sim_console_int_status(int n);extern int  sim_console_int_status_noSE(int n);/* Set the interrupt enable bits. */extern void sim_console_int_set(int n, int bits);#endif /* _SIMPROM_H */

⌨️ 快捷键说明

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