Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1609 → Rev 1610

/demos/trunk/loader/marte/makefile.in
File deleted
/demos/trunk/loader/shark/initfile.c
File deleted
/demos/trunk/loader/shark/shark.c
File deleted
/demos/trunk/loader/shark/shark.h
File deleted
/demos/trunk/loader/shark/shark.mak
File deleted
/demos/trunk/loader/shark/func.h
File deleted
/demos/trunk/loader/shark/makefile.in
File deleted
/demos/trunk/loader/shark/fsfinit.c
File deleted
/demos/trunk/loader/generators/lparser.h
File deleted
/demos/trunk/loader/generators/java/Application.java
File deleted
/demos/trunk/loader/generators/java/task_class.java
File deleted
/demos/trunk/loader/generators/java/fsf-schema.xsd
File deleted
/demos/trunk/loader/generators/java/timespec.java
File deleted
/demos/trunk/loader/generators/java/java_gen
File deleted
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: demos/trunk/loader/generators/java/makefile
===================================================================
--- demos/trunk/loader/generators/java/makefile (revision 1609)
+++ demos/trunk/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: demos/trunk/loader/generators/lread.c
===================================================================
--- demos/trunk/loader/generators/lread.c (revision 1609)
+++ demos/trunk/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, &current_c);
- else
- res = line_parser_contract(&pbuf, line_num, total, &current_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, &current_t);
- else
- res = line_parser_task(&pbuf, line_num, &current_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: demos/trunk/loader/generators/lparser.c
===================================================================
--- demos/trunk/loader/generators/lparser.c (revision 1609)
+++ demos/trunk/loader/generators/lparser.c (nonexistent)
@@ -1,486 +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;
- }
-
- if (!strncmp(*buf,"NONE",2)) {
- *buf += 4;
- *val = PAR_NONE;
- 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: demos/trunk/loader/generators/event_gen.c
===================================================================
--- demos/trunk/loader/generators/event_gen.c (revision 1609)
+++ demos/trunk/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: demos/trunk/loader/generators/lread.h
===================================================================
--- demos/trunk/loader/generators/lread.h (revision 1609)
+++ demos/trunk/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: demos/trunk/loader/generators/makefile
===================================================================
--- demos/trunk/loader/generators/makefile (revision 1609)
+++ demos/trunk/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: demos/trunk/loader/loadfile/loadm.fsf
===================================================================
--- demos/trunk/loader/loadfile/loadm.fsf (revision 1609)
+++ demos/trunk/loader/loadfile/loadm.fsf (nonexistent)
@@ -1,72 +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
-# NONE - DEFAULT FOR THE FRAMEWORK
-# POSIX
-# 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][6000]:[0][30000]:[0][6000]:[0][30000]:[0]:[0][0]:EDF;
-[1]:[0][6000]:[0][60000]:[0][6000]:[0][60000]:[0]:[0][0]:EDF;
-[2]:[0][12000]:[0][60000]:[0][12000]:[0][60000]:[0]:[0][0]:POSIX;
-
-END
-
-TASK SECTION
-
-CT:[0]:EDF:[2]:[1][0]:[0][40000]:ACT_PERIODIC([1][0],[1][0]):
-:EXEC_CONST([0][16000]):CRIT([0],[0][2000]);
-
-CT:[1]:EDF:[2]:[1][0]:[0][40000]:ACT_PERIODIC([2][0],[1][0]):
-:EXEC_MEAN([0][16000],[0][10000]):CRIT([0],[0][2000]);
-
-BT:[2]:POSIX:[2]:[0][0]:[0][0]:ACT_SINGLE([3][0]):
-:EXEC_CONST([0][10000]):CRIT([0],[0][2000]);
-
-END
-
Index: demos/trunk/loader/loadfile/load.fsf
===================================================================
--- demos/trunk/loader/loadfile/load.fsf (revision 1609)
+++ demos/trunk/loader/loadfile/load.fsf (nonexistent)
@@ -1,76 +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
-# EDF
-# RM
-# NONE DEFAULT FROM THE FRAMEWORK
-#
-# 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: demos/trunk/loader/loadfile/loadr.fsf
===================================================================
--- demos/trunk/loader/loadfile/loadr.fsf (revision 1609)
+++ demos/trunk/loader/loadfile/loadr.fsf (nonexistent)
@@ -1,72 +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
-# NONE - DEFAULT FOR THE FRAMEWORK
-# POSIX
-# 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][9000]:[0][30000]:[0][9000]:[0][30000]:[0]:[0][0]:EDF;
-[1]:[0][9000]:[0][30000]:[0][9000]:[0][30000]:[0]:[0][0]:EDF;
-[2]:[0][6000]:[0][60000]:[0][6000]:[0][60000]:[0]:[0][0]:POSIX;
-
-END
-
-TASK SECTION
-
-CT:[0]:EDF:[2]:[0][100000]:[0][40000]:ACT_PERIODIC([0][0],[0][100000]):
-:EXEC_MEAN([0][8000]:[0][14000]):NO_CRIT;
-
-CT:[1]:EDF:[2]:[0][100000]:[0][40000]:ACT_PERIODIC([0][0],[0][100000]):
-:EXEC_MEAN([0][8000]:[0][14000]):NO_CRIT;
-
-BT:[2]:POSIX:[2]:[0][0]:[0][0]:ACT_SINGLE([0][0]):
-:EXEC_CONST([0][10000]):NO_CRIT;
-
-END
-
Index: demos/trunk/loader/loadfile/loadxml.fsf2
===================================================================
--- demos/trunk/loader/loadfile/loadxml.fsf2 (revision 1609)
+++ demos/trunk/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>