1 /* $NetBSD: weaselreg.h,v 1.6 2001/05/03 17:55:47 hpeyerl Exp $ */
4 * Copyright (c) 2000 Zembu Labs, Inc.
7 * Author: Jason R. Thorpe <thorpej@zembu.com>
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by Zembu Labs, Inc.
20 * 4. Neither the name of Zembu Labs nor the names of its employees may
21 * be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY ZEMBU LABS, INC. ``AS IS'' AND ANY EXPRESS
25 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WAR-
26 * RANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DIS-
27 * CLAIMED. IN NO EVENT SHALL ZEMBU LABS BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 * Register and firmware communication definitions for the
38 * Middle Digital, Inc. PC-Weasel serial console board.
42 * Current versions of the PC-Weasel emulate a Monochrome Display
43 * Adapter. The framebuffer is at the standard ISA framebuffer
44 * location (0xb0000). At the end of the viewable framebuffer area
45 * is a control register space.
48 #define WEASEL_WDT_SEMAPHORE 0x0fa0
50 #define WEASEL_CONFIG_BLOCK 0x0fa1
52 #define WEASEL_WDT_TICKLE 0x0fa2
54 #define WEASEL_MISC_COMMAND 0x0fcd
56 #define WEASEL_MISC_RESPONSE 0x0fce
59 * Layout of the PC-Weasel configuration block. This is taken
60 * more or less right out of the PC-Weasel manual, page 52.
62 struct weasel_config_block
{
63 u_int8_t cfg_version
; /* configuration version */
65 #define CFG_VERSION_1_0 0x01
66 #define CFG_VERSION_1_1 0x02
68 u_int8_t weasel_attn
; /* Weasel attention character */
69 u_int8_t debug
; /* debug level */
70 u_int8_t reset_pc_on_boot
;/* reset PC on Weasel boot */
71 u_int8_t duart_baud
; /* baud rate of DUART */
72 u_int8_t duart_parity
; /* 0 none, 1 even, 2 odd */
73 u_int8_t duart_bits
; /* 7 or 8 */
76 * Unfortunately, between cfg_version 1 and 2, the semantics
77 * of this variable changed.
90 u_int8_t enable_duart_switching
;
91 u_int8_t wdt_allow
; /* 0 disable, 1 allow */
92 u_int16_t wdt_msec
; /* watchdog timer period */
93 u_int8_t duart_flow
; /* 1 rts/cts, 0 none */
94 u_int8_t break_passthru
; /* BREAK is passed through */
95 u_int8_t obsolete
[30]; /* reserved for future use */
96 u_int8_t cksum
; /* arithmetic sum -> reserved */
100 * Commands that can be written to the MISC_COMMAND register.
103 #define OS_READY 0x00 /* ready for commands */
105 #define OS_UART_CLEAR 0x01 /* clear response for OS_UART_QUERY */
107 #define OS_UART_QUERY 0x02 /* query Weasel UART setting */
108 #define UART_QUERY_DIS 0x00 /* UART is disabled */
109 #define UART_QUERY_3f8 0x01 /* UART at 0x3f8 */
110 #define UART_QUERY_2F8 0x02 /* UART at 0x2f8 */
111 #define UART_QUERY_3e8 0x03 /* UART at 0x3e8 */
112 #define UART_QUERY_2e8 0x04 /* UART at 0x2e8 */
114 #define OS_CONFIG_COPY 0x03 /* copy config to offscreen space */
115 #define OS_WDT_QUERY 0x04 /* query watchdog state. 0=off 1=on */
120 * The watchdog timer on the PC-Weasel is enabled/disabled (it's a toggle)
121 * using the WDT_SEMAPHORE register in the offscreen area. The semaphore
122 * is also used to service the watchdog.
124 * To toggle the watchdog:
126 * for (new_state = old_state; new_state == old_state;) {
127 * WDT_SEMAPHORE = 0x22;
129 * if (WDT_SEMAPHORE == 0xea) {
130 * WDT_SEMAPHORE = 0x2f;
132 * if (WDT_SEMAPHORE == 0xae) {
133 * WDT_SEMAPHORE = 0x37;
135 * new_state = WDT_SEMAPHORE;
140 * To serivce the watchdog when armed:
142 * tmp = WDT_SEMPAPHORE;
143 * WDT_SEMAPHORE ~= tmp;
145 #define WDT_ATTENTION 0x22 /* get the attention of the WDT state engine */
146 #define WDT_OK 0xae /* we get back an acknowledgement */
147 #define WDT_ENABLE 0xf1 /* the command to arm to watchdog. */
148 #define WDT_DISABLE 0xf4 /* the command to disarm the watchdog. */