/demos/trunk/input/input.c |
---|
427,7 → 427,7 |
soft_task_def_usemath(mp); |
pid = task_create("Key_Print", my_getch, &mp, NULL); |
if (pid == NIL) { |
sys_shutdown_message("Could not create task <Key_Print>\n"); |
perror("Could not create task <Key_Print>"); |
sys_end(); |
} else |
task_activate(pid); |
441,7 → 441,7 |
soft_task_def_usemath(mp); |
pid = task_create("Joy_Print", my_getjoy, &mp, NULL); |
if (pid == NIL) { |
sys_shutdown_message("Could not create task <Joy_Print>\n"); |
perror("Could not create task <Joy_Print>"); |
sys_end(); |
} else |
task_activate(pid); |
/demos/trunk/input/initspk.c |
---|
103,7 → 103,7 |
device_drivers_close(); |
sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
sys_abort_shutdown(0); |
sys_end(); |
return NULL; |
} |
114,6 → 114,7 |
nrt_task_default_model(nrt); |
nrt_task_def_system(nrt); |
nrt_task_def_nokill(nrt); |
shutdown_task_PID = task_create("Shutdown Task", shutdown_task_body, &nrt, NULL); |
if (shutdown_task_PID == NIL) { |
123,17 → 124,7 |
} |
#define SHUTDOWN_TIMEOUT_SEC 3 |
void call_shutdown_task(void *arg) { |
struct timespec t; |
sys_gettime(&t); |
t.tv_sec += SHUTDOWN_TIMEOUT_SEC; |
/* Emergency timeout to exit from RUNLEVEL_SHUTDOWN */ |
kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0); |
task_activate(shutdown_task_PID); |
} |
/demos/trunk/input/joy.c |
---|
43,7 → 43,7 |
while (1) { |
joy_getstatus(&a0, &a1, &a2, &a3, &btn); |
cprintf("(%6d %6d) %2x\n", a0, a1, btn); |
printk ("(%6d %6d) %2x\n", a0, a1, btn); |
task_endcycle(); |
if (btn == 0xF) |
sys_end(); |
56,7 → 56,7 |
PID pid; |
if (!JOY26_installed()) { |
cprintf("No Joystick found."); |
printk("No Joystick found."); |
sys_end(); |
} |
soft_task_default_model(mp); |
67,7 → 67,7 |
soft_task_def_usemath(mp); |
pid = task_create("Joy_Print", my_getjoy, &mp, NULL); |
if (pid == NIL) { |
sys_shutdown_message("Could not create task <Joy_Print>\n"); |
perror("Could not create task <Joy_Print>"); |
sys_end(); |
} else |
task_activate(pid); |
/demos/trunk/input/initjoy.c |
---|
96,7 → 96,7 |
device_drivers_close(); |
sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
sys_abort_shutdown(0); |
sys_end(); |
return NULL; |
} |
107,6 → 107,7 |
nrt_task_default_model(nrt); |
nrt_task_def_system(nrt); |
nrt_task_def_nokill(nrt); |
shutdown_task_PID = task_create("Shutdown Task", shutdown_task_body, &nrt, NULL); |
if (shutdown_task_PID == NIL) { |
116,17 → 117,7 |
} |
#define SHUTDOWN_TIMEOUT_SEC 3 |
void call_shutdown_task(void *arg) { |
struct timespec t; |
sys_gettime(&t); |
t.tv_sec += SHUTDOWN_TIMEOUT_SEC; |
/* Emergency timeout to exit from RUNLEVEL_SHUTDOWN */ |
kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0); |
task_activate(shutdown_task_PID); |
} |
/demos/trunk/input/key.c |
---|
50,7 → 50,7 |
while (1) { |
ch = keyb_getch(NON_BLOCK); |
if (ch) |
cprintf("%c", ch); |
printk ("%c", ch); |
task_endcycle(); |
} |
} |
59,13 → 59,13 |
TIME t; |
cprintf("Start Pause.\n"); |
printk("Start Pause.\n"); |
keyb_disable(); |
cprintf("Keyboard Disabled.\n"); |
printk("Keyboard Disabled.\n"); |
t = sys_gettime(NULL); |
while ( ( (sys_gettime(NULL) -t) / 1000) < 5000); |
keyb_enable(); |
cprintf("Keyboard Enabled.\n"); |
printk("Keyboard Enabled.\n"); |
} |
int main(int argc, char **argv) |
/demos/trunk/input/mouse.c |
---|
43,6 → 43,7 |
{ |
mouse_txtcursor(DISABLE); |
kern_printf("S.Ha.R.K. closed.\n\n"); |
sys_end(); |
} |
56,7 → 57,7 |
while (1) { |
mouse_getposition(&x, &y, &z, &btn); |
place(10, 10); |
cprintf("X: %2d - Y: %2d - Z: %3d - Btn: %4d\n", x, y, z, (int)btn); |
printk("X: %2d - Y: %2d - Z: %3d - Btn: %4d\n", x, y, z, (int)btn); |
task_endcycle(); |
} |
86,7 → 87,7 |
soft_task_def_usemath(mp); |
pid = task_create("Mouse_Print", my_putxy, &mp, NULL); |
if (pid == NIL) { |
sys_shutdown_message("Could not create task <Mouse_Print>\n"); |
perror("Could not create task <Mouse_Print>"); |
my_sysclose(NULL); |
} else |
task_activate(pid); |
/demos/trunk/input/initkey.c |
---|
57,12 → 57,6 |
#define INTDRIVE_T 10000 |
#define INTDRIVE_FLAG 0 |
void call_shutdown_task(void *arg); |
int device_drivers_init(); |
int device_drivers_close(); |
void set_shutdown_task(); |
TASK shutdown_task_body(void *arg); |
PID shutdown_task_PID = 1; |
TIME __kernel_register_levels__(void *arg) |
84,9 → 78,8 |
KEYB26_close(); |
INPUT26_close(); |
return 0; |
return 0; |
} |
int device_drivers_init() { |
107,13 → 100,11 |
device_drivers_close(); |
sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
sys_abort_shutdown(0); |
sys_end(); |
return NULL; |
} |
#define SHUTDOWN_TIMEOUT_SEC 3 |
void set_shutdown_task() { |
NRT_TASK_MODEL nrt; |
120,6 → 111,7 |
nrt_task_default_model(nrt); |
nrt_task_def_system(nrt); |
nrt_task_def_nokill(nrt); |
shutdown_task_PID = task_create("Shutdown Task", shutdown_task_body, &nrt, NULL); |
if (shutdown_task_PID == NIL) { |
130,15 → 122,6 |
} |
void call_shutdown_task(void *arg) { |
struct timespec t; |
sys_gettime(&t); |
t.tv_sec += SHUTDOWN_TIMEOUT_SEC; |
/* Emergency timeout to exit from RUNLEVEL_SHUTDOWN */ |
kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0); |
task_activate(shutdown_task_PID); |
} |
/demos/trunk/input/initcur.c |
---|
57,12 → 57,6 |
#define INTDRIVE_T 10000 |
#define INTDRIVE_FLAG 0 |
void call_shutdown_task(void *arg); |
int device_drivers_init(); |
int device_drivers_close(); |
void set_shutdown_task(); |
TASK shutdown_task_body(void *arg); |
PID shutdown_task_PID = 1; |
TIME __kernel_register_levels__(void *arg) |
86,7 → 80,7 |
KEYB26_close(); |
INPUT26_close(); |
return 0; |
return 0; |
} |
int device_drivers_init() { |
111,7 → 105,7 |
device_drivers_close(); |
sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
sys_abort_shutdown(0); |
sys_end(); |
return NULL; |
} |
122,6 → 116,7 |
nrt_task_default_model(nrt); |
nrt_task_def_system(nrt); |
nrt_task_def_nokill(nrt); |
shutdown_task_PID = task_create("Shutdown Task", shutdown_task_body, &nrt, NULL); |
if (shutdown_task_PID == NIL) { |
131,17 → 126,7 |
} |
#define SHUTDOWN_TIMEOUT_SEC 3 |
void call_shutdown_task(void *arg) { |
struct timespec t; |
sys_gettime(&t); |
t.tv_sec += SHUTDOWN_TIMEOUT_SEC; |
/* Emergency timeout to exit from RUNLEVEL_SHUTDOWN */ |
kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0); |
task_activate(shutdown_task_PID); |
} |