Home | History | Annotate | Line # | Download | only in memswitch
properties.c revision 1.2
      1 /*	$NetBSD: properties.c,v 1.2 1999/06/28 08:49:15 minoura Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1999 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Minoura Makoto.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. All advertising materials mentioning features or use of this software
     19  *    must display the following acknowledgement:
     20  *	This product includes software developed by the NetBSD
     21  *	Foundation, Inc. and its contributors.
     22  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  *    contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  * POSSIBILITY OF SUCH DAMAGE.
     37  */
     38 
     39 
     40 #include <sys/types.h>
     41 
     42 #include "memswitch.h"
     43 #include "methods.h"
     44 
     45 
     46 /*
     47  * XXX: gcc extension is used.
     48  */
     49 struct property properties[] = {
     50 	{
     51 		"special", "magic1",
     52 		0, 4, 0, {longword:0}, 0, {longword:0}, {longword:MAGIC1},
     53 		parse_dummy, 0, 0,
     54 		print_magic,
     55 		fill_ulong, flush_ulong,
     56 		" Magic.  Must be 0x82773638\n"
     57 	},
     58 	{
     59 		"special", "magic2",
     60 		4, 4, 0, {longword:0}, 0, {longword:0}, {longword:MAGIC2},
     61 		parse_dummy, 0, 0,
     62 		print_magic,
     63 		fill_ulong, flush_ulong,
     64 		" Magic.  Must be 0x30303057\n"
     65 	},
     66 	{
     67 		"alarm", "bootmode",
     68 		30, 4, 0, {longword:0}, 0, {longword:0}, {longword:0},
     69 		parse_ulong, 0, 0xff0000,
     70 		print_ulongh,
     71 		fill_ulong, flush_ulong,
     72 		" What to do on RTC alarm boot.\n"
     73 	},
     74 	{
     75 		"alarm", "boottime",
     76 		34, 4, 0, {longword:0}, 0, {longword:0}, {longword:0xffff0000},
     77 		parse_ulong, 0, 0xffffffff,
     78 		print_ulongh,
     79 		fill_ulong, flush_ulong,
     80 		" Alarm.\n"
     81 	},
     82 	{
     83 		"alarm", "enabled",
     84 		38, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}},
     85 		parse_uchar, 0, 7,
     86 		print_uchar,
     87 		fill_uchar, flush_uchar,
     88 		" 0 to enable alarm, 7 to disable.\n"
     89 	},
     90 	{
     91 		"alarm", "timetodown",
     92 		20, 4, 0, {longword:0}, 0, {longword:0}, {longword:-1},
     93 		parse_time, -1, 0x7fffffff,
     94 		print_timesec,
     95 		fill_ulong, flush_ulong,
     96 		" When boot on alarm, time to shutdown is stored in second.\n"
     97 		" Can be specified in minite with suffix minute.\n"
     98 	},
     99 	{
    100 		"boot", "device",
    101 		24, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] -1}},
    102 		parse_bootdev, 0, 0,
    103 		print_bootdev,
    104 		fill_ushort, flush_ushort,
    105 		" Boot device.\n"
    106 		" STD for standard, HDn for the nth harddisk,  FDn for the nth floppy drive,\n"
    107 		" ROM for ROM, RAM for RAM.\n"
    108 	},
    109 	{
    110 		"boot", "ramaddr",
    111 		16, 4, 0, {longword:0}, 0, {longword:0}, {longword:0xed0100},
    112 		parse_ulong, 0xed0000, 0xed3fff,
    113 		print_ulongh,
    114 		fill_ulong, flush_ulong,
    115 		" If boot.device specifies to boot from RAM, the start address is stored.\n"
    116 	},
    117 	{
    118 		"boot", "romaddr",
    119 		12, 4, 0, {longword:0}, 0, {longword:0}, {longword:0xbffffc},
    120 		parse_ulong, 0xe80000, 0xffffff,
    121 		print_ulongh,
    122 		fill_ulong, flush_ulong,
    123 		" If boot.device specifies to boot from ROM, the start address is stored.\n"
    124 	},
    125 	{
    126 		"display", "contrast",
    127 		40, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 14}},
    128 		parse_uchar, 0, 1,
    129 		print_uchar,
    130 		fill_uchar, flush_uchar,
    131 		" Display contrast (0-15).\n"
    132 	},
    133 	{
    134 		"display", "dentakufont",
    135 		44, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}},
    136 		parse_uchar, 0, 1,
    137 		print_uchar,
    138 		fill_uchar, flush_uchar,
    139 		" In-line calculator font.  0 for LCD-like, 1 for normal.\n"
    140 		" Note on NetBSD in-line calculator is not supported.\n"
    141 	},
    142 	{
    143 		"display", "glyphmode",
    144 		89, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}},
    145 		parse_uchar, 0, 0x7,
    146 		print_ucharh,
    147 		fill_uchar, flush_uchar,
    148 		" Glyph mode for ASCII/JIS ROMAN characters (bitmap).\n"
    149 		" Bit 0 (LSB) is for codepoint 0x5c (\\), bit 1 for 0x7e (~),\n"
    150 		" bit 2 for 0x7c (|).\n"
    151 		" 0 for JIS ROMAN, 1 for ASCII.\n"
    152 	},
    153 	{
    154 		"display", "resolution",
    155 		29, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 16}},
    156 		parse_uchar, 0, 18,
    157 		print_ucharh,
    158 		fill_uchar, flush_uchar,
    159 		" Initial display resolution.\n"
    160 	},
    161 	{
    162 		"display", "tcolor0",
    163 		46, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0}},
    164 		parse_ushort, 0, 0xffff,
    165 		print_ushorth,
    166 		fill_ushort, flush_ushort,
    167 		" Initial RGB value for color cell #0.\n"
    168 		" Note on NetBSD the value is ignored.\n"
    169 	},
    170 	{
    171 		"display", "tcolor1",
    172 		48, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0xf83e}},
    173 		parse_ushort, 0, 0xffff,
    174 		print_ushorth,
    175 		fill_ushort, flush_ushort,
    176 		" Initial RGB value for color cell #1.\n"
    177 		" Note on NetBSD the value is ignored.\n"
    178 	},
    179 	{
    180 		"display", "tcolor2",
    181 		50, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0xffc0}},
    182 		parse_ushort, 0, 0xffff,
    183 		print_ushorth,
    184 		fill_ushort, flush_ushort,
    185 		" Initial RGB value for color cell #2.\n"
    186 		" Note on NetBSD the value is ignored.\n"
    187 	},
    188 	{
    189 		"display", "tcolor3",
    190 		52, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0xfffe}},
    191 		parse_ushort, 0, 0xffff,
    192 		print_ushorth,
    193 		fill_ushort, flush_ushort,
    194 		" Initial RGB value for color cell #3.\n"
    195 		" Note on NetBSD the value is ignored.\n"
    196 	},
    197 	{
    198 		"display", "tcolor47",
    199 		54, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0xde6c}},
    200 		parse_ushort, 0, 0xffff,
    201 		print_ushorth,
    202 		fill_ushort, flush_ushort,
    203 		" Initial RGB value for color cell #4-7.\n"
    204 		" Note on NetBSD the value is ignored.\n"
    205 	},
    206 	{
    207 		"display", "tcolor8f",
    208 		56, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0}},
    209 		parse_ushort, 0, 0xffff,
    210 		print_ushorth,
    211 		fill_ushort, flush_ushort,
    212 		" Initial RGB value for color cell #8-15.\n"
    213 		" Note on NetBSD the value is ignored.\n"
    214 	},
    215 	{
    216 		"hw", "harddrive",
    217 		90, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}},
    218 		parse_uchar, 0, 15,
    219 		print_ucharh,
    220 		fill_uchar, flush_uchar,
    221 		" Number of old, SASI-compatible hard disks connected.\n"
    222 		" Note they are not supported on NetBSD.\n"
    223 	},
    224 	{
    225 		"hw", "memory",
    226 		8, 4, 0, {longword:0}, 0, {longword:0}, {longword:1024*1024},
    227 		parse_byte, 1024*1024, 12*1024*1024,
    228 		print_ulongh,
    229 		fill_ulong, flush_ulong,
    230 		" Memory size in byte.\n"
    231 		" Can be specified by Kilobyte and Megabyte with suffix KB and MB respectively.\n"
    232 	},
    233 	{
    234 		"hw", "serial",
    235 		26, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0x4e07}},
    236 		parse_serial, 0, 0,
    237 		print_serial,
    238 		fill_ushort, flush_ushort,
    239 		" Serial mode.\n"
    240 		" Consist of comma-separated 5 specs.  The first value means speed in bps,\n"
    241 		" second means the bit width (5-8), third means parity (n for non parity,\n"
    242 		" o for odd parity, e for even parity), fourth means stop bit (2, 1 or 1.5),\n"
    243 		" fifth for software flow control (`-' or `s').\n"
    244 		" Note that the value is ignored on NetBSD.\n"
    245 	},
    246 	{
    247 		"hw", "srammode",
    248 		45, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}},
    249 		parse_srammode, 0, 1,
    250 		print_srammode,
    251 		fill_uchar, flush_uchar,
    252 		" Usage of the user area of non-volatile static RAM.\n"
    253 		" 0 for unused, 1 for SRAMDISK, 2 for user program.\n"
    254 	},
    255 	{
    256 		"hw", "upcount",
    257 		84, 4, 0, {longword:0}, 0, {longword:0}, {longword:0},
    258 		parse_dummy, 0, 0xffffffff,
    259 		print_ulong,
    260 		fill_ulong, flush_dummy,
    261 		" Boot count since the SRAM is initialized.\n"
    262 	},
    263 	{
    264 		"hw", "uptime",
    265 		76, 4, 0, {longword:0}, 0, {longword:0}, {longword:0},
    266 		parse_dummy, 0, 0xffffffff,
    267 		print_ulong,
    268 		fill_ulong, flush_dummy,
    269 		" Total uptime since the SRAM is initialized.\n"
    270 	},
    271 	{
    272 		"keyboard", "delay",
    273 		58, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 3}},
    274 		parse_uchar, 0, 0xff,
    275 		print_uchar,
    276 		fill_uchar, flush_uchar,
    277 		" Delay for start keyboard autorepeat. (200+100*n) ms.\n"
    278 	},
    279 	{
    280 		"keyboard", "kanalayout",
    281 		43,  1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}},
    282 		parse_uchar, 0, 1,
    283 		print_uchar,
    284 		fill_uchar, flush_uchar,
    285 		" Layout of kana keys.  0 for JIS, 1 for AIUEO order.\n"
    286 		" Note on NetBSD kana input is not supported.\n"
    287 	},
    288 	{
    289 		"keyboard", "ledstat",
    290 		28, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}},
    291 		parse_uchar, 0, 0x7f,
    292 		print_uchar,
    293 		fill_uchar, flush_uchar,
    294 		" Initial keyboard LED status (bitmap).\n"
    295 		" Each bit means KANA, ROMAJI, CODE, CAPS, INS, HIRAGANA, ZENKAKU from LSB.\n"
    296 	},
    297 	{
    298 		"keyboard", "opt2",
    299 		39, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}},
    300 		parse_uchar, 0, 1,
    301 		print_uchar,
    302 		fill_uchar, flush_uchar,
    303 		" 1 for normal, 0 for TV control.\n"
    304 	},
    305 	{
    306 		"keyboard", "repeat",
    307 		59, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 3}},
    308 		parse_uchar, 0, 0xff,
    309 		print_uchar,
    310 		fill_uchar, flush_uchar,
    311 		" Time elapsed between the keyboard autorepeat. (30+5*n^2 ms.\n"
    312 	},
    313 	{
    314 		"poweroff", "ejectfloppy",
    315 		41, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}},
    316 		parse_uchar, 0, 1,
    317 		print_uchar,
    318 		fill_uchar, flush_uchar,
    319 		" 1 to eject floppy disks at shutdown.\n"
    320 	},
    321 	{
    322 		"poweroff", "tvctrl",
    323 		42,  1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 13}},
    324 		parse_uchar, 0, 0xff,
    325 		print_uchar,
    326 		fill_uchar, flush_uchar,
    327 		" What to do at shutdown for display TV.\n"
    328 	},
    329 	{
    330 		"printer", "timeout",
    331 		60, 4, 0, {longword:0}, 0, {longword:0}, {longword:0x80000},
    332 		parse_ulong, 0, 0xffffffff,
    333 		print_ulong,
    334 		fill_ulong, flush_ulong,
    335 		" Printer timeout in second.\n"
    336 	},
    337 };
    338 
    339 int number_of_props = sizeof (properties) / sizeof (struct property);
    340