console.h
2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
* 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 32
extern 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 */