]> git.saurik.com Git - apple/xnu.git/blame - osfmk/ppc/serial_io.h
xnu-517.tar.gz
[apple/xnu.git] / osfmk / ppc / serial_io.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
43866e37 6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
1c79356b 7 *
43866e37
A
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1c79356b
A
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
43866e37
A
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
1c79356b
A
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25/*
26 * @OSF_COPYRIGHT@
27 */
28/*
29 * @APPLE_FREE_COPYRIGHT@
30 */
31
32
33#include <device/device_types.h>
34#include <mach_kdp.h>
35
36/*
37 * Console is on the Printer Port (chip channel 0)
38 * Debugger is on the Modem Port (chip channel 1)
39 */
40
41#define CONSOLE_PORT 1
42
43struct scc_tty {
44 char * t_addr; /* device pointer */
45 int t_dev; /* device number */
46 int t_ispeed; /* input speed */
47 int t_ospeed; /* output speed */
48 char t_breakc; /* character to deliver when 'break'
49 condition received */
50 int t_flags; /* mode flags */
51 int t_state; /* current state */
52 int t_line; /* fake line discipline number,
53 for old drivers - always 0 */
54 int t_outofband; /* current out-of-band events */
55 int t_outofbandarg; /* arg to first out-of-band event */
56 int t_nquoted; /* number of quoted chars in inq */
57 int t_hiwater; /* baud-rate limited high water mark */
58 int t_lowater; /* baud-rate limited low water mark */
59};
60typedef struct scc_tty *scc_tty_t;
61
62/*
63 * function declarations for performing serial i/o
64 * other functions below are declared in kern/misc_protos.h
65 * cnputc, cngetc, cnmaygetc
66 */
67
68void initialize_serial(caddr_t scc_phys_base);
69
70extern int scc_probe(void);
71
72#if 0
73extern int scc_open(
74 dev_t dev,
75 dev_mode_t flag,
76 io_req_t ior);
77
78extern void scc_close(
79 dev_t dev);
80
81extern int scc_read(
82 dev_t dev,
83 io_req_t ior);
84
85extern io_return_t scc_write(
86 dev_t dev,
87 io_req_t ior);
88
89extern io_return_t scc_get_status(
90 dev_t dev,
91 dev_flavor_t flavor,
92 dev_status_t data,
93 mach_msg_type_number_t *status_count);
94
95extern io_return_t scc_set_status(
96 dev_t dev,
97 dev_flavor_t flavor,
98 dev_status_t data,
99 mach_msg_type_number_t status_count);
100
101extern boolean_t scc_portdeath(
102 dev_t dev,
103 ipc_port_t port);
104
105#endif /* 0 */
106
107extern int scc_putc(
108 int unit,
109 int line,
110 int c);
111
112extern int scc_getc(
113 int unit,
114 int line,
115 boolean_t wait,
116 boolean_t raw);
117
118/* Functions in serial_console.c for switching between serial and video
119 consoles. */
120extern boolean_t console_is_serial(void);
121extern int switch_to_serial_console(
122 void);
123
124extern int switch_to_video_console(
125 void);
126
127extern void switch_to_old_console(
128 int old_console);
129
55e303ae
A
130void serial_keyboard_init(void);
131void serial_keyboard_start(void);
132void serial_keyboard_poll(void);
133
1c79356b 134
de355530
A
135/*
136 * JMM - We are not really going to support this driver in SMP (barely
137 * support it now - so just pick up the stubbed out versions.
138 */
139#define DECL_FUNNEL(class,f)
140#define DECL_FUNNEL_VARS
141#define FUNNEL_INIT(f,p)
142#define FUNNEL_ENTER(f)
143#define FUNNEL_EXIT(f)
144#define FUNNEL_ESCAPE(f) (1)
145#define FUNNEL_REENTER(f,count)
146#define FUNNEL_IN_USE(f) (TRUE)
1c79356b
A
147
148/*
149 * Flags
150 */
151#define TF_ODDP 0x00000002 /* get/send odd parity */
152#define TF_EVENP 0x00000004 /* get/send even parity */
153#define TF_ANYP (TF_ODDP|TF_EVENP)
154 /* get any parity/send none */
155#define TF_LITOUT 0x00000008 /* output all 8 bits
156 otherwise, characters >= 0x80
157 are time delays XXX */
158#define TF_ECHO 0x00000080 /* device wants user to echo input */
159#define TS_MIN 0x00004000 /* buffer input chars, if possible */