|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /* Copyright (c) 1992 NeXT Computer, Inc. All rights reserved.
26: *
27: * kmDevice.h - private #defines and class definition for kernel
28: * keyboard/monitor module.
29: *
30: * HISTORY
31: * 16-Jan-92 Doug Mitchell at NeXT
32: * Created.
33: */
34:
35: #ifdef DRIVER_PRIVATE
36:
37: #import <driverkit/IODevice.h>
38: #import "PCKeyboardDefs.h"
39: #import "ConsoleSupport.h"
40:
41: #define NUM_KM_DEVS 1
42: #define FB_DEV_NORMAL 0 // frameBuffer for normal I/O
43: #define FB_DEV_ALERT 1 // frameBuffer for alert panels
44: #define NUM_FB_DEVS 2
45:
46: #define INBUF_SIZE 16 // size of circular buffer for
47: // blocking getc
48:
49: /*
50: * This class's interface is private to km.m and kmPrivate.m. The
51: * kmDevice is the glue between the bsd device interface (kmopen, kmputc,
52: * etc.) and the two classes which do the actual I/O - adbKeyboard and
53: * frameBuffer.
54: */
55: @interface kmDevice : IODevice <PCKeyboardImported>
56: {
57: /*
58: * kmOpenLock (an NXLock) protects all operations which create and
59: * destroy frameBuffer instances.
60: */
61: id kmOpenLock;
62:
63: /*
64: * frame buffer state.
65: */
66: IOConsoleInfo *fbp[NUM_FB_DEVS]; // output devices
67: ScreenMode fbMode; // current screen mode
68: ScreenMode savedFbMode; // screen mode before entering
69: // FBM_ALERT
70: int alertRefCount;
71:
72: /*
73: * Keyboard info.
74: */
75: id kbId; // input device (adbKeyboard)
76: unsigned blockIn:1; // indicates "blocking getc()
77: // mode"
78:
79:
80: /*
81: * Circular buffer for blocking getc(). A thread waiting for
82: * synchronous input locks inBufLock and sleeps on inBuf.
83: */
84: int inBuf[INBUF_SIZE];
85: int inDex; // in pointer
86: int outDex; // out pointer
87: simple_lock_data_t inBufLock;
88:
89: BOOL hasRegistered; // have called registerDevice
90: BOOL probed; // have been probed
91: }
92:
93: /*
94: * Standard direct device probe.
95: */
96: + (BOOL)probe : deviceDescription;
97: + (IODeviceStyle)deviceStyle;
98:
99: - init : (BOOL)initKb
100: fb_mode : (ScreenMode)fb_mode;
101:
102: /*
103: * Keyboard-specific initialization.
104: */
105: - initKb;
106:
107: /*
108: * Interface to bsd code.
109: */
110: - (int)kmOpen : (int)flag;
111: - (int)kmPutc : (int)c; // paint one character
112: - (int)kmGetc; // blocking read
113:
114: /*
115: * ioctl equivalents.
116: */
117: - (int)restore;
118: - (int)drawRect : (const struct km_drawrect *)kmRect;
119: - (int)eraseRect : (const struct km_drawrect *)kmRect;
120: - (int)disableCons;
121:
122: - (int)animationCtl : (km_anim_ctl_t)ctl;
123: - (int)getStatus : (unsigned *)statusp;
124: - (int)getScreenSize : (struct ConsoleSize *)size;
125:
126: /*
127: * Kernel internal alert panel support.
128: */
129: - (void)doAlert : (const char *)windowTitle
130: msg : (const char *)msg;
131:
132: - (void)registerDisplay:newDisplay;
133: - (void)unregisterDisplay:oldDisplay;
134:
135: @end
136:
137: @interface kmDevice (KmGraphics)
138:
139: - (void)graphicPanelString:(char *)string;
140: - (void)drawGraphicPanel:(GraphicPanelType)panelType;
141:
142: @end
143:
144: /*
145: * 'Global' variables, shared only by km.m and kmDevice.m.
146: */
147:
148: extern kmDevice *kmId; // the kmDevice
149: extern IOConsoleInfo *basicConsole;
150: extern ScreenMode basicConsoleMode;
151: extern const char *mach_title;
152:
153: #endif /* DRIVER_PRIVATE */
154:
155: /* end of kmDevice.h */
156:
157:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.