aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/arm/spitz.c100
1 files changed, 50 insertions, 50 deletions
diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c
index c42668a..b5ed109 100644
--- a/hw/arm/spitz.c
+++ b/hw/arm/spitz.c
@@ -277,9 +277,9 @@ static void spitz_keyboard_keydown(SpitzKeyboardState *s, int keycode)
spitz_keyboard_sense_update(s);
}
-#define SHIFT (1 << 7)
-#define CTRL (1 << 8)
-#define FN (1 << 9)
+#define MOD_SHIFT (1 << 7)
+#define MOD_CTRL (1 << 8)
+#define MOD_FN (1 << 9)
#define QUEUE_KEY(c) s->fifo[(s->fifopos + s->fifolen ++) & 0xf] = c
@@ -316,20 +316,20 @@ static void spitz_keyboard_handler(void *opaque, int keycode)
}
code = s->pre_map[mapcode = ((s->modifiers & 3) ?
- (keycode | SHIFT) :
- (keycode & ~SHIFT))];
+ (keycode | MOD_SHIFT) :
+ (keycode & ~MOD_SHIFT))];
if (code != mapcode) {
#if 0
- if ((code & SHIFT) && !(s->modifiers & 1))
+ if ((code & MOD_SHIFT) && !(s->modifiers & 1))
QUEUE_KEY(0x2a | (keycode & 0x80));
- if ((code & CTRL ) && !(s->modifiers & 4))
+ if ((code & MOD_CTRL ) && !(s->modifiers & 4))
QUEUE_KEY(0x1d | (keycode & 0x80));
- if ((code & FN ) && !(s->modifiers & 8))
+ if ((code & MOD_FN ) && !(s->modifiers & 8))
QUEUE_KEY(0x38 | (keycode & 0x80));
- if ((code & FN ) && (s->modifiers & 1))
+ if ((code & MOD_FN ) && (s->modifiers & 1))
QUEUE_KEY(0x2a | (~keycode & 0x80));
- if ((code & FN ) && (s->modifiers & 2))
+ if ((code & MOD_FN ) && (s->modifiers & 2))
QUEUE_KEY(0x36 | (~keycode & 0x80));
#else
if (keycode & 0x80) {
@@ -345,24 +345,24 @@ static void spitz_keyboard_handler(void *opaque, int keycode)
QUEUE_KEY(0x36);
s->imodifiers = 0;
} else {
- if ((code & SHIFT) && !((s->modifiers | s->imodifiers) & 1)) {
+ if ((code & MOD_SHIFT) && !((s->modifiers | s->imodifiers) & 1)) {
QUEUE_KEY(0x2a);
s->imodifiers |= 1;
}
- if ((code & CTRL ) && !((s->modifiers | s->imodifiers) & 4)) {
+ if ((code & MOD_CTRL ) && !((s->modifiers | s->imodifiers) & 4)) {
QUEUE_KEY(0x1d);
s->imodifiers |= 4;
}
- if ((code & FN ) && !((s->modifiers | s->imodifiers) & 8)) {
+ if ((code & MOD_FN ) && !((s->modifiers | s->imodifiers) & 8)) {
QUEUE_KEY(0x38);
s->imodifiers |= 8;
}
- if ((code & FN ) && (s->modifiers & 1) &&
+ if ((code & MOD_FN ) && (s->modifiers & 1) &&
!(s->imodifiers & 0x10)) {
QUEUE_KEY(0x2a | 0x80);
s->imodifiers |= 0x10;
}
- if ((code & FN ) && (s->modifiers & 2) &&
+ if ((code & MOD_FN ) && (s->modifiers & 2) &&
!(s->imodifiers & 0x20)) {
QUEUE_KEY(0x36 | 0x80);
s->imodifiers |= 0x20;
@@ -394,38 +394,38 @@ static void spitz_keyboard_pre_map(SpitzKeyboardState *s)
int i;
for (i = 0; i < 0x100; i ++)
s->pre_map[i] = i;
- s->pre_map[0x02 | SHIFT ] = 0x02 | SHIFT; /* exclam */
- s->pre_map[0x28 | SHIFT ] = 0x03 | SHIFT; /* quotedbl */
- s->pre_map[0x04 | SHIFT ] = 0x04 | SHIFT; /* numbersign */
- s->pre_map[0x05 | SHIFT ] = 0x05 | SHIFT; /* dollar */
- s->pre_map[0x06 | SHIFT ] = 0x06 | SHIFT; /* percent */
- s->pre_map[0x08 | SHIFT ] = 0x07 | SHIFT; /* ampersand */
- s->pre_map[0x28 ] = 0x08 | SHIFT; /* apostrophe */
- s->pre_map[0x0a | SHIFT ] = 0x09 | SHIFT; /* parenleft */
- s->pre_map[0x0b | SHIFT ] = 0x0a | SHIFT; /* parenright */
- s->pre_map[0x29 | SHIFT ] = 0x0b | SHIFT; /* asciitilde */
- s->pre_map[0x03 | SHIFT ] = 0x0c | SHIFT; /* at */
- s->pre_map[0xd3 ] = 0x0e | FN; /* Delete */
- s->pre_map[0x3a ] = 0x0f | FN; /* Caps_Lock */
- s->pre_map[0x07 | SHIFT ] = 0x11 | FN; /* asciicircum */
- s->pre_map[0x0d ] = 0x12 | FN; /* equal */
- s->pre_map[0x0d | SHIFT ] = 0x13 | FN; /* plus */
- s->pre_map[0x1a ] = 0x14 | FN; /* bracketleft */
- s->pre_map[0x1b ] = 0x15 | FN; /* bracketright */
- s->pre_map[0x1a | SHIFT ] = 0x16 | FN; /* braceleft */
- s->pre_map[0x1b | SHIFT ] = 0x17 | FN; /* braceright */
- s->pre_map[0x27 ] = 0x22 | FN; /* semicolon */
- s->pre_map[0x27 | SHIFT ] = 0x23 | FN; /* colon */
- s->pre_map[0x09 | SHIFT ] = 0x24 | FN; /* asterisk */
- s->pre_map[0x2b ] = 0x25 | FN; /* backslash */
- s->pre_map[0x2b | SHIFT ] = 0x26 | FN; /* bar */
- s->pre_map[0x0c | SHIFT ] = 0x30 | FN; /* underscore */
- s->pre_map[0x33 | SHIFT ] = 0x33 | FN; /* less */
- s->pre_map[0x35 ] = 0x33 | SHIFT; /* slash */
- s->pre_map[0x34 | SHIFT ] = 0x34 | FN; /* greater */
- s->pre_map[0x35 | SHIFT ] = 0x34 | SHIFT; /* question */
- s->pre_map[0x49 ] = 0x48 | FN; /* Page_Up */
- s->pre_map[0x51 ] = 0x50 | FN; /* Page_Down */
+ s->pre_map[0x02 | MOD_SHIFT ] = 0x02 | MOD_SHIFT; /* exclam */
+ s->pre_map[0x28 | MOD_SHIFT ] = 0x03 | MOD_SHIFT; /* quotedbl */
+ s->pre_map[0x04 | MOD_SHIFT ] = 0x04 | MOD_SHIFT; /* numbersign */
+ s->pre_map[0x05 | MOD_SHIFT ] = 0x05 | MOD_SHIFT; /* dollar */
+ s->pre_map[0x06 | MOD_SHIFT ] = 0x06 | MOD_SHIFT; /* percent */
+ s->pre_map[0x08 | MOD_SHIFT ] = 0x07 | MOD_SHIFT; /* ampersand */
+ s->pre_map[0x28 ] = 0x08 | MOD_SHIFT; /* apostrophe */
+ s->pre_map[0x0a | MOD_SHIFT ] = 0x09 | MOD_SHIFT; /* parenleft */
+ s->pre_map[0x0b | MOD_SHIFT ] = 0x0a | MOD_SHIFT; /* parenright */
+ s->pre_map[0x29 | MOD_SHIFT ] = 0x0b | MOD_SHIFT; /* asciitilde */
+ s->pre_map[0x03 | MOD_SHIFT ] = 0x0c | MOD_SHIFT; /* at */
+ s->pre_map[0xd3 ] = 0x0e | MOD_FN; /* Delete */
+ s->pre_map[0x3a ] = 0x0f | MOD_FN; /* Caps_Lock */
+ s->pre_map[0x07 | MOD_SHIFT ] = 0x11 | MOD_FN; /* asciicircum */
+ s->pre_map[0x0d ] = 0x12 | MOD_FN; /* equal */
+ s->pre_map[0x0d | MOD_SHIFT ] = 0x13 | MOD_FN; /* plus */
+ s->pre_map[0x1a ] = 0x14 | MOD_FN; /* bracketleft */
+ s->pre_map[0x1b ] = 0x15 | MOD_FN; /* bracketright */
+ s->pre_map[0x1a | MOD_SHIFT ] = 0x16 | MOD_FN; /* braceleft */
+ s->pre_map[0x1b | MOD_SHIFT ] = 0x17 | MOD_FN; /* braceright */
+ s->pre_map[0x27 ] = 0x22 | MOD_FN; /* semicolon */
+ s->pre_map[0x27 | MOD_SHIFT ] = 0x23 | MOD_FN; /* colon */
+ s->pre_map[0x09 | MOD_SHIFT ] = 0x24 | MOD_FN; /* asterisk */
+ s->pre_map[0x2b ] = 0x25 | MOD_FN; /* backslash */
+ s->pre_map[0x2b | MOD_SHIFT ] = 0x26 | MOD_FN; /* bar */
+ s->pre_map[0x0c | MOD_SHIFT ] = 0x30 | MOD_FN; /* underscore */
+ s->pre_map[0x33 | MOD_SHIFT ] = 0x33 | MOD_FN; /* less */
+ s->pre_map[0x35 ] = 0x33 | MOD_SHIFT; /* slash */
+ s->pre_map[0x34 | MOD_SHIFT ] = 0x34 | MOD_FN; /* greater */
+ s->pre_map[0x35 | MOD_SHIFT ] = 0x34 | MOD_SHIFT; /* question */
+ s->pre_map[0x49 ] = 0x48 | MOD_FN; /* Page_Up */
+ s->pre_map[0x51 ] = 0x50 | MOD_FN; /* Page_Down */
s->modifiers = 0;
s->imodifiers = 0;
@@ -433,9 +433,9 @@ static void spitz_keyboard_pre_map(SpitzKeyboardState *s)
s->fifolen = 0;
}
-#undef SHIFT
-#undef CTRL
-#undef FN
+#undef MOD_SHIFT
+#undef MOD_CTRL
+#undef MOD_FN
static int spitz_keyboard_post_load(void *opaque, int version_id)
{