unsigned int svc_dbg_handler(unsigned int num, unsigned int param1, unsigned int param2) { CHECK_CONTEXT(SUPERVISOR_CONTEXT | IRQ_CONTEXT | SYSTEM_CONTEXT); unsigned int res = 0; switch (num) { case DBG_WRITE: if (_dbg_console) console_write(_dbg_console, (char*)param1, (int)param2); break; case DBG_PUSH: if (_dbg_console) console_push(_dbg_console); break; default: error_value(ERROR_GENERAL_INVALID_SYS_CALL, num); } return res; }
void update_touchscreen (void) { static int graffiti = 0; struct MW_UID_MESSAGE m; int x, y, k, kh, btns = 0; touchPosition pos; char c; /* update keypad & touchscreen */ scanKeys (); pos = touchReadXY (); x = pos.px; y = pos.py; k = keysDown (); kh = keysHeld (); /* check for character recognition */ if ((kh & KEY_L) || (kh & KEY_R)) { graffiti = 1; c = PA_CheckLetter ((kh & KEY_TOUCH ? 1 : 0), x, y); if (c) { /* signal the console driver */ console_push (c); if (kbd_queue_id != 0) { /* send the read character */ m.type = MV_UID_KBD; m.m.kbd.code = c; m.m.kbd.modifiers = 0; m.m.kbd.mode = MV_KEY_MODE_ASCII; rtems_message_queue_send (kbd_queue_id, (void *) &m, sizeof (struct MW_UID_MESSAGE)); } } } else { if (graffiti == 1) { x = old_x; y = old_y; } graffiti = 0; } if (mou_queue_id == 0) return; if (hand == 1) { if (k & KEY_LEFT) { btns = MV_BUTTON_LEFT; } if (k & KEY_RIGHT) { btns = MV_BUTTON_RIGHT; } } else { if (k & KEY_A) { btns = MV_BUTTON_LEFT; } if (k & KEY_B) { btns = MV_BUTTON_RIGHT; } } if (!((kh & KEY_L) || (kh & KEY_R)) && (kh & KEY_TOUCH) && (x != old_x || y != old_y || btns)) { /* send the read position */ m.type = MV_UID_ABS_POS; old_btns = m.m.pos.btns = btns; old_x = m.m.pos.x = x; old_y = m.m.pos.y = y; m.m.pos.z = 0; rtems_message_queue_send (mou_queue_id, (void *) &m, sizeof (struct MW_UID_MESSAGE)); } }