/demos/tags/rel_1_4_rc1/servo/makefile |
File deleted |
|
Property changes: |
Deleted: svn:executable |
## -1 +0,0 ## |
-* |
\ No newline at end of property |
Index: rel_1_4_rc1/servo/load.c |
=================================================================== |
--- rel_1_4_rc1/servo/load.c (revision 1476) |
+++ rel_1_4_rc1/servo/load.c (nonexistent) |
@@ -1,52 +0,0 @@ |
-#include "kernel/kern.h" |
-#include "drivers/shark_keyb26.h" |
- |
-#include "servo.h" |
- |
-#define N_SEND 100000 |
- |
-int main () { |
- |
- TIME seme; |
- int res, i, err=0; |
- int rnd1, rnd2; |
- //char ch; |
- |
- seme = sys_gettime(NULL); |
- srand(seme); |
- |
- servo_open(COM2, 19200); |
- |
- /*cprintf("servo_set_RS232_baudrate\n"); |
- res = servo_set_RS232_baudrate(COM2, 9600); |
- cprintf("Res = %d\n",res); |
- |
- cprintf("servo_get_RS232_baudrate\n"); |
- res = servo_get_RS232_baudrate(COM2); |
- cprintf("Res = %d\n",res); |
- |
- cprintf("servo_store_RS232_baudrate\n"); |
- res = servo_store_RS232_baudrate(COM2); |
- cprintf("Res = %d\n\n",res); |
- |
- ch = keyb_getch(BLOCK);*/ |
- |
- |
- for (i=0; i<N_SEND; i++) { |
- |
- rnd1 = rand()%16; |
- rnd2 = rand()%180 - 90; |
- res = servo_set_angle_sec(COM2, rnd1,ANGLE2SEC(rnd2,0,0)); |
- cprintf("Pin = %2d - Angle = %3d - Res = %d\n",rnd1, rnd2, res); |
- if (res) err++; |
- |
- } |
- cprintf("\nEvents = %d; Errors = %d\n",i, err); |
- |
- |
- servo_close(COM2); |
- |
- return 0; |
- |
-} |
- |
Index: rel_1_4_rc1/servo/initfile.c |
=================================================================== |
--- rel_1_4_rc1/servo/initfile.c (revision 1476) |
+++ rel_1_4_rc1/servo/initfile.c (nonexistent) |
@@ -1,164 +0,0 @@ |
-/* |
- * Project: S.Ha.R.K |
- * |
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
- * |
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
- * |
- * http://www.sssup.it |
- * http://retis.sssup.it |
- * http://hartik.sssup.it |
- */ |
- |
-#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 "modules/sem.h" |
-#include "modules/hartport.h" |
- |
-#include "modules/pi.h" |
-#include "modules/pc.h" |
-#include "modules/srp.h" |
-#include "modules/npp.h" |
-#include "modules/nop.h" |
- |
-#include <drivers/shark_linuxc26.h> |
-#include <drivers/shark_input26.h> |
-#include <drivers/shark_keyb26.h> |
- |
-#define FRAME_BUFFER_DEVICE 0 |
- |
-/*+ sysyem tick in us +*/ |
-#define TICK 0 |
- |
-/*+ RR tick in us +*/ |
-#define RRTICK 10000 |
- |
-/*+ Interrupt Server +*/ |
-#define INTDRIVE_Q 1000 |
-#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) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- 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); |
- dummy_register_level(); |
- |
- SEM_register_module(); |
- |
- PI_register_module(); |
- PC_register_module(); |
- NPP_register_module(); |
- SRP_register_module(); |
- NOP_register_module(); |
- |
- return TICK; |
-} |
- |
-TASK __init__(void *arg) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- HARTPORT_init(); |
- |
- /* Create the shutdown task. It will be activated at RUNLEVEL |
- SHUTDOWN */ |
- set_shutdown_task(); |
- |
- /* Init the drivers */ |
- device_drivers_init(); |
- |
- /* Set the shutdown task activation */ |
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN); |
- |
- __call_main__(mb); |
- |
- return (void *)0; |
-} |
- |
-void set_shutdown_task() { |
- |
- /* WARNING: the shutdown task is a background thread. It cannot execute |
- if the system is overloaded */ |
- NRT_TASK_MODEL nrt; |
- |
- nrt_task_default_model(nrt); |
- nrt_task_def_system(nrt); |
- |
- shutdown_task_PID = task_create("Shutdown Task",shutdown_task_body,&nrt,NULL); |
- if (shutdown_task_PID == NIL) { |
- sys_shutdown_message("Error: Cannot create shutdown task\n"); |
- sys_end(); |
- } |
- |
-} |
- |
-int device_drivers_init() { |
- |
- KEYB_PARMS kparms = BASE_KEYB; |
- |
- LINUXC26_register_module(); |
- |
- INPUT26_init(); |
- |
- keyb_def_ctrlC(kparms, NULL); |
- |
- KEYB26_init(&kparms); |
- |
- return 0; |
- |
-} |
- |
-int device_drivers_close() { |
- |
- KEYB26_close(); |
- |
- INPUT26_close(); |
- |
- return 0; |
- |
-} |
- |
-#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); |
-} |
- |
-TASK shutdown_task_body(void *arg) { |
- |
- device_drivers_close(); |
- |
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
- |
- sys_abort_shutdown(0); |
- |
- return NULL; |
- |
-} |
/rel_1_4_rc1/servo/initfile.c |
Property changes: |
Deleted: svn:executable |
## -1 +0,0 ## |
-* |
\ No newline at end of property |
Index: rel_1_4_rc1/input/initcur.c |
=================================================================== |
--- rel_1_4_rc1/input/initcur.c (revision 1476) |
+++ rel_1_4_rc1/input/initcur.c (nonexistent) |
@@ -1,163 +0,0 @@ |
-/* |
- * 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 |
- */ |
- |
-/* |
- * 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 "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> |
- |
-/*+ sysyem tick in us +*/ |
-#define TICK 0 |
- |
-/*+ RR tick in us +*/ |
-#define RRTICK 10000 |
- |
-/*+ Interrupt Server +*/ |
-#define INTDRIVE_Q 1000 |
-#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) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- 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); |
- dummy_register_level(); |
- |
- SEM_register_module(); |
- |
- return TICK; |
-} |
- |
-int device_drivers_close() { |
- |
- MOUSE26_close(); |
- KEYB26_close(); |
- INPUT26_close(); |
- |
- return 0; |
-} |
- |
-int device_drivers_init() { |
- |
- KEYB_PARMS kparms = BASE_KEYB; |
- MOUSE_PARMS mparms = BASE_MOUSE; |
- |
- LINUXC26_register_module(); |
- INPUT26_init(); |
- |
- /*keyb_def_map(kparms, KEYMAP_IT);*/ |
- keyb_def_ctrlC(kparms, NULL); |
- KEYB26_init(&kparms); |
- |
- MOUSE26_init(&mparms); |
- |
- return 0; |
- |
-} |
- |
-TASK shutdown_task_body(void *arg) { |
- |
- device_drivers_close(); |
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
- sys_abort_shutdown(0); |
- |
- return NULL; |
-} |
- |
-void set_shutdown_task() { |
- |
- NRT_TASK_MODEL nrt; |
- |
- nrt_task_default_model(nrt); |
- nrt_task_def_system(nrt); |
- |
- shutdown_task_PID = task_create("Shutdown Task", shutdown_task_body, &nrt, NULL); |
- if (shutdown_task_PID == NIL) { |
- sys_shutdown_message("Error: Cannot create shutdown task\n"); |
- sys_end(); |
- } |
- |
-} |
- |
-#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); |
-} |
- |
-TASK __init__(void *arg) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- HARTPORT_init(); |
- |
- set_shutdown_task(); |
- |
- device_drivers_init(); |
- |
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN); |
- |
- __call_main__(mb); |
- |
- return (void *)0; |
-} |
/rel_1_4_rc1/input/initcur.c |
Property changes: |
Deleted: svn:executable |
## -1 +0,0 ## |
-* |
\ No newline at end of property |
Index: rel_1_4_rc1/input/input.c |
=================================================================== |
--- rel_1_4_rc1/input/input.c (revision 1476) |
+++ rel_1_4_rc1/input/input.c (nonexistent) |
@@ -1,452 +0,0 @@ |
- |
-/* |
- * 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 |
- */ |
- |
-/* |
- * 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_fb26.h> |
- |
-#include <drivers/shark_mouse26.h> |
-#include <drivers/shark_keyb26.h> |
-#include <drivers/shark_spk26.h> |
-#include <drivers/shark_joy26.h> |
- |
-#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_sysend(KEY_EVT *e) |
-{ |
- sys_end(); |
-} |
- |
-void no_note(KEY_EVT *e) |
-{ |
- speaker_sound(0, 0); |
-} |
- |
-void my_note(KEY_EVT *e) |
-{ |
- switch (e->scan) { |
- case KEY_Q: |
- speaker_sound(262, 0); /* DO */ |
- break; |
- case KEY_W: |
- speaker_sound(277, 0); /* DO# */ |
- break; |
- case KEY_E: |
- speaker_sound(294, 0); /* RE */ |
- break; |
- case KEY_R: |
- speaker_sound(311, 0); /* RE# */ |
- break; |
- case KEY_T: |
- speaker_sound(330, 0); /* MI */ |
- break; |
- case KEY_Y: |
- speaker_sound(349, 0); /* FA */ |
- break; |
- case KEY_U: |
- speaker_sound(370, 0); /* FA# */ |
- break; |
- case KEY_I: |
- speaker_sound(392, 0); /* SOL */ |
- break; |
- case KEY_O: |
- speaker_sound(415, 0); /* SOL# */ |
- break; |
- case KEY_P: |
- speaker_sound(440, 0); /* LA */ |
- break; |
- case KEY_BRL: |
- speaker_sound(466, 0); /* LA# */ |
- break; |
- case KEY_BRR: |
- speaker_sound(494, 0); /* SI */ |
- break; |
- } |
-} |
- |
-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_sysend(NULL); |
- } |
-} |
- |
-TASK my_getch(void *arg) |
-{ |
-#define MYNCHAR 25 |
- |
- BYTE ch; |
- int i = 0; |
- char st[20]; |
- |
- while (1) { |
- ch = keyb_getch(NON_BLOCK); |
- if (ch) { |
- if (ch == BACKSPACE) { //backspace |
- i--; |
- //ch = 0x20; |
- } |
- if (ch == ENTER) { //enter |
- i = ((i / MYNCHAR) + 1) * MYNCHAR - 1; |
- ch = 0x20; |
- } |
- sprintf(st, "%c", ch); |
- grx_text(st, 340 + 10 * (i%MYNCHAR), 25 + 20 * (i/MYNCHAR), RGB_BLUE, RGB_BLACK); |
- |
- if (ch == BACKSPACE) //backspace |
- i--; |
- if (++i >= MYNCHAR * 9) { |
- i = 0; |
- grx_box(315, 15, 623, 223, RGB_BLACK); |
- } |
- } |
- |
- task_endcycle(); |
- } |
-} |
- |
-void my_mouse(MOUSE_EVT *e) |
-{ |
- char st[20]; |
- char pressed = 0; |
- |
- sprintf(st, "X Axis : %3d (%4d)", e->x, e->dx); |
- grx_text(st, 100, 280, RGB_YELLOW, RGB_BLACK); |
- sprintf(st, "Y Axis : %3d (%4d)", e->y, e->dy); |
- grx_text(st, 100, 320, RGB_YELLOW, RGB_BLACK); |
- sprintf(st, "Z Axis : %3d (%4d)", e->z, e->dz); |
- grx_text(st, 100, 360, RGB_YELLOW, RGB_BLACK); |
- sprintf(st, "Buttons: %6x ", (int)e->buttons); |
- grx_text(st, 100, 400, RGB_YELLOW, RGB_BLACK); |
- |
- if ((e->x > 377) && (e->x < 401) && (e->y > 300) && (e->y < 360) && (e->buttons == MOUSE_LBUTTON)){ |
- if (!pressed) { |
- speaker_sound(277, 0); /* DO# */ |
- pressed = 1; |
- } |
- return; |
- } |
- if ((e->x > 407) && (e->x < 431) && (e->y > 300) && (e->y < 360) && (e->buttons == MOUSE_LBUTTON)){ |
- if (!pressed) { |
- speaker_sound(311, 0); /* RE# */ |
- pressed = 1; |
- } |
- return; |
- } |
- if ((e->x > 467) && (e->x < 491) && (e->y > 300) && (e->y < 360) && (e->buttons == MOUSE_LBUTTON)){ |
- if (!pressed) { |
- speaker_sound(370, 0); /* FA# */ |
- pressed = 1; |
- } |
- return; |
- } |
- if ((e->x > 497) && (e->x < 521) && (e->y > 300) && (e->y < 360) && (e->buttons == MOUSE_LBUTTON)){ |
- if (!pressed) { |
- speaker_sound(415, 0); /* SOL# */ |
- pressed = 1; |
- } |
- return; |
- } |
- if ((e->x > 527) && (e->x < 551) && (e->y > 300) && (e->y < 360) && (e->buttons == MOUSE_LBUTTON)){ |
- if (!pressed) { |
- speaker_sound(466, 0); /* LA# */ |
- pressed = 1; |
- } |
- return; |
- } |
- |
- if ((e->x > 360) && (e->x < 388) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)){ |
- if (!pressed) { |
- speaker_sound(262, 0); /* DO */ |
- pressed = 1; |
- } |
- return; |
- } |
- if ((e->x > 390) && (e->x < 418) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)) { |
- if (!pressed) { |
- speaker_sound(294, 0); /* RE */ |
- pressed = 1; |
- } |
- return; |
- } |
- if ((e->x > 420) && (e->x < 448) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)) { |
- if (!pressed) { |
- speaker_sound(330, 0); /* MI */ |
- pressed = 1; |
- } |
- return; |
- } |
- if ((e->x > 450) && (e->x < 478) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)) { |
- if (!pressed) { |
- speaker_sound(349, 0); /* FA */ |
- pressed = 1; |
- } |
- return; |
- } |
- if ((e->x > 480) && (e->x < 508) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)) { |
- if (!pressed) { |
- speaker_sound(392, 0); /* SOL */ |
- pressed = 1; |
- } |
- return; |
- } |
- if ((e->x > 510) && (e->x < 538) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)) { |
- if (!pressed) { |
- speaker_sound(440, 0); /* LA */ |
- pressed = 1; |
- } |
- return; |
- } |
- if ((e->x > 540) && (e->x < 568) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)) { |
- if (!pressed) { |
- speaker_sound(494, 0); /* SI */ |
- pressed = 1; |
- } |
- return; |
- } |
- |
- speaker_sound(0, 0); |
- pressed = 0; |
-} |
- |
-void graph_init(void) |
-{ |
- grx_rect( 4, 4, 634, 474, RGB_WHITE); |
- grx_rect( 14, 14, 304, 224, RGB_YELLOW); |
- grx_rect(314, 14, 624, 224, RGB_RED); |
- grx_rect( 14, 234, 304, 464, RGB_GREEN); |
- grx_rect(314, 234, 624, 464, RGB_BLUE); |
- |
- /* Draw Teyboard */ |
- grx_box(360, 300, 388, 400, RGB_WHITE); /* DO */ |
- grx_box(390, 300, 418, 400, RGB_WHITE); /* RE */ |
- grx_box(420, 300, 448, 400, RGB_WHITE); /* MI */ |
- grx_box(450, 300, 478, 400, RGB_WHITE); /* FA */ |
- grx_box(480, 300, 508, 400, RGB_WHITE); /* SOL */ |
- grx_box(510, 300, 538, 400, RGB_WHITE); /* LA */ |
- grx_box(540, 300, 568, 400, RGB_WHITE); /* SI */ |
- |
- grx_box(377, 301, 401, 360, RGB_BLACK); /* DO# */ |
- grx_box(407, 301, 431, 360, RGB_BLACK); /* RE# */ |
- grx_box(467, 301, 491, 360, RGB_BLACK); /* FA# */ |
- grx_box(497, 301, 521, 360, RGB_BLACK); /* SOL# */ |
- grx_box(527, 301, 551, 360, RGB_BLACK); /* LA# */ |
-} |
- |
-void start_sound(void) |
-{ |
- KEY_EVT ev; |
- |
- speaker_sound(440, 400); |
- while ( (sys_gettime(NULL)/1000) < 1000); |
- |
- ev.ascii = 'q'; |
- ev.scan = KEY_Q; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = 'w'; |
- ev.scan = KEY_W; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = 'e'; |
- ev.scan = KEY_E; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = 'r'; |
- ev.scan = KEY_R; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = 't'; |
- ev.scan = KEY_T; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = 'y'; |
- ev.scan = KEY_Y; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = 'u'; |
- ev.scan = KEY_U; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = 'i'; |
- ev.scan = KEY_I; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = 'o'; |
- ev.scan = KEY_O; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = 'p'; |
- ev.scan = KEY_P; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = '['; |
- ev.scan = KEY_BRL; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = ']'; |
- ev.scan = KEY_BRR; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
-} |
- |
-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_sysend, FALSE); |
- ev.flag = CNTR_BIT; |
- keyb_hook(ev, my_sysend, FALSE); |
- |
- graph_init(); |
- |
- mouse_grxlimits(639, 479); |
- mouse_setposition(319, 239, 0); |
- mouse_hook(my_mouse); |
- 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_usemath(mp); |
- pid = task_create("Key_Print", my_getch, &mp, NULL); |
- if (pid == NIL) { |
- sys_shutdown_message("Could not create task <Key_Print>\n"); |
- sys_end(); |
- } else |
- task_activate(pid); |
- |
- if (JOY26_installed()) { |
- 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_usemath(mp); |
- pid = task_create("Joy_Print", my_getjoy, &mp, NULL); |
- if (pid == NIL) { |
- sys_shutdown_message("Could not create task <Joy_Print>\n"); |
- sys_end(); |
- } else |
- task_activate(pid); |
- } |
- |
- start_sound(); |
- return 0; |
-} |
Index: rel_1_4_rc1/input/initspk.c |
=================================================================== |
--- rel_1_4_rc1/input/initspk.c (revision 1476) |
+++ rel_1_4_rc1/input/initspk.c (nonexistent) |
@@ -1,155 +0,0 @@ |
-/* |
- * 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 |
- */ |
- |
-/* |
- * 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 "modules/sem.h" |
-#include "modules/hartport.h" |
- |
-#include <drivers/shark_linuxc26.h> |
-#include <drivers/shark_input26.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 |
- |
-/*+ Interrupt Server +*/ |
-#define INTDRIVE_Q 1000 |
-#define INTDRIVE_T 10000 |
-#define INTDRIVE_FLAG 0 |
- |
-PID shutdown_task_PID = 1; |
- |
-TIME __kernel_register_levels__(void *arg) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- 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); |
- dummy_register_level(); |
- |
- SEM_register_module(); |
- |
- return TICK; |
-} |
- |
-int device_drivers_close() { |
- |
- KEYB26_close(); |
- SPEAK26_close(); |
- INPUT26_close(); |
- |
- return 0; |
-} |
- |
-int device_drivers_init() { |
- |
- KEYB_PARMS kparms = BASE_KEYB; |
- |
- LINUXC26_register_module(); |
- INPUT26_init(); |
- |
- /*keyb_def_map(kparms, KEYMAP_IT);*/ |
- keyb_def_ctrlC(kparms, NULL); |
- KEYB26_init(&kparms); |
- |
- SPEAK26_init(); |
- return 0; |
-} |
- |
-TASK shutdown_task_body(void *arg) { |
- |
- device_drivers_close(); |
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
- sys_abort_shutdown(0); |
- |
- return NULL; |
-} |
- |
-void set_shutdown_task() { |
- |
- NRT_TASK_MODEL nrt; |
- |
- nrt_task_default_model(nrt); |
- nrt_task_def_system(nrt); |
- |
- shutdown_task_PID = task_create("Shutdown Task", shutdown_task_body, &nrt, NULL); |
- if (shutdown_task_PID == NIL) { |
- sys_shutdown_message("Error: Cannot create shutdown task\n"); |
- sys_end(); |
- } |
- |
-} |
- |
-#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); |
-} |
- |
-TASK __init__(void *arg) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- HARTPORT_init(); |
- |
- set_shutdown_task(); |
- |
- device_drivers_init(); |
- |
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN); |
- |
- __call_main__(mb); |
- |
- return (void *)0; |
-} |
Index: rel_1_4_rc1/input/joy.c |
=================================================================== |
--- rel_1_4_rc1/input/joy.c (revision 1476) |
+++ rel_1_4_rc1/input/joy.c (nonexistent) |
@@ -1,76 +0,0 @@ |
- |
-/* |
- * 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 |
- */ |
- |
-/* |
- * 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_joy26.h> |
- |
-TASK my_getjoy(void *arg) { |
- |
- int a0, a1, a2, a3, btn; |
- |
- while (1) { |
- joy_getstatus(&a0, &a1, &a2, &a3, &btn); |
- cprintf("(%6d %6d) %2x\n", a0, a1, btn); |
- task_endcycle(); |
- if (btn == 0xF) |
- sys_end(); |
- } |
-} |
- |
-int main(int argc, char **argv) |
-{ |
- SOFT_TASK_MODEL mp; |
- PID pid; |
- |
- if (!JOY26_installed()) { |
- cprintf("No Joystick found."); |
- sys_end(); |
- } |
- 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_usemath(mp); |
- pid = task_create("Joy_Print", my_getjoy, &mp, NULL); |
- if (pid == NIL) { |
- sys_shutdown_message("Could not create task <Joy_Print>\n"); |
- sys_end(); |
- } else |
- task_activate(pid); |
- |
- return 0; |
-} |
/rel_1_4_rc1/input/joy.c |
Property changes: |
Deleted: svn:executable |
## -1 +0,0 ## |
-* |
\ No newline at end of property |
Index: rel_1_4_rc1/input/speak.c |
=================================================================== |
--- rel_1_4_rc1/input/speak.c (revision 1476) |
+++ rel_1_4_rc1/input/speak.c (nonexistent) |
@@ -1,208 +0,0 @@ |
- |
-/* |
- * 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 |
- */ |
- |
-/* |
- * 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_keyb26.h> |
-#include <drivers/shark_spk26.h> |
- |
-void my_sysclose(KEY_EVT *e) |
-{ |
- speaker_sound(0, 0); |
- |
- kern_printf("S.Ha.R.K. closed.\n\n"); |
- sys_end(); |
-} |
- |
-void no_note(KEY_EVT *e){ |
- speaker_sound(0, 0); |
-} |
- |
-void my_note(KEY_EVT *e){ |
- |
- switch (e->scan) { |
- case KEY_Q: |
- speaker_sound(262, 0); |
- break; |
- case KEY_W: |
- speaker_sound(277, 0); |
- break; |
- case KEY_E: |
- speaker_sound(294, 0); |
- break; |
- case KEY_R: |
- speaker_sound(311, 0); |
- break; |
- case KEY_T: |
- speaker_sound(330, 0); |
- break; |
- case KEY_Y: |
- speaker_sound(349, 0); |
- break; |
- case KEY_U: |
- speaker_sound(370, 0); |
- break; |
- case KEY_I: |
- speaker_sound(392, 0); |
- break; |
- case KEY_O: |
- speaker_sound(415, 0); |
- break; |
- case KEY_P: |
- speaker_sound(440, 0); |
- break; |
- case KEY_BRL: |
- speaker_sound(466, 0); |
- break; |
- case KEY_BRR: |
- speaker_sound(494, 0); |
- break; |
- } |
-} |
- |
-int main(int argc, char **argv) |
-{ |
- 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); |
- |
- speaker_sound(440, 400); |
- while ( (sys_gettime(NULL)/1000) < 1000); |
- |
- ev.ascii = 'q'; |
- ev.scan = KEY_Q; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = 'w'; |
- ev.scan = KEY_W; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = 'e'; |
- ev.scan = KEY_E; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = 'r'; |
- ev.scan = KEY_R; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = 't'; |
- ev.scan = KEY_T; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = 'y'; |
- ev.scan = KEY_Y; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = 'u'; |
- ev.scan = KEY_U; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = 'i'; |
- ev.scan = KEY_I; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = 'o'; |
- ev.scan = KEY_O; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = 'p'; |
- ev.scan = KEY_P; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = '['; |
- ev.scan = KEY_BRL; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- ev.ascii = ']'; |
- ev.scan = KEY_BRR; |
- ev.flag = 0; |
- ev.status = KEY_PRESSED; |
- keyb_hook(ev, my_note, FALSE); |
- ev.status = KEY_RELEASED; |
- keyb_hook(ev, no_note, FALSE); |
- |
- while(1); |
- return 0; |
-} |
Index: rel_1_4_rc1/input/initfile.c |
=================================================================== |
--- rel_1_4_rc1/input/initfile.c (revision 1476) |
+++ rel_1_4_rc1/input/initfile.c (nonexistent) |
@@ -1,216 +0,0 @@ |
-/* |
- * 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/intdrive.h" |
-#include "modules/edf.h" |
-#include "modules/hardcbs.h" |
-#include "modules/rr.h" |
-#include "modules/dummy.h" |
- |
-#include "modules/sem.h" |
-#include "modules/hartport.h" |
-#include "modules/cabs.h" |
- |
-#include <drivers/shark_linuxc26.h> |
-#include <drivers/shark_pci26.h> |
- |
-#include <drivers/shark_input26.h> |
-#include <drivers/shark_keyb26.h> |
-#include <drivers/shark_mouse26.h> |
-#include <drivers/shark_spk26.h> |
-#include <drivers/shark_joy26.h> |
- |
-#include <drivers/shark_fb26.h> |
- |
-#define FRAME_BUFFER_DEVICE 0 |
- |
-/*+ sysyem tick in us +*/ |
-#define TICK 0 |
- |
-/*+ RR tick in us +*/ |
-#define RRTICK 2000 |
- |
-/*+ Interrupt Server +*/ |
-#define INTDRIVE_Q 1000 |
-#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) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- INTDRIVE_register_level(INTDRIVE_Q,INTDRIVE_T,INTDRIVE_FLAG); |
- EDF_register_level(EDF_ENABLE_ALL); |
- HCBS_register_level(HCBS_ENABLE_ALL, 1); |
- RR_register_level(RRTICK, RR_MAIN_YES, mb); |
- dummy_register_level(); |
- |
- SEM_register_module(); |
- CABS_register_module(); |
- |
- return TICK; |
-} |
- |
-TASK __init__(void *arg) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- HARTPORT_init(); |
- |
- /* Create the shutdown task. It will be activated at RUNLEVEL SHUTDOWN */ |
- set_shutdown_task(); |
- |
- /* Init the drivers */ |
- device_drivers_init(); |
- |
- /* Set the shutdown task activation */ |
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN); |
- |
- __call_main__(mb); |
- |
- return (void *)0; |
-} |
- |
-void set_shutdown_task() |
-{ |
-/* WARNING: the shutdown task is a background thread. It cannot execute if the system is overloaded */ |
- NRT_TASK_MODEL nrt; |
- |
- nrt_task_default_model(nrt); |
- nrt_task_def_system(nrt); |
- |
- shutdown_task_PID = task_create("Shutdown Task",shutdown_task_body,&nrt,NULL); |
- if (shutdown_task_PID == NIL) { |
- sys_shutdown_message("Error: Cannot create shutdown task\n"); |
- sys_end(); |
- } |
-} |
- |
-int device_drivers_init() |
-{ |
- int res; |
- KEYB_PARMS kparms = BASE_KEYB; |
- MOUSE_PARMS mparms = BASE_MOUSE; |
- |
- LINUXC26_register_module(); |
- |
- PCI26_init(); |
- |
- INPUT26_init(); |
- |
- /* keyb_def_map(kparms, KEYMAP_IT);*/ |
- keyb_def_ctrlC(kparms, NULL); |
- KEYB26_init(&kparms); |
- |
- 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); |
- MOUSE26_init(&mparms); |
- |
- SPEAK26_init(); |
- |
- JOY26_init(); |
- |
- FB26_init(); |
- res = FB26_open(FRAME_BUFFER_DEVICE); |
- if (res) { |
- cprintf("Error: Cannot open graphical mode\n"); |
- MOUSE26_close(); |
- SPEAK26_close(); |
- JOY26_close(); |
- KEYB26_close(); |
- INPUT26_close(); |
- sys_end(); |
- } |
- |
- FB26_use_grx(FRAME_BUFFER_DEVICE); |
- FB26_setmode(FRAME_BUFFER_DEVICE,"640x480-16"); |
- |
- return 0; |
-} |
- |
-int device_drivers_close() { |
- |
- mouse_grxcursor(DISABLE, 0); |
- |
- FB26_close(FRAME_BUFFER_DEVICE); |
- |
- MOUSE26_close(); |
- SPEAK26_close(); |
- JOY26_close(); |
- KEYB26_close(); |
- INPUT26_close(); |
- |
- return 0; |
-} |
- |
-#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); |
-} |
- |
-TASK shutdown_task_body(void *arg) |
-{ |
- device_drivers_close(); |
- |
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
- |
- sys_abort_shutdown(0); |
- |
- return NULL; |
-} |
Index: rel_1_4_rc1/input/initjoy.c |
=================================================================== |
--- rel_1_4_rc1/input/initjoy.c (revision 1476) |
+++ rel_1_4_rc1/input/initjoy.c (nonexistent) |
@@ -1,148 +0,0 @@ |
-/* |
- * 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 |
- */ |
- |
-/* |
- * 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 "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 |
- |
-/*+ Interrupt Server +*/ |
-#define INTDRIVE_Q 1000 |
-#define INTDRIVE_T 10000 |
-#define INTDRIVE_FLAG 0 |
- |
-PID shutdown_task_PID = 1; |
- |
-TIME __kernel_register_levels__(void *arg) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- 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); |
- dummy_register_level(); |
- |
- SEM_register_module(); |
- |
- return TICK; |
-} |
- |
-int device_drivers_close() { |
- |
- JOY26_close(); |
- INPUT26_close(); |
- |
- return 0; |
-} |
- |
-int device_drivers_init() { |
- |
- LINUXC26_register_module(); |
- INPUT26_init(); |
- |
- JOY26_init(); |
- |
- return 0; |
- |
-} |
- |
-TASK shutdown_task_body(void *arg) { |
- |
- device_drivers_close(); |
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
- sys_abort_shutdown(0); |
- |
- return NULL; |
-} |
- |
-void set_shutdown_task() { |
- |
- NRT_TASK_MODEL nrt; |
- |
- nrt_task_default_model(nrt); |
- nrt_task_def_system(nrt); |
- |
- shutdown_task_PID = task_create("Shutdown Task", shutdown_task_body, &nrt, NULL); |
- if (shutdown_task_PID == NIL) { |
- sys_shutdown_message("Error: Cannot create shutdown task\n"); |
- sys_end(); |
- } |
- |
-} |
- |
-#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); |
-} |
- |
-TASK __init__(void *arg) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- HARTPORT_init(); |
- |
- set_shutdown_task(); |
- |
- device_drivers_init(); |
- |
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN); |
- |
- __call_main__(mb); |
- |
- return (void *)0; |
-} |
/rel_1_4_rc1/input/initjoy.c |
Property changes: |
Deleted: svn:executable |
## -1 +0,0 ## |
-* |
\ No newline at end of property |
Index: rel_1_4_rc1/input/key.c |
=================================================================== |
--- rel_1_4_rc1/input/key.c (revision 1476) |
+++ rel_1_4_rc1/input/key.c (nonexistent) |
@@ -1,106 +0,0 @@ |
- |
-/* |
- * 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 |
- */ |
- |
-/* |
- * 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_keyb26.h> |
- |
-void my_sysclose(KEY_EVT *e) |
-{ |
- kern_printf("S.Ha.R.K. closed.\n\n"); |
- sys_end(); |
-} |
- |
-TASK my_getch(void *arg) { |
- |
- BYTE ch; |
- |
- while (1) { |
- ch = keyb_getch(NON_BLOCK); |
- if (ch) |
- cprintf("%c", ch); |
- task_endcycle(); |
- } |
-} |
- |
-void my_pause(KEY_EVT *e){ |
- |
- TIME t; |
- |
- cprintf("Start Pause.\n"); |
- keyb_disable(); |
- cprintf("Keyboard Disabled.\n"); |
- t = sys_gettime(NULL); |
- while ( ( (sys_gettime(NULL) -t) / 1000) < 5000); |
- keyb_enable(); |
- cprintf("Keyboard Enabled.\n"); |
-} |
- |
-int main(int argc, char **argv) |
-{ |
- SOFT_TASK_MODEL mp; |
- PID pid; |
- |
- KEY_EVT ev; |
- |
- ev.ascii = 'p'; |
- ev.scan = KEY_P; |
- ev.status = KEY_PRESSED; |
- ev.flag = CNTR_BIT; |
- keyb_hook(ev, my_pause, FALSE); |
- |
- ev.ascii = 'c'; |
- ev.scan = KEY_C; |
- ev.status = KEY_PRESSED; |
- ev.flag = CNTR_BIT; |
- keyb_hook(ev, my_sysclose, FALSE); |
- ev.flag = CNTL_BIT; |
- keyb_hook(ev, my_sysclose, FALSE); |
- |
- 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_usemath(mp); |
- pid = task_create("Keyb_Print", my_getch, &mp, NULL); |
- if (pid == NIL) { |
- perror("Could not create task <Keyb_Print>"); |
- sys_end(); |
- } else |
- task_activate(pid); |
- |
- return 0; |
-} |
Index: rel_1_4_rc1/input/mouse.c |
=================================================================== |
--- rel_1_4_rc1/input/mouse.c (revision 1476) |
+++ rel_1_4_rc1/input/mouse.c (nonexistent) |
@@ -1,95 +0,0 @@ |
- |
-/* |
- * 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 |
- */ |
- |
-/* |
- * 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_mouse26.h> |
-#include <drivers/shark_keyb26.h> |
-#include <drivers/shark_spk26.h> |
- |
-void my_sysclose(KEY_EVT *e) |
-{ |
- mouse_txtcursor(DISABLE); |
- |
- sys_end(); |
-} |
- |
-TASK my_putxy(void *arg) { |
- |
- int x, y, z; |
- unsigned long btn; |
- |
- clear(); |
- |
- 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); |
- |
- 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_usemath(mp); |
- pid = task_create("Mouse_Print", my_putxy, &mp, NULL); |
- if (pid == NIL) { |
- sys_shutdown_message("Could not create task <Mouse_Print>\n"); |
- my_sysclose(NULL); |
- } else |
- task_activate(pid); |
- |
- return 0; |
-} |
/rel_1_4_rc1/input/mouse.c |
Property changes: |
Deleted: svn:executable |
## -1 +0,0 ## |
-* |
\ No newline at end of property |
Index: rel_1_4_rc1/input/initkey.c |
=================================================================== |
--- rel_1_4_rc1/input/initkey.c (revision 1476) |
+++ rel_1_4_rc1/input/initkey.c (nonexistent) |
@@ -1,160 +0,0 @@ |
-/* |
- * 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 |
- */ |
- |
-/* |
- * 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 "modules/sem.h" |
-#include "modules/hartport.h" |
- |
-#include <drivers/shark_linuxc26.h> |
-#include <drivers/shark_input26.h> |
-#include <drivers/shark_keyb26.h> |
- |
-/*+ sysyem tick in us +*/ |
-#define TICK 0 |
- |
-/*+ RR tick in us +*/ |
-#define RRTICK 10000 |
- |
-/*+ Interrupt Server +*/ |
-#define INTDRIVE_Q 1000 |
-#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) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- 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); |
- dummy_register_level(); |
- |
- SEM_register_module(); |
- |
- return TICK; |
-} |
- |
-int device_drivers_close() { |
- |
- KEYB26_close(); |
- INPUT26_close(); |
- |
- return 0; |
- |
-} |
- |
-int device_drivers_init() { |
- |
- KEYB_PARMS kparms = BASE_KEYB; |
- |
- LINUXC26_register_module(); |
- INPUT26_init(); |
- |
- /*keyb_def_map(kparms, KEYMAP_IT);*/ |
- keyb_def_ctrlC(kparms, NULL); |
- KEYB26_init(&kparms); |
- |
- return 0; |
-} |
- |
-TASK shutdown_task_body(void *arg) { |
- |
- device_drivers_close(); |
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
- sys_abort_shutdown(0); |
- |
- return NULL; |
-} |
- |
-#define SHUTDOWN_TIMEOUT_SEC 3 |
- |
-void set_shutdown_task() { |
- |
- NRT_TASK_MODEL nrt; |
- |
- nrt_task_default_model(nrt); |
- nrt_task_def_system(nrt); |
- |
- shutdown_task_PID = task_create("Shutdown Task", shutdown_task_body, &nrt, NULL); |
- if (shutdown_task_PID == NIL) { |
- sys_shutdown_message("Error: Cannot create shutdown task\n"); |
- sys_end(); |
- } |
- |
-} |
- |
-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); |
-} |
- |
-TASK __init__(void *arg) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- HARTPORT_init(); |
- |
- set_shutdown_task(); |
- |
- device_drivers_init(); |
- |
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN); |
- |
- __call_main__(mb); |
- |
- return (void *)0; |
-} |
Index: rel_1_4_rc1/input/makefile |
=================================================================== |
--- rel_1_4_rc1/input/makefile (revision 1476) |
+++ rel_1_4_rc1/input/makefile (nonexistent) |
@@ -1,28 +0,0 @@ |
-# |
-# |
-# |
- |
-ifndef BASE |
-BASE=../.. |
-endif |
-include $(BASE)/config/config.mk |
- |
-PROGS= input speak key mouse joy |
- |
-include $(BASE)/config/example.mk |
- |
-input: |
- make -f $(SUBMAKE) APP=input INIT= OTHEROBJS="initfile.o" SHARKOPT="__INPUT__ __LINUXC26__ __PCI__ __FB__" |
- |
-speak: |
- make -f $(SUBMAKE) APP=speak INIT= OTHEROBJS="initspk.o" SHARKOPT="__INPUT__ __LINUXC26__ __PCI__" |
- |
-key: |
- make -f $(SUBMAKE) APP=key INIT= OTHEROBJS="initkey.o" SHARKOPT="__INPUT__ __LINUXC26__ __PCI__" |
- |
-mouse: |
- make -f $(SUBMAKE) APP=mouse INIT= OTHEROBJS="initcur.o" SHARKOPT="__INPUT__ __LINUXC26__ __PCI__" |
- |
-joy: |
- make -f $(SUBMAKE) APP=joy INIT= OTHEROBJS="initjoy.o" SHARKOPT="__INPUT__ __LINUXC26__ __PCI__" |
- |
Index: rel_1_4_rc1/mesatex/initfile.c |
=================================================================== |
--- rel_1_4_rc1/mesatex/initfile.c (revision 1476) |
+++ rel_1_4_rc1/mesatex/initfile.c (nonexistent) |
@@ -1,202 +0,0 @@ |
-/* |
- * Project: S.Ha.R.K. |
- * |
- * Coordinators: |
- * Giorgio Buttazzo <giorgio@sssup.it> |
- * Paolo Gai <pj@gandalf.sssup.it> |
- * |
- * Authors : |
- * Giacomo Guidi <giacomo@gandalf.sssup.it> |
- * (see the web pages for full authors list) |
- * |
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
- * |
- * http://www.sssup.it |
- * http://retis.sssup.it |
- * http://shark.sssup.it |
- */ |
- |
-/* |
- * |
- * 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/intdrive.h" |
-#include "modules/edf.h" |
-#include "modules/hardcbs.h" |
-#include "modules/rr.h" |
-#include "modules/dummy.h" |
- |
-#include "modules/sem.h" |
-#include "modules/hartport.h" |
-#include "modules/cabs.h" |
- |
-#include <drivers/shark_linuxc26.h> |
-#include <drivers/shark_pci26.h> |
-#include <drivers/shark_input26.h> |
-#include <drivers/shark_keyb26.h> |
-#include <drivers/shark_fb26.h> |
- |
-#define FRAME_BUFFER_DEVICE 0 |
- |
-/*+ sysyem tick in us +*/ |
-#define TICK 0 |
- |
-/*+ RR tick in us +*/ |
-#define RRTICK 10000 |
- |
-/*+ Interrupt Server +*/ |
-#define INTDRIVE_Q 1000 |
-#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) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- INTDRIVE_register_level(INTDRIVE_Q,INTDRIVE_T,INTDRIVE_FLAG); |
- EDF_register_level(EDF_ENABLE_ALL); |
- HCBS_register_level(HCBS_ENABLE_ALL, 1); |
- RR_register_level(RRTICK, RR_MAIN_YES, mb); |
- dummy_register_level(); |
- |
- SEM_register_module(); |
- |
- CABS_register_module(); |
- |
- return TICK; |
-} |
- |
-TASK __init__(void *arg) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- HARTPORT_init(); |
- |
- /* Create the shutdown task. It will be activated at RUNLEVEL |
- SHUTDOWN */ |
- set_shutdown_task(); |
- |
- /* Init the drivers */ |
- device_drivers_init(); |
- |
- /* Set the shutdown task activation */ |
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN); |
- |
- __call_main__(mb); |
- |
- return (void *)0; |
-} |
- |
-void set_shutdown_task() { |
- |
- /* WARNING: the shutdown task is a background thread. It cannot execute |
- if the system is overloaded */ |
- NRT_TASK_MODEL nrt; |
- |
- nrt_task_default_model(nrt); |
- nrt_task_def_system(nrt); |
- |
- shutdown_task_PID = task_create("Shutdown Task",shutdown_task_body,&nrt,NULL); |
- if (shutdown_task_PID == NIL) { |
- sys_shutdown_message("Error: Cannot create shutdown task\n"); |
- sys_end(); |
- } |
- |
-} |
- |
-int device_drivers_init() { |
- |
- int res; |
- KEYB_PARMS kparms = BASE_KEYB; |
- |
- LINUXC26_register_module(); |
- |
- PCI26_init(); |
- |
- INPUT26_init(); |
- |
- keyb_def_ctrlC(kparms, NULL); |
- |
- KEYB26_init(&kparms); |
- |
- FB26_init(); |
- |
- res = FB26_open(FRAME_BUFFER_DEVICE); |
- if (res) { |
- cprintf("Error: Cannot open graphical mode\n"); |
- KEYB26_close(); |
- INPUT26_close(); |
- sys_end(); |
- } |
- |
- FB26_use_grx(FRAME_BUFFER_DEVICE); |
- |
- FB26_setmode(FRAME_BUFFER_DEVICE,"640x480-16"); |
- |
- return 0; |
- |
-} |
- |
-int device_drivers_close() { |
- |
- FB26_close(FRAME_BUFFER_DEVICE); |
- |
- KEYB26_close(); |
- |
- INPUT26_close(); |
- |
- return 0; |
- |
-} |
- |
-#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); |
-} |
- |
-TASK shutdown_task_body(void *arg) { |
- |
- device_drivers_close(); |
- |
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
- |
- sys_abort_shutdown(0); |
- |
- return NULL; |
- |
-} |
- |
- |
Index: rel_1_4_rc1/mesatex/mesatex.c |
=================================================================== |
--- rel_1_4_rc1/mesatex/mesatex.c (revision 1476) |
+++ rel_1_4_rc1/mesatex/mesatex.c (nonexistent) |
@@ -1,372 +0,0 @@ |
-/* |
- * Project: S.Ha.R.K. |
- * |
- * Coordinators: |
- * Giorgio Buttazzo <giorgio@sssup.it> |
- * Paolo Gai <pj@gandalf.sssup.it> |
- * |
- * Authors : |
- * Giacomo Guidi <giacomo@gandalf.sssup.it> |
- * |
- * |
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
- * |
- * http://www.sssup.it |
- * http://retis.sssup.it |
- * http://shark.sssup.it |
- */ |
- |
-#include <GL/osmesa.h> |
-#include <GL/glut.h> |
- |
-#include <math.h> |
-#include <stdlib.h> |
-#include <assert.h> |
-#include <kernel/log.h> |
-#include <kernel/kern.h> |
- |
-#include <drivers/shark_fb26.h> |
-#include <drivers/shark_keyb26.h> |
- |
-#ifndef M_PI |
-#define M_PI 3.14159265 |
-#endif |
- |
-#define WIDTH 640 |
-#define HEIGHT 430 |
-#define BYTES_PP 2 //BytesPerPixel |
- |
-OSMesaContext ctx; |
- |
-static GLuint TexObj[2]; |
-static GLfloat Angle = 0.0f; |
-static GLboolean UseObj = GL_FALSE; |
- |
-extern void *video_memory; |
- |
-#if defined(GL_VERSION_1_1) || defined(GL_VERSION_1_2) |
-# define TEXTURE_OBJECT 1 |
-#elif defined(GL_EXT_texture_object) |
-# define TEXTURE_OBJECT 1 |
-# define glBindTexture(A,B) glBindTextureEXT(A,B) |
-# define glGenTextures(A,B) glGenTexturesEXT(A,B) |
-# define glDeleteTextures(A,B) glDeleteTexturesEXT(A,B) |
-#endif |
- |
-unsigned char *rgb_565_buf = NULL; //RGB 16 bpp Buffer |
-unsigned char *video_buf = NULL; //Video Buffer |
- |
-unsigned long int RGB565MEM = WIDTH * HEIGHT * BYTES_PP; // Total video mem |
- |
-unsigned long int PERIOD_REFRESH = 30000; |
-unsigned long int PERIOD_DISEGNA = 30000; |
- |
-unsigned long int WCET_REFRESH, WCET_DISEGNA; |
- |
-TASK refesh(void); |
-TASK disegna(void); |
- |
-PID refresh_PID, disegna_PID; |
- |
-static void draw( void ) |
-{ |
- glDepthFunc(GL_EQUAL); |
- /* glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );*/ |
- glClear( GL_COLOR_BUFFER_BIT ); |
- |
- glColor3f( 1.0, 1.0, 1.0 ); |
- |
- /* draw first polygon */ |
- glPushMatrix(); |
- glTranslatef( -1.0, 0.0, 0.0 ); |
- glRotatef( Angle, 0.0, 0.0, 1.0 ); |
- if (UseObj) { |
-#ifdef TEXTURE_OBJECT |
- glBindTexture( GL_TEXTURE_2D, TexObj[0] ); |
-#endif |
- } |
- else { |
- glCallList( TexObj[0] ); |
- } |
- glBegin( GL_POLYGON ); |
- glTexCoord2f( 0.0, 0.0 ); glVertex2f( -1.0, -1.0 ); |
- glTexCoord2f( 1.0, 0.0 ); glVertex2f( 1.0, -1.0 ); |
- glTexCoord2f( 1.0, 1.0 ); glVertex2f( 1.0, 1.0 ); |
- glTexCoord2f( 0.0, 1.0 ); glVertex2f( -1.0, 1.0 ); |
- glEnd(); |
- glPopMatrix(); |
- |
- /* draw second polygon */ |
- glPushMatrix(); |
- glTranslatef( 1.0, 0.0, 0.0 ); |
- glRotatef( Angle-90.0, 0.0, 1.0, 0.0 ); |
- if (UseObj) { |
-#ifdef TEXTURE_OBJECT |
- glBindTexture( GL_TEXTURE_2D, TexObj[1] ); |
-#endif |
- } |
- else { |
- glCallList( TexObj[1] ); |
- } |
- glBegin( GL_POLYGON ); |
- glTexCoord2f( 0.0, 0.0 ); glVertex2f( -1.0, -1.0 ); |
- glTexCoord2f( 1.0, 0.0 ); glVertex2f( 1.0, -1.0 ); |
- glTexCoord2f( 1.0, 1.0 ); glVertex2f( 1.0, 1.0 ); |
- glTexCoord2f( 0.0, 1.0 ); glVertex2f( -1.0, 1.0 ); |
- glEnd(); |
- glPopMatrix(); |
- |
-} |
- |
-static void gl_init() |
-{ |
- |
- static int twidth=8, theight=8; |
- static GLubyte tex1[] = { |
- 0, 0, 0, 1, 1, 1, 0, 0, |
- 0, 0, 1, 0, 0, 0, 0, 0, |
- 0, 0, 1, 0, 0, 0, 0, 0, |
- 0, 0, 1, 0, 0, 0, 0, 0, |
- 0, 0, 1, 0, 0, 0, 0, 0, |
- 0, 0, 1, 0, 0, 0, 0, 0, |
- 0, 0, 1, 0, 0, 0, 0, 0, |
- 0, 0, 0, 1, 1, 1, 0, 0 }; |
- |
- static GLubyte tex2[] = { |
- 0, 0, 0, 2, 2, 2, 0, 0, |
- 0, 0, 2, 0, 0, 0, 0, 0, |
- 0, 0, 2, 0, 0, 0, 0, 0, |
- 0, 0, 0, 2, 0, 0, 0, 0, |
- 0, 0, 0, 0, 2, 0, 0, 0, |
- 0, 0, 0, 0, 0, 2, 0, 0, |
- 0, 0, 0, 0, 0, 2, 0, 0, |
- 0, 0, 2, 2, 2, 0, 0, 0 }; |
- |
- GLubyte tex[64][3]; |
- GLint i, j; |
- |
- //Create the OSMesa Context |
- ctx = OSMesaCreateContext(OSMESA_RGB_565, NULL); |
- |
- //Make Current Context |
- OSMesaMakeCurrent(ctx, rgb_565_buf, GL_UNSIGNED_SHORT_5_6_5, WIDTH, HEIGHT); |
- |
- UseObj = GL_TRUE; |
- |
- glDisable( GL_DITHER ); |
- |
- /* Setup texturing */ |
- glEnable( GL_TEXTURE_2D ); |
- glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL ); |
- glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST ); |
- |
- /* generate texture object IDs */ |
- if (UseObj) { |
-#ifdef TEXTURE_OBJECT |
- glGenTextures( 2, TexObj ); |
-#endif |
- } |
- else { |
- TexObj[0] = glGenLists(2); |
- TexObj[1] = TexObj[0]+1; |
- } |
- |
- /* setup first texture object */ |
- if (UseObj) { |
-#ifdef TEXTURE_OBJECT |
- glBindTexture( GL_TEXTURE_2D, TexObj[0] ); |
- assert(glIsTexture(TexObj[0])); |
-#endif |
- } |
- else { |
- glNewList( TexObj[0], GL_COMPILE ); |
- } |
- /* red on white */ |
- for (i=0;i<theight;i++) { |
- for (j=0;j<twidth;j++) { |
- int p = i*twidth+j; |
- if (tex1[(theight-i-1)*twidth+j]) { |
- tex[p][0] = 255; tex[p][1] = 0; tex[p][2] = 0; |
- } |
- else { |
- tex[p][0] = 255; tex[p][1] = 255; tex[p][2] = 255; |
- } |
- } |
- } |
- |
- glTexImage2D( GL_TEXTURE_2D, 0, 3, twidth, theight, 0, |
- GL_RGB, GL_UNSIGNED_BYTE, tex ); |
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); |
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); |
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); |
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); |
- if (!UseObj) { |
- glEndList(); |
- } |
- /* end of texture object */ |
- |
- /* setup second texture object */ |
- if (UseObj) { |
-#ifdef TEXTURE_OBJECT |
- glBindTexture( GL_TEXTURE_2D, TexObj[1] ); |
- assert(glIsTexture(TexObj[1])); |
-#endif |
- assert(!glIsTexture(TexObj[1] + 999)); |
- } |
- else { |
- glNewList( TexObj[1], GL_COMPILE ); |
- } |
- /* green on blue */ |
- for (i=0;i<theight;i++) { |
- for (j=0;j<twidth;j++) { |
- int p = i*twidth+j; |
- if (tex2[(theight-i-1)*twidth+j]) { |
- tex[p][0] = 0; tex[p][1] = 255; tex[p][2] = 0; |
- } |
- else { |
- tex[p][0] = 0; tex[p][1] = 0; tex[p][2] = 255; |
- } |
- } |
- } |
- glTexImage2D( GL_TEXTURE_2D, 0, 3, twidth, theight, 0, |
- GL_RGB, GL_UNSIGNED_BYTE, tex ); |
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); |
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); |
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); |
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); |
- if (!UseObj) { |
- glEndList(); |
- } |
- /* end texture object */ |
- |
- glViewport(0, 0, (GLint)WIDTH, (GLint)HEIGHT); |
- glMatrixMode(GL_PROJECTION); |
- glLoadIdentity(); |
- /* glOrtho( -3.0, 3.0, -3.0, 3.0, -10.0, 10.0 );*/ |
- glFrustum( -2.0, 2.0, 2.0, -2.0, 6.0, 20.0 ); |
- glMatrixMode(GL_MODELVIEW); |
- glLoadIdentity(); |
- glTranslatef( 0.0, 0.0, -8.0 ); |
- |
-} |
- |
-void program_end(void *arg) |
-{ |
- |
- OSMesaDestroyContext(ctx); |
- free(rgb_565_buf); |
- |
- sys_end(); |
- |
-} |
- |
-void program_key_end(KEY_EVT *k) |
-{ |
- |
- sys_end(); |
- |
-} |
- |
-TASK refresh(void) |
-{ |
- |
- while(1) { |
- |
- memcpy((video_buf+40*WIDTH*2), rgb_565_buf, RGB565MEM); |
- task_endcycle(); |
- |
- } |
- |
- sys_end(); |
- |
-} |
- |
- |
-TASK disegna(void) |
-{ |
- |
- char text[100]; |
- TIME disegna_TIME, refresh_TIME; |
- |
- while(1) { |
- |
- jet_gettable(refresh_PID, &refresh_TIME, 1); |
- jet_gettable(disegna_PID, &disegna_TIME, 1); |
- |
- Angle += 2.0; |
- |
- draw(); |
- |
- sprintf(text,"Hard Task Refresh PER:%6d us EX:%6d us",(int)PERIOD_REFRESH,(int)refresh_TIME); |
- grx_text(text,10,5,rgb16(0,0,255),0); |
- sprintf(text,"Hard Task Draw PER:%6d us EX:%6d us",(int)PERIOD_DISEGNA,(int)disegna_TIME); |
- grx_text(text,10,15,rgb16(0,0,255),0); |
- |
- task_endcycle(); |
- |
- } |
- |
- sys_end(); |
- |
-} |
- |
-int main (int argc, char *argv[]) |
-{ |
- |
- HARD_TASK_MODEL ht_refresh, ht_disegna; |
- |
- clear(); |
- |
- WCET_REFRESH =((long int) PERIOD_REFRESH * (0.45)); |
- WCET_DISEGNA =((long int) PERIOD_DISEGNA * (0.45)); |
- |
- hard_task_default_model(ht_refresh); |
- hard_task_def_wcet(ht_refresh,WCET_REFRESH); |
- hard_task_def_mit(ht_refresh,PERIOD_REFRESH); |
- hard_task_def_usemath(ht_refresh); |
- hard_task_def_group(ht_refresh,1); |
- hard_task_def_ctrl_jet(ht_refresh); |
- |
- refresh_PID = task_create("refresh", refresh, &ht_refresh, NULL); |
- if (refresh_PID == -1) { |
- sys_end(); |
- exit(4); |
- } |
- |
- hard_task_default_model(ht_disegna); |
- hard_task_def_mit(ht_disegna,PERIOD_DISEGNA); |
- hard_task_def_wcet(ht_disegna,WCET_DISEGNA); |
- hard_task_def_group(ht_disegna,1); |
- hard_task_def_ctrl_jet(ht_disegna); |
- hard_task_def_usemath(ht_disegna); |
- hard_task_def_stack(ht_disegna,30000); |
- |
- disegna_PID = task_create("disegna", disegna, &ht_disegna, NULL); |
- if (disegna_PID == -1) { |
- sys_end(); |
- exit(4); |
- } |
- |
- { |
- KEY_EVT k; |
- k.flag = ALTL_BIT; |
- k.scan = KEY_C; |
- k.ascii = 'c'; |
- k.status = KEY_PRESSED; |
- keyb_hook(k,program_key_end,FALSE); |
- } |
- |
- rgb_565_buf = malloc(RGB565MEM); |
- |
- gl_init(); |
- |
- video_buf = (unsigned char *)video_memory; |
- //video_buf = (unsigned char *)malloc(640*480*2); |
- |
- memset(rgb_565_buf, 0, RGB565MEM); |
- |
- group_activate(1); |
- |
- return 0; |
- |
-} |
Index: rel_1_4_rc1/mesatex/readme.txt |
=================================================================== |
--- rel_1_4_rc1/mesatex/readme.txt (revision 1476) |
+++ rel_1_4_rc1/mesatex/readme.txt (nonexistent) |
@@ -1,44 +0,0 @@ |
--------------------------------------- |
-MESA Demo (tex) |
- |
-by |
- |
-Giacomo Guidi <giacomo@gandalf.sssup.it> |
- |
-Last update 17/03/2003 |
--------------------------------------- |
- |
-This is a simple test demo for the MESA (5.0) |
-libraries, the low level graphic drivers is |
-the SVGA (from the SVGAlib) |
- |
-See drivers/svga/readme for supported cards |
- |
--------------------------------------- |
- |
-The demo is composed by: |
- |
-MAKEFILE The makefile used to compile the application |
-README.TXT This file |
-INITFILE.C The init file |
-MESATEX.C The MESA Demo |
- |
--------------------------------------- |
- |
-- To specify your card change the line |
- |
-#define CARD <driver name> |
- |
-- The demo calls the grx and off-screen Mesa functions. |
-The resolution must be 16 bitsperpixel (64K colors) and |
-the graphic access mode must be linear. |
- |
-- There are two buffers |
- |
- The video buffer (video_buf) |
- The virtual buffer (rgb_565_buf) |
- |
- copy_videomem_16to16 links these buffers |
- |
- |
- |
Index: rel_1_4_rc1/mesatex/makefile |
=================================================================== |
--- rel_1_4_rc1/mesatex/makefile (revision 1476) |
+++ rel_1_4_rc1/mesatex/makefile (nonexistent) |
@@ -1,16 +0,0 @@ |
-# |
-# |
-# |
- |
-ifndef BASE |
-BASE=../.. |
-endif |
-include $(BASE)/config/config.mk |
- |
-PROGS = mesatex |
- |
-include $(BASE)/config/example.mk |
- |
-mesatex: |
- make -f $(SUBMAKE) APP=mesatex INIT= OTHEROBJS="initfile.o" SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __FB__ __OSMESA__" |
- |
Index: rel_1_4_rc1/loader/loadfile/loadxml.fsf2 |
=================================================================== |
--- rel_1_4_rc1/loader/loadfile/loadxml.fsf2 (revision 1476) |
+++ rel_1_4_rc1/loader/loadfile/loadxml.fsf2 (nonexistent) |
@@ -1,59 +0,0 @@ |
-<?xml version="1.0" encoding="UTF-8"?> |
-<fsf_framework xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../generators/java/fsf-schema.xsd"> |
- |
-<simulation> |
-<time>20s 0u</time> |
-</simulation> |
-<contract> |
- <cmin>0s 3000u</cmin> |
- <tmax>0s 10000u</tmax> |
- <cmax>0s 3000u</cmax> |
- <tmin>0s 10000u</tmin> |
- <workload>0</workload> |
- <localscheduler type="POSIX"> |
- <task_section type="BackTask"> |
- <number>1</number> |
- <act_section> |
- <start_time>3s 0u</start_time> |
- </act_section> |
- <exec_section> |
- <exec_time>3s 0u</exec_time> |
- </exec_section> |
- </task_section> |
- <task_section type="OneShot"> |
- <number>2</number> |
- <dline>0s 0u</dline> |
- <wcet>0s 0u</wcet> |
- <act_section> |
- <start_time>3s 0u</start_time> |
- </act_section> |
- <exec_section> |
- <exec_time>3s 0u</exec_time> |
- </exec_section> |
- </task_section> |
- </localscheduler> |
-</contract> |
-<contract> |
- <cmin>0s 3000u</cmin> |
- <tmax>0s 10000u</tmax> |
- <cmax>0s 3000u</cmax> |
- <tmin>0s 10000u</tmin> |
- <workload>0</workload> |
- <localscheduler type="EDF"> |
- <task_section type="CyclicalTask"> |
- <number>1</number> |
- <dline>1s 0u</dline> |
- <wcet>0s 100000u</wcet> |
- <act_section> |
- <start_time>3s 0u</start_time> |
- <period_time>1s 0u</period_time> |
- </act_section> |
- <exec_section> |
- <exec_time>0s 10000u</exec_time> |
- <delta_time>0s 10000u</delta_time> |
- </exec_section> |
- </task_section> |
- </localscheduler> |
-</contract> |
- |
-</fsf_framework> |
Index: rel_1_4_rc1/loader/loadfile/load.fsf |
=================================================================== |
--- rel_1_4_rc1/loader/loadfile/load.fsf (revision 1476) |
+++ rel_1_4_rc1/loader/loadfile/load.fsf (nonexistent) |
@@ -1,75 +0,0 @@ |
-# CONTRACT SECTION |
-# |
-# CONTRACT NUMBER:CMIN:TMAX:CMAX:TMIN:WORKLOAD:DEADLINE:LOCAL SCHEDULER |
-# |
-# YOU WILL HAVE A SERVER FOR EACH SPECIFIED CONTRACT, |
-# SO IN THE TASK SECTION YOU CAN SPECIFY THE "CONTRACT NUMBER" |
-# INSTEAD OF THE SERVER NUMBER, WHICH IS CALCULATED INSIDE THE |
-# LOADER |
-# |
-# ALL THE TIME PARAMETERS INSIDE THIS FILE ARE ALWAYS EXPRESSED AS |
-# "[SECONDS][MICROSECONDS]" TO AVOID FLOATING POINT CALCULATIONS |
-# |
-# WORKLOAD |
-# 0 BOUNDED |
-# 1 INDETERMINATED |
-# |
-# LOCAL SCHEDULER |
-# POSIX - DEFAULT FOR THE FRAMEWORK |
-# EDF |
-# RM |
-# |
-# TASK SECTION |
-# |
-# TASK TYPE:CONTRACT NUMBER:LOCAL SCHEDULER:NUMBER OF TASK:DEADLINE:WCET:TASK ACT TYPE (PAR1,PAR2,...): |
-# :TASK EXEC TYPE (PAR1,PAR2,...):CRITICAL SESSION (PAR1,PAR2,PAR3,PAR4); |
-# |
-# TASK TYPE |
-# OS - ONE_SHOT |
-# CT - CYCLICAL_TASK |
-# BT - BACKGROUND_TASK |
-# |
-# TASK EXEC TYPE |
-# EXEC_CONST(TIME) |
-# - CONSTANT EXEC TIME |
-# EXEC_MEAN(MEAN, DELTA) |
-# - VARIABLE EXEC TIME WITH CONSTANT DISTRIBUTION |
-# |
-# TASK ACTIVATION TIME |
-# ACT_SINGLE(START_TIME) |
-# ACT_PERIODIC(START_TIME, PERIOD) |
-# ACT_MEAN(START_TIME, MEAN, DELTA) |
-# |
-# CRITICAL SESSION |
-# CRIT(RES NUMBER, BLOCKING_TIME) |
-# NO_CRIT |
-# |
- |
-TOTAL_EXEC_TIME:[20][0]; |
-# SIMULATION TOTAL TIME |
- |
-CONTRACT SECTION |
- |
-[0]:[0][3000]:[0][10000]:[0][3000]:[0][10000]:[0]:[0][9000]:POSIX; |
-[1]:[0][6000]:[0][30000]:[0][6000]:[0][30000]:[0]:[0][0]:POSIX; |
-[2]:[0][3000]:[0][30000]:[0][3000]:[0][30000]:[0]:[0][0]:POSIX; |
-[3]:[0][3000]:[0][20000]:[0][3000]:[0][20000]:[0]:[0][0]:POSIX; |
- |
-END |
- |
-TASK SECTION |
- |
-BT:[0]:POSIX:[1]:[0][0]:[0][0]:ACT_SINGLE([1][0]): |
-:EXEC_CONST([0][25000]):NO_CRIT; |
- |
-BT:[1]:POSIX:[1]:[0][0]:[0][0]:ACT_SINGLE([2][0]): |
-:EXEC_CONST([0][16000]):NO_CRIT; |
- |
-OS:[2]:POSIX:[1]:[0][0]:[0][0]:ACT_SINGLE([3][0]): |
-:EXEC_CONST([1][0]):NO_CRIT; |
- |
-BT:[3]:POSIX:[5]:[0][0]:[0][0]:ACT_SINGLE([4][0]): |
-:EXEC_CONST([0][10000]):NO_CRIT; |
- |
-END |
- |
Index: rel_1_4_rc1/loader/common/lconst.h |
=================================================================== |
--- rel_1_4_rc1/loader/common/lconst.h (revision 1476) |
+++ rel_1_4_rc1/loader/common/lconst.h (nonexistent) |
@@ -1,36 +0,0 @@ |
-#define PAR_TOTAL_EXEC_TIME 0 |
-#define PAR_TIME 1 |
-#define PAR_ACT_TYPE 2 |
-#define PAR_TASK_NUMBER 3 |
-#define PAR_EXEC_TYPE 4 |
-#define PAR_TASK_TYPE 5 |
-#define PAR_NOTHING 6 |
-#define PAR_DEADLINE 7 |
-#define PAR_ERROR 8 |
-#define PAR_FOUND 9 |
-#define PAR_CRIT_SESSION 10 |
-#define PAR_END 11 |
- |
-#define PAR_EXEC_CONST 12 |
-#define PAR_EXEC_MEAN 13 |
- |
-#define PAR_CONTRACT_SECTION 14 |
-#define PAR_TASK_SECTION 15 |
- |
-#define PAR_ACT_SINGLE 16 |
-#define PAR_ACT_PERIODIC 17 |
-#define PAR_ACT_MEAN 18 |
- |
-#define PAR_TASK_OS 21 |
-#define PAR_TASK_CT 22 |
-#define PAR_TASK_BT 23 |
- |
-#define PAR_NO_CRIT 26 |
-#define PAR_CRIT 27 |
- |
-#define PAR_LOCAL_SCHEDULER 29 |
-#define PAR_POSIX 30 |
-#define PAR_EDF 31 |
-#define PAR_RM 32 |
- |
-#define PAR_FSF_SERVER 33 |
Index: rel_1_4_rc1/loader/common/calibrate.h |
=================================================================== |
--- rel_1_4_rc1/loader/common/calibrate.h (revision 1476) |
+++ rel_1_4_rc1/loader/common/calibrate.h (nonexistent) |
@@ -1,8 +0,0 @@ |
- |
-/* Nunber of calibration iterations */ |
-#define CALIBRATION_DELTA 100000 |
- |
-/* Usec of exec time for CALIBRATING_DELTA iterations |
- Set to 0 if you calibrate during loader execution */ |
-#define CALIBRATION_RESULT 0 |
- |
Index: rel_1_4_rc1/loader/common/nload.c |
=================================================================== |
--- rel_1_4_rc1/loader/common/nload.c (revision 1476) |
+++ rel_1_4_rc1/loader/common/nload.c (nonexistent) |
@@ -1,315 +0,0 @@ |
-/* FSF Loader |
- * |
- * Load and run a specific set of tasks/contracts |
- * |
- * This is the system indipendent part |
- * |
- * Giacomo Guidi <giacomo@gandalf.sssup.it> |
- * Michael Timarchi <trimarchi@gandalf.sssup.it> |
- * |
- */ |
- |
-#include "fsf_contract.h" //Framework main header |
-#include "calibrate.h" |
-#include "func.h" //Generic function definitions |
-#include "lconst.h" |
- |
-/* Activate task output debug */ |
-#define TASK_OUTPUT |
- |
-int cal_cycles = CALIBRATION_RESULT; //Calibration const, it converts usec to cycles |
-struct timespec zero_time; //Zero time of the simulation |
-extern struct loader_task loader_task_list[]; //Loader task array |
-extern int total_loader_task; //Loader task number |
- |
-/* OS: Oneshot Task: |
- begin |
- - execution |
- end |
-*/ |
-void *oneshot_task(void *arg) |
-{ |
- long long i,exec_cycles = 0; |
- struct loader_task *l = (struct loader_task *)(arg); |
- #ifdef TASK_OUTPUT |
- #ifdef OS_SHARK |
- char tmp[20]; |
- #endif |
- #endif |
- |
- start_oneshot_task(); |
- |
- /* to avoid problem if the task start inside the create function */ |
- if (l->act_current == 0) l->act_current = 1; |
- #ifdef TASK_OUTPUT |
- #ifdef OS_SHARK |
- sprintf(tmp,"[ONESHOT]"); |
- printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, GREEN, tmp); |
- #endif |
- #endif |
- |
- exec_cycles = (long long)(TIMESPEC2USEC(&l->exec[l->act_current-1])) * CALIBRATION_DELTA / cal_cycles; |
- |
- /* Execution delay */ |
- for (i=0;i<exec_cycles;i++) |
- __asm__ __volatile__ ("xorl %%eax,%%eax\n\t" |
- "cpuid\n\t" |
- :::"eax","ebx","ecx","edx"); |
- |
- end_oneshot_task(); |
- |
- #ifdef TASK_OUTPUT |
- #ifdef OS_SHARK |
- sprintf(tmp,"[--END--]"); |
- printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, GREEN, tmp); |
- #endif |
- #endif |
- |
- return NULL; |
- |
-} |
- |
-/* CT: Cyclical Task: |
- begin |
- while (1) { |
- - execution |
- - end_cycle |
- } |
- end (never end) |
-*/ |
-void *periodic_task(void *arg) |
-{ |
- long long i,exec_cycles = 0,block_cycles = 0; |
- int act = 0; |
- struct loader_task *l = (struct loader_task *)(arg); |
- |
- #ifdef TASK_OUTPUT |
- #ifdef OS_SHARK |
- char tmp[20]; |
- #endif |
- #endif |
- |
- start_periodic_task(); |
- |
- if (l->act_current == 0) l->act_current = 1; |
- |
- while(1) { |
- |
- start_job_periodic_task(); |
- |
- #ifdef TASK_OUTPUT |
- #ifdef OS_SHARK |
- sprintf(tmp,"C[%06d]",act); |
- printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, GREEN, tmp); |
- #endif |
- #endif |
- |
- exec_cycles = (long long)(TIMESPEC2USEC(&l->exec[l->act_current-1])) * CALIBRATION_DELTA / cal_cycles; |
- block_cycles = (long long)(TIMESPEC2USEC(&l->block[l->act_current-1])) * CALIBRATION_DELTA / cal_cycles; |
- |
- /* Execution delay */ |
- for (i=0;i<exec_cycles;i++) |
- __asm__ __volatile__ ("xorl %%eax,%%eax\n\t" |
- "cpuid\n\t" |
- :::"eax","ebx","ecx","edx"); |
- if (l->muxstatus == 2) { |
- |
- #ifdef TASK_OUTPUT |
- #ifdef OS_SHARK |
- sprintf(tmp,"C[LOCK%02d]",l->resource); |
- printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, RED, tmp); |
- #endif |
- #endif |
- |
- generic_lock_mutex(l->resource); |
- for (i=0;i<block_cycles;i++) |
- __asm__ __volatile__ ("xorl %%eax,%%eax\n\t" |
- "cpuid\n\t" |
- :::"eax","ebx","ecx","edx"); |
- generic_unlock_mutex(l->resource); |
- |
- #ifdef TASK_OUTPUT |
- #ifdef OS_SHARK |
- sprintf(tmp,"C[FREE%02d]",l->resource); |
- printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, GREEN, tmp); |
- #endif |
- #endif |
- |
- } |
- |
- end_job_periodic_task(); |
- |
- generic_task_endcycle(); |
- |
- act++; |
- |
- } |
- |
- end_periodic_task(); |
- |
- #ifdef TASK_OUTPUT |
- #ifdef OS_SHARK |
- sprintf(tmp,"[--END--]"); |
- printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, GREEN, tmp); |
- #endif |
- #endif |
- |
- return NULL; |
- |
-} |
- |
-/* BT: Background Task: |
- begin |
- while (1) { |
- - execution |
- } |
- end (never end) |
-*/ |
-void *back_task(void *arg) |
-{ |
- long long i,exec_cycles = 0,block_cycles = 0; |
- int act = 0; |
- struct loader_task *l = (struct loader_task *)(arg); |
- #ifdef TASK_OUTPUT |
- #ifdef OS_SHARK |
- char tmp[20]; |
- #endif |
- #endif |
- |
- start_back_task(); |
- |
- if (l->act_current == 0) l->act_current = 1; |
- |
- while(1) { |
- |
- start_job_back_task(); |
- |
- #ifdef TASK_OUTPUT |
- #ifdef OS_SHARK |
- sprintf(tmp,"B[%06d]",act); |
- printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, GREEN, tmp); |
- #endif |
- #endif |
- |
- exec_cycles = (long long)(TIMESPEC2USEC(&l->exec[l->act_current-1])) * CALIBRATION_DELTA / cal_cycles; |
- block_cycles = (long long)(TIMESPEC2USEC(&l->block[l->act_current-1])) * CALIBRATION_DELTA / cal_cycles; |
- |
- /* Execution delay */ |
- for (i=0;i<exec_cycles;i++) |
- __asm__ __volatile__ ("xorl %%eax,%%eax\n\t" |
- "cpuid\n\t" |
- :::"eax","ebx","ecx","edx"); |
- if (l->muxstatus == 2) { |
- |
- #ifdef TASK_OUTPUT |
- #ifdef OS_SHARK |
- sprintf(tmp,"B[LOCK%02d]",l->resource); |
- printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, RED, tmp); |
- #endif |
- #endif |
- |
- generic_lock_mutex(l->resource); |
- for (i=0;i<block_cycles;i++) |
- __asm__ __volatile__ ("xorl %%eax,%%eax\n\t" |
- "cpuid\n\t" |
- :::"eax","ebx","ecx","edx"); |
- generic_unlock_mutex(l->resource); |
- |
- #ifdef TASK_OUTPUT |
- #ifdef OS_SHARK |
- sprintf(tmp,"C[FREE%02d]",l->resource); |
- printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, GREEN, tmp); |
- #endif |
- #endif |
- |
- } |
- |
- end_job_back_task(); |
- |
- act++; |
- |
- } |
- |
- end_back_task(); |
- |
- #ifdef TASK_OUTPUT |
- #ifdef OS_SHARK |
- sprintf(tmp,"[--END--]"); |
- printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, GREEN, tmp); |
- #endif |
- #endif |
- |
- return NULL; |
- |
-} |
- |
-/* Task create */ |
-/* this function create the task struct in memory */ |
-void loader_task_create() |
-{ |
- |
- struct loader_task *current = loader_task_list; |
- int i=0, k=0; |
- |
- while (k <total_loader_task) { |
- k++; |
- |
- for (i=0; i < current->number; i++) { |
- |
- pthread_t j; |
- int err = 0; |
- |
- switch(current->task_type) { |
- case PAR_TASK_OS: |
- err = generic_create_thread(generic_get_server_from_contract(current->contract),&j,NULL, |
- oneshot_task,(void *)current,generic_get_task_model(current)); |
- break; |
- case PAR_TASK_BT: |
- err = generic_create_thread(generic_get_server_from_contract(current->contract),&j,NULL, |
- back_task,(void *)current,generic_get_task_model(current)); |
- break; |
- case PAR_TASK_CT: |
- err = generic_create_thread(generic_get_server_from_contract(current->contract),&j,NULL, |
- periodic_task,(void *)current,generic_get_task_model(current)); |
- break; |
- } |
- if (err) { |
- printf("Error fsf task creating\n"); |
- generic_end_simulation(); |
- } |
- |
- } |
- |
- current = &loader_task_list[k]; |
- |
- } |
- |
- printf("Created %d loader tasks\n",k); |
- |
- |
-} |
- |
-/* Main Function */ |
-int start_environment() |
-{ |
- |
- extern struct timespec total_time; |
- |
- /* Calibrate the exec time */ |
- generic_calibrate_cycle(); |
- |
- /* Create the servers usign defined contracts */ |
- generic_fsfinit(); |
- |
- /* Create the tasks */ |
- loader_task_create(); |
- |
- /* Start the simulation */ |
- generic_start_simulation(); |
- |
- /* Set the simulation end time */ |
- generic_set_simulation_time(&total_time); |
- |
- return 0; |
- |
-} |
Index: rel_1_4_rc1/loader/common/nload.h |
=================================================================== |
--- rel_1_4_rc1/loader/common/nload.h (revision 1476) |
+++ rel_1_4_rc1/loader/common/nload.h (nonexistent) |
@@ -1,46 +0,0 @@ |
-/* Generic Struct for loader task */ |
-#ifndef __NLOAD_H__ |
-#define __NLOAD_H__ |
- |
-#include "func.h" //Constant definition for loader and linux parser |
- |
-struct loader_task { |
- |
- char name[20]; //Task name |
- int task_type; //Tast type (OS,CT,BT) |
- int contract; //Contract number |
- int local_scheduler; //Local scheduler for the task |
- int number; //How many copies of this task |
- int group; //Group number |
- |
- struct timespec deadline; //Task deadline |
- struct timespec wcet; //Task wcet |
- |
- int act_number; //Number of activations precalcolated |
- int act_current; //Actual activation number |
- |
- int resource; |
- int muxstatus; |
- |
- struct timespec *act; //Activation list |
- struct timespec *exec; //Execution time list |
- struct timespec *block; //Blocking time |
- |
-}; |
- |
-struct loader_contract { |
- |
- int number; //Contract number |
- struct timespec cmin; |
- struct timespec tmax; |
- struct timespec cmax; |
- struct timespec tmin; |
- int workload; |
- struct timespec deadline; |
- int local_scheduler; |
- int server; //Server number linked to this contract |
- |
-}; |
- |
-#endif |
- |
Index: rel_1_4_rc1/loader/common/time.h |
=================================================================== |
--- rel_1_4_rc1/loader/common/time.h (revision 1476) |
+++ rel_1_4_rc1/loader/common/time.h (nonexistent) |
@@ -1,65 +0,0 @@ |
-#ifndef __TIME_H__ |
-#define __TIME_H__ |
- |
-#define TIMESPEC2NANOSEC(t) ((t)->tv_sec * 1000000000 + (t)->tv_nsec) |
-#define TIMESPEC2USEC(t) ((t)->tv_sec * 1000000 + (t)->tv_nsec / 1000) |
-#define NULL_TIMESPEC(t) ((t)->tv_sec = (t)->tv_nsec = 0) |
-#define ADDNANO2TIMESPEC(n, t) ((t)->tv_nsec += (n), \ |
- (t)->tv_sec += (t)->tv_nsec / 1000000000, \ |
- (t)->tv_nsec %= 1000000000) |
- |
-#define SUBTIMESPEC(s1, s2, d) \ |
- ((d)->tv_nsec = ((s1)->tv_nsec >= (s2)->tv_nsec) ? \ |
- (((d)->tv_sec = (s1)->tv_sec - (s2)->tv_sec), \ |
- (s1)->tv_nsec - (s2)->tv_nsec) \ |
- : \ |
- (((d)->tv_sec = (s1)->tv_sec - (s2)->tv_sec - 1), \ |
- (1000000000 + (s1)->tv_nsec - (s2)->tv_nsec))) |
- |
-/* |
- * ...and these not! |
- */ |
- |
-extern __inline__ void ADDTIMESPEC(const struct timespec *s1, |
- const struct timespec *s2, |
- struct timespec *d) |
-{ |
- d->tv_sec = s1->tv_sec + s2->tv_sec; |
- d->tv_nsec = s1->tv_nsec + s2->tv_nsec; |
- |
- if (d->tv_nsec < 0) { |
- d->tv_sec--; |
- d->tv_nsec += 1000000000; |
- } else if (d->tv_nsec >= 1000000000) { |
- d->tv_sec++; |
- d->tv_nsec -= 1000000000; |
- } |
-} |
- |
- |
-#define ADDUSEC2TIMESPEC(m, t) ((t)->tv_nsec += (m%1000000)*1000, \ |
- (t)->tv_sec += ((t)->tv_nsec / 1000000000) + (m/1000000), \ |
- (t)->tv_nsec %= 1000000000) |
- |
-#define TIMESPEC_A_LT_B(a,b) \ |
- ( \ |
- ((a)->tv_sec < (b)->tv_sec) || \ |
- ((a)->tv_sec == (b)->tv_sec && (a)->tv_nsec < (b)->tv_nsec) \ |
- ) |
- |
-#define TIMESPEC_A_GT_B(a,b) \ |
- ( \ |
- ((a)->tv_sec > (b)->tv_sec) || \ |
- ((a)->tv_sec == (b)->tv_sec && (a)->tv_nsec > (b)->tv_nsec) \ |
- ) |
- |
-#define TIMESPEC_A_EQ_B(a,b) \ |
- ((a)->tv_sec == (b)->tv_sec && (a)->tv_nsec == (b)->tv_nsec) |
- |
-#define TIMESPEC_A_NEQ_B(a,b) \ |
- ((a)->tv_sec != (b)->tv_sec || (a)->tv_nsec != (b)->tv_nsec) |
- |
-#define TIMESPEC_ASSIGN(t1,t2) \ |
- ((t1)->tv_sec = (t2)->tv_sec, (t1)->tv_nsec = (t2)->tv_nsec) |
- |
-#endif |
Index: rel_1_4_rc1/loader/marte/makefile.in |
=================================================================== |
--- rel_1_4_rc1/loader/marte/makefile.in (revision 1476) |
+++ rel_1_4_rc1/loader/marte/makefile.in (nonexistent) |
@@ -1,7 +0,0 @@ |
-# |
-# MaRTE OS dependecies |
-# |
- |
-os_specific_dep: |
- echo MaRTE dependencies here |
- |
Index: rel_1_4_rc1/loader/shark/shark.c |
=================================================================== |
--- rel_1_4_rc1/loader/shark/shark.c (revision 1476) |
+++ rel_1_4_rc1/loader/shark/shark.c (nonexistent) |
@@ -1,232 +0,0 @@ |
-#include "func.h" |
-#include "calibrate.h" |
-#include <tracer.h> |
- |
-#include "FTrace_udp.h" |
-#include "FTrace_chunk.h" |
- |
-extern int cal_cycles; |
-extern struct timespec zero_time; |
-extern struct loader_task loader_task_list[]; |
-extern struct loader_contract loader_contract_list[]; |
-extern int total_loader_task; |
-extern int total_loader_contract; |
- |
-mutex_t mutex_table[MAX_MUTEX]; |
-int main_chunk; |
- |
-/* Runtime Calibration */ |
-int calibrate_cycle() |
-{ |
- long long i; |
- struct timespec start,end,diff; |
- |
- if (cal_cycles != 0) return 0; |
- |
- kern_cli(); |
- __asm__ __volatile__ ("xorl %%eax,%%eax\n\t" |
- "cpuid\n\t" |
- :::"eax","ebx","ecx","edx"); |
- kern_gettime(&start); |
- for (i=0;i<CALIBRATION_DELTA;i++) |
- __asm__ __volatile__ ("xorl %%eax,%%eax\n\t" |
- "cpuid\n\t" |
- :::"eax","ebx","ecx","edx"); |
- __asm__ __volatile__ ("xorl %%eax,%%eax\n\t" |
- "cpuid\n\t" |
- :::"eax","ebx","ecx","edx"); |
- kern_gettime(&end); |
- kern_sti(); |
- |
- SUBTIMESPEC(&end,&start,&diff); |
- cal_cycles = TIMESPEC2USEC(&diff); |
- cprintf("Calibration usec/[%d cycles] = %d\n",CALIBRATION_DELTA,cal_cycles); |
- |
- return 0; |
- |
-} |
- |
-int get_server_from_contract(int contract) |
-{ |
- |
- int i; |
- |
- for(i=0;i<total_loader_contract;i++) |
- if (loader_contract_list[i].number == contract) |
- return loader_contract_list[i].server; |
- |
- return -1; |
- |
-} |
- |
-void *get_task_model(struct loader_task *current) { |
- if (current->local_scheduler == PAR_POSIX) { |
- static NRT_TASK_MODEL nrt; |
- |
- nrt_task_default_model(nrt); |
- nrt_task_def_save_arrivals(nrt); |
- nrt_task_def_ctrl_jet(nrt); |
- nrt_task_def_group(nrt,current->group); |
- nrt_task_def_usemath(nrt); |
- |
- return &nrt; |
- |
- } |
- |
- if (current->local_scheduler == PAR_EDF) { |
- static HARD_TASK_MODEL ht; |
- |
- hard_task_default_model(ht); |
- hard_task_def_ctrl_jet(ht); |
- hard_task_def_mit(ht,TIMESPEC2USEC(¤t->deadline)); |
- hard_task_def_wcet(ht,TIMESPEC2USEC(¤t->wcet)); |
- hard_task_def_group(ht,current->group); |
- hard_task_def_aperiodic(ht); |
- hard_task_def_usemath(ht); |
- return &ht; |
- } |
- |
- |
- if (current->local_scheduler == PAR_RM) { |
- static HARD_TASK_MODEL ht; |
- |
- hard_task_default_model(ht); |
- hard_task_def_mit(ht,TIMESPEC2USEC(¤t->deadline)); |
- hard_task_def_wcet(ht,TIMESPEC2USEC(¤t->wcet)); |
- hard_task_def_ctrl_jet(ht); |
- hard_task_def_group(ht,current->group); |
- hard_task_def_usemath(ht); |
- return &ht; |
- } |
- |
- return NULL; |
- |
-} |
- |
-TASK finish_task() { |
- |
- #ifdef __NEW_TRACER__ |
- |
- FTrace_OSD_init_udp(1,"192.168.82.43","192.168.82.20"); |
- |
- FTrace_send_chunk(main_chunk, 0, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC); |
- |
- sys_end(); |
- |
- #else |
- |
- sys_end(); |
- |
- #endif |
- |
- return NULL; |
- |
-} |
- |
-void end_simulation() { |
- |
- #ifdef __NEW_TRACER__ |
- |
- int i; |
- struct loader_task *l = loader_task_list; |
- |
- NRT_TASK_MODEL nrt; |
- |
- TRACER_LOGEVENT(FTrace_EVT_trace_stop,0,0); |
- |
- FTrace_disable(); |
- |
- i = 0; |
- while (i < total_loader_task) { |
- |
- group_kill(l->group); |
- |
- i++; |
- l=&loader_task_list[i]; |
- |
- } |
- |
- nrt_task_default_model(nrt); |
- |
- task_activate(task_create("Finish",finish_task,&nrt,NULL)); |
- |
- #else |
- |
- sys_end(); |
- |
- #endif |
- |
-} |
- |
-void set_simulation_time (struct timespec *total) { |
- struct timespec end_time; |
- |
- ADDTIMESPEC(&zero_time,total,&end_time); |
- kern_event_post(&end_time,(void *)((void *)(end_simulation)),NULL); |
- |
-} |
- |
-/* Set the zero_time and post the first activation event */ |
-void start_simulation() { |
- |
- int i; |
- struct loader_task *l = loader_task_list; |
- struct timespec end_time; |
- PI_mutexattr_t a; |
- |
- PI_mutexattr_default(a); |
- |
- i = 0; |
- |
- #ifdef __NEW_TRACER__ |
- |
- main_chunk = FTrace_chunk_create(10000000, 1000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC); |
- |
- FTrace_actual_chunk_select(main_chunk); |
- |
- FTrace_enable(); |
- |
- #endif |
- |
- TRACER_LOGEVENT(FTrace_EVT_trace_start,0,0); |
- |
- kern_gettime(&zero_time); |
- |
- while (i < total_loader_task) { |
- |
- if (l->muxstatus == 1) { |
- mutex_init(&mutex_table[l->resource],&a); |
- l->muxstatus = 2; |
- } |
- |
- if (l->act_number > 0) { |
- ADDTIMESPEC(&zero_time, &l->act[0], &end_time); |
- l->act_current++; |
- kern_event_post(&end_time,(void *)((void *)(loader_task_activate)),l); |
- } |
- |
- i++; |
- l=&loader_task_list[i]; |
- |
- } |
- |
-} |
- |
-/* Activate task and post the new activation event */ |
-void loader_task_activate(struct loader_task *l) { |
- |
- struct timespec actual_time,end_time; |
- |
- kern_gettime(&actual_time); |
- group_activate(l->group); |
- |
- if (l->act_number > l->act_current) { |
- |
- ADDTIMESPEC(&actual_time, &l->act[l->act_current], &end_time); |
- |
- l->act_current++; |
- kern_event_post(&end_time,(void *)((void *)(loader_task_activate)),l); |
- |
- } |
- |
-} |
Index: rel_1_4_rc1/loader/shark/shark.h |
=================================================================== |
--- rel_1_4_rc1/loader/shark/shark.h (revision 1476) |
+++ rel_1_4_rc1/loader/shark/shark.h (nonexistent) |
@@ -1,19 +0,0 @@ |
-#ifndef __SHARK_H__ |
-#define __SHARK_H__ |
- |
-#include "nload.h" |
-#include "lconst.h" |
- |
-#define MAX_MUTEX 20 |
- |
-int calibrate_cycle(); |
-void start_simulation(); |
-void *get_task_model(struct loader_task *current); |
-void set_simulation_time (struct timespec *total); |
-void set_next_activation(struct timespec *next); |
-void loader_task_activate(struct loader_task *l); |
-int get_server_from_contract(int contract); |
- |
-void fsfinit(); |
- |
-#endif |
Index: rel_1_4_rc1/loader/shark/shark.mak |
=================================================================== |
--- rel_1_4_rc1/loader/shark/shark.mak (revision 1476) |
+++ rel_1_4_rc1/loader/shark/shark.mak (nonexistent) |
@@ -1,13 +0,0 @@ |
-ifndef BASE |
-BASE=../../.. |
-endif |
- |
-include $(BASE)/config/config.mk |
- |
-PROGS = TEST |
- |
-include $(BASE)/config/example.mk |
- |
-TEST: |
- make -f $(SUBMAKE) APP="nload" BASE=../../.. INIT= OTHEROBJS="event.o initfile.o shark.o fsfinit.o" OTHERINCL="-I." SHARKOPT="__LINUXC26__ __PCI__ __NET__ __FIRST__" |
- cp nload TEST |
Index: rel_1_4_rc1/loader/shark/func.h |
=================================================================== |
--- rel_1_4_rc1/loader/shark/func.h (revision 1476) |
+++ rel_1_4_rc1/loader/shark/func.h (nonexistent) |
@@ -1,123 +0,0 @@ |
-#ifndef __FUNC_H__ |
-#define __FUNC_H__ |
- |
-#include "kernel/kern.h" |
-#include "shark.h" |
- |
-#define OS_SHARK |
- |
-#define get_current_exec_task() exec_shadow |
-/* Return the PID/pthread_t of calling task */ |
- |
-#define generic_get_server_from_contract get_server_from_contract |
-/* Return the server_id from the contract number used |
- * inside .fsf file to define contract parameters |
- * |
- * generic_get_server_from_contract(int contract_number) */ |
- |
-#define generic_create_thread fsf_create_thread |
-/* Create a task/thread inside a specific server. |
- * it's very similar to fsf_create_thread, but we need a parameter |
- * to set the local scheduler task and actually it's outside |
- * the framework |
- * |
- * generic_task_create( |
- * server number, |
- * pthread_t of created task (-1 if failed), |
- * pthread_attr_t, |
- * task_body, |
- * arg of the body (must be "(void *)current"), |
- * arg for real-time task specification) |
- */ |
- |
-#define generic_calibrate_cycle calibrate_cycle |
-/* Set the calibration parameter "cal_cycle" |
- * only if it's initialized to 0. The calibration routine |
- * calculates cal_cycle from CALIBRATION_DELTA. |
- * This step can also be performed outside the demo. |
- * Inside calibrate.h you can set the calibration parameters |
- * for calibration step performed outside. |
- * |
- * cal_cycle is the number of cycles that are needed to |
- * make CALIBRATION_DELTA number of iteration. |
- * |
- * kern_cli(); |
- * kern_gettime(&start); |
- * for (i=0;i<CALIBRATION_DELTA;i++) |
- * __asm__ __volatile__ ("xorl %%eax,%%eax\n\t" |
- * "cpuid\n\t" |
- * :::"eax","ebx","ecx","edx"); |
- * kern_gettime(&end); |
- * kern_sti(); |
- * |
- * SUBTIMESPEC(&end,&start,&diff); |
- * cal_cycles = TIMESPEC2USEC(&diff); |
- * |
- */ |
- |
-#define generic_set_next_activation set_next_activation |
-/* Set the next activation time. It's like fsf_schedule_next_timed_job |
- * but it don't return nothing |
- */ |
- |
-#define generic_set_simulation_time set_simulation_time |
-/* Set the end time of simulation */ |
- |
-#define generic_get_task_model get_task_model |
-/* Return a pointer to the struct that contains the |
- * local shceduler parameter */ |
- |
-#define generic_start_simulation start_simulation |
-/* Start the simulation */ |
- |
-#define generic_fsfinit() fsfinit() |
-/* Create the fsf_server */ |
- |
-#define generic_task_endcycle() task_endcycle() |
-/* The job is finished */ |
- |
-#define generic_end_simulation() sys_end() |
-/* Exit from simulation */ |
- |
-#define printf cprintf |
-/* Printf standard function */ |
- |
-/* Mutex */ |
-extern __inline__ void generic_lock_mutex(int res) { |
- extern mutex_t mutex_table[MAX_MUTEX]; |
- |
- mutex_lock(&mutex_table[res]); |
-} |
- |
-extern __inline__ void generic_unlock_mutex(int res) { |
- extern mutex_t mutex_table[MAX_MUTEX]; |
- |
- mutex_unlock(&mutex_table[res]); |
-} |
- |
-/* TASK RUNTIME FUNCTIONS */ |
- |
-extern __inline__ void start_oneshot_task(void) {} |
-extern __inline__ void end_oneshot_task(void) {} |
- |
-extern __inline__ void start_periodic_task(void) {} |
-extern __inline__ void start_job_periodic_task(void) { |
- task_testcancel(); |
-} |
-extern __inline__ void end_job_periodic_task(void) { |
- task_testcancel(); |
-} |
-extern __inline__ void end_periodic_task(void) {} |
- |
-extern __inline__ void start_back_task(void) {} |
-extern __inline__ void start_job_back_task(void) { |
- task_testcancel(); |
-} |
-extern __inline__ void end_job_back_task(void) { |
- task_testcancel(); |
-} |
-extern __inline__ void end_back_task(void) {} |
- |
-#endif |
- |
- |
Index: rel_1_4_rc1/loader/shark/makefile.in |
=================================================================== |
--- rel_1_4_rc1/loader/shark/makefile.in (revision 1476) |
+++ rel_1_4_rc1/loader/shark/makefile.in (nonexistent) |
@@ -1,14 +0,0 @@ |
-# |
-# Shark dependecies |
-# |
- |
-os_specific_dep: out/shark.done out/makefile |
- |
- |
-out/shark.done: |
- cd out; cp -sf ../shark/*.c . |
- cd out; cp -sf ../shark/*.h . |
- touch out/shark.done |
- |
-out/makefile: shark/shark.mak |
- sed -e "s/TEST/$(TEST)/" shark/shark.mak > out/makefile |
Index: rel_1_4_rc1/loader/shark/fsfinit.c |
=================================================================== |
--- rel_1_4_rc1/loader/shark/fsfinit.c (revision 1476) |
+++ rel_1_4_rc1/loader/shark/fsfinit.c (nonexistent) |
@@ -1,56 +0,0 @@ |
-#include "kernel/kern.h" |
-#include "fsf_server.h" |
-#include "fsf_contract.h" |
-#include "func.h" |
- |
-extern struct loader_contract loader_contract_list[]; |
-extern int total_loader_contract; |
- |
-void fsfinit() |
-{ |
- |
- struct loader_contract *c; |
- fsf_contract_parameters_t contract; |
- fsf_server_id_t server; |
- union sigval no_sigval = {0}; |
- int i; |
- SOFT_TASK_MODEL m; |
- |
- soft_task_default_model(m); |
- soft_task_def_period(m,50000); |
- soft_task_def_met(m,1000); |
- |
- FSF_start_service_task(&m); |
- |
- for (i=0;i<total_loader_contract;i++) { |
- |
- c = &loader_contract_list[i]; |
- |
- fsf_initialize_contract(&contract); |
- |
- fsf_set_contract_basic_parameters(&contract,&c->cmin,&c->tmax,&c->cmax,&c->tmin,c->workload); |
- |
- if (TIMESPEC2USEC(&c->deadline) != 0) |
- fsf_set_contract_timing_requirements(&contract,FALSE,&c->deadline,0,no_sigval,0,no_sigval); |
- |
- if (c->local_scheduler != PAR_POSIX) { |
- |
- switch (c->local_scheduler) { |
- case PAR_EDF: |
- fsf_set_local_scheduler_parameter(&contract,FSF_SCHEDULER_EDF); |
- break; |
- case PAR_RM: |
- fsf_set_local_scheduler_parameter(&contract,FSF_SCHEDULER_RM); |
- break; |
- } |
- |
- } |
- |
- fsf_negotiate_contract(&contract,&server); |
- c->server = server; |
- |
- } |
- |
- print_server_list(); |
- |
-} |
Index: rel_1_4_rc1/loader/shark/initfile.c |
=================================================================== |
--- rel_1_4_rc1/loader/shark/initfile.c (revision 1476) |
+++ rel_1_4_rc1/loader/shark/initfile.c (nonexistent) |
@@ -1,177 +0,0 @@ |
-/* |
- * 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://hartik.sssup.it |
- */ |
- |
-/* |
- * 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 "modules/posix.h" |
-#include "grubstar.h" |
-#include "fsf_contract.h" |
- |
-#include "modules/pi.h" |
-#include "modules/pc.h" |
- |
-#include "pthread.h" |
- |
-#include "modules/sem.h" |
-#include "modules/hartport.h" |
-#include "modules/nop.h" |
- |
-#include <drivers/shark_linuxc26.h> |
-#include <drivers/shark_pci26.h> |
- |
-/*+ sysyem tick in us +*/ |
-#define TICK 0 |
- |
-/*+ RR tick in us +*/ |
-#define RRTICK 10000 |
- |
-/*+ Interrupt Server +*/ |
-#define INTDRIVE_Q 1000 |
-#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) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- int grubstar_level; |
- |
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_T, INTDRIVE_FLAG); |
- EDF_register_level(EDF_ENABLE_ALL); |
- POSIX_register_level(RRTICK, 1, mb, 32); |
- grubstar_level = GRUBSTAR_register_level(FSF_MAX_N_SERVERS, 1); |
- |
- FSF_register_module(grubstar_level, (int)(MAX_BANDWIDTH * 0.8)); |
- dummy_register_level(); |
- |
- CBS_register_level(CBS_ENABLE_ALL,1); |
- |
- SEM_register_module(); |
- |
- PI_register_module(); |
- PC_register_module(); |
- NOP_register_module(); |
- |
- PTHREAD_register_module(2, 0, 1); |
- |
- return TICK; |
-} |
- |
-int device_drivers_close() { |
- |
- return 0; |
- |
-} |
- |
-int device_drivers_init() { |
- |
- LINUXC26_register_module(); |
- PCI26_init(); |
- |
- return 0; |
-} |
- |
-TASK shutdown_task_body(void *arg) { |
- |
- device_drivers_close(); |
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
- sys_abort_shutdown(0); |
- |
- return NULL; |
-} |
- |
-#define SHUTDOWN_TIMEOUT_SEC 3 |
- |
-void set_shutdown_task() { |
- |
- NRT_TASK_MODEL nrt; |
- |
- nrt_task_default_model(nrt); |
- nrt_task_def_system(nrt); |
- |
- shutdown_task_PID = task_create("Shutdown Task", shutdown_task_body, &nrt, NULL); |
- if (shutdown_task_PID == NIL) { |
- sys_shutdown_message("Error: Cannot create shutdown task\n"); |
- sys_end(); |
- } |
- |
-} |
- |
-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); |
-} |
- |
-TASK __init__(void *arg) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- HARTPORT_init(); |
- |
- set_shutdown_task(); |
- |
- device_drivers_init(); |
- |
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN); |
- |
- __call_main__(mb); |
- |
- return (void *)0; |
-} |
- |
-int main() { |
- |
- return start_environment(); |
- |
-} |
- |
Index: rel_1_4_rc1/loader/generators/lparser.c |
=================================================================== |
--- rel_1_4_rc1/loader/generators/lparser.c (revision 1476) |
+++ rel_1_4_rc1/loader/generators/lparser.c (nonexistent) |
@@ -1,479 +0,0 @@ |
-#include <stdlib.h> |
-#include <string.h> |
-#include <stdio.h> |
-#include "lparser.h" |
-#include "common/time.h" |
- |
-#define PARSER_DEBUG |
- |
-static int find_break(char **buf, int find_type, struct timespec *time, int *val) |
-{ |
- |
- int i; |
- char str[20]; |
- |
- i = 0; |
- while (((char *)(*buf))[i] == ' ' || ((char *)(*buf))[i] == ':' || |
- ((char *)(*buf))[i] == '\n' || ((char *)(*buf))[i] == '\r') i++; |
- *buf += i; |
- |
- if (!strncmp(*buf,"END",3) && find_type == PAR_NOTHING) { |
- *buf += 3; |
- return PAR_END; |
- } |
- |
- if (!strncmp(*buf,"CONTRACT SECTION",16) && find_type == PAR_NOTHING) { |
- *buf += 16; |
- return PAR_CONTRACT_SECTION; |
- } |
- |
- if (!strncmp(*buf,"TASK SECTION",12) && find_type == PAR_NOTHING) { |
- *buf += 12; |
- return PAR_TASK_SECTION; |
- } |
- |
- i = 0; |
- if (((char *)(*buf))[0] == '#' && find_type == PAR_NOTHING) { |
- while (((char *)(*buf))[i] != '\n' && ((char *)(*buf))[i] != '\r') i++; |
- *buf += i; |
- return PAR_FOUND; |
- } |
- |
- switch (find_type) { |
- |
- case PAR_NOTHING: |
- if (((char *)(*buf))[0] == ';' || |
- ((char *)(*buf))[0] < 32) { |
- *buf += 1; |
- return PAR_FOUND; |
- } |
- break; |
- |
- case PAR_TOTAL_EXEC_TIME: |
- if (!strncmp(*buf, "TOTAL_EXEC_TIME:",16)) { |
- *buf += 16; |
- return PAR_FOUND; |
- } |
- break; |
- |
- case PAR_TIME: |
- if (((char *)(*buf))[0] != '[') return PAR_ERROR; |
- *buf += 1; |
- i = 0; |
- while (((char *)(*buf))[i] >= '0' && ((char *)(*buf))[i] <= '9') { |
- str[i] = ((char *)(*buf))[i]; |
- i++; |
- } |
- if (((char *)(*buf))[i] != ']') return PAR_ERROR; |
- str[i] = 0; |
- time->tv_sec = atoi(str); |
- i += 2; |
- *buf += i; |
- i = 0; |
- while (((char *)(*buf))[i] >= '0' && ((char *)(*buf))[i] <= '9') { |
- str[i] = ((char *)(*buf))[i]; |
- i++; |
- } |
- if (((char *)(*buf))[i] != ']') return PAR_ERROR; |
- str[i] = 0; |
- time->tv_nsec = atoi(str) * 1000; |
- i += 2; |
- *buf += i; |
- return PAR_FOUND; |
- break; |
- |
- case PAR_TASK_TYPE: |
- if (!strncmp(*buf, "OS:",3)) { |
- *val = PAR_TASK_OS; |
- *buf += 3; |
- return PAR_FOUND; |
- } |
- if (!strncmp(*buf, "CT:",3)) { |
- *val = PAR_TASK_CT; |
- *buf += 3; |
- return PAR_FOUND; |
- } |
- if (!strncmp(*buf, "BT:",3)) { |
- *val = PAR_TASK_BT; |
- *buf += 3; |
- return PAR_FOUND; |
- } |
- break; |
- |
- case PAR_TASK_NUMBER: |
- if (((char *)(*buf))[0] != '[') return PAR_ERROR; |
- *buf += 1; |
- i = 0; |
- while (((char *)(*buf))[i] >= '0' && ((char *)(*buf))[i] <= '9') { |
- str[i] = ((char *)(*buf))[i]; |
- i++; |
- } |
- if (((char *)(*buf))[i] != ']') return PAR_ERROR; |
- str[i] = 0; |
- *val = atoi(str); |
- i += 2; |
- *buf += i; |
- return PAR_FOUND; |
- break; |
- |
- case PAR_ACT_TYPE: |
- if (!strncmp(*buf,"ACT_SINGLE(",11)) { |
- *buf += 11; |
- *val = PAR_ACT_SINGLE; |
- return PAR_FOUND; |
- } |
- if (!strncmp(*buf,"ACT_PERIODIC(",13)) { |
- *buf += 13; |
- *val = PAR_ACT_PERIODIC; |
- return PAR_FOUND; |
- } |
- if (!strncmp(*buf,"ACT_MEAN(",9)) { |
- *buf += 9; |
- *val = PAR_ACT_MEAN; |
- return PAR_FOUND; |
- } |
- return PAR_ERROR; |
- break; |
- |
- case PAR_LOCAL_SCHEDULER: |
- if (!strncmp(*buf,"POSIX",5)) { |
- *buf += 5; |
- *val = PAR_POSIX; |
- return PAR_FOUND; |
- } |
- if (!strncmp(*buf,"EDF",3)) { |
- *buf += 3; |
- *val = PAR_EDF; |
- return PAR_FOUND; |
- } |
- if (!strncmp(*buf,"RM",2)) { |
- *buf += 2; |
- *val = PAR_RM; |
- return PAR_FOUND; |
- } |
- return PAR_ERROR; |
- break; |
- |
- case PAR_EXEC_TYPE: |
- if (!strncmp(*buf,"EXEC_CONST(",11)) { |
- *buf += 11; |
- *val = PAR_EXEC_CONST; |
- return PAR_FOUND; |
- } |
- if (!strncmp(*buf,"EXEC_MEAN(",10)) { |
- *buf += 10; |
- *val = PAR_EXEC_MEAN; |
- return PAR_FOUND; |
- } |
- return PAR_ERROR; |
- break; |
- |
- case PAR_CRIT_SESSION: |
- if (!strncmp(*buf,"NO_CRIT",7)) { |
- *buf += 7; |
- *val = PAR_NO_CRIT; |
- return PAR_FOUND; |
- } |
- if (!strncmp(*buf,"CRIT(",5)) { |
- *buf += 5; |
- *val = PAR_CRIT; |
- return PAR_FOUND; |
- } |
- return PAR_ERROR; |
- break; |
- |
- } |
- |
- return PAR_ERROR; |
- |
-} |
- |
-void par_error(int line_num) |
-{ |
- |
- printf("\nParser error: line [%d]\n",line_num); |
- exit(1); |
- |
-} |
- |
-/* result: |
- * 0 -> nothing |
- * 1 -> total |
- * 2 -> new task-loader |
- * 3 -> end file |
- */ |
-int line_parser_task(char **pbuf, int line_num, struct loader_task **last) |
-{ |
- struct timespec time; |
- struct loader_task *ld = NULL; |
- int val, res; |
- |
- res = find_break(pbuf, PAR_NOTHING, &time, &val); |
- if (res == PAR_FOUND) return 0; |
- if (res == PAR_END) return 3; |
- |
- res = find_break(pbuf,PAR_TASK_TYPE, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf("TASK TYPE = %d\n",val); |
- #endif |
- |
- ld = malloc(sizeof(struct loader_task)); |
- if (ld == NULL) par_error(line_num); |
- |
- ld->next = NULL; |
- *last = ld; |
- |
- ld->task_type = val; |
- |
- } else par_error(line_num); |
- |
- res = find_break(pbuf,PAR_TASK_NUMBER, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf("TASK SERVER = %d\n",val); |
- #endif |
- |
- ld->server = val; |
- } else par_error(line_num); |
- |
- res = find_break(pbuf,PAR_LOCAL_SCHEDULER, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf("TASK LOCAL SCHEDULER = %d\n",val); |
- #endif |
- |
- ld->local_scheduler = val; |
- } else par_error(line_num); |
- |
- res = find_break(pbuf,PAR_TASK_NUMBER, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf("TASK NUMBER = %d\n",val); |
- #endif |
- |
- ld->number = val; |
- |
- } else par_error(line_num); |
- |
- res = find_break(pbuf,PAR_TIME, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf("DEADLINE: [%ld][%ld]\n",time.tv_sec,time.tv_nsec/1000); |
- #endif |
- TIMESPEC_ASSIGN(&ld->deadline,&time); |
- } else par_error(line_num); |
- |
- res = find_break(pbuf,PAR_TIME, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf("WCET: [%ld][%ld]\n",time.tv_sec,time.tv_nsec/1000); |
- #endif |
- TIMESPEC_ASSIGN(&ld->wcet,&time); |
- } else par_error(line_num); |
- |
- res = find_break(pbuf,PAR_ACT_TYPE, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf("ACTIVATION TYPE: %d (",val); |
- #endif |
- |
- ld->act_type = val; |
- |
- res = find_break(pbuf,PAR_TIME, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf("[%ld][%ld]",time.tv_sec,time.tv_nsec/1000); |
- #endif |
- TIMESPEC_ASSIGN(&ld->act_par_1,&time); |
- } else par_error(line_num); |
- |
- if (ld->act_type != PAR_ACT_SINGLE) { |
- res = find_break(pbuf,PAR_TIME, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000); |
- #endif |
- TIMESPEC_ASSIGN(&ld->act_par_2,&time); |
- } else par_error(line_num); |
- } |
- |
- if (ld->act_type != PAR_ACT_SINGLE && ld->act_type != PAR_ACT_PERIODIC) { |
- res = find_break(pbuf,PAR_TIME, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000); |
- #endif |
- TIMESPEC_ASSIGN(&ld->act_par_3,&time); |
- } else par_error(line_num); |
- } |
- |
- #ifdef PARSER_DEBUG |
- printf(")\n"); |
- #endif |
- |
- } else par_error(line_num); |
- |
- res = find_break(pbuf,PAR_EXEC_TYPE, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf("EXEC TYPE: %d (",val); |
- #endif |
- ld->exec_type = val; |
- res = find_break(pbuf,PAR_TIME, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf("[%ld][%ld]",time.tv_sec,time.tv_nsec/1000); |
- #endif |
- TIMESPEC_ASSIGN(&ld->exec_par_1,&time); |
- } else par_error(line_num); |
- |
- if (ld->exec_type != PAR_EXEC_CONST) { |
- res = find_break(pbuf,PAR_TIME, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000); |
- #endif |
- TIMESPEC_ASSIGN(&ld->exec_par_2,&time); |
- } else par_error(line_num); |
- } |
- |
- #ifdef PARSER_DEBUG |
- printf(")\n"); |
- #endif |
- |
- } else par_error(line_num); |
- |
- res = find_break(pbuf,PAR_CRIT_SESSION, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf("CRITITCAL SESSION: %d (",val); |
- #endif |
- ld->crit_type = val; |
- if (ld->crit_type == PAR_CRIT) { |
- res = find_break(pbuf,PAR_TASK_NUMBER, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf("[%d]",val); |
- #endif |
- ld->resource = val; |
- } else par_error(line_num); |
- res = find_break(pbuf,PAR_TIME, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000); |
- #endif |
- TIMESPEC_ASSIGN(&ld->crit_par,&time); |
- } else par_error(line_num); |
- } |
- |
- #ifdef PARSER_DEBUG |
- printf(")\n"); |
- #endif |
- |
- } else par_error(line_num); |
- |
- return 2; |
- |
-} |
- |
-int line_parser_contract(char **pbuf, int line_num, struct timespec *total, struct loader_contract **last) |
-{ |
- |
- struct timespec time; |
- struct loader_contract *lc = NULL; |
- int val, res; |
- |
- res = find_break(pbuf, PAR_NOTHING, &time, &val); |
- if (res == PAR_FOUND) return 0; |
- if (res == PAR_END) return 3; |
- |
- res = find_break(pbuf,PAR_TOTAL_EXEC_TIME, &time, &val); |
- if (res == PAR_FOUND) { |
- NULL_TIMESPEC(total); |
- res = find_break(pbuf, PAR_TIME, &time, &val); |
- if (res == PAR_FOUND) { |
- TIMESPEC_ASSIGN(total,&time); |
- #ifdef PARSER_DEBUG |
- printf("TOTAL EXEC TIME SEC = %ld NSEC = %ld\n",total->tv_sec,total->tv_nsec); |
- #endif |
- return 1; |
- } else par_error(line_num); |
- } |
- |
- res = find_break(pbuf,PAR_TASK_NUMBER, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf("CONTRACT [%d]",val); |
- #endif |
- |
- lc = malloc(sizeof(struct loader_contract)); |
- if (lc == NULL) par_error(line_num); |
- |
- lc->next = NULL; |
- *last = lc; |
- |
- lc->number = val; |
- } else par_error(line_num); |
- |
- res = find_break(pbuf,PAR_TIME, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000); |
- #endif |
- TIMESPEC_ASSIGN(&lc->cmin,&time); |
- } else par_error(line_num); |
- |
- res = find_break(pbuf,PAR_TIME, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000); |
- #endif |
- TIMESPEC_ASSIGN(&lc->tmax,&time); |
- } else par_error(line_num); |
- |
- res = find_break(pbuf,PAR_TIME, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000); |
- #endif |
- TIMESPEC_ASSIGN(&lc->cmax,&time); |
- } else par_error(line_num); |
- |
- res = find_break(pbuf,PAR_TIME, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf(",[%ld][%ld],",time.tv_sec,time.tv_nsec/1000); |
- #endif |
- TIMESPEC_ASSIGN(&lc->tmin,&time); |
- } else par_error(line_num); |
- |
- res = find_break(pbuf,PAR_TASK_NUMBER, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf(",[%d]\n",val); |
- #endif |
- |
- lc->workload = val; |
- } else par_error(line_num); |
- |
- res = find_break(pbuf,PAR_TIME, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf(",[%ld][%ld],",time.tv_sec,time.tv_nsec/1000); |
- #endif |
- TIMESPEC_ASSIGN(&lc->deadline,&time); |
- } else par_error(line_num); |
- |
- res = find_break(pbuf,PAR_LOCAL_SCHEDULER, &time, &val); |
- if (res == PAR_FOUND) { |
- #ifdef PARSER_DEBUG |
- printf("LOCAL SCHEDULER = %d\n",val); |
- #endif |
- |
- lc->local_scheduler = val; |
- } else par_error(line_num); |
- |
- return 2; |
- |
-} |
Index: rel_1_4_rc1/loader/generators/event_gen.c |
=================================================================== |
--- rel_1_4_rc1/loader/generators/event_gen.c (revision 1476) |
+++ rel_1_4_rc1/loader/generators/event_gen.c (nonexistent) |
@@ -1,474 +0,0 @@ |
-/* Event Generator |
- * |
- * Giacomo Guidi |
- */ |
- |
-#include <stdio.h> |
-#include <stdlib.h> |
- |
-#include "lparser.h" |
-#include "lread.h" |
-#include "time.h" |
-#include "common/time.h" |
- |
-#define LOADFILE_DIR "../loadfile/" |
- |
-#define EVENT_DEFINE "event.c" |
-#define ACT_LIST "event.c" |
- |
-int write_struct(void) |
-{ |
- |
- FILE *file_event_header; |
- |
- file_event_header = fopen(EVENT_DEFINE,"w"); |
- if (file_event_header == NULL) return 1; |
- |
- fprintf(file_event_header, "\n#include \"func.h\"\n"); |
- |
- fclose(file_event_header); |
- |
- return 0; |
- |
-} |
- |
-int write_basic_par_start(void) |
-{ |
- |
- FILE *file_event_header; |
- |
- file_event_header = fopen(EVENT_DEFINE,"a+"); |
- if (file_event_header == NULL) return 1; |
- |
- fprintf(file_event_header, "struct loader_task loader_task_list[] = {\n"); |
- |
- fclose(file_event_header); |
- |
- return 0; |
- |
-} |
- |
-int write_contract_start(void) |
-{ |
- |
- FILE *file_event_header; |
- |
- file_event_header = fopen(EVENT_DEFINE,"a+"); |
- if (file_event_header == NULL) return 1; |
- |
- fprintf(file_event_header, "struct loader_contract loader_contract_list[] = {\n"); |
- |
- fclose(file_event_header); |
- |
- return 0; |
- |
-} |
- |
-int write_basic_par(struct loader_task *c) |
-{ |
- |
- FILE *file_event_header; |
- int muxpres; |
- char muxtemp[30]; |
- |
- file_event_header = fopen(EVENT_DEFINE,"a+"); |
- if (file_event_header == NULL) return 1; |
- |
- if (c->crit_type == PAR_CRIT) { |
- muxpres = 1; |
- sprintf(muxtemp,"block_%s",c->name); |
- } else { |
- muxpres = 0; |
- sprintf(muxtemp,"NULL"); |
- } |
- |
- fprintf(file_event_header, " {\"%s\",%d,%d,%d,%d,%d,{%d,%d},{%d,%d},%d,0,%d,%d,act_%s,exec_%s,%s},\n", |
- c->name,(int)c->task_type,(int)c->server,(int)c->local_scheduler,(int)c->number,(int)c->group, |
- (int)c->deadline.tv_sec, (int)c->deadline.tv_nsec, |
- (int)c->wcet.tv_sec, (int)c->wcet.tv_nsec, |
- (int)c->act_number, (int)c->resource, muxpres, c->name, c->name, muxtemp); |
- |
- fclose(file_event_header); |
- |
- return 0; |
- |
-} |
- |
-int write_contract(struct loader_contract *c) |
-{ |
- |
- FILE *file_event_header; |
- |
- file_event_header = fopen(EVENT_DEFINE,"a+"); |
- if (file_event_header == NULL) return 1; |
- |
- fprintf(file_event_header, " {%d,{%d,%d},{%d,%d},{%d,%d},{%d,%d},%d,{%d,%d},%d,-1},\n", |
- (int)c->number,(int)c->cmin.tv_sec,(int)c->cmin.tv_nsec, |
- (int)c->tmax.tv_sec,(int)c->tmax.tv_nsec, |
- (int)c->cmax.tv_sec,(int)c->cmax.tv_nsec, |
- (int)c->tmin.tv_sec,(int)c->tmin.tv_nsec, |
- (int)c->workload, |
- (int)c->deadline.tv_sec,(int)c->deadline.tv_nsec, |
- (int)c->local_scheduler); |
- |
- fclose(file_event_header); |
- |
- return 0; |
- |
-} |
- |
-int close_loader_task(int total_task_number) |
-{ |
- |
- FILE *file_event_header; |
- |
- file_event_header = fopen(EVENT_DEFINE,"a+"); |
- if (file_event_header == NULL) return 1; |
- |
- fprintf(file_event_header,"};\n\n"); |
- |
- fprintf(file_event_header,"int total_loader_task = %d;\n\n",total_task_number); |
- |
- fclose(file_event_header); |
- |
- return 0; |
- |
-} |
- |
-int close_loader_contract(int total_contract_number) |
-{ |
- |
- FILE *file_event_header; |
- |
- file_event_header = fopen(EVENT_DEFINE,"a+"); |
- if (file_event_header == NULL) return 1; |
- |
- fprintf(file_event_header,"};\n\n"); |
- |
- fprintf(file_event_header,"int total_loader_contract = %d;\n\n",total_contract_number); |
- |
- fclose(file_event_header); |
- |
- return 0; |
- |
-} |
- |
-int write_simulation_time(struct timespec *total) |
-{ |
- |
- FILE *file_event_header; |
- |
- file_event_header = fopen(EVENT_DEFINE,"a+"); |
- if (file_event_header == NULL) return 1; |
- |
- fprintf(file_event_header,"struct timespec total_time = {%d,%d};\n\n",(int)total->tv_sec,(int)total->tv_nsec); |
- |
- fclose(file_event_header); |
- |
- return 0; |
- |
- |
-} |
- |
-int write_single_act(struct timespec *t, struct loader_task *c) |
-{ |
- |
- FILE *file_act_header; |
- |
- file_act_header = fopen(ACT_LIST,"a+"); |
- if (file_act_header == NULL) return 1; |
- |
- if (TIMESPEC_A_GT_B(t,&c->act_par_1)) { |
- fprintf(file_act_header,"struct timespec act_%s[] = {{%d,%d}};\n\n",c->name, |
- (int)c->act_par_1.tv_sec,(int)c->act_par_1.tv_nsec); |
- c->act_number = 1; |
- } else { |
- fprintf(file_act_header,"struct timespec act_%s[] = {{0,0}};\n\n",c->name); |
- c->act_number = 0; |
- } |
- |
- fclose(file_act_header); |
- |
- return 0; |
- |
-} |
- |
-int write_periodic_act(struct timespec *t, struct loader_task *c) |
-{ |
- |
- FILE *file_act_header; |
- struct timespec tot_time; |
- int period; |
- |
- file_act_header = fopen(ACT_LIST,"a+"); |
- if (file_act_header == NULL) return 1; |
- |
- fprintf(file_act_header,"struct timespec act_%s[] = {{%d,%d},\n",c->name, |
- (int)c->act_par_1.tv_sec,(int)c->act_par_1.tv_nsec); |
- |
- c->act_number = 1; |
- TIMESPEC_ASSIGN(&tot_time,&c->act_par_1); |
- period = TIMESPEC2USEC(&c->act_par_2); |
- while (TIMESPEC_A_GT_B(t, &tot_time)) { |
- c->act_number++; |
- ADDUSEC2TIMESPEC(period,&tot_time); |
- fprintf(file_act_header," {%d,%d},\n", |
- (int)c->act_par_2.tv_sec,(int)c->act_par_2.tv_nsec); |
- } |
- |
- fprintf(file_act_header," };\n\n"); |
- |
- fclose(file_act_header); |
- |
- return 0; |
- |
-} |
- |
-int write_mean_act(struct timespec *t,struct loader_task *c) |
-{ |
- |
- FILE *file_act_header; |
- struct timespec tot_time; |
- int next_act; |
- |
- file_act_header = fopen(ACT_LIST,"a+"); |
- if (file_act_header == NULL) return 1; |
- |
- fprintf(file_act_header,"struct timespec act_%s[] = {{%d,%d},\n",c->name, |
- (int)c->act_par_1.tv_sec,(int)c->act_par_1.tv_nsec); |
- |
- c->act_number = 1; |
- TIMESPEC_ASSIGN(&tot_time,&c->act_par_1); |
- while (TIMESPEC_A_GT_B(t, &tot_time)) { |
- c->act_number++; |
- next_act = TIMESPEC2USEC(&c->act_par_2) + random() % TIMESPEC2USEC(&c->act_par_3) - TIMESPEC2USEC(&c->act_par_3) / 2; |
- ADDUSEC2TIMESPEC(next_act,&tot_time); |
- fprintf(file_act_header," {%d,%d},\n", |
- next_act / 1000000, next_act % 1000000 * 1000); |
- } |
- |
- fprintf(file_act_header," };\n\n"); |
- |
- fclose(file_act_header); |
- |
- return 0; |
- |
-} |
- |
-int write_block_const(struct loader_task *c) |
-{ |
- |
- FILE *file_block_header; |
- int i; |
- |
- file_block_header = fopen(ACT_LIST,"a+"); |
- if (file_block_header == NULL) return 1; |
- |
- fprintf(file_block_header,"struct timespec block_%s[] = {{%d,%d},\n",c->name, |
- (int)c->crit_par.tv_sec,(int)c->crit_par.tv_nsec); |
- |
- for (i=0; i< c->act_number-1; i++) |
- fprintf(file_block_header," {%d,%d},\n", |
- (int)c->crit_par.tv_sec,(int)c->crit_par.tv_nsec); |
- |
- fprintf(file_block_header," };\n\n"); |
- |
- fclose(file_block_header); |
- |
- return 0; |
- |
-} |
- |
-int write_exec_const(struct loader_task *c) |
-{ |
- |
- FILE *file_exec_header; |
- int i; |
- |
- file_exec_header = fopen(ACT_LIST,"a+"); |
- if (file_exec_header == NULL) return 1; |
- |
- fprintf(file_exec_header,"struct timespec exec_%s[] = {{%d,%d},\n",c->name, |
- (int)c->exec_par_1.tv_sec,(int)c->exec_par_1.tv_nsec); |
- |
- for (i=0; i< c->act_number-1; i++) |
- fprintf(file_exec_header," {%d,%d},\n", |
- (int)c->exec_par_1.tv_sec,(int)c->exec_par_1.tv_nsec); |
- |
- fprintf(file_exec_header," };\n\n"); |
- |
- fclose(file_exec_header); |
- |
- return 0; |
- |
-} |
- |
-int write_exec_mean(struct loader_task *c) |
-{ |
- |
- FILE *file_exec_header; |
- int exec_time_usec; |
- int i; |
- |
- file_exec_header = fopen(ACT_LIST,"a+"); |
- if (file_exec_header == NULL) return 1; |
- |
- exec_time_usec = TIMESPEC2USEC(&c->exec_par_1) |
- + random() % TIMESPEC2USEC(&c->exec_par_2) - TIMESPEC2USEC(&c->exec_par_2) / 2; |
- fprintf(file_exec_header,"struct timespec exec_%s[] = {{%d,%d},\n",c->name, |
- exec_time_usec / 1000000, exec_time_usec % 1000000 * 1000); |
- |
- for (i=0; i< c->act_number-1; i++) { |
- exec_time_usec = TIMESPEC2USEC(&c->exec_par_1) |
- + random() % TIMESPEC2USEC(&c->exec_par_2) - TIMESPEC2USEC(&c->exec_par_2) / 2; |
- fprintf(file_exec_header," {%d,%d},\n", |
- exec_time_usec / 1000000, exec_time_usec % 1000000 * 1000); |
- } |
- |
- fprintf(file_exec_header," };\n\n"); |
- |
- fclose(file_exec_header); |
- |
- return 0; |
- |
-} |
- |
-void *start; |
-void *end; |
- |
-int main(int argc, char **argv) { |
- |
- char loadfile[100]; |
- struct timespec total_time; |
- struct loader_task *start_loader_task = NULL, *current_t; |
- struct loader_contract *start_loader_contract = NULL, *current_c; |
- int err,ldnum; |
- int total_task_number; |
- int total_contract_number; |
- |
- printf("\nEvent Generator\n"); |
- |
- if (argc < 2) { |
- printf("Error: event_gen loadfile.fsf\n"); |
- exit(1); |
- } |
- |
- printf("Read loader file %s\n",argv[1]); |
- |
- sprintf(loadfile,"%s%s",LOADFILE_DIR,argv[1]); |
- err = dos_preload(loadfile,100000,&start,&end); |
- |
- if (err != 0) { |
- printf("Error: File not found\n"); |
- exit(1); |
- } |
- |
- printf("Parsing file\n"); |
- |
- line_reader(start, end, &total_time, &start_loader_task, &start_loader_contract); |
- |
- srandom(time(NULL)); |
- |
- write_struct(); |
- |
- current_t = start_loader_task; |
- ldnum = 1; |
- |
- while(current_t != NULL) { |
- |
- sprintf(current_t->name,"ltask%d",ldnum); |
- current_t->group = ldnum; |
- ldnum++; |
- |
- switch (current_t->act_type) { |
- case PAR_ACT_SINGLE: |
- err = write_single_act(&total_time,current_t); |
- if (err != 0) { |
- printf("Error writing activation header\n"); |
- exit(1); |
- } |
- break; |
- case PAR_ACT_PERIODIC: |
- err = write_periodic_act(&total_time,current_t); |
- if (err != 0) { |
- printf("Error writing activation header\n"); |
- exit(1); |
- } |
- break; |
- case PAR_ACT_MEAN: |
- err = write_mean_act(&total_time,current_t); |
- if (err != 0) { |
- printf("Error writing activation header\n"); |
- exit(1); |
- } |
- break; |
- } |
- |
- switch (current_t->exec_type) { |
- case PAR_EXEC_CONST: |
- err = write_exec_const(current_t); |
- if (err != 0) { |
- printf("Error writing exec header\n"); |
- exit(1); |
- } |
- break; |
- case PAR_EXEC_MEAN: |
- err = write_exec_mean(current_t); |
- if (err != 0) { |
- printf("Error writing exec header\n"); |
- exit(1); |
- } |
- break; |
- } |
- |
- switch (current_t->crit_type) { |
- case PAR_CRIT: |
- err = write_block_const(current_t); |
- if (err != 0) { |
- printf("Error writing block header\n"); |
- exit(1); |
- } |
- break; |
- } |
- |
- current_t = current_t->next; |
- |
- } |
- |
- write_basic_par_start(); |
- |
- total_task_number = 0; |
- current_t = start_loader_task; |
- while(current_t != NULL) { |
- |
- write_basic_par(current_t); |
- |
- current_t = current_t->next; |
- |
- total_task_number++; |
- |
- } |
- |
- close_loader_task(total_task_number); |
- |
- write_contract_start(); |
- |
- total_contract_number = 0; |
- current_c = start_loader_contract; |
- while(current_c != NULL) { |
- |
- write_contract(current_c); |
- |
- current_c = current_c->next; |
- |
- total_contract_number++; |
- |
- } |
- |
- close_loader_contract(total_contract_number); |
- |
- write_simulation_time(&total_time); |
- |
- return 0; |
- |
-} |
Index: rel_1_4_rc1/loader/generators/lread.h |
=================================================================== |
--- rel_1_4_rc1/loader/generators/lread.h (revision 1476) |
+++ rel_1_4_rc1/loader/generators/lread.h (nonexistent) |
@@ -1,11 +0,0 @@ |
-#ifndef __LREAD_H__ |
-#define __LREAD_H__ |
- |
-#include "lparser.h" |
- |
-int dos_preload(char *file_name, long max_size, void **start, void **end); |
- |
-int line_reader(void *start, void *end, struct timespec *total, |
- struct loader_task **start_loader_task, struct loader_contract **start_loader_contract); |
- |
-#endif |
Index: rel_1_4_rc1/loader/generators/makefile |
=================================================================== |
--- rel_1_4_rc1/loader/generators/makefile (revision 1476) |
+++ rel_1_4_rc1/loader/generators/makefile (nonexistent) |
@@ -1,9 +0,0 @@ |
-event_gen: |
- gcc -o lparser.o -c -Wall lparser.c -I. -I.. |
- gcc -o lread.o -c -Wall lread.c -I. -I.. |
- gcc -o event_gen -Wall lparser.o lread.o -I. -I.. -lc event_gen.c |
- |
-clean: |
- rm -f *.o |
- rm -f event_gen |
- |
Index: rel_1_4_rc1/loader/generators/lparser.h |
=================================================================== |
--- rel_1_4_rc1/loader/generators/lparser.h (revision 1476) |
+++ rel_1_4_rc1/loader/generators/lparser.h (nonexistent) |
@@ -1,58 +0,0 @@ |
-#ifndef __LPARSER_H__ |
-#define __LPARSER_H__ |
- |
-#include "common/lconst.h" |
- |
-struct loader_task { |
- |
- char name[20]; |
- int number; |
- int group; |
- int server; |
- int local_scheduler; |
- int task_type; |
- |
- int act_type; |
- struct timespec act_par_1; |
- struct timespec act_par_2; |
- struct timespec act_par_3; |
- int exec_type; |
- struct timespec exec_par_1; |
- struct timespec exec_par_2; |
- |
- struct timespec deadline; |
- struct timespec wcet; |
- |
- int act_number; |
- struct timespec *act; |
- struct timespec *exec; |
- |
- int crit_type; |
- int resource; |
- struct timespec crit_par; |
- |
- struct loader_task *next; |
- |
-}; |
- |
-struct loader_contract { |
- |
- int number; |
- struct timespec cmin; |
- struct timespec tmax; |
- struct timespec cmax; |
- struct timespec tmin; |
- int workload; |
- struct timespec deadline; |
- int local_scheduler; |
- |
- struct loader_contract *next; |
- |
-}; |
- |
-int line_parser_contract(char **buf, int line_num, struct timespec *total_time, struct loader_contract **last); |
- |
-int line_parser_task(char **buf, int line_num, struct loader_task **last); |
- |
-#endif |
- |
Index: rel_1_4_rc1/loader/generators/java/java_gen |
=================================================================== |
--- rel_1_4_rc1/loader/generators/java/java_gen (revision 1476) |
+++ rel_1_4_rc1/loader/generators/java/java_gen (nonexistent) |
@@ -1,10 +0,0 @@ |
-#!/bin/bash |
- |
-#if $CLASSPATH; then |
-#echo Please define the CLASSPATH environment variable!!! |
-#echo ...something like: export CLASSPATH=/usr/java/j2sdk1.4.2/jre/lib |
-#exit 1; |
-#fi |
- |
-java -classpath ".:$CLASSPATH/jdom.jar:$CLASSPATH/xercesImpl.jar:$CLASSPATH/xml-apis.jar" Application $1 |
- |
/rel_1_4_rc1/loader/generators/java/java_gen |
Property changes: |
Deleted: svn:executable |
## -1 +0,0 ## |
-* |
\ No newline at end of property |
Index: rel_1_4_rc1/loader/generators/java/makefile |
=================================================================== |
--- rel_1_4_rc1/loader/generators/java/makefile (revision 1476) |
+++ rel_1_4_rc1/loader/generators/java/makefile (nonexistent) |
@@ -1,17 +0,0 @@ |
-ifdef CLASSPATH |
-all: |
- javac Application.java timespec.java task_class.java -classpath "$(CLASSPATH)/jdom.jar" |
-else |
-all: |
- @echo ---------------------------------------------------------------- |
- @echo Please define the CLASSPATH environment variable!!! |
- @echo ...something like: export CLASSPATH=/usr/java/j2sdk1.4.2/jre/lib |
- @echo ---------------------------------------------------------------- |
- @exit 1 |
-endif |
- |
- |
-clean: |
- rm -f *.class |
- rm -f event.c |
- |
Index: rel_1_4_rc1/loader/generators/java/Application.java |
=================================================================== |
--- rel_1_4_rc1/loader/generators/java/Application.java (revision 1476) |
+++ rel_1_4_rc1/loader/generators/java/Application.java (nonexistent) |
@@ -1,856 +0,0 @@ |
-//package first_filter; |
- |
-import java.io.*; |
-import java.net.*; |
-import java.util.List; |
-import java.util.ArrayList; |
-import java.util.Iterator; |
-import org.jdom.*; |
-import org.jdom.input.SAXBuilder; |
-import org.jdom.output.XMLOutputter; |
-import java.util.regex.*; |
-import java.util.Random; |
- |
-/** |
- * <p>Title: First XML filter</p> |
- * <p>Description: </p> |
- * <p>Copyright: Copyright (c) 2003</p> |
- * <p>Company: Retis Lab</p> |
- * @author not attributable |
- * @version 1.0 |
- */ |
- |
-public class Application { |
- private int numElements = 0; |
- final String LOADFILE_DIR="../loadfile/"; |
- final String EVENT_DEFINE="event.c"; |
- final String ACT_LIST="event.c"; |
- private int servernumber=0; |
- private timespec simulation_time=new timespec(); |
- ArrayList local_scheduler=new ArrayList(); |
- ArrayList Task_Section=new ArrayList(); |
- private int task_group=0; |
- private int task_server=0; |
- private int current_scheduler=0; |
- |
- |
- |
- //Construct the frame |
- public Application() { |
- try { |
- jbInit(); |
- } |
- catch(Exception e) { |
- e.printStackTrace(); |
- } |
- } |
- //Component initialization |
- private void jbInit() throws Exception { |
- } |
- |
- public void process (String url) throws MalformedURLException { |
- try { |
- // Use SAXBuilder |
- SAXBuilder builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser", true); |
- builder.setFeature("http://apache.org/xml/features/validation/schema", true); |
- |
- |
- Document doc = builder.build(url); |
- Element root = doc.getRootElement(); |
- |
- try { |
- // Funzione per il salvataggio del file XML |
- OutputStream fout = new FileOutputStream(EVENT_DEFINE); |
- OutputStream bout = new BufferedOutputStream(fout); |
- OutputStreamWriter out = new OutputStreamWriter(bout, "8859_1"); |
- out.write("\n#include \"func.h\"\n"); |
- |
- processElement (root,out); |
- out.flush(); |
- out.close(); |
- } catch (UnsupportedEncodingException e) { |
- System.out.println("Non sono supportati i caratteri latini"); |
- System.exit(1); |
- |
- } catch (IOException e){ |
- System.out.println("Salvatagio fallito"); |
- System.exit(1); |
- } |
- |
- |
- |
- System.out.println ("Total Number of Elements Processed: " |
- +numElements); |
- } catch (JDOMException e) { |
- System.out.println ("JDOM Exception: "+e.getMessage()); |
- } catch (java.io.IOException e) { |
- System.out.println ("File Exception: "+e.getMessage()); |
- |
- } |
-} |
- |
-// Recursive Function to Process Elements |
-// Prints the Element Name and keeps a running count |
-// out total number of elements. |
-private void processElement(Element element, OutputStreamWriter out) { |
- numElements++; |
- String elementName = element.getName(); |
- |
- System.out.println(elementName); |
- List servers = element.getChildren(); |
- Iterator iterator = servers.iterator(); |
- /* get simulation parameter */ |
- Element SimulationInfo = (Element) iterator.next(); |
- |
- Pattern pattern = Pattern.compile("[us\\s]+"); |
- try { |
- /*simulation time */ |
- |
- String[] stime = pattern.split(SimulationInfo.getChild("time").getText()); |
- out.write("struct timespec total_time={" + stime[0] + "," + stime[1] + |
- "};\n\n"); |
- simulation_time.tv_sec = Long.valueOf(stime[0].trim()).longValue(); |
- simulation_time.tv_nsec = Long.valueOf(stime[1].trim()).longValue() / |
- 1000; |
-//float f = Float.valueOf(s.trim()).floatValue(); |
- /* server section start */ |
- out.write("struct loader_contract loader_contract_list[] = {\n"); |
- int total_server=0; |
- while (iterator.hasNext()) { |
- /* get server */ |
- Element server = (Element) iterator.next(); |
- process_server_section(server, out); |
- total_server++; |
- } |
- |
- out.write("};\n\n"); |
- |
- out.write("int total_loader_contract="+total_server+";\n\n"); |
- iterator = local_scheduler.iterator(); |
- while (iterator.hasNext()) { |
- /* get server */ |
- Element loc_sched = (Element) iterator.next(); |
- process_scheduler_section(loc_sched, out); |
- task_server++; |
- } |
- |
- iterator = Task_Section.iterator(); |
- int total_task_section=0; |
- out.write("\nstruct loader_task loader_task_list[] = {\n"); |
- while (iterator.hasNext()) { |
- /* get server */ |
- task_class tsk_sec = (task_class) iterator.next(); |
- out.write(" {\"" + tsk_sec.name + "\"," + tsk_sec.task_type + "," + |
- tsk_sec.contract + |
- "," + tsk_sec.localscheduler + "," + tsk_sec.number + "," |
- + tsk_sec.group + ",{" + tsk_sec.deadline.tv_sec + |
- "," + |
- tsk_sec.deadline.tv_nsec + "}," + "{" + |
- tsk_sec.wcet.tv_sec + "," + |
- tsk_sec.wcet.tv_nsec + "}," + tsk_sec.act_number + |
- ",0,act_" + tsk_sec.name + |
- ",exec_" + tsk_sec.name + "},\n"); |
- total_task_section++; |
- } |
- out.write("};\n\n"); |
- out.write("int total_loader_task="+total_task_section+";\n\n"); |
- |
- |
- } |
- catch (java.io.IOException e) { |
- System.out.println("File Exception: " + e.getMessage()); |
- |
- } |
- |
-} |
- |
-void process_scheduler_section(Element e, OutputStreamWriter out) { |
- Attribute t; |
- t=e.getAttribute("type"); |
- |
- List localpars = e.getChildren(); |
- Iterator iterator = localpars.iterator(); |
- while (iterator.hasNext()) { |
- /* get task section */ |
- Element loc_task = (Element) iterator.next(); |
- process_task_section(loc_task, out, t); |
- |
- } |
- |
-} |
- |
-void process_task_section(Element e, OutputStreamWriter out, Attribute loc) { |
- Attribute t; |
- int act; |
- act=1; |
- int task_type=0; |
- int localscheduler=0; |
- timespec time = new timespec(); |
- Pattern pattern = Pattern.compile("[us\\s]+"); |
- String scheduler=loc.getValue(); |
- if (scheduler.equals("POSIX")) { |
- localscheduler=30; |
- } |
- else if (scheduler.equals("EDF")) { |
- localscheduler=31; |
- } |
- else if (scheduler.equals("RM")) { |
- localscheduler=32; |
- } |
- |
- /* get task section */ |
- t=e.getAttribute("type"); |
- |
- if (t.getValue().equals("BackTask")) { |
- process_back_task(e, out); |
- task_type=23; |
- } else if (t.getValue().equals("OneShot")) { |
- process_oneshot_task(e, out); |
- task_type=21; |
- } else if (t.getValue().equals("CyclicalTask")) { |
- task_type=22; |
- act=process_cyclical_task(e, out); |
- } |
- |
- task_class section=new task_class(); |
- section.deadline=new timespec(); |
- section.wcet=new timespec(); |
- section.name="task"+task_group; |
- section.contract=task_server; |
- section.group=task_group; |
- section.act_number=act; |
- section.task_type=task_type; |
- section.localscheduler=localscheduler; |
- section.number=Integer.valueOf(e.getChild("number").getText()).intValue(); |
- |
- Element dl = e.getChild("dline"); |
- if (dl != null) { |
- |
- String[] dline=pattern.split(dl.getText()); |
- time.tv_sec = Long.valueOf(dline[0]).longValue(); |
- time.tv_nsec = Long.valueOf(dline[1]).longValue() * 1000; |
- |
- section.deadline.tv_sec=time.tv_sec; |
- section.deadline.tv_nsec=time.tv_nsec; |
- |
- } |
- |
- |
- Element wc = e.getChild("wcet"); |
- if (wc != null) { |
- |
- String[] wcet=pattern.split(e.getChild("wcet").getText()); |
- time.tv_sec = Long.valueOf(wcet[0]).longValue(); |
- time.tv_nsec = Long.valueOf(wcet[1]).longValue() * 1000; |
- |
- section.wcet.tv_sec=time.tv_sec; |
- section.wcet.tv_nsec=time.tv_nsec; |
- |
- } |
- |
- Task_Section.add(section); |
- task_group++; |
- |
-} |
- |
-void process_back_task(Element e, OutputStreamWriter out) { |
- |
- Pattern pattern = Pattern.compile("[us\\s]+"); |
- |
- Element act_section=e.getChild("act_section"); |
- String[] start_time=pattern.split(act_section.getChild("start_time").getText()); |
- Element exec_section=e.getChild("exec_section"); |
- |
- String[] exec_const=pattern.split(exec_section.getChild("exec_time").getText()); |
- try { |
- out.write("struct timespec act_task"+task_group+"[]={{"+start_time[0]+","+start_time[1]+"},};\n\n"); |
- out.write("struct timespec exec_task"+task_group+"[]={{"+exec_const[0]+","+exec_const[1]+"},};\n\n"); |
- |
- } |
- catch (java.io.IOException ex) { |
- System.out.println("File Exception: " + ex.getMessage()); |
- |
- } |
-} |
-void process_oneshot_task(Element e, OutputStreamWriter out) { |
- Pattern pattern = Pattern.compile("[us\\s]+"); |
- |
- Element act_section=e.getChild("act_section"); |
- String[] start_time=pattern.split(act_section.getChild("start_time").getText()); |
- |
- Element exec_section=e.getChild("exec_section"); |
- String[] exec_const=pattern.split(exec_section.getChild("exec_time").getText()); |
- |
- try { |
- out.write("struct timespec act_task"+task_group+"[]={{"+start_time[0]+","+start_time[1]+"},};\n\n"); |
- out.write("struct timespec exec_task"+task_group+"[]={{"+exec_const[0]+","+exec_const[1]+"},};\n\n"); |
- } |
- catch (java.io.IOException ex) { |
- System.out.println("File Exception: " + ex.getMessage()); |
- } |
-} |
- |
-int process_cyclical_task(Element e, OutputStreamWriter out) { |
- |
- int activated=1; |
- Pattern pattern = Pattern.compile("[us\\s]+"); |
- Element act_section=e.getChild("act_section"); |
- String[] start_time=pattern.split(act_section.getChild("start_time").getText()); |
- String[] period=pattern.split(act_section.getChild("period_time").getText()); |
- Element deltatime=act_section.getChild("delta_time"); |
- String[] delta_time; |
- |
- long act_delta=0; |
- timespec delta_act_ts = new timespec(); |
- |
- if (deltatime != null) { |
- delta_time = pattern.split(deltatime.getText()); |
- delta_act_ts.tv_sec = Long.valueOf(delta_time[0]).longValue(); |
- delta_act_ts.tv_nsec = Long.valueOf(delta_time[1]).longValue() * 1000; |
- act_delta = delta_act_ts.TIMESPEC2USEC(); |
- } |
- |
- Element exec_section=e.getChild("exec_section"); |
- String[] exec_const=pattern.split(exec_section.getChild("exec_time").getText()); |
- Element execdelta=exec_section.getChild("delta_time"); |
- String[] exec_delta; |
- |
- long exec_delta_long = 0; |
- timespec exec_delta_ts = new timespec(); |
- |
- if (execdelta != null) { |
- exec_delta=pattern.split(execdelta.getText()); |
- exec_delta_ts.tv_sec = Long.valueOf(exec_delta[0]).longValue(); |
- exec_delta_ts.tv_nsec = Long.valueOf(exec_delta[1]).longValue() * 1000; |
- exec_delta_long = exec_delta_ts.TIMESPEC2USEC(); |
- } |
- |
- try { |
- out.write("struct timespec act_task"+task_group+"[]={{"+ |
- start_time[0]+","+start_time[1]+"},\n"); |
- |
- timespec time = new timespec(); |
- time.tv_sec = Long.valueOf(period[0]).longValue(); |
- time.tv_nsec = Long.valueOf(period[1]).longValue() * 1000; |
- |
- long usecperiod = time.TIMESPEC2USEC(); |
- timespec nextact = new timespec(); |
- |
- time.tv_sec = Long.valueOf(start_time[0]).longValue(); |
- time.tv_nsec = Long.valueOf(start_time[1]).longValue() * 1000; |
- |
- Random rd = new Random(); |
- |
- while (simulation_time.TIMESPEC_A_GT_B(time)) { |
- |
- nextact.tv_sec = Long.valueOf(period[0]).longValue(); |
- nextact.tv_nsec = Long.valueOf(period[1]).longValue() * 1000; |
- |
- if (act_delta != 0) { |
- nextact.ADDUSEC2TIMESPEC((rd.nextInt() & Integer.MAX_VALUE) % act_delta - act_delta/2); |
- } |
- |
- time.ADDUSEC2TIMESPEC(usecperiod); |
- out.write(" {"+nextact.tv_sec+","+nextact.tv_nsec/1000+"},\n"); |
- activated++; |
- } |
- out.write("};\n"); |
- |
- out.write("struct timespec exec_task"+task_group+"[]={\n"); |
- |
- timespec nextexec = new timespec(); |
- |
- for (int i=0; i<activated; i++) { |
- |
- nextexec.tv_sec = Long.valueOf(exec_const[0]).longValue(); |
- nextexec.tv_nsec = Long.valueOf(exec_const[1]).longValue() * 1000; |
- |
- if (exec_delta_long != 0) { |
- nextexec.ADDUSEC2TIMESPEC((rd.nextInt() & Integer.MAX_VALUE) % exec_delta_long - exec_delta_long/2); |
- } |
- |
- out.write(" {"+nextexec.tv_sec+","+nextexec.tv_nsec/1000+"},\n"); |
- |
- } |
- out.write("};\n"); |
- } |
- catch (java.io.IOException ex) { |
- System.out.println("File Exception: " + ex.getMessage()); |
- } |
- |
- return activated; |
-} |
- |
-void process_server_section(Element e, OutputStreamWriter out) { |
- |
- |
- List serverpars = e.getChildren(); |
- Iterator iterator = serverpars.iterator(); |
- Element serverpar = (Element) iterator.next(); |
- String current_value; |
- current_value=serverpar.getText(); |
- try { |
- out.write("{" + servernumber + ",{"); |
- servernumber++; |
- |
- Pattern pattern = Pattern.compile("[us\\s]+"); |
- /* cmin */ |
- String[] cmin = pattern.split(current_value); |
- out.write(cmin[0] + "," + Long.valueOf(cmin[1]).longValue()*1000+"},{"); |
- |
- /* tmax */ |
- serverpar = (Element) iterator.next(); |
- current_value=serverpar.getText(); |
- String[] tmax = pattern.split(current_value); |
- out.write(tmax[0] + "," + Long.valueOf(tmax[1]).longValue()*1000+"},{"); |
- |
- /* cmax */ |
- serverpar = (Element) iterator.next(); |
- current_value=serverpar.getText(); |
- String[] cmax = pattern.split(current_value); |
- out.write(cmax[0] + "," + Long.valueOf(cmax[1]).longValue()*1000+"},{"); |
- |
- /* tmin */ |
- serverpar = (Element) iterator.next(); |
- current_value=serverpar.getText(); |
- String[] tmin = pattern.split(current_value); |
- out.write(tmin[0] + "," + Long.valueOf(tmin[1]).longValue()*1000+"},"); |
- |
- /*work load */ |
- serverpar = (Element) iterator.next(); |
- current_value=serverpar.getText(); |
- out.write(current_value+","); |
- |
- serverpar = (Element) iterator.next(); |
- current_value=serverpar.getName(); |
- Attribute loc_type=serverpar.getAttribute("type"); |
- String scheduler=loc_type.getValue(); |
- if (scheduler.equals("POSIX")) { |
- out.write("30"); |
- } |
- else if (scheduler.equals("EDF")) { |
- out.write("31"); |
- } |
- else if (scheduler.equals("RM")) { |
- out.write("32"); |
- } |
- out.write(",-1},\n"); |
- local_scheduler.add(servernumber-1,serverpar); |
- |
- } catch (java.io.IOException ex) { |
- System.out.println ("File Exception: "+ex.getMessage()); |
- } |
- |
- /* |
- fprintf(file_event_header, " {%d,{%d,%d},{%d,%d},{%d,%d},{%d,%d},%d,%d,-1},\n", |
- (int)c->number,(int)c->cmin.tv_sec,(int)c->cmin.tv_nsec, |
- (int)c->tmax.tv_sec,(int)c->tmax.tv_nsec, |
- (int)c->cmax.tv_sec,(int)c->cmax.tv_nsec, |
- (int)c->tmin.tv_sec,(int)c->tmin.tv_nsec, |
- (int)c->workload,(int)c->local_scheduler); |
- |
-*/ |
- //processElement (kid); |
- } |
- |
- |
- |
-public static void main(String[] args) throws Exception { |
- System.out.println("Parser Versione 1.0"); |
- Application app = new Application(); |
- if (args.length > 0) |
- app.process(args[0]); |
-} |
- |
-/* Event Generator |
- * |
- * Giacomo Guidi |
- */ |
- |
- |
- |
- |
- |
-/* |
-int write_basic_par_start(void) |
-{ |
- |
- FILE *file_event_header; |
- |
- file_event_header = fopen(EVENT_DEFINE,"a+"); |
- if (file_event_header == NULL) return 1; |
- |
- fprintf(file_event_header, "struct loader_task loader_task_list[] = {\n"); |
- |
- fclose(file_event_header); |
- |
- return 0; |
- |
-} |
- |
- |
-int write_basic_par(struct loader_task *c) |
-{ |
- |
- FILE *file_event_header; |
- |
- file_event_header = fopen(EVENT_DEFINE,"a+"); |
- if (file_event_header == NULL) return 1; |
- |
- fprintf(file_event_header, " {\"%s\",%d,%d,%d,%d,%d,{%d,%d},{%d,%d},%d,0,act_%s,exec_%s},\n", |
- c->name,(int)c->task_type,(int)c->server,(int)c->local_scheduler,(int)c->number,(int)c->group, |
- (int)c->deadline.tv_sec, (int)c->deadline.tv_nsec, |
- (int)c->wcet.tv_sec, (int)c->wcet.tv_nsec, |
- (int)c->act_number, c->name, c->name); |
- |
- fclose(file_event_header); |
- |
- return 0; |
- |
-} |
- |
-int write_contract(struct loader_contract *c) |
-{ |
- |
- FILE *file_event_header; |
- |
- file_event_header = fopen(EVENT_DEFINE,"a+"); |
- if (file_event_header == NULL) return 1; |
- |
- fprintf(file_event_header, " {%d,{%d,%d},{%d,%d},{%d,%d},{%d,%d},%d,%d,-1},\n", |
- (int)c->number,(int)c->cmin.tv_sec,(int)c->cmin.tv_nsec, |
- (int)c->tmax.tv_sec,(int)c->tmax.tv_nsec, |
- (int)c->cmax.tv_sec,(int)c->cmax.tv_nsec, |
- (int)c->tmin.tv_sec,(int)c->tmin.tv_nsec, |
- (int)c->workload,(int)c->local_scheduler); |
- |
- fclose(file_event_header); |
- |
- return 0; |
- |
-} |
- |
-int close_loader_task(int total_task_number) |
-{ |
- |
- FILE *file_event_header; |
- |
- file_event_header = fopen(EVENT_DEFINE,"a+"); |
- if (file_event_header == NULL) return 1; |
- |
- fprintf(file_event_header,"};\n\n"); |
- |
- fprintf(file_event_header,"int total_loader_task = %d;\n\n",total_task_number); |
- |
- fclose(file_event_header); |
- |
- return 0; |
- |
-} |
- |
-int close_loader_contract(int total_contract_number) |
-{ |
- |
- FILE *file_event_header; |
- |
- file_event_header = fopen(EVENT_DEFINE,"a+"); |
- if (file_event_header == NULL) return 1; |
- |
- fprintf(file_event_header,"};\n\n"); |
- |
- fprintf(file_event_header,"int total_loader_contract = %d;\n\n",total_contract_number); |
- |
- fclose(file_event_header); |
- |
- return 0; |
- |
-} |
- |
-int write_simulation_time(struct timespec *total) |
-{ |
- |
- FILE *file_event_header; |
- |
- file_event_header = fopen(EVENT_DEFINE,"a+"); |
- if (file_event_header == NULL) return 1; |
- |
- fprintf(file_event_header,"struct timespec total_time = {%d,%d};\n\n",(int)total->tv_sec,(int)total->tv_nsec); |
- |
- fclose(file_event_header); |
- |
- return 0; |
- |
- |
-} |
- |
-int write_single_act(struct timespec *t, struct loader_task *c) |
-{ |
- |
- FILE *file_act_header; |
- |
- file_act_header = fopen(ACT_LIST,"a+"); |
- if (file_act_header == NULL) return 1; |
- |
- if (TIMESPEC_A_GT_B(t,&c->act_par_1)) { |
- fprintf(file_act_header,"struct timespec act_%s[] = {{%d,%d}};\n\n",c->name, |
- (int)c->act_par_1.tv_sec,(int)c->act_par_1.tv_nsec); |
- c->act_number = 1; |
- } else { |
- fprintf(file_act_header,"struct timespec act_%s[] = {{0,0}};\n\n",c->name); |
- c->act_number = 0; |
- } |
- |
- fclose(file_act_header); |
- |
- return 0; |
- |
-} |
- |
-int write_periodic_act(struct timespec *t, struct loader_task *c) |
-{ |
- |
- FILE *file_act_header; |
- struct timespec tot_time; |
- int period; |
- |
- file_act_header = fopen(ACT_LIST,"a+"); |
- if (file_act_header == NULL) return 1; |
- |
- fprintf(file_act_header,"struct timespec act_%s[] = {{%d,%d},\n",c->name, |
- (int)c->act_par_1.tv_sec,(int)c->act_par_1.tv_nsec); |
- |
- c->act_number = 1; |
- TIMESPEC_ASSIGN(&tot_time,&c->act_par_1); |
- period = TIMESPEC2USEC(&c->act_par_2); |
- while (TIMESPEC_A_GT_B(t, &tot_time)) { |
- c->act_number++; |
- ADDUSEC2TIMESPEC(period,&tot_time); |
- fprintf(file_act_header," {%d,%d},\n", |
- (int)c->act_par_2.tv_sec,(int)c->act_par_2.tv_nsec); |
- } |
- |
- fprintf(file_act_header," };\n\n"); |
- |
- fclose(file_act_header); |
- |
- return 0; |
- |
-} |
- |
-int write_mean_act(struct timespec *t,struct loader_task *c) |
-{ |
- |
- FILE *file_act_header; |
- struct timespec tot_time; |
- int next_act; |
- |
- file_act_header = fopen(ACT_LIST,"a+"); |
- if (file_act_header == NULL) return 1; |
- |
- fprintf(file_act_header,"struct timespec act_%s[] = {{%d,%d},\n",c->name, |
- (int)c->act_par_1.tv_sec,(int)c->act_par_1.tv_nsec); |
- |
- c->act_number = 1; |
- TIMESPEC_ASSIGN(&tot_time,&c->act_par_1); |
- while (TIMESPEC_A_GT_B(t, &tot_time)) { |
- c->act_number++; |
- next_act = TIMESPEC2USEC(&c->act_par_2) + random() % TIMESPEC2USEC(&c->act_par_3) - TIMESPEC2USEC(&c->act_par_3) / 2; |
- ADDUSEC2TIMESPEC(next_act,&tot_time); |
- fprintf(file_act_header," {%d,%d},\n", |
- next_act / 1000000, next_act % 1000000 * 1000); |
- } |
- |
- fprintf(file_act_header," };\n\n"); |
- |
- fclose(file_act_header); |
- |
- return 0; |
- |
-} |
- |
-int write_exec_const(struct loader_task *c) |
-{ |
- |
- FILE *file_exec_header; |
- int i; |
- |
- file_exec_header = fopen(ACT_LIST,"a+"); |
- if (file_exec_header == NULL) return 1; |
- |
- fprintf(file_exec_header,"struct timespec exec_%s[] = {{%d,%d},\n",c->name, |
- (int)c->exec_par_1.tv_sec,(int)c->exec_par_1.tv_nsec); |
- |
- for (i=0; i< c->act_number-1; i++) |
- fprintf(file_exec_header," {%d,%d},\n", |
- (int)c->exec_par_1.tv_sec,(int)c->exec_par_1.tv_nsec); |
- |
- fprintf(file_exec_header," };\n\n"); |
- |
- fclose(file_exec_header); |
- |
- return 0; |
- |
-} |
- |
-int write_exec_mean(struct loader_task *c) |
-{ |
- |
- FILE *file_exec_header; |
- int exec_time_usec; |
- int i; |
- |
- file_exec_header = fopen(ACT_LIST,"a+"); |
- if (file_exec_header == NULL) return 1; |
- |
- exec_time_usec = TIMESPEC2USEC(&c->exec_par_1) |
- + random() % TIMESPEC2USEC(&c->exec_par_2) - TIMESPEC2USEC(&c->exec_par_2) / 2; |
- fprintf(file_exec_header,"struct timespec exec_%s[] = {{%d,%d},\n",c->name, |
- exec_time_usec / 1000000, exec_time_usec % 1000000 * 1000); |
- |
- for (i=0; i< c->act_number-1; i++) { |
- exec_time_usec = TIMESPEC2USEC(&c->exec_par_1) |
- + random() % TIMESPEC2USEC(&c->exec_par_2) - TIMESPEC2USEC(&c->exec_par_2) / 2; |
- fprintf(file_exec_header," {%d,%d},\n", |
- exec_time_usec / 1000000, exec_time_usec % 1000000 * 1000); |
- } |
- |
- fprintf(file_exec_header," };\n\n"); |
- |
- fclose(file_exec_header); |
- |
- return 0; |
- |
-} |
- |
-void *start; |
-void *end; |
- |
-int main(int argc, char **argv) { |
- |
- char loadfile[100]; |
- struct timespec total_time; |
- struct loader_task *start_loader_task = NULL, *current_t; |
- struct loader_contract *start_loader_contract = NULL, *current_c; |
- int err,ldnum; |
- int total_task_number; |
- int total_contract_number; |
- |
- printf("\nEvent Generator\n"); |
- |
- if (argc < 2) { |
- printf("Error: event_gen loadfile.fsf\n"); |
- exit(1); |
- } |
- |
- printf("Read loader file %s\n",argv[1]); |
- |
- sprintf(loadfile,"%s%s",LOADFILE_DIR,argv[1]); |
- err = dos_preload(loadfile,100000,&start,&end); |
- |
- if (err != 0) { |
- printf("Error: File not found\n"); |
- exit(1); |
- } |
- |
- printf("Parsing file\n"); |
- |
- line_reader(start, end, &total_time, &start_loader_task, &start_loader_contract); |
- |
- srandom(time(NULL)); |
- |
- write_struct(); |
- |
- current_t = start_loader_task; |
- ldnum = 1; |
- |
- while(current_t != NULL) { |
- |
- sprintf(current_t->name,"ltask%d",ldnum); |
- current_t->group = ldnum; |
- ldnum++; |
- |
- switch (current_t->act_type) { |
- case PAR_ACT_SINGLE: |
- err = write_single_act(&total_time,current_t); |
- if (err != 0) { |
- printf("Error writing activation header\n"); |
- exit(1); |
- } |
- break; |
- case PAR_ACT_PERIODIC: |
- err = write_periodic_act(&total_time,current_t); |
- if (err != 0) { |
- printf("Error writing activation header\n"); |
- exit(1); |
- } |
- break; |
- case PAR_ACT_MEAN: |
- err = write_mean_act(&total_time,current_t); |
- if (err != 0) { |
- printf("Error writing activation header\n"); |
- exit(1); |
- } |
- break; |
- } |
- |
- switch (current_t->exec_type) { |
- case PAR_EXEC_CONST: |
- err = write_exec_const(current_t); |
- if (err != 0) { |
- printf("Error writing exec header\n"); |
- exit(1); |
- } |
- break; |
- case PAR_EXEC_MEAN: |
- err = write_exec_mean(current_t); |
- if (err != 0) { |
- printf("Error writing exec header\n"); |
- exit(1); |
- } |
- break; |
- } |
- |
- current_t = current_t->next; |
- |
- } |
- |
- write_basic_par_start(); |
- |
- total_task_number = 0; |
- current_t = start_loader_task; |
- while(current_t != NULL) { |
- |
- write_basic_par(current_t); |
- |
- current_t = current_t->next; |
- |
- total_task_number++; |
- |
- } |
- |
- close_loader_task(total_task_number); |
- |
- write_contract_start(); |
- |
- total_contract_number = 0; |
- current_c = start_loader_contract; |
- while(current_c != NULL) { |
- |
- write_contract(current_c); |
- |
- current_c = current_c->next; |
- |
- total_contract_number++; |
- |
- } |
- |
- close_loader_contract(total_contract_number); |
- |
- write_simulation_time(&total_time); |
- |
- return 0; |
- |
-} |
- |
-*/ |
-} |
Index: rel_1_4_rc1/loader/generators/java/task_class.java |
=================================================================== |
--- rel_1_4_rc1/loader/generators/java/task_class.java (revision 1476) |
+++ rel_1_4_rc1/loader/generators/java/task_class.java (nonexistent) |
@@ -1,26 +0,0 @@ |
-//package first_filter; |
- |
-/** |
- * <p>Title: First XML filter</p> |
- * <p>Description: </p> |
- * <p>Copyright: Copyright (c) 2003</p> |
- * <p>Company: Retis Lab</p> |
- * @author not attributable |
- * @version 1.0 |
- */ |
- |
-public class task_class { |
- String name; |
- int task_type; |
- int contract; |
- int localscheduler; |
- int number; |
- int group; |
- timespec deadline; |
- timespec wcet; |
- int act_number; |
- |
- public task_class() { |
- } |
- |
-} |
Index: rel_1_4_rc1/loader/generators/java/fsf-schema.xsd |
=================================================================== |
--- rel_1_4_rc1/loader/generators/java/fsf-schema.xsd (revision 1476) |
+++ rel_1_4_rc1/loader/generators/java/fsf-schema.xsd (nonexistent) |
@@ -1,75 +0,0 @@ |
-<?xml version="1.0" encoding="UTF-8"?> |
-<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'> |
- |
-<xs:element name="fsf_framework"> |
- <xs:complexType> |
- <xs:sequence> |
- <xs:element ref="simulation"/> |
- <xs:element ref="contract" minOccurs='1' maxOccurs='unbounded'/> |
- </xs:sequence> |
- </xs:complexType> |
-</xs:element> |
- |
-<xs:element name="simulation"> |
- <xs:complexType> |
- <xs:sequence> |
- <xs:element name="time" type="xs:string"/> |
- </xs:sequence> |
- </xs:complexType> |
-</xs:element> |
- |
-<xs:element name="contract"> |
- <xs:complexType> |
- <xs:sequence> |
- <xs:element name="cmin" type="xs:string"/> |
- <xs:element name="tmax" type="xs:string" /> |
- <xs:element name="cmax" type="xs:string" /> |
- <xs:element name="tmin" type="xs:string" /> |
- <xs:element name="workload" type="xs:string" /> |
- <xs:element ref="localscheduler"/> |
- </xs:sequence> |
- </xs:complexType> |
-</xs:element> |
- |
-<xs:element name="localscheduler"> |
- <xs:complexType> |
- <xs:sequence> |
- <xs:element ref="task_section" minOccurs='1' maxOccurs='unbounded'/> |
- </xs:sequence> |
- <xs:attribute name="type" type="xs:string" use='required'/> |
- </xs:complexType> |
-</xs:element> |
- |
-<xs:element name="task_section"> |
- <xs:complexType> |
- <xs:sequence> |
- <xs:element name="number" type="xs:integer"/> |
- <xs:element name="dline" type="xs:string" minOccurs="0" /> |
- <xs:element name="wcet" type="xs:string" minOccurs="0"/> |
- <xs:element ref="act_section"/> |
- <xs:element ref="exec_section"/> |
- </xs:sequence> |
- <xs:attribute name="type" type="xs:string" use='required'/> |
- </xs:complexType> |
-</xs:element> |
- |
-<xs:element name="act_section"> |
- <xs:complexType> |
- <xs:sequence> |
- <xs:element name="start_time" type="xs:string"/> |
- <xs:element name="period_time" type="xs:string" minOccurs="0" /> |
- <xs:element name="delta_time" type="xs:string" minOccurs="0" /> |
- </xs:sequence> |
- </xs:complexType> |
-</xs:element> |
- |
-<xs:element name="exec_section"> |
- <xs:complexType> |
- <xs:sequence> |
- <xs:element name="exec_time" type="xs:string"/> |
- <xs:element name="delta_time" type="xs:string" minOccurs="0" /> |
- </xs:sequence> |
- </xs:complexType> |
-</xs:element> |
- |
-</xs:schema> |
Index: rel_1_4_rc1/loader/generators/java/timespec.java |
=================================================================== |
--- rel_1_4_rc1/loader/generators/java/timespec.java (revision 1476) |
+++ rel_1_4_rc1/loader/generators/java/timespec.java (nonexistent) |
@@ -1,37 +0,0 @@ |
-//package first_filter; |
- |
-/** |
- * <p>Title: First XML filter</p> |
- * <p>Description: </p> |
- * <p>Copyright: Copyright (c) 2003</p> |
- * <p>Company: Retis Lab</p> |
- * @author not attributable |
- * @version 1.0 |
- */ |
- |
-public class timespec { |
- long tv_sec; |
- long tv_nsec; |
- |
- public timespec() { |
- tv_sec=0; |
- tv_nsec=0; |
- } |
- |
- |
- void ADDUSEC2TIMESPEC(long t1) { |
- tv_nsec+=(t1%1000000)*1000; |
- tv_sec+=(tv_nsec / 1000000000)+(t1/1000000); |
- tv_nsec%=1000000000; |
- } |
- long TIMESPEC2USEC() { |
- return (tv_sec*1000000+tv_nsec/1000); |
- } |
- boolean TIMESPEC_A_GT_B(timespec t1) { |
- |
- return (tv_sec>t1.tv_sec || |
- (tv_sec==t1.tv_sec && tv_nsec>t1.tv_nsec)); |
- |
- } |
- |
-} |
Index: rel_1_4_rc1/loader/generators/lread.c |
=================================================================== |
--- rel_1_4_rc1/loader/generators/lread.c (revision 1476) |
+++ rel_1_4_rc1/loader/generators/lread.c (nonexistent) |
@@ -1,95 +0,0 @@ |
-#include <stdio.h> |
-#include <stdlib.h> |
-#include "lparser.h" |
-#include "common/time.h" |
- |
-int dos_preload(char *file_name, long max_size, void **start_file, void **end_file) |
-{ |
- FILE *file; |
- void *buf; |
- long rd; |
- |
- |
- file = fopen(file_name,"r"); |
- if (file == NULL) return -1; |
- |
- buf = malloc(max_size); |
- *start_file = buf; |
- |
- while(((rd = fread(buf, 1, 2048, file)) == 2048) && |
- ((buf - *start_file + rd) < (max_size-2048))) { |
- buf += rd; |
- } |
- |
- *end_file = buf + rd; |
- |
- fclose(file); |
- return(0); |
- |
-} |
- |
-int line_reader(void *start_file, void *end_file, struct timespec *total, |
- struct loader_task **start_loader_task, struct loader_contract **start_loader_contract) |
-{ |
- |
- char *pbuf = start_file; |
- int res,line_num,total_loader_task,total_loader_contract; |
- struct loader_task *current_t = NULL; |
- struct loader_contract *current_c = NULL; |
- |
- NULL_TIMESPEC(total); |
- |
- line_num = 0; |
- total_loader_task = 0; |
- total_loader_contract = 0; |
- |
- while ((void *)(pbuf) < end_file) { |
- |
- line_num++; |
- |
- if (*start_loader_contract == NULL) |
- res = line_parser_contract(&pbuf, line_num, total, ¤t_c); |
- else |
- res = line_parser_contract(&pbuf, line_num, total, ¤t_c->next); |
- |
- if (res == 2) { |
- total_loader_contract++; |
- if (*start_loader_contract == NULL) |
- *start_loader_contract = current_c; |
- else |
- current_c = current_c->next; |
- } |
- |
- if (res == 3) break; |
- |
- } |
- |
- while ((void *)(pbuf) < end_file) { |
- |
- line_num++; |
- |
- if (*start_loader_task == NULL) |
- res = line_parser_task(&pbuf, line_num, ¤t_t); |
- else |
- res = line_parser_task(&pbuf, line_num, ¤t_t->next); |
- |
- if (res == 2) { |
- total_loader_task++; |
- if (*start_loader_task == NULL) |
- *start_loader_task = current_t; |
- else |
- current_t = current_t->next; |
- } |
- |
- if (res == 3) break; |
- |
- } |
- |
- printf("Total decoded lines %d\n",line_num); |
- printf("Total loader contract %d\n",total_loader_contract); |
- printf("Total loader task %d\n",total_loader_task); |
- printf("Simulation time sec = %ld usec = %ld\n",total->tv_sec,total->tv_nsec/1000); |
- |
- return 0; |
- |
-} |
Index: rel_1_4_rc1/loader/readme.txt |
=================================================================== |
--- rel_1_4_rc1/loader/readme.txt (revision 1476) |
+++ rel_1_4_rc1/loader/readme.txt (nonexistent) |
@@ -1,64 +0,0 @@ |
-FIRST Framework Evaluation architecture |
---------------------------------------- |
- |
-makefile usage: |
- |
-$ make OS=<osname> TEST=<demo> all |
- |
-where: |
- |
-<osname> is the name of the target operating system and it can be: |
- |
-- MARTE for MaRTE OS |
-- SHARK for Shark |
- |
-<demo> is the name of the test case that have to be compiled. The |
-specification of the test case is contained inside the loadfile |
-directory. |
- |
-Valid extensions for the test case specification files are: |
-.fsf - old script file |
-.fsf2 - XML version |
-(other extensions can be added easily) |
- |
-For example: |
- |
-make OS=SHARK TEST=load all |
- |
-these makefile will: |
-- prepare the out directory with the common files |
-- add the shark initialization files |
-- parse a file loadfile/load.fsf (the file extension is guessed automatically |
- by the makefile) to produce source code inside out |
-- compile the resulting shark application |
- |
-------------------------------------------------------------------------- |
- |
-XML Parser & Java setup |
- |
-To use the XML parser (file extension .fsf2) you need to properly setup |
-your system, and you need toinstall the following libraries: |
- |
-- JDOM BETA 9 - http://www.jdom.org |
-- XERCES (Parser SAX with XSD support) - http://xml.apache.org |
- |
-On my Linux system, after installing the Sun's j2re, |
-I did the following commands (as root): |
- |
-# mkdir j |
-# cd j |
-# wget http://www.jdom.org/dist/binary/jdom-b9.tar.gz |
-# tar xvzf jdom-b9.tar.gz |
-# cp jdom-b9/build/jdom.jar /usr/java/j2re1.4.1_02/lib/ |
-# wget http://www.apache.org/dist/xml/xerces-j/Xerces-J-bin.2.6.0.tar.gz |
-# tar xvzf Xerces-J-bin.2.6.0.tar.gz |
-# cp ./xerces-2_6_0/xercesImpl.jar /usr/java/j2re1.4.1_02/lib/ |
-# cp ./xerces-2_6_0/xml-apis.jar /usr/java/j2re1.4.1_02/lib/ |
- |
-then, as user, I did |
- |
-$ export CLASSPATH=/usr/java/j2re1.4.1_02/lib |
- |
-Enjoy, |
- |
-Michael, Giacomo, PJ |
Index: rel_1_4_rc1/loader/makefile |
=================================================================== |
--- rel_1_4_rc1/loader/makefile (revision 1476) |
+++ rel_1_4_rc1/loader/makefile (nonexistent) |
@@ -1,88 +0,0 @@ |
-# |
-# help can be found in readme.txt |
-# |
- |
-# ----------------------------------------------------- |
-# |
-# OS dependent variables: |
- |
-# all the OS dependent variables and dependencies are under $(OS)/makefile.in |
- |
-# This makefile will execute the dependency os_specific_dep to "fill" |
-# the out directory with OS-specific stuffs; Then, the makefile |
-# generated in the out directory will be executed with $(TEST) as |
-# parameter. |
- |
-ifndef $(BASE) |
-BASE=../.. |
-endif |
- |
-include $(BASE)/config/config.mk |
- |
-ifeq ($(OS),MARTE) |
-OSINCLUDE=marte/makefile.in |
-endif |
- |
-ifeq ($(OS),SHARK) |
-OSINCLUDE=shark/makefile.in |
-endif |
- |
-# ----------------------------------------------------- |
- |
-.PHONY: all clean help |
- |
-help: |
-ifeq ($(CAT),cat) |
- cat readme.txt |
-endif |
- |
-all: out out/common.done out/$(TEST).done os_specific_dep |
- make -C out $(TEST) |
- |
-clean: |
- make -C generators clean |
- make -C generators/java clean |
- rm -rf out |
- |
-out/common.done: |
- cd out; cp -sf ../common/*.c . |
- cd out; cp -sf ../common/*.h . |
- touch out/common.done |
- |
-# note: the out dependency is present only in the "all" dependency |
-# (there is some strange case with the updating of the out date that I |
-# do not know how to resolve... |
-out: |
- mkdir out |
- |
-# ----------------------------------------------------- |
-# |
-# Testcase generation |
- |
-# .FSF Format |
-# ----------------------- |
- |
-generators/event_gen: |
- make -C generators event_gen |
- |
-out/%.done: loadfile/%.fsf generators/event_gen |
- cd out; ../generators/event_gen ../loadfile/$(TEST).fsf |
- touch out/$*.done |
- |
-# .FSF2 Format |
-# ----------------------- |
- |
-generators/java/Applicazione.class: |
- make -C generators/java all |
- |
-out/%.done: loadfile/%.fsf2 generators/java/Applicazione.class |
- cd generators/java; ./java_gen ../../loadfile/$(TEST).fsf2; mv event.c ../../out/ |
- touch out/$*.done |
- |
-# other file formats |
-# ----------------------- |
-out/%.done: loadfile/%.otherformat |
- echo Other file formats that are not specified yet... |
- touch out/$*.done |
- |
-include $(OSINCLUDE) |
Index: rel_1_4_rc1/jumpball/rrn.c |
=================================================================== |
--- rel_1_4_rc1/jumpball/rrn.c (revision 1476) |
+++ rel_1_4_rc1/jumpball/rrn.c (nonexistent) |
@@ -1,219 +0,0 @@ |
-/* |
- * Project: S.Ha.R.K. |
- * |
- * Coordinators: |
- * Giorgio Buttazzo <giorgio@sssup.it> |
- * Paolo Gai <pj@gandalf.sssup.it> |
- * |
- * Authors : |
- * Paolo Gai <pj@gandalf.sssup.it> |
- * (see the web pages for full authors list) |
- * |
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
- * |
- * http://www.sssup.it |
- * http://retis.sssup.it |
- * http://shark.sssup.it |
- */ |
- |
-/** |
- ------------ |
- CVS : $Id: rrn.c,v 1.5 2004-04-19 13:45:15 giacomo Exp $ |
- |
- File: $File$ |
- Revision: $Revision: 1.5 $ |
- Last update: $Date: 2004-04-19 13:45:15 $ |
- ------------ |
-**/ |
- |
-/* |
- * Copyright (C) 2003 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/intdrive.h" |
-#include "modules/edf.h" |
-#include "modules/rr.h" |
-#include "modules/rrsoft.h" |
-#include "modules/dummy.h" |
- |
-#include "modules/sem.h" |
-#include "modules/hartport.h" |
-#include "modules/cabs.h" |
- |
-#include "modules/nop.h" |
- |
-#include <drivers/shark_linuxc26.h> |
-#include <drivers/shark_pci26.h> |
-#include <drivers/shark_input26.h> |
-#include <drivers/shark_keyb26.h> |
-#include <drivers/shark_fb26.h> |
- |
-#define FRAME_BUFFER_DEVICE 0 |
- |
-/*+ sysyem tick in us +*/ |
-#define TICK 0 |
- |
-/*+ RR tick in us +*/ |
-#define RRTICK 2000 |
- |
-/*+ Interrupt Server +*/ |
-#define INTDRIVE_Q 1000 |
-#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) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- INTDRIVE_register_level(INTDRIVE_Q,INTDRIVE_T,INTDRIVE_FLAG); |
- RR_register_level(RRTICK, RR_MAIN_NO, mb); // this module remains empty!!! |
- RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_HARD|RRSOFT_ONLY_SOFT); |
- RR_register_level(RRTICK, RR_MAIN_YES, mb); |
- dummy_register_level(); |
- |
- SEM_register_module(); |
- |
- CABS_register_module(); |
- |
- NOP_register_module(); |
- |
- return TICK; |
-} |
- |
-TASK __init__(void *arg) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- HARTPORT_init(); |
- |
- set_shutdown_task(); |
- |
- device_drivers_init(); |
- |
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN); |
- |
- __call_main__(mb); |
- |
- return (void *)0; |
-} |
- |
-void set_shutdown_task() { |
- |
- NRT_TASK_MODEL nrt; |
- |
- nrt_task_default_model(nrt); |
- nrt_task_def_system(nrt); |
- |
- shutdown_task_PID = task_create("Shutdown Task",shutdown_task_body,&nrt,NULL); |
- if (shutdown_task_PID == NIL) { |
- sys_shutdown_message("Error: Cannot create shutdown task\n"); |
- sys_end(); |
- } |
- |
-} |
- |
-int device_drivers_init() { |
- |
- int res; |
- KEYB_PARMS kparms = BASE_KEYB; |
- |
- LINUXC26_register_module(); |
- |
- PCI26_init(); |
- |
- INPUT26_init(); |
- |
- keyb_def_ctrlC(kparms, NULL); |
- |
- KEYB26_init(&kparms); |
- |
- FB26_init(); |
- |
- res = FB26_open(FRAME_BUFFER_DEVICE); |
- if (res) { |
- cprintf("Error: Cannot open graphical mode\n"); |
- KEYB26_close(); |
- INPUT26_close(); |
- sys_end(); |
- } |
- |
- FB26_use_grx(FRAME_BUFFER_DEVICE); |
- |
- FB26_setmode(FRAME_BUFFER_DEVICE,"640x480-16"); |
- |
- return 0; |
- |
-} |
- |
-int device_drivers_close() { |
- |
- FB26_close(FRAME_BUFFER_DEVICE); |
- |
- KEYB26_close(); |
- |
- INPUT26_close(); |
- |
- return 0; |
- |
-} |
- |
-#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); |
-} |
- |
-TASK shutdown_task_body(void *arg) { |
- |
- device_drivers_close(); |
- |
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
- |
- sys_abort_shutdown(0); |
- |
- return NULL; |
- |
-} |
- |
-void app_mutex_init(mutex_t *m) |
-{ |
- NOP_mutexattr_t attr; |
- |
- NOP_mutexattr_default(attr); |
- |
- mutex_init(m, &attr); |
-} |
- |
Index: rel_1_4_rc1/jumpball/rrp.c |
=================================================================== |
--- rel_1_4_rc1/jumpball/rrp.c (revision 1476) |
+++ rel_1_4_rc1/jumpball/rrp.c (nonexistent) |
@@ -1,219 +0,0 @@ |
-/* |
- * Project: S.Ha.R.K. |
- * |
- * Coordinators: |
- * Giorgio Buttazzo <giorgio@sssup.it> |
- * Paolo Gai <pj@gandalf.sssup.it> |
- * |
- * Authors : |
- * Paolo Gai <pj@gandalf.sssup.it> |
- * (see the web pages for full authors list) |
- * |
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
- * |
- * http://www.sssup.it |
- * http://retis.sssup.it |
- * http://shark.sssup.it |
- */ |
- |
-/** |
- ------------ |
- CVS : $Id: rrp.c,v 1.5 2004-04-19 13:45:15 giacomo Exp $ |
- |
- File: $File$ |
- Revision: $Revision: 1.5 $ |
- Last update: $Date: 2004-04-19 13:45:15 $ |
- ------------ |
-**/ |
- |
-/* |
- * Copyright (C) 2003 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/intdrive.h" |
-#include "modules/edf.h" |
-#include "modules/rr.h" |
-#include "modules/rrsoft.h" |
-#include "modules/dummy.h" |
- |
-#include "modules/sem.h" |
-#include "modules/hartport.h" |
-#include "modules/cabs.h" |
- |
-#include "modules/pi.h" |
- |
-#include <drivers/shark_linuxc26.h> |
-#include <drivers/shark_pci26.h> |
-#include <drivers/shark_input26.h> |
-#include <drivers/shark_keyb26.h> |
-#include <drivers/shark_fb26.h> |
- |
-#define FRAME_BUFFER_DEVICE 0 |
- |
-/*+ sysyem tick in us +*/ |
-#define TICK 0 |
- |
-/*+ RR tick in us +*/ |
-#define RRTICK 2000 |
- |
-/*+ Interrupt Server +*/ |
-#define INTDRIVE_Q 1000 |
-#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) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- INTDRIVE_register_level(INTDRIVE_Q,INTDRIVE_T,INTDRIVE_FLAG); |
- RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_HARD); |
- RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_SOFT); |
- RR_register_level(RRTICK, RR_MAIN_YES, mb); |
- dummy_register_level(); |
- |
- SEM_register_module(); |
- |
- CABS_register_module(); |
- |
- PI_register_module(); |
- |
- return TICK; |
-} |
- |
-TASK __init__(void *arg) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- HARTPORT_init(); |
- |
- set_shutdown_task(); |
- |
- device_drivers_init(); |
- |
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN); |
- |
- __call_main__(mb); |
- |
- return (void *)0; |
-} |
- |
-void set_shutdown_task() { |
- |
- NRT_TASK_MODEL nrt; |
- |
- nrt_task_default_model(nrt); |
- nrt_task_def_system(nrt); |
- |
- shutdown_task_PID = task_create("Shutdown Task",shutdown_task_body,&nrt,NULL); |
- if (shutdown_task_PID == NIL) { |
- sys_shutdown_message("Error: Cannot create shutdown task\n"); |
- sys_end(); |
- } |
- |
-} |
- |
-int device_drivers_init() { |
- |
- int res; |
- KEYB_PARMS kparms = BASE_KEYB; |
- |
- LINUXC26_register_module(); |
- |
- PCI26_init(); |
- |
- INPUT26_init(); |
- |
- keyb_def_ctrlC(kparms, NULL); |
- |
- KEYB26_init(&kparms); |
- |
- FB26_init(); |
- |
- res = FB26_open(FRAME_BUFFER_DEVICE); |
- if (res) { |
- cprintf("Error: Cannot open graphical mode\n"); |
- KEYB26_close(); |
- INPUT26_close(); |
- sys_end(); |
- } |
- |
- FB26_use_grx(FRAME_BUFFER_DEVICE); |
- |
- FB26_setmode(FRAME_BUFFER_DEVICE,"640x480-16"); |
- |
- return 0; |
- |
-} |
- |
-int device_drivers_close() { |
- |
- FB26_close(FRAME_BUFFER_DEVICE); |
- |
- KEYB26_close(); |
- |
- INPUT26_close(); |
- |
- return 0; |
- |
-} |
- |
-#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); |
-} |
- |
-TASK shutdown_task_body(void *arg) { |
- |
- device_drivers_close(); |
- |
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
- |
- sys_abort_shutdown(0); |
- |
- return NULL; |
- |
-} |
- |
-void app_mutex_init(mutex_t *m) |
-{ |
- PI_mutexattr_t attr; |
- |
- PI_mutexattr_default(attr); |
- |
- mutex_init(m, &attr); |
-} |
- |
Index: rel_1_4_rc1/jumpball/demo.c |
=================================================================== |
--- rel_1_4_rc1/jumpball/demo.c (revision 1476) |
+++ rel_1_4_rc1/jumpball/demo.c (nonexistent) |
@@ -1,198 +0,0 @@ |
-/* |
- * Project: S.Ha.R.K. |
- * |
- * Coordinators: |
- * Giorgio Buttazzo <giorgio@sssup.it> |
- * Paolo Gai <pj@gandalf.sssup.it> |
- * |
- * Authors : |
- * Paolo Gai <pj@gandalf.sssup.it> |
- * (see the web pages for full authors list) |
- * |
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
- * |
- * http://www.sssup.it |
- * http://retis.sssup.it |
- * http://shark.sssup.it |
- */ |
- |
-/** |
- ------------ |
- CVS : $Id: demo.c,v 1.7 2004-04-18 18:48:22 giacomo Exp $ |
- |
- File: $File$ |
- Revision: $Revision: 1.7 $ |
- Last update: $Date: 2004-04-18 18:48:22 $ |
- ------------ |
-**/ |
- |
-/* |
- * Copyright (C) 2000-2003 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 "demo.h" |
-#include <kernel/func.h> |
-#include <string.h> |
-#include <stdlib.h> |
- |
-/* useful colors... */ |
-int white; |
-int black; |
-int red; |
-int gray; |
- |
-void app_mutex_init(mutex_t *m); |
- |
-static void version( void ) |
-{ |
- cprintf( "S.Ha.R.K. Jumpball Demo 1.0\n" ); |
- cprintf( "---------------------------\n" ); |
- cprintf( "by Paolo Gai 1999-2001\n" ); |
- cprintf( " <pj@sssup.it>\n" ); |
- cprintf( "---------------------------\n" ); |
-} |
- |
-int myrand(int x) |
-{ |
- return rand()%x; |
-} |
- |
-void reverse(char s[]) |
-{ |
- int c, i, j; |
- |
- for (i = 0, j = strlen(s)-1; i<j; i++, j--) |
- { |
- c = s[i]; |
- s[i] = s[j]; |
- s[j] = c; |
- } |
-} |
- |
-char * itoa(int n, char *s) |
-{ |
- int i, sign; |
- |
- if ((sign = n) < 0) |
- n = -n; |
- |
- i = 0; |
- |
- do |
- { |
- s[i++] = n % 10 + '0'; |
- } while ((n /= 10) > 0); |
- |
- if (sign < 0) |
- s[i++] = '-'; |
- |
- s[i] = 0; |
- |
- reverse(s); |
- |
- return s; |
-} |
- |
- |
-void scenario() |
-{ |
- grx_text("S.Ha.R.K. Jumpball Demo 1.0", 0, 0, rgb16(0,255,0), black ); |
- grx_text(" by Paolo Gai 1999-2001" , 0, 8, rgb16(0,255,0), black ); |
- grx_text(" pj@sssup.it" , 0,16, rgb16(0,255,0), black ); |
- |
- grx_text("Ctrl-C, Ctrr-C, Enter: exit" ,320, 0, gray, black ); |
- grx_text("Alt-C : void statistics" ,320, 8, gray, black ); |
- grx_text("Space : create noise ball",320,16, gray, black ); |
- grx_text("Backspace : kill noise balls" ,320,24, gray, black ); |
- |
- |
- #ifdef JET_ON |
- scenario_jetcontrol(); |
- #endif |
- |
- #ifdef BALL_ON |
- scenario_ball(); |
- #endif |
-} |
- |
-void endfun(KEY_EVT *k) |
-{ |
- sys_end(); |
-} |
- |
-void zerofun(KEY_EVT *k) |
-{ |
- int i; |
- for (i=0; i<MAX_PROC; i++) jet_delstat(i); |
-} |
- |
-int main(int argc, char **argv) |
-{ |
- |
- KEY_EVT k; |
- |
- version(); |
- |
- srand(4); |
- |
- k.flag = CNTR_BIT; |
- k.scan = KEY_C; |
- k.ascii = 'c'; |
- k.status = KEY_PRESSED; |
- keyb_hook(k,endfun,FALSE); |
- k.flag = CNTL_BIT; |
- k.scan = KEY_C; |
- k.ascii = 'c'; |
- k.status = KEY_PRESSED; |
- keyb_hook(k,endfun,FALSE); |
- k.flag = ALTL_BIT; |
- k.scan = KEY_C; |
- k.ascii = 'c'; |
- k.status = KEY_PRESSED; |
- keyb_hook(k,zerofun,FALSE); |
- k.flag = 0; |
- k.scan = KEY_ENT; |
- k.ascii = 13; |
- k.status = KEY_PRESSED; |
- keyb_hook(k,endfun,FALSE); |
- |
- /* init the graphic mutex */ |
- app_mutex_init(&mutex); |
- |
- /* useful colors ... */ |
- white = rgb16(255,255,255); |
- black = rgb16(0,0,0); |
- red = rgb16(255,0,0); |
- gray = rgb16(128,128,128); |
- |
- scenario(); |
- |
- #ifdef JET_ON |
- init_jetcontrol(); |
- #endif |
- |
- #ifdef BALL_ON |
- init_ball(); |
- #endif |
- |
- group_activate(1); |
- |
- return 0; |
-} |
- |
- |
Index: rel_1_4_rc1/jumpball/ern.c |
=================================================================== |
--- rel_1_4_rc1/jumpball/ern.c (revision 1476) |
+++ rel_1_4_rc1/jumpball/ern.c (nonexistent) |
@@ -1,220 +0,0 @@ |
-/* |
- * Project: S.Ha.R.K. |
- * |
- * Coordinators: |
- * Giorgio Buttazzo <giorgio@sssup.it> |
- * Paolo Gai <pj@gandalf.sssup.it> |
- * |
- * Authors : |
- * Paolo Gai <pj@gandalf.sssup.it> |
- * (see the web pages for full authors list) |
- * |
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
- * |
- * http://www.sssup.it |
- * http://retis.sssup.it |
- * http://shark.sssup.it |
- */ |
- |
-/** |
- ------------ |
- CVS : $Id: ern.c,v 1.5 2004-04-19 13:45:15 giacomo Exp $ |
- |
- File: $File$ |
- Revision: $Revision: 1.5 $ |
- Last update: $Date: 2004-04-19 13:45:15 $ |
- ------------ |
-**/ |
- |
-/* |
- * Copyright (C) 2003 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/intdrive.h" |
-#include "modules/edf.h" |
-#include "modules/rr.h" |
-#include "modules/rrsoft.h" |
-#include "modules/dummy.h" |
- |
-#include "modules/sem.h" |
-#include "modules/hartport.h" |
-#include "modules/cabs.h" |
- |
-#include "modules/nop.h" |
- |
-#include <drivers/shark_linuxc26.h> |
-#include <drivers/shark_pci26.h> |
-#include <drivers/shark_input26.h> |
-#include <drivers/shark_keyb26.h> |
-#include <drivers/shark_fb26.h> |
- |
-#define FRAME_BUFFER_DEVICE 0 |
- |
- |
-/*+ sysyem tick in us +*/ |
-#define TICK 0 |
- |
-/*+ RR tick in us +*/ |
-#define RRTICK 2000 |
- |
-/*+ Interrupt Server +*/ |
-#define INTDRIVE_Q 1000 |
-#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) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- INTDRIVE_register_level(INTDRIVE_Q,INTDRIVE_T,INTDRIVE_FLAG); |
- EDF_register_level(EDF_ENABLE_ALL); |
- RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_HARD|RRSOFT_ONLY_SOFT); |
- RR_register_level(RRTICK, RR_MAIN_YES, mb); |
- dummy_register_level(); |
- |
- SEM_register_module(); |
- |
- CABS_register_module(); |
- |
- NOP_register_module(); |
- |
- return TICK; |
-} |
- |
-TASK __init__(void *arg) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- HARTPORT_init(); |
- |
- set_shutdown_task(); |
- |
- device_drivers_init(); |
- |
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN); |
- |
- __call_main__(mb); |
- |
- return (void *)0; |
-} |
- |
-void set_shutdown_task() { |
- |
- NRT_TASK_MODEL nrt; |
- |
- nrt_task_default_model(nrt); |
- nrt_task_def_system(nrt); |
- |
- shutdown_task_PID = task_create("Shutdown Task",shutdown_task_body,&nrt,NULL); |
- if (shutdown_task_PID == NIL) { |
- sys_shutdown_message("Error: Cannot create shutdown task\n"); |
- sys_end(); |
- } |
- |
-} |
- |
-int device_drivers_init() { |
- |
- int res; |
- KEYB_PARMS kparms = BASE_KEYB; |
- |
- LINUXC26_register_module(); |
- |
- PCI26_init(); |
- |
- INPUT26_init(); |
- |
- keyb_def_ctrlC(kparms, NULL); |
- |
- KEYB26_init(&kparms); |
- |
- FB26_init(); |
- |
- res = FB26_open(FRAME_BUFFER_DEVICE); |
- if (res) { |
- cprintf("Error: Cannot open graphical mode\n"); |
- KEYB26_close(); |
- INPUT26_close(); |
- sys_end(); |
- } |
- |
- FB26_use_grx(FRAME_BUFFER_DEVICE); |
- |
- FB26_setmode(FRAME_BUFFER_DEVICE,"640x480-16"); |
- |
- return 0; |
- |
-} |
- |
-int device_drivers_close() { |
- |
- FB26_close(FRAME_BUFFER_DEVICE); |
- |
- KEYB26_close(); |
- |
- INPUT26_close(); |
- |
- return 0; |
- |
-} |
- |
-#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); |
-} |
- |
-TASK shutdown_task_body(void *arg) { |
- |
- device_drivers_close(); |
- |
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
- |
- sys_abort_shutdown(0); |
- |
- return NULL; |
- |
-} |
- |
-void app_mutex_init(mutex_t *m) |
-{ |
- NOP_mutexattr_t attr; |
- |
- NOP_mutexattr_default(attr); |
- |
- mutex_init(m, &attr); |
-} |
- |
Index: rel_1_4_rc1/jumpball/ecp.c |
=================================================================== |
--- rel_1_4_rc1/jumpball/ecp.c (revision 1476) |
+++ rel_1_4_rc1/jumpball/ecp.c (nonexistent) |
@@ -1,216 +0,0 @@ |
-/* |
- * Project: S.Ha.R.K. |
- * |
- * Coordinators: |
- * Giorgio Buttazzo <giorgio@sssup.it> |
- * Paolo Gai <pj@gandalf.sssup.it> |
- * |
- * Authors : |
- * Paolo Gai <pj@gandalf.sssup.it> |
- * (see the web pages for full authors list) |
- * |
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
- * |
- * http://www.sssup.it |
- * http://retis.sssup.it |
- * http://shark.sssup.it |
- */ |
- |
-/** |
- ------------ |
- CVS : $Id: ecp.c,v 1.5 2004-04-19 13:45:15 giacomo Exp $ |
- |
- File: $File$ |
- Revision: $Revision: 1.5 $ |
- Last update: $Date: 2004-04-19 13:45:15 $ |
- ------------ |
-**/ |
- |
-/* |
- * Copyright (C) 2003 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/intdrive.h" |
-#include "modules/edf.h" |
-#include "modules/cbs.h" |
-#include "modules/rr.h" |
-#include "modules/dummy.h" |
- |
-#include "modules/sem.h" |
-#include "modules/hartport.h" |
-#include "modules/cabs.h" |
- |
-#include "modules/pi.h" |
- |
-#include <drivers/shark_linuxc26.h> |
-#include <drivers/shark_pci26.h> |
-#include <drivers/shark_input26.h> |
-#include <drivers/shark_keyb26.h> |
-#include <drivers/shark_fb26.h> |
- |
-#define FRAME_BUFFER_DEVICE 0 |
- |
-/*+ sysyem tick in us +*/ |
-#define TICK 0 |
- |
-/*+ RR tick in us +*/ |
-#define RRTICK 2000 |
- |
-/*+ Interrupt Server +*/ |
-#define INTDRIVE_Q 1000 |
-#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) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- 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); |
- dummy_register_level(); |
- |
- SEM_register_module(); |
- CABS_register_module(); |
- PI_register_module(); |
- |
- return TICK; |
-} |
- |
-TASK __init__(void *arg) |
-{ |
- struct multiboot_info *mb = (struct multiboot_info *)arg; |
- |
- HARTPORT_init(); |
- |
- set_shutdown_task(); |
- |
- device_drivers_init(); |
- |
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN); |
- |
- __call_main__(mb); |
- |
- return (void *)0; |
-} |
- |
-void set_shutdown_task() { |
- |
- NRT_TASK_MODEL nrt; |
- |
- nrt_task_default_model(nrt); |
- nrt_task_def_system(nrt); |
- |
- shutdown_task_PID = task_create("Shutdown Task",shutdown_task_body,&nrt,NULL); |
- if (shutdown_task_PID == NIL) { |
- sys_shutdown_message("Error: Cannot create shutdown task\n"); |
- sys_end(); |
- } |
- |
-} |
- |
-int device_drivers_init() { |
- |
- int res; |
- KEYB_PARMS kparms = BASE_KEYB; |
- |
- LINUXC26_register_module(); |
- |
- PCI26_init(); |
- |
- INPUT26_init(); |
- |
- keyb_def_ctrlC(kparms, NULL); |
- |
- KEYB26_init(&kparms); |
- |
- FB26_init(); |
- |
- res = FB26_open(FRAME_BUFFER_DEVICE); |
- if (res) { |
- cprintf("Error: Cannot open graphical mode\n"); |
- KEYB26_close(); |
- INPUT26_close(); |
- sys_end(); |
- } |
- |
- FB26_use_grx(FRAME_BUFFER_DEVICE); |
- |
- FB26_setmode(FRAME_BUFFER_DEVICE,"640x480-16"); |
- |
- return 0; |
- |
-} |
- |
-int device_drivers_close() { |
- |
- FB26_close(FRAME_BUFFER_DEVICE); |
- |
- KEYB26_close(); |
- |
- INPUT26_close(); |
- |
- return 0; |
- |
-} |
- |
-#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); |
-} |
- |
-TASK shutdown_task_body(void *arg) { |
- |
- device_drivers_close(); |
- |
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
- |
- sys_abort_shutdown(0); |
- |
- return NULL; |
- |
-} |
- |
-void app_mutex_init(mutex_t *m) |
-{ |
- PI_mutexattr_t attr; |
- |
- PI_mutexattr_default(attr); |
- |
- mutex_init(m, &attr); |
-} |
Index: rel_1_4_rc1/jumpball/jetctrl.c |
=================================================================== |
--- rel_1_4_rc1/jumpball/jetctrl.c (revision 1476) |
+++ rel_1_4_rc1/jumpball/jetctrl.c (nonexistent) |
@@ -1,236 +0,0 @@ |
-/* |
- * Project: S.Ha.R.K. |
- * |
- * Coordinators: |
- * Giorgio Buttazzo <giorgio@sssup.it> |
- * Paolo Gai <pj@gandalf.sssup.it> |
- * |
- * Authors : |
- * Paolo Gai <pj@gandalf.sssup.it> |
- * (see the web pages for full authors list) |
- * |
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
- * |
- * http://www.sssup.it |
- * http://retis.sssup.it |
- * http://shark.sssup.it |
- */ |
- |
-/** |
- ------------ |
- CVS : $Id: jetctrl.c,v 1.4 2004-04-18 18:48:22 giacomo Exp $ |
- |
- File: $File$ |
- Revision: $Revision: 1.4 $ |
- Last update: $Date: 2004-04-18 18:48:22 $ |
- ------------ |
-**/ |
- |
-/* |
- * 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 |
- * |
- */ |
- |
- |
-// JetControl |
- |
-#include "demo.h" |
-#include "kernel/func.h" |
- |
-TASK jetdummy_task(void *arg) |
-{ |
- TIME now_dummy, last_dummy, diff_dummy, slice; |
- struct timespec now, last, diff; |
- int x = 0; |
- int height; |
- |
- NULL_TIMESPEC(&last); |
- last_dummy = 0; |
- for (;;) { |
- task_nopreempt(); |
- jet_getstat(DUMMY_PID, NULL, NULL, NULL, &now_dummy); |
- sys_gettime(&now); |
- task_preempt(); |
- |
- SUBTIMESPEC(&now, &last, &diff); |
- slice = diff.tv_sec * 1000000 + diff.tv_nsec/1000; |
- diff_dummy = now_dummy - last_dummy; |
- |
- height = (int)(JET_DUMMY_HEIGHT*((float)diff_dummy)/((float)slice)); |
- |
- TIMESPEC_ASSIGN(&last, &now); |
- last_dummy = now_dummy; |
- |
- grx_line(JET_DUMMY_X+x,JET_DUMMY_Y, |
- JET_DUMMY_X+x,JET_DUMMY_Y+height ,black); |
- grx_line(JET_DUMMY_X+x,JET_DUMMY_Y+height, |
- JET_DUMMY_X+x,JET_DUMMY_Y+JET_DUMMY_HEIGHT,white); |
- grx_line(JET_DUMMY_X+(x+1)%JET_DUMMY_WIDTH,JET_DUMMY_Y, |
- JET_DUMMY_X+(x+1)%JET_DUMMY_WIDTH,JET_DUMMY_Y+JET_DUMMY_HEIGHT,255); |
- |
- x = (x+1)%JET_DUMMY_WIDTH; |
- |
- task_endcycle(); |
- } |
-} |
- |
- |
-TASK jetctrl_task(void *arg) |
-{ |
- char st[50]; |
- TIME sum, max; |
- int n; |
- |
- PID i; |
- int printed = 0; |
- |
- for (;;) { |
- for (i=2, printed=0; i<MAX_PROC && printed<JET_NTASK; i++) { |
- if (jet_getstat(i, &sum, &max, &n, NULL) != -1) { |
- if (!n) n=1; |
- sprintf(st, "%6d %6d %10s", (int)sum/n, (int)max, proc_table[i].name); |
- grx_text(st, 384, JET_Y_NAME+16+printed*8, gray, black); |
- printed++; |
- } |
- } |
- while (printed<JET_NTASK) { |
- grx_text(" ", |
- 384, JET_Y_NAME+16+printed*8, gray, black); |
- printed++; |
- } |
- task_endcycle(); |
- } |
-} |
- |
-TASK jetslide_task(void *arg) |
-{ |
- TIME sum, curr, max; |
- |
- TIME total[JET_NTASK]; |
- int slides[JET_NTASK]; |
- |
- PID i; |
- int printed = 0; |
- |
- for (;;) { |
- // Fill the total array in a nonpreemptive section |
- task_nopreempt(); |
- for (i=2, printed=0; i<MAX_PROC && printed<JET_NTASK; i++) { |
- if (jet_getstat(i, &sum, NULL, NULL, &curr) != -1) { |
- total[printed] = sum+curr; |
- printed++; |
- } |
- } |
- task_preempt(); |
- |
- while (printed < JET_NTASK) |
- total[printed++] = 0; |
- |
- // Compute the Max elapsed time |
- max = 0; |
- for (i=0; i<JET_NTASK; i++) |
- if (total[i] > max) max = total[i]; |
- if (!max) max = 1; |
- |
- // Compute the slides width |
- for (i=0; i<JET_NTASK; i++) |
- slides[i] = (int)( (((float)total[i])/max) * JET_SLIDE_WIDTH); |
- |
- // print the data |
- for (i=0; i<JET_NTASK; i++) { |
- grx_box(JET_SLIDE_X, JET_Y_NAME+16+i*8, |
- JET_SLIDE_X+slides[i], JET_Y_NAME+23+i*8, gray); |
- grx_box(JET_SLIDE_X+slides[i], JET_Y_NAME+16+i*8, |
- JET_SLIDE_X+JET_SLIDE_WIDTH, JET_Y_NAME+23+i*8, black); |
- } |
- |
- while (i<JET_NTASK) { |
- grx_box(JET_SLIDE_X, JET_Y_NAME+16+i*8, |
- JET_SLIDE_X+JET_SLIDE_WIDTH, JET_Y_NAME+20+i*8, black); |
- i++; |
- } |
- task_endcycle(); |
- } |
-} |
- |
- |
-void scenario_jetcontrol(void) |
-{ |
- grx_text("System load" , 384, 45, rgb16(0,0,255), black); |
- grx_line(384,55,639,55,red); |
- |
- grx_text(" Mean Max Name Slide", 384, JET_Y_NAME, gray, black); |
- grx_line(384,JET_Y_NAME+10,639,JET_Y_NAME+10,gray); |
- |
- grx_rect(JET_DUMMY_X-1, JET_DUMMY_Y-1, |
- JET_DUMMY_X+JET_DUMMY_WIDTH, JET_DUMMY_Y+JET_DUMMY_HEIGHT+1, gray); |
- |
- grx_text("100%", JET_DUMMY_X-40, JET_DUMMY_Y, gray, black); |
- grx_text(" 0%", JET_DUMMY_X-40, JET_DUMMY_Y+JET_DUMMY_HEIGHT-8, gray, black); |
- |
- grx_line(JET_DUMMY_X-1, JET_DUMMY_Y, JET_DUMMY_X-5, JET_DUMMY_Y, gray); |
- grx_line(JET_DUMMY_X-1, JET_DUMMY_Y+JET_DUMMY_HEIGHT, JET_DUMMY_X-5, JET_DUMMY_Y+JET_DUMMY_HEIGHT, gray); |
-} |
- |
-void init_jetcontrol(void) |
-{ |
- SOFT_TASK_MODEL m3, m4, m5; |
- |
- PID p3, p4, p5; |
- |
- soft_task_default_model(m3); |
- soft_task_def_level(m3,2); |
- soft_task_def_period(m3, PERIOD_JETCTRL); |
- soft_task_def_met(m3, WCET_JETCTRL); |
- soft_task_def_ctrl_jet(m3); |
- soft_task_def_group(m3, 1); |
- p3 = task_create("jctrl", jetctrl_task, &m3, NULL); |
- if (p3 == -1) { |
- sys_shutdown_message("Could not create task <jetctrl> errno=%d", |
- errno); |
- sys_end(); |
- } |
- |
- soft_task_default_model(m4); |
- soft_task_def_level(m4,2); |
- soft_task_def_period(m4, PERIOD_JETDUMMY); |
- soft_task_def_met(m4, WCET_JETDUMMY); |
- soft_task_def_group(m4, 1); |
- soft_task_def_usemath(m4); |
- soft_task_def_ctrl_jet(m4); |
- p4 = task_create("jdmy", jetdummy_task, &m4, NULL); |
- if (p4 == -1) { |
- sys_shutdown_message("Could not create task <jetdummy> errno=%d", |
- errno); |
- sys_end(); |
- } |
- |
- soft_task_default_model(m5); |
- soft_task_def_level(m5,2); |
- soft_task_def_period(m5, PERIOD_JETSLIDE); |
- soft_task_def_met(m5, WCET_JETSLIDE); |
- soft_task_def_group(m5, 1); |
- soft_task_def_usemath(m5); |
- soft_task_def_ctrl_jet(m5); |
- p5 = task_create("jsli", jetslide_task, &m5, NULL); |
- if (p5 == -1) { |
- sys_shutdown_message("Could not create task <jetslide> errno=%d", |
- errno); |
- sys_end(); |
- } |
-} |
- |
Index: rel_1_4_rc1/jumpball/demo.h |
=================================================================== |
--- rel_1_4_rc1/jumpball/demo.h (revision 1476) |
+++ rel_1_4_rc1/jumpball/demo.h (nonexistent) |
@@ -1,183 +0,0 @@ |
-/* |
- * Project: S.Ha.R.K. |
- * |
- * Coordinators: |
- * Giorgio Buttazzo <giorgio@sssup.it> |
- * Paolo Gai <pj@gandalf.sssup.it> |
- * |
- * Authors : |
- * Paolo Gai <pj@gandalf.sssup.it> |
- * (see the web pages for full authors list) |
- * |
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
- * |
- * http://www.sssup.it |
- * http://retis.sssup.it |
- * http://shark.sssup.it |
- */ |
- |
-/** |
- ------------ |
- CVS : $Id: demo.h,v 1.6 2004-04-18 09:45:27 giacomo Exp $ |
- |
- File: $File$ |
- Revision: $Revision: 1.6 $ |
- Last update: $Date: 2004-04-18 09:45:27 $ |
- ------------ |
-**/ |
- |
-/* |
- * 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 <ll/ll.h> |
-#include <kernel/types.h> |
-#include <kernel/descr.h> |
-#include <math.h> |
- |
-#include <drivers/shark_linuxc26.h> |
-#include <drivers/shark_pci26.h> |
-#include <drivers/shark_input26.h> |
-#include <drivers/shark_keyb26.h> |
-#include <drivers/shark_fb26.h> |
- |
-#define FRAME_BUFFER_DEVICE 0 |
- |
-/* Subparts */ |
-#define JET_ON |
-#define BALL_ON |
- |
- |
-/* CPU Speed Selection |
- -------------------------------------------------------------------- |
- 1700 - Pentium 4 1.7 GHz |
- 1300 - Centrino 1.3 GHz |
- 400 - Pentium 2 400 MHz |
- 133 - Pentium 1 133 MHz |
-*/ |
-#define CPU 400 |
- |
-/* |
- * |
- * WCET, Periods and Models |
- * |
- */ |
- |
-#if CPU==133 |
-#define WCET_JETCTRL 10000 |
-#define WCET_JETDUMMY 300 |
-#define WCET_JETSLIDE 2000 |
-#define WCET_BALL 250 |
-#define WCET_HARD_BALL 1000 |
-#define BALL_DELAY 10000 |
-#endif |
- |
-#if CPU==400 |
-#define WCET_JETCTRL 7500 |
-#define WCET_JETDUMMY 200 |
-#define WCET_JETSLIDE 2100 |
-#define WCET_BALL 100 |
-#define WCET_HARD_BALL 380 |
-#define BALL_DELAY 10000 |
-#endif |
- |
-#if CPU==1300 |
-#define WCET_JETCTRL 4500 |
-#define WCET_JETDUMMY 100 |
-#define WCET_JETSLIDE 1300 |
-#define WCET_BALL 100 |
-#define WCET_HARD_BALL 650 |
-#define BALL_DELAY 100000 |
-#endif |
- |
-#if CPU==1700 |
-#define WCET_JETCTRL 4500 |
-#define WCET_JETDUMMY 100 |
-#define WCET_JETSLIDE 1300 |
-#define WCET_BALL 100 |
-#define WCET_HARD_BALL 410 |
-#define BALL_DELAY 100000 |
-#endif |
- |
-#define PERIOD_JETCTRL 100000 |
-#define PERIOD_JETDUMMY 100000 |
-#define PERIOD_JETSLIDE 100000 |
-#define PERIOD_BALL 10000 |
- |
-/* |
- * |
- * Global Stuffs |
- * |
- */ |
- |
-extern PID shutdown_task_PID; |
- |
-/* graphic mutex... */ |
-extern mutex_t mutex; |
- |
-/* useful colors... */ |
-extern int white; |
-extern int black; |
-extern int red; |
-extern int gray; |
- |
-void init_jetcontrol(); |
-void init_ball(void); |
-void scenario_jetcontrol(); |
-void scenario_ball(); |
-char *itoa(int n, char *s); |
-int myrand(int x); |
- |
-/* |
- * |
- * JETCONTROL stuffs |
- * |
- */ |
- |
-#define JET_NTASK 35 |
-#define JET_Y_NAME 170 |
- |
-#define DUMMY_PID 1 |
- |
-#define JET_DUMMY_WIDTH 210 |
-#define JET_DUMMY_HEIGHT 80 |
- |
-/* the point (x, y) is the top left corner */ |
-#define JET_DUMMY_X 428 |
-#define JET_DUMMY_Y 65 |
- |
-#define JET_SLIDE_WIDTH 50 |
-#define JET_SLIDE_X 576 |
- |
-/* |
- * |
- * BALL stuffs |
- * |
- */ |
- |
-// x and y corners are specified whithout consider a border of 3 pixels |
-#define BALL_Y 450 /* position of the floor */ |
-#define BALL_HEIGHT 385 /* initial height of the ball */ |
-#define BALL_XMIN 10 /* min position X of the ball */ |
-#define BALL_XMAX 370 /* max position X of the ball */ |
-#define BALL_VELX 5. /* horizontal ball velocity */ |
-#define BALL_VYMIN 11. /* min ground speed */ |
-#define BALL_MAX_P 60 /* max number of balls */ |
- |
-#define BALL_GROUP 2 /* task group of the balls */ |
Index: rel_1_4_rc1/jumpball/readme.txt |
=================================================================== |
--- rel_1_4_rc1/jumpball/readme.txt (revision 1476) |
+++ rel_1_4_rc1/jumpball/readme.txt (nonexistent) |
@@ -1,94 +0,0 @@ |
----------------------------------- |
-Jumping Balls demo |
- |
-by |
- |
-Paolo Gai 1999-2001 - pj@sssup.it |
- |
----------------------------------- |
- |
-This demo was created to show some S.Ha.R.K. functionalities in the course |
-of Informatica Industriale , University of Pavia, Italy. |
- |
-The demo is composed by an application (derived by the template application |
-distributed on the web site) and two init files. |
- |
-The demo is composed by: |
- |
-MAKEFILE The makefile used to compile the application; |
- demo is the rule to compile the application with a CBS scheduler |
- demo2 is the rule to compile the application with a RR scheduler |
-README.TXT This file |
-DEMO.H Some constants used into the demo |
-ECP.C, ERN.C, RRP.C, RRN.C Various initfiles |
-INITFIL2.C The EDF initfile |
-INITFILE.C A makefile that cover either EDF+CBS and RR |
-BALL.C The Jumping balls part of the demo |
-DEMO.C The main() function and some other utility function |
-JETCTRL.C The JET part of the demo |
- |
-The demo works as follows: |
-- It works at 640x480 16 bit colors |
-- on the left, there is the jumping ball arena, on the rigth there is the |
- statistics about the tasks into the system. |
- |
-- the tasks are guaranteed using CBS and EDF. The wcet and mean execution |
- time on my portable after a few minutes are (us): |
- |
- JetCtrl 7400 max 7500 CBS met |
- JetDummy 135 max 200 CBS met |
- JetSlide 2100 max 2100 CBS met |
- Balls 276 max 380 EDF wcet for hard ball,100 CBS met for soft ones |
- |
- The system should go overloaded with 40 soft balls. |
- |
-- The idea is the following: |
- - first, an edf guaranteed ball is created. |
- - then, create a set of soft ball using space. since their met is < than the |
- real met, they posticipate the deadlines. |
- - if they are killed, they remain for some seconds in the zombie state |
- - if a set of soft ball arde created (i.e., 10), and after a while all the |
- others are created, the bandwidth is fully used, and the task posticipate |
- their deadlines. the first set of tasks stops jumping when the bandwidth |
- is full utilized by the newest balls until all the tasks have similar |
- deadlines. |
- - Note on the left the slides that represents the relative ratio |
- between the tasks. |
- - Note that in overload conditions the EDF task is still guaranteed |
- - Note that PI is used with EDF, also if no theory says that it is good: |
- - S.Ha.R.K. allows that, it is the user that have to choose if that is |
- a non-sense |
- - PI is independent from the implemnentation of the scheduling modules |
- - if the second init file is used, RR is used instead of EDF+CBS. |
- - In overload condition RR perform differently from EDF+CBS, giving to |
- each task an equal fraction of bandwidth |
- |
- - note also: |
- - the redefinition of the standard exception handler |
- - the redefinition of the keys and the initialization of the keyboard |
- - the myend exit function |
- - the main() that terminates |
- - the two parts (ball and jet) can be excluded using a #define |
- |
-If You have any question, please contact the author... |
- |
-Update (2003/12/19): |
-Just some more notes... |
-I usually show the four demos in the following order: |
- |
-(first of all, tune the demo depending on how fast your notebook is; see demo.h) |
- |
-ECP - EDF with CBS and PI... the white EDF ball still work also in overload; CBS balls just slow down but they still get their guaranteed bandwidth |
- |
-RRP - Round Robin with Priority inheritance ... the EDF ball is at the same level of the others, all slow down... |
- |
-RRN - 2 levels of Round Robin, without Priority inheritance ... when |
-there is overload, the white ball works ok, but the other have an impredicible |
-behavior (they execute many instances in one RR period) |
- |
-ERN - EDF, RR, no priority inheritance - the white ball misses his deadline |
-just when there is an overload (all the other balls are queued on the same |
-semaphore, so the blocking time increase, and when there is overload the EDF |
-task misses also if it has not consumed his bandwidth). Note that it happens |
-also if the EDF task consume just a few microseconds... Real time does not |
-means "fast" :-) |
Index: rel_1_4_rc1/jumpball/ball.c |
=================================================================== |
--- rel_1_4_rc1/jumpball/ball.c (revision 1476) |
+++ rel_1_4_rc1/jumpball/ball.c (nonexistent) |
@@ -1,247 +0,0 @@ |
-/* |
- * Project: S.Ha.R.K. |
- * |
- * Coordinators: |
- * Giorgio Buttazzo <giorgio@sssup.it> |
- * Paolo Gai <pj@gandalf.sssup.it> |
- * |
- * Authors : |
- * Paolo Gai <pj@gandalf.sssup.it> |
- * (see the web pages for full authors list) |
- * |
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
- * |
- * http://www.sssup.it |
- * http://retis.sssup.it |
- * http://shark.sssup.it |
- */ |
- |
-/** |
- ------------ |
- CVS : $Id: ball.c,v 1.6 2004-04-18 18:48:22 giacomo Exp $ |
- |
- File: $File$ |
- Revision: $Revision: 1.6 $ |
- Last update: $Date: 2004-04-18 18:48:22 $ |
- ------------ |
-**/ |
- |
-/* |
- * 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 |
- * |
- */ |
- |
-/*--------------------------------------------------------------*/ |
-/* SIMULATION OF JUMPING BALLS */ |
-/*--------------------------------------------------------------*/ |
- |
-#include "demo.h" |
-#include <kernel/func.h> |
-#include <stdlib.h> |
- |
-#define R 8 /* dimension of a ball */ |
-#define G 9.8 /* acceleration of gravity */ |
- |
-static int ballexit = 0; |
-static int npc = 0; /* number of tasks created */ |
- |
-/*--------------------------------------------------------------*/ |
-/* Delay function for jumping balls */ |
-/*--------------------------------------------------------------*/ |
- |
-void my_delay(void) |
-{ |
- int xxx; |
- for (xxx=0; xxx<BALL_DELAY; xxx++); |
-} |
- |
-/*--------------------------------------------------------------*/ |
-/* Periodic task for ball simulation */ |
-/*--------------------------------------------------------------*/ |
- |
-TASK palla(int i) |
-{ |
-int x, y; /* coordinate grafiche pallina */ |
-int ox, oy; /* vecchia posizione pallina */ |
-int x0, y0; /* posizione iniziale X pallina */ |
-float vx, vy; /* velocitÂ… della pallina */ |
-float vy0; /* velocita' pallina al primo rimbalzo */ |
-float ty, tx; /* variabile temporale */ |
-float dt; /* incremento temporale */ |
- |
- y = oy = y0 = BALL_HEIGHT; |
- x = ox = x0 = BALL_XMIN; |
- |
- vy0= sqrt(2. * G * (float)BALL_HEIGHT); |
- vy = 0; |
- vx = BALL_VELX + myrand(9); |
- tx = 0; |
- ty = 0; |
- dt = ((float)PERIOD_BALL)/100000; |
- |
- while (1) { |
- y = y0 + vy*ty - .5*G*ty*ty; |
- x = x0 + vx * tx; |
- |
- if (y < 0) { |
- y = 0; |
- |
- if (vy == 0.0) |
- vy = vy0; |
- else if (vy < BALL_VYMIN) |
- vy = vy0 * (1.0 - myrand(50)/100.0); |
- else |
- vy = 0.9 * vy; |
- |
- ty = 0.0; |
- y0 = 0; |
- } |
- |
- if (x > BALL_XMAX) { |
- tx = 0.0; |
- x0 = BALL_XMAX; |
- vx = -vx; |
- x = x0 + vx * tx; |
- } |
- |
- if (x < BALL_XMIN) { |
- tx = 0.0; |
- x0 = BALL_XMIN; |
- vx = -vx; |
- x = x0 + vx * tx; |
- } |
- |
- mutex_lock(&mutex); |
- grx_disc(ox, oy, R, 0); |
- ox = x; |
- oy = BALL_Y - y; |
- mutex_unlock(&mutex); |
- |
- if (ballexit && i!=0xFFFF) { |
- npc--; |
- return 0; |
- } |
- |
- mutex_lock(&mutex); |
- grx_disc(ox, oy, R, i); |
- mutex_unlock(&mutex); |
- |
- my_delay(); |
- |
- ty += dt; |
- tx += dt; |
- task_endcycle(); |
- } |
-} |
- |
-void killball(KEY_EVT *k) |
-{ |
- ballexit = 1; |
-} |
- |
-void ballfun(KEY_EVT *k) |
-{ |
- SOFT_TASK_MODEL mp; |
- int r,g,b; |
- PID pid; |
- char palla_str[]="palla "; |
- |
- if (npc == BALL_MAX_P) return; |
- |
- ballexit = 0; |
- |
- r = 64 + myrand(190); |
- g = 64 + myrand(190); |
- b = 64 + myrand(190); |
- |
- itoa(npc,palla_str+5); |
- |
- soft_task_default_model(mp); |
- soft_task_def_level(mp,2); |
- soft_task_def_ctrl_jet(mp); |
- soft_task_def_arg(mp, (void *)rgb16(r,g,b)); |
- soft_task_def_group(mp, BALL_GROUP); |
- soft_task_def_met(mp, WCET_BALL); |
- soft_task_def_period(mp,PERIOD_BALL); |
- soft_task_def_usemath(mp); |
- pid = task_create(palla_str, palla, &mp, NULL); |
- |
- if (pid != NIL) { |
- task_activate(pid); |
- npc++; |
- } |
-} |
- |
-void hardball() |
-{ |
- HARD_TASK_MODEL mp; |
- int r,g,b; |
- PID pid; |
- |
- r = 255; |
- g = 255; |
- b = 255; |
- |
- hard_task_default_model(mp); |
- hard_task_def_ctrl_jet(mp); |
- hard_task_def_arg(mp, (void *)rgb16(r,g,b)); |
- hard_task_def_wcet(mp, WCET_HARD_BALL); |
- hard_task_def_mit(mp,PERIOD_BALL); |
- hard_task_def_usemath(mp); |
- pid = task_create("pallaEDF", palla, &mp, NULL); |
- if (pid == NIL) { |
- sys_shutdown_message("Could not create task <pallaEDF>"); |
- sys_end(); |
- return; |
- } |
- else |
- task_activate(pid); |
-} |
- |
- |
-/*--------------------------------------------------------------*/ |
-/* MAIN process */ |
-/*--------------------------------------------------------------*/ |
- |
-void scenario_ball() |
-{ |
- grx_text("Noise", 0, 45 /*BALL_Y-BALL_HEIGHT-15*/, rgb16(0,0,255), black); |
- grx_line(0,55,383,55,red); |
- grx_rect(BALL_XMIN-R-1, BALL_Y-BALL_HEIGHT-R-1, |
- BALL_XMAX+R+1, BALL_Y+R+1, rgb16(0,200,0)); |
-} |
- |
-void init_ball(void) |
-{ |
- KEY_EVT k; |
- |
- hardball(); |
- |
- k.flag = 0; |
- k.scan = KEY_SPC; |
- k.ascii = ' '; |
- k.status = KEY_PRESSED; |
- keyb_hook(k,ballfun,FALSE); |
- |
- k.flag = 0; |
- k.scan = KEY_BKS; |
- k.ascii = ' '; |
- k.status = KEY_PRESSED; |
- keyb_hook(k,killball,FALSE); |
-} |
- |
-/*--------------------------------------------------------------*/ |
Index: rel_1_4_rc1/jumpball/makefile |
=================================================================== |
--- rel_1_4_rc1/jumpball/makefile (revision 1476) |
+++ rel_1_4_rc1/jumpball/makefile (nonexistent) |
@@ -1,24 +0,0 @@ |
-# |
-# |
-# |
- |
-ifndef BASE |
-BASE=../.. |
-endif |
-include $(BASE)/config/config.mk |
- |
-PROGS= ecp ern rrp rrn |
- |
-include $(BASE)/config/example.mk |
- |
-ecp: |
- make -f $(SUBMAKE) APP=ecp INIT= OTHEROBJS="demo.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __FB__" |
- |
-ern: |
- make -f $(SUBMAKE) APP=ern INIT= OTHEROBJS="demo.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __FB__" |
- |
-rrp: |
- make -f $(SUBMAKE) APP=rrp INIT= OTHEROBJS="demo.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __FB__" |
- |
-rrn: |
- make -f $(SUBMAKE) APP=rrn INIT= OTHEROBJS="demo.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __FB__" |