Contiki 2.5
ctk_arch-def.h
1 /*
2  * Copyright (c) 2007, Takahide Matsutsuka.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following
12  * disclaimer in the documentation and/or other materials provided
13  * with the distribution.
14  * 3. The name of the author may not be used to endorse or promote
15  * products derived from this software without specific prior
16  * written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
19  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
22  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
24  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  * $Id: ctk_arch-def.h,v 1.5 2007/12/14 23:49:14 oliverschmidt Exp $
31  *
32  */
33 
34 /*
35  * \file
36  * ctk_arch-def.h
37  * Definitions of CTK for PC-6001 family, which consist of the following:
38  * - Configuraton for ctk main library.
39  * - Configuraton for ctk_arch library.
40  * This file is used in assembler file with precompilation, so
41  * NEVER include other than directives and comments.
42  * \author
43  * Takahide Matsutsuka <markn@markn.org>
44  */
45 
46 #ifndef __CTK_ARCH_DEF_H__
47 #define __CTK_ARCH_DEF_H__
48 
49 /* characters */
50 #if defined(ARCH_PC6001) || defined(ARCH_PC6001MK2)
51 #define CH_VERTLINE 0x16
52 #define CH_HOLILINE 0x17
53 #define CH_ULCORNER 0x18
54 #define CH_URCORNER 0x19
55 #define CH_LLCORNER 0x1a
56 #define CH_LRCORNER 0x1b
57 #elif defined(ARCH_PC6001A)
58 #define CH_VERTLINE '|'
59 #define CH_HOLILINE '-'
60 #define CH_ULCORNER '/'
61 #define CH_URCORNER '\\'
62 #define CH_LLCORNER '\\'
63 #define CH_LRCORNER '/'
64 #else
65 #error invalid ARCH
66 #endif
67 #define CH_SPACE 0x20
68 
69 /* screen properties */
70 #if defined(ARCH_PC6001MK2)
71 #define VRAM_ATTR 0x4000
72 #define VRAM_CHAR 0x4400
73 #define SCREEN_WIDTH 40
74 #define SCREEN_HEIGHT 20
75 #define COLOR_NORMAL 0x0f
76 #define COLOR_REVERSED 0x70
77 #elif (defined(ARCH_PC6001) || defined(ARCH_PC6001A)) && defined(MEMORY_16K)
78 #define VRAM_ATTR 0xc000
79 #define VRAM_CHAR 0xc200
80 #define SCREEN_WIDTH 32
81 #define SCREEN_HEIGHT 16
82 #define COLOR_NORMAL 0x20
83 #define COLOR_REVERSED 0x21
84 #elif (defined(ARCH_PC6001) || defined(ARCH_PC6001A)) && (defined(MEMORY_32K) || defined(MEMORY_ROM))
85 #define VRAM_ATTR 0x8000
86 #define VRAM_CHAR 0x8200
87 #define SCREEN_WIDTH 32
88 #define SCREEN_HEIGHT 16
89 #define COLOR_NORMAL 0x20
90 #define COLOR_REVERSED 0x21
91 #else
92 #error Specify appropriate ARCH & MEMORY combination
93 #endif /* ARCH_PC6001MK2 */
94 
95 /* key code */
96 #define CH_F1 -16//0xf0
97 #define CH_F2 -15//0xf1
98 #define CH_F3 -14//0xf2
99 #define CH_F4 -13//0xf3
100 #define CH_F5 -12//0xf4
101 #define CH_TAB 0x09
102 
103 #define CH_CURS_UP 0x1e
104 #define CH_CURS_DOWN 0x1f
105 #define CH_CURS_LEFT 0x1d
106 #define CH_CURS_RIGHT 0x1c
107 #define CH_ENTER 0x0d
108 #define CH_ESC 0x1b
109 #define CH_STOP 0x03
110 #define CH_DEL 0x08
111 
112 /* Contiki toolkit options */
113 
114 #if defined(CTK_CLIENT) || defined(CTK_SERVER)
115 /* If network is available, turn all options off by the memory reason */
116 #define CTK_CONF_ICONS 0
117 #define CTK_CONF_ICON_TEXTMAPS 0
118 #define CTK_CONF_WINDOWS 1
119 #define CTK_CONF_WINDOWCLOSE 0
120 #define CTK_CONF_WINDOWMOVE 0
121 #define CTK_CONF_MENUS 0
122 #define CTK_CONF_HYPERLINK 0
123 #elif defined(CTK_NOICON)
124 /* In the case of loader arch, we omit the icons by the memory reason */
125 #define CTK_CONF_ICONS 0
126 #define CTK_CONF_ICON_TEXTMAPS 0
127 #define CTK_CONF_WINDOWS 1
128 #define CTK_CONF_WINDOWCLOSE 1
129 #define CTK_CONF_WINDOWMOVE 1
130 #define CTK_CONF_MENUS 1
131 #define CTK_CONF_HYPERLINK 1
132 #else /* CTK_MINIMUM */
133 /* Toggles support for desktop icons. */
134 #define CTK_CONF_ICONS 1
135 /* Define if text icon is used. */
136 #define CTK_CONF_ICON_TEXTMAPS 1
137 /* Toggles support for windows. */
138 #define CTK_CONF_WINDOWS 1
139 /* Toggles support for closable windows. */
140 #define CTK_CONF_WINDOWCLOSE 1
141 /* Toggles support for movable windows. */
142 #define CTK_CONF_WINDOWMOVE 1
143 /* Toggles support for menus. */
144 #define CTK_CONF_MENUS 1
145 /* Defines if hyperlink is supported. */
146 #define CTK_CONF_HYPERLINK 1
147 #endif /* CTK_MINIMUM */
148 
149 /* Define if bitmap icon is used. */
150 #define CTK_CONF_ICON_BITMAPS 0
151 /* Defines the default width of a menu. */
152 #define CTK_CONF_MENUWIDTH 16
153 /* Defines if screen saver is supported. */
154 #define CTK_CONF_SCREENSAVER 0
155 /* Defines if mouse is supported. */
156 #define CTK_CONF_MOUSE_SUPPORT 0
157 
158 /* The maximum number of menu items in each menu. */
159 #define CTK_CONF_MAXMENUITEMS 4
160 
161 /* Key used to switch the frontmost window. */
162 #define CTK_CONF_WINDOWSWITCH_KEY CH_F3
163 /* Key used to move down a widget. */
164 #define CTK_CONF_WIDGETDOWN_KEY CH_TAB
165 /* Key used to move up a widget. */
166 #define CTK_CONF_WIDGETUP_KEY CH_F5
167 /* Defines which key that is to be used for activating the menus */
168 #define CTK_CONF_MENU_KEY CH_F1
169 
170 #ifdef LIBCONIO_CONF_EXPORT
171 #define LIBCONIO_EXPORT LIBCONIO_CONF_EXPORT
172 #else /* LIBCONIO_CONF_EXPORT */
173 #define LIBCONIO_EXPORT 0
174 #endif /* LIBCONIO_CONF_EXPORT */
175 
176 /* Imported symbols from ctk.h */
177 
178 #define _CTK_FOCUS_NONE 0
179 #define _CTK_FOCUS_WIDGET 1
180 #define _CTK_FOCUS_WINDOW 2
181 #define _CTK_FOCUS_DIALOG 4
182 
183 #define _CTK_WIDGET_SEPARATOR 1
184 #define _CTK_WIDGET_LABEL 2
185 #define _CTK_WIDGET_BUTTON 3
186 #define _CTK_WIDGET_HYPERLINK 4
187 #define _CTK_WIDGET_TEXTENTRY 5
188 #define _CTK_WIDGET_BITMAP 6
189 #define _CTK_WIDGET_ICON 7
190 
191 #define _CTK_TEXTENTRY_NORMAL 0
192 #define _CTK_TEXTENTRY_EDIT 1
193 
194 #endif /* __CTK_ARCH_DEF_H__ */