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