Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / usr.sbin / memswitch / memswitch.h
blobf79db163aaba5cfef77b3c4f51d247b7eef754eb
1 /* $NetBSD: memswitch.h,v 1.1.1.1 1999/06/21 15:56:03 minoura Exp $ */
3 /*-
4 * Copyright (c) 1999 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Minoura Makoto.
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.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 /* memswitch.h */
34 #include <paths.h>
36 #ifndef _PATH_DEVSRAM
37 #define _PATH_DEVSRAM "/dev/sram"
38 #endif
40 #define PROP_MAGIC1 (0)
41 #define PROP_MAGIC2 (1)
42 #define MAGIC1 (0x82773638)
43 #define MAGIC2 (0x30303057)
44 #define MAXVALUELEN 100
46 struct property;
48 typedef int (*parse_t) __P((struct property*, const char*));
49 typedef int (*print_t) __P((struct property*, char*));
50 typedef int (*fill_t) __P((struct property*));
51 typedef int (*flush_t) __P((struct property*));
53 struct property {
54 const char *class;
55 const char *node;
56 int offset;
57 int size;
58 int value_valid;
59 union value {
60 unsigned char byte[4];
61 unsigned short word[2];
62 unsigned long longword;
63 void *pointer;
64 } current_value;
65 int modified;
66 union value modified_value;
67 union value default_value;
68 parse_t parse;
69 int min, max;
70 print_t print;
71 fill_t fill;
72 flush_t flush;
73 const char *descr;
76 extern int number_of_props;
77 extern struct property properties[];
78 extern char *progname;
79 extern u_int8_t *current_values;
80 extern u_int8_t *modified_values;
82 void usage __P((void)) __attribute__((noreturn));
83 void show_single __P((const char*));
84 void show_all __P((void));
85 void modify_single __P((const char*));
86 void help_single __P((const char*));
87 void alloc_current_values __P((void));
88 void alloc_modified_values __P((void));
89 void flush __P((void));
90 int save __P((const char*));
91 int restore __P((const char*));