No empty .Rs/.Re
[netbsd-mini2440.git] / sys / arch / evbarm / dev / plcomvar.h
blobe9566f70de2e6a3cf2b254c3735b7d51313ace57
1 /* $NetBSD: plcomvar.h,v 1.5 2007/10/17 19:54:11 garbled Exp $ */
3 /*
4 * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by Christopher G. Demetriou
17 * for the NetBSD Project.
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #include "rnd.h"
34 #include "opt_multiprocessor.h"
35 #include "opt_lockdebug.h"
36 #include "opt_plcom.h"
37 #include "opt_kgdb.h"
39 #if NRND > 0 && defined(RND_COM)
40 #include <sys/rnd.h>
41 #endif
43 #include <sys/callout.h>
44 #include <sys/timepps.h>
45 #include <sys/simplelock.h>
47 int plcomcnattach (bus_space_tag_t, bus_addr_t, int, int, tcflag_t, int);
48 void plcomcndetach (void);
50 #ifdef KGDB
51 int plcom_kgdb_attach (bus_space_tag_t, bus_addr_t, int, int, tcflag_t);
52 #endif
54 int plcom_is_console (bus_space_tag_t, int, bus_space_handle_t *);
56 /* Hardware flag masks */
57 #define PLCOM_HW_NOIEN 0x01
58 #define PLCOM_HW_FIFO 0x02
59 #define PLCOM_HW_HAYESP 0x04
60 #define PLCOM_HW_FLOW 0x08
61 #define PLCOM_HW_DEV_OK 0x20
62 #define PLCOM_HW_CONSOLE 0x40
63 #define PLCOM_HW_KGDB 0x80
64 #define PLCOM_HW_TXFIFO_DISABLE 0x100
66 /* Buffer size for character buffer */
67 #define PLCOM_RING_SIZE 2048
69 struct plcom_softc {
70 struct device sc_dev;
71 void *sc_si;
72 struct tty *sc_tty;
74 struct callout sc_diag_callout;
76 bus_addr_t sc_iounit;
77 int sc_frequency;
79 bus_space_tag_t sc_iot;
80 bus_space_handle_t sc_ioh;
82 u_int sc_overflows,
83 sc_floods,
84 sc_errors;
86 int sc_hwflags,
87 sc_swflags;
88 u_int sc_fifolen;
90 u_int sc_r_hiwat,
91 sc_r_lowat;
92 u_char *volatile sc_rbget,
93 *volatile sc_rbput;
94 volatile u_int sc_rbavail;
95 u_char *sc_rbuf,
96 *sc_ebuf;
98 u_char *sc_tba;
99 u_int sc_tbc,
100 sc_heldtbc;
102 volatile u_char sc_rx_flags,
103 #define RX_TTY_BLOCKED 0x01
104 #define RX_TTY_OVERFLOWED 0x02
105 #define RX_IBUF_BLOCKED 0x04
106 #define RX_IBUF_OVERFLOWED 0x08
107 #define RX_ANY_BLOCK 0x0f
108 sc_tx_busy,
109 sc_tx_done,
110 sc_tx_stopped,
111 sc_st_check,
112 sc_rx_ready;
114 volatile u_char sc_heldchange;
115 volatile u_char sc_msr, sc_msr_delta, sc_msr_mask, sc_mcr,
116 sc_mcr_active, sc_lcr, sc_cr, sc_dlbl, sc_dlbh;
117 u_char sc_mcr_dtr, sc_mcr_rts, sc_msr_cts, sc_msr_dcd;
118 u_int sc_fifo;
120 /* Support routine to program mcr lines, if present. */
121 void (*sc_set_mcr)(void *, int, u_int);
122 void *sc_set_mcr_arg;
124 /* power management hooks */
125 int (*enable) (struct plcom_softc *);
126 void (*disable) (struct plcom_softc *);
127 int enabled;
129 /* PPS signal on DCD, with or without inkernel clock disciplining */
130 u_char sc_ppsmask; /* pps signal mask */
131 u_char sc_ppsassert; /* pps leading edge */
132 u_char sc_ppsclear; /* pps trailing edge */
133 pps_info_t ppsinfo;
134 pps_params_t ppsparam;
136 #if NRND > 0 && defined(RND_COM)
137 rndsource_element_t rnd_source;
138 #endif
139 struct simplelock sc_lock;
142 int plcomprobe1 (bus_space_tag_t, bus_space_handle_t);
143 int plcomintr (void *);
144 void plcom_attach_subr (struct plcom_softc *);
145 int plcom_detach (struct device *, int);
146 int plcom_activate (struct device *, enum devact);