/demos/trunk/input/input.c |
---|
39,18 → 39,43 |
#include <string.h> |
#include <drivers/shark_linuxc26.h> |
#include <drivers/shark_fb26.h> |
#include <drivers/shark_input26.h> |
#include <drivers/shark_mouse26.h> |
#include <drivers/shark_keyb26.h> |
#include <drivers/shark_spk26.h> |
#include <drivers/shark_joy26.h> |
#define FRAME_BUFFER_DEVICE 0 |
#define RGB_BLACK rgb16( 0, 0, 0) |
#define RGB_GRAY rgb16(127,127,127) |
#define RGB_WHITE rgb16(255,255,255) |
#define RGB_RED rgb16(255, 0, 0) |
#define RGB_GREEN rgb16( 0,255, 0) |
#define RGB_BLUE rgb16( 0, 0,255) |
#define RGB_YELLOW rgb16(255,255, 0) |
#define RGB_MAGENTA rgb16(255, 0,255) |
#define RGB_CYAN rgb16( 0,255,255) |
#define RGB_D_RED rgb16(127, 0, 0) |
#define RGB_D_GREEN rgb16( 0,127, 0) |
#define RGB_D_BLUE rgb16( 0, 0,127) |
#define RGB_D_YELLOW rgb16(127,127, 0) |
#define RGB_D_MAGENTA rgb16(127, 0,127) |
#define RGB_D_CYAN rgb16( 0,127,127) |
void my_sysclose(KEY_EVT *e) |
{ |
//EVBUG26_close(); |
mouse_grxcursor(DISABLE, 0); |
FB26_close(FRAME_BUFFER_DEVICE); |
MOUSE26_close(); |
KEYB26_close(); |
MOUSE26_close(); |
SPEAK26_close(); |
//JOY26_close(); |
JOY26_close(); |
INPUT26_close(); |
kern_printf("S.Ha.R.K. closed.\n\n"); |
57,8 → 82,59 |
sys_end(); |
} |
TASK my_getjoy(void *arg) { |
int a0, a1, a2, a3, btn; |
char st[20]; |
while (1) { |
joy_getstatus(&a0, &a1, &a2, &a3, &btn); |
sprintf(st, "X Axis : %6d ", a0); |
grx_text(st, 100, 64, RGB_CYAN, RGB_BLACK); |
sprintf(st, "Y Axis : %6d ", a1); |
grx_text(st, 100, 114, RGB_CYAN, RGB_BLACK); |
sprintf(st, "Buttons: %2x ", btn); |
grx_text(st, 100, 164, RGB_CYAN, RGB_BLACK); |
task_endcycle(); |
if (btn == 0xF) |
my_sysclose(NULL); |
} |
} |
TASK my_getch(void *arg) { |
BYTE ch; |
int i = 0; |
char st[20]; |
while (1) { |
ch = keyb_getch(NON_BLOCK); |
if (ch) { |
sprintf(st, "%c", ch); |
grx_text(st, 340 + 10 * (i%25), 30 + 20 * (i/25), RGB_BLUE, RGB_BLACK); |
if (++i >= 200) |
i = 0; |
} |
task_endcycle(); |
} |
} |
void graph_init(void) |
{ |
grx_rect( 4, 4, 634, 474, RGB_WHITE); |
grx_rect( 14, 14, 304, 214, RGB_YELLOW); |
grx_rect(314, 14, 624, 214, RGB_RED); |
} |
int main(int argc, char **argv) |
{ |
SOFT_TASK_MODEL mp; |
PID pid; |
KEY_EVT ev; |
ev.ascii = 'c'; |
69,10 → 145,47 |
ev.flag = CNTR_BIT; |
keyb_hook(ev, my_sysclose, FALSE); |
while ( (sys_gettime(NULL)/1000) < 20000); |
my_sysclose(NULL); |
//while(1); |
FB26_init(); |
FB26_open(FRAME_BUFFER_DEVICE); |
FB26_use_grx(FRAME_BUFFER_DEVICE); |
FB26_setmode(FRAME_BUFFER_DEVICE,"640x480-16"); |
graph_init(); |
mouse_grxlimits(639, 479); |
mouse_setposition(319, 239, 0); |
mouse_grxcursor(ENABLE, 2); |
soft_task_default_model(mp); |
soft_task_def_level(mp,2); |
soft_task_def_ctrl_jet(mp); |
soft_task_def_met(mp,700); |
soft_task_def_period(mp,10000); |
//soft_task_def_aperiodic(mp); |
soft_task_def_usemath(mp); |
pid = task_create("Joy_Print", my_getjoy, &mp, NULL); |
if (pid == NIL) { |
perror("Could not create task <Joy_Print>"); |
sys_end(); |
} else |
task_activate(pid); |
soft_task_default_model(mp); |
soft_task_def_level(mp,2); |
soft_task_def_ctrl_jet(mp); |
soft_task_def_met(mp,700); |
soft_task_def_period(mp,10000); |
//soft_task_def_aperiodic(mp); |
soft_task_def_usemath(mp); |
pid = task_create("Key_Print", my_getch, &mp, NULL); |
if (pid == NIL) { |
perror("Could not create task <Key_Print>"); |
sys_end(); |
} else |
task_activate(pid); |
return 0; |
} |
/demos/trunk/input/joy.c |
---|
0,0 → 1,92 |
/* |
* Project: S.Ha.R.K. |
* |
* Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
* |
* Authors : Mauro Marinoni <mauro.marinoni@unipv.it> |
* (see authors.txt for full list of hartik's authors) |
* |
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
* |
* http://www.sssup.it |
* http://retis.sssup.it |
* http://shark.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License as published by |
* the Free Software Foundation; either version 2 of the License, or |
* (at your option) any later version. |
* |
* This program is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* GNU General Public License for more details. |
* |
* You should have received a copy of the GNU General Public License |
* along with this program; if not, write to the Free Software |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* |
*/ |
#include <kernel/kern.h> |
#include <kernel/func.h> |
#include <stdlib.h> |
#include <string.h> |
#include <drivers/shark_linuxc26.h> |
#include <drivers/shark_input26.h> |
#include <drivers/shark_joy26.h> |
//void my_sysclose(KEY_EVT *e) |
void my_sysclose(void) |
{ |
JOY26_close(); |
INPUT26_close(); |
kern_printf("S.Ha.R.K. closed.\n\n"); |
sys_end(); |
} |
TASK my_getjoy(void *arg) { |
int a0, a1, a2, a3, btn; |
while (1) { |
joy_getstatus(&a0, &a1, &a2, &a3, &btn); |
printk ("(%6d %6d) %2x\n", a0, a1, btn); |
task_endcycle(); |
if (btn == 0xF) |
my_sysclose(); |
} |
} |
int main(int argc, char **argv) |
{ |
SOFT_TASK_MODEL mp; |
PID pid; |
soft_task_default_model(mp); |
soft_task_def_level(mp,2); |
soft_task_def_ctrl_jet(mp); |
soft_task_def_met(mp,700); |
soft_task_def_period(mp,10000); |
//soft_task_def_aperiodic(mp); |
soft_task_def_usemath(mp); |
pid = task_create("Joy_Print", my_getjoy, &mp, NULL); |
if (pid == NIL) { |
perror("Could not create task <Joy_Print>"); |
sys_end(); |
} else |
task_activate(pid); |
/*while ( (sys_gettime(NULL)/1000) < 20000); |
my_sysclose();*/ |
//while(1); |
return 0; |
} |
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/input/initfile.c |
=================================================================== |
--- trunk/input/initfile.c (revision 1362) |
+++ trunk/input/initfile.c (revision 1363) |
@@ -50,7 +50,10 @@ |
#include <drivers/shark_mouse26.h> |
#include <drivers/shark_keyb26.h> |
#include <drivers/shark_spk26.h> |
+#include <drivers/shark_joy26.h> |
+#include <drivers/shark_fb26.h> |
+ |
/*+ sysyem tick in us +*/ |
#define TICK 0 |
@@ -57,13 +60,23 @@ |
/*+ RR tick in us +*/ |
#define RRTICK 10000 |
+/*+ Interrup Server */ |
+#define INTDRIVE_Q 1000 |
+#define INTDRIVE_T 10000 |
+#define INTDRIVE_FLAG 0 |
+ |
+#define FRAME_BUFFER_DEVICE 0 |
+ |
void my_close(void *arg) |
{ |
- //EVBUG26_close(); |
+ mouse_grxcursor(DISABLE, 0); |
+ |
+ FB26_close(FRAME_BUFFER_DEVICE); |
+ |
+ MOUSE26_close(); |
KEYB26_close(); |
- MOUSE26_close(); |
SPEAK26_close(); |
- //JOY26_close(); |
+ JOY26_close(); |
INPUT26_close(); |
kern_printf("S.Ha.R.K. closed.\n\n"); |
@@ -73,7 +86,7 @@ |
{ |
struct multiboot_info *mb = (struct multiboot_info *)arg; |
- INTDRIVE_register_level(1000, 10000, 0); |
+ INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_T, INTDRIVE_FLAG); |
EDF_register_level(EDF_ENABLE_ALL); |
CBS_register_level(CBS_ENABLE_ALL, 1); |
RR_register_level(RRTICK, RR_MAIN_YES, mb); |
@@ -92,17 +105,22 @@ |
HARTPORT_init(); |
- /*keyb_def_map(kparms, KEYMAP_IT);*/ |
+ /* keyb_def_map(kparms, KEYMAP_IT);*/ |
keyb_def_ctrlC(kparms, NULL); |
- |
+ |
+ mouse_def_threshold(mparms, 5); |
+ mouse_def_xmin(mparms, 0); |
+ mouse_def_ymin(mparms, 0); |
+ mouse_def_xmax(mparms, 639); |
+ mouse_def_ymax(mparms, 479); |
+ |
LINUXC26_register_module(); |
INPUT26_init(); |
+ MOUSE26_init(&mparms); |
KEYB26_init(&kparms); |
- MOUSE26_init(&mparms); |
SPEAK26_init(); |
- //JOY26_init(); |
- //EVBUG26_init(); |
- |
+ JOY26_init(); |
+ |
//sys_atrunlevel(my_close, NULL, RUNLEVEL_BEFORE_EXIT); |
__call_main__(mb); |
/demos/trunk/input/initjoy.c |
---|
0,0 → 1,94 |
/* |
* Project: HARTIK (HA-rd R-eal TI-me K-ernel) |
* |
* Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
* Gerardo Lamastra <gerardo@sssup.it> |
* |
* Authors : Mauro Marinoni <mauro.marinoni@unipv.it> |
* (see authors.txt for full list of hartik's authors) |
* |
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
* |
* http://www.sssup.it |
* http://retis.sssup.it |
* http://hartik.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License as published by |
* the Free Software Foundation; either version 2 of the License, or |
* (at your option) any later version. |
* |
* This program is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* GNU General Public License for more details. |
* |
* You should have received a copy of the GNU General Public License |
* along with this program; if not, write to the Free Software |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* |
*/ |
#include <kernel/kern.h> |
#include "modules/edf.h" |
#include "modules/cbs.h" |
#include "modules/rr.h" |
#include "modules/dummy.h" |
#include "modules/intdrive.h" |
#include <semaphore.h> |
#include "modules/sem.h" |
#include "modules/hartport.h" |
#include <drivers/shark_linuxc26.h> |
#include <drivers/shark_input26.h> |
#include <drivers/shark_joy26.h> |
/*+ sysyem tick in us +*/ |
#define TICK 0 |
/*+ RR tick in us +*/ |
#define RRTICK 10000 |
void my_close(void *arg) |
{ |
JOY26_close(); |
INPUT26_close(); |
kern_printf("S.Ha.R.K. closed.\n\n"); |
} |
TIME __kernel_register_levels__(void *arg) |
{ |
struct multiboot_info *mb = (struct multiboot_info *)arg; |
INTDRIVE_register_level(1000, 10000, 0); |
EDF_register_level(EDF_ENABLE_ALL); |
CBS_register_level(CBS_ENABLE_ALL, 1); |
RR_register_level(RRTICK, RR_MAIN_YES, mb); |
dummy_register_level(); |
SEM_register_module(); |
return TICK; |
} |
TASK __init__(void *arg) |
{ |
struct multiboot_info *mb = (struct multiboot_info *)arg; |
LINUXC26_register_module(); |
INPUT26_init(); |
JOY26_init(); |
//sys_atrunlevel(my_close, NULL, RUNLEVEL_BEFORE_EXIT); |
__call_main__(mb); |
return (void *)0; |
} |
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/input/mouse.c |
=================================================================== |
--- trunk/input/mouse.c (nonexistent) |
+++ trunk/input/mouse.c (revision 1363) |
@@ -0,0 +1,111 @@ |
+ |
+/* |
+ * Project: S.Ha.R.K. |
+ * |
+ * Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
+ * |
+ * Authors : Mauro Marinoni <mauro.marinoni@unipv.it> |
+ * (see authors.txt for full list of hartik's authors) |
+ * |
+ * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
+ * |
+ * http://www.sssup.it |
+ * http://retis.sssup.it |
+ * http://shark.sssup.it |
+ */ |
+ |
+/* |
+ * Copyright (C) 2000 Paolo Gai |
+ * |
+ * This program is free software; you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License as published by |
+ * the Free Software Foundation; either version 2 of the License, or |
+ * (at your option) any later version. |
+ * |
+ * This program is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with this program; if not, write to the Free Software |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+ * |
+ */ |
+ |
+#include <kernel/kern.h> |
+#include <kernel/func.h> |
+#include <stdlib.h> |
+#include <string.h> |
+ |
+#include <drivers/shark_linuxc26.h> |
+#include <drivers/shark_input26.h> |
+#include <drivers/shark_mouse26.h> |
+#include <drivers/shark_keyb26.h> |
+#include <drivers/shark_spk26.h> |
+ |
+void my_sysclose(KEY_EVT *e) |
+{ |
+ mouse_txtcursor(DISABLE); |
+ |
+ MOUSE26_close(); |
+ KEYB26_close(); |
+ INPUT26_close(); |
+ |
+ kern_printf("S.Ha.R.K. closed.\n\n"); |
+ sys_end(); |
+} |
+ |
+TASK my_putxy(void *arg) { |
+ |
+ int x, y, z; |
+ unsigned long btn; |
+ |
+ clear(); |
+ |
+ while (1) { |
+ mouse_getpos(&x, &y, &z, &btn); |
+ place(10, 10); |
+ printk("X: %2d - Y: %2d - Z: %3d - Btn: %4d\n", x, y, z, (int)btn); |
+ |
+ task_endcycle(); |
+ } |
+} |
+ |
+int main(int argc, char **argv) |
+{ |
+ SOFT_TASK_MODEL mp; |
+ PID pid; |
+ KEY_EVT ev; |
+ |
+ ev.ascii = 'c'; |
+ ev.scan = KEY_C; |
+ ev.status = KEY_PRESSED; |
+ ev.flag = CNTL_BIT; |
+ keyb_hook(ev, my_sysclose, FALSE); |
+ ev.flag = CNTR_BIT; |
+ keyb_hook(ev, my_sysclose, FALSE); |
+ |
+ mouse_txtcursor(ENABLE); |
+ |
+ soft_task_default_model(mp); |
+ soft_task_def_level(mp,2); |
+ soft_task_def_ctrl_jet(mp); |
+ soft_task_def_met(mp,700); |
+ soft_task_def_period(mp,1000); |
+ //soft_task_def_aperiodic(mp); |
+ soft_task_def_usemath(mp); |
+ pid = task_create("Mouse_Print", my_putxy, &mp, NULL); |
+ if (pid == NIL) { |
+ perror("Could not create task <Mouse_Print>"); |
+ my_sysclose(NULL); |
+ } else |
+ task_activate(pid); |
+ |
+ while ( (sys_gettime(NULL)/1000) < 20000); |
+ my_sysclose(NULL); |
+ |
+ //while(1); |
+ |
+ return 0; |
+} |
/trunk/input/mouse.c |
---|
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/input/makefile |
=================================================================== |
--- trunk/input/makefile (revision 1362) |
+++ trunk/input/makefile (revision 1363) |
@@ -7,12 +7,12 @@ |
endif |
include $(BASE)/config/config.mk |
-PROGS= speak key input |
+PROGS= input speak key mouse joy |
include $(BASE)/config/example.mk |
input: |
- make -f $(SUBMAKE) APP=input INIT= OTHEROBJS="initfile.o" SHARKOPT="__INPUT__ __LINUXC26__ __NEWPCI__" |
+ make -f $(SUBMAKE) APP=input INIT= OTHEROBJS="initfile.o" SHARKOPT="__INPUT__ __LINUXC26__ __NEWPCI__ __FB__" |
speak: |
make -f $(SUBMAKE) APP=speak INIT= OTHEROBJS="initspk.o" SHARKOPT="__INPUT__ __LINUXC26__ __NEWPCI__" |
@@ -19,3 +19,10 @@ |
key: |
make -f $(SUBMAKE) APP=key INIT= OTHEROBJS="initkey.o" SHARKOPT="__INPUT__ __LINUXC26__ __NEWPCI__" |
+ |
+mouse: |
+ make -f $(SUBMAKE) APP=mouse INIT= OTHEROBJS="initcur.o" SHARKOPT="__INPUT__ __LINUXC26__ __NEWPCI__" |
+ |
+mouse: |
+ make -f $(SUBMAKE) APP=joy INIT= OTHEROBJS="initjoy.o" SHARKOPT="__INPUT__ __LINUXC26__ __NEWPCI__" |
+ |
/demos/trunk/input/initcur.c |
---|
0,0 → 1,105 |
/* |
* Project: HARTIK (HA-rd R-eal TI-me K-ernel) |
* |
* Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
* Gerardo Lamastra <gerardo@sssup.it> |
* |
* Authors : Mauro Marinoni <mauro.marinoni@unipv.it> |
* (see authors.txt for full list of hartik's authors) |
* |
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
* |
* http://www.sssup.it |
* http://retis.sssup.it |
* http://hartik.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License as published by |
* the Free Software Foundation; either version 2 of the License, or |
* (at your option) any later version. |
* |
* This program is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* GNU General Public License for more details. |
* |
* You should have received a copy of the GNU General Public License |
* along with this program; if not, write to the Free Software |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* |
*/ |
#include <kernel/kern.h> |
#include "modules/edf.h" |
#include "modules/cbs.h" |
#include "modules/rr.h" |
#include "modules/dummy.h" |
#include "modules/intdrive.h" |
#include <semaphore.h> |
#include "modules/sem.h" |
#include "modules/hartport.h" |
#include <drivers/shark_linuxc26.h> |
#include <drivers/shark_input26.h> |
#include <drivers/shark_mouse26.h> |
#include <drivers/shark_keyb26.h> |
#include <drivers/shark_spk26.h> |
/*+ sysyem tick in us +*/ |
#define TICK 0 |
/*+ RR tick in us +*/ |
#define RRTICK 10000 |
void my_close(void *arg) |
{ |
MOUSE26_close(); |
KEYB26_close(); |
INPUT26_close(); |
kern_printf("S.Ha.R.K. closed.\n\n"); |
} |
TIME __kernel_register_levels__(void *arg) |
{ |
struct multiboot_info *mb = (struct multiboot_info *)arg; |
INTDRIVE_register_level(1000, 10000, 0); |
EDF_register_level(EDF_ENABLE_ALL); |
CBS_register_level(CBS_ENABLE_ALL, 1); |
RR_register_level(RRTICK, RR_MAIN_YES, mb); |
dummy_register_level(); |
SEM_register_module(); |
return TICK; |
} |
TASK __init__(void *arg) |
{ |
struct multiboot_info *mb = (struct multiboot_info *)arg; |
KEYB_PARMS kparms = BASE_KEYB; |
MOUSE_PARMS mparms = BASE_MOUSE; |
HARTPORT_init(); |
/*keyb_def_map(kparms, KEYMAP_IT);*/ |
keyb_def_ctrlC(kparms, NULL); |
LINUXC26_register_module(); |
INPUT26_init(); |
MOUSE26_init(&mparms); |
KEYB26_init(&kparms); |
//sys_atrunlevel(my_close, NULL, RUNLEVEL_BEFORE_EXIT); |
__call_main__(mb); |
return (void *)0; |
} |
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |