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