Subversion Repositories shark

Rev

Rev 1363 | Rev 1399 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1363 mauro 1
 
2
/*
3
 * Project: S.Ha.R.K.
4
 *
5
 * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
6
 *
7
 * Authors     : Mauro Marinoni <mauro.marinoni@unipv.it>
8
 * (see authors.txt for full list of hartik's authors)
9
 *
10
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
11
 *
12
 * http://www.sssup.it
13
 * http://retis.sssup.it
14
 * http://shark.sssup.it
15
 */
16
 
17
/*
18
 * This program is free software; you can redistribute it and/or modify
19
 * it under the terms of the GNU General Public License as published by
20
 * the Free Software Foundation; either version 2 of the License, or
21
 * (at your option) any later version.
22
 *
23
 * This program is distributed in the hope that it will be useful,
24
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
 * GNU General Public License for more details.
27
 *
28
 * You should have received a copy of the GNU General Public License
29
 * along with this program; if not, write to the Free Software
30
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31
 */
32
 
33
#include <kernel/kern.h>
34
#include <kernel/func.h>
35
#include <stdlib.h>
36
#include <string.h>
37
 
38
#include <drivers/shark_mouse26.h>
39
#include <drivers/shark_keyb26.h>
40
#include <drivers/shark_spk26.h>
41
 
42
void my_sysclose(KEY_EVT *e)
43
{
44
        mouse_txtcursor(DISABLE);
45
 
46
        kern_printf("S.Ha.R.K. closed.\n\n");
47
        sys_end();
48
}
49
 
50
TASK my_putxy(void *arg) {
51
 
52
        int x, y, z;
53
        unsigned long btn;
54
 
55
        clear();
56
 
57
        while (1) {
1389 mauro 58
                mouse_getposition(&x, &y, &z, &btn);
1363 mauro 59
                place(10, 10);
60
                printk("X: %2d - Y: %2d - Z: %3d - Btn: %4d\n", x, y, z, (int)btn);
61
 
62
                task_endcycle();
63
        }
64
}
65
 
66
int main(int argc, char **argv)
67
{
68
        SOFT_TASK_MODEL mp;
69
        PID pid;
70
        KEY_EVT ev;
71
 
72
        ev.ascii = 'c';
73
        ev.scan  = KEY_C;
74
        ev.status = KEY_PRESSED;
75
        ev.flag = CNTL_BIT;
76
        keyb_hook(ev, my_sysclose, FALSE);
77
        ev.flag = CNTR_BIT;
78
        keyb_hook(ev, my_sysclose, FALSE);
79
 
80
        mouse_txtcursor(ENABLE);
81
 
82
        soft_task_default_model(mp);
83
        soft_task_def_level(mp,2);
84
        soft_task_def_ctrl_jet(mp);
85
        soft_task_def_met(mp,700);
86
        soft_task_def_period(mp,1000);
87
        soft_task_def_usemath(mp);
88
        pid = task_create("Mouse_Print", my_putxy, &mp, NULL);
89
        if (pid == NIL) {
90
                perror("Could not create task <Mouse_Print>");
91
                my_sysclose(NULL);
92
        } else
93
                task_activate(pid);
94
 
95
        return 0;
96
}