Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1254 → Rev 1255

/demos/trunk/loader/common/nload.h
1,6 → 1,8
/* Generic Struct for loader task */
#ifndef __NLOAD_H__
#define __NLOAD_H__
 
#include "lconst.h" //Constant definition for loader and linux parser
#include "func.h" //Constant definition for loader and linux parser
 
struct loader_task {
 
35,3 → 37,5
 
};
 
#endif
 
/demos/trunk/loader/common/calibrate.h
1,8 → 1,8
 
/* Nunber of calibration iterations */
#define CALIBRATING_DELTA 100000
#define CALIBRATION_DELTA 100000
 
/* Usec of exec time for CALIBRATING_DELTA iterations
Set to 0 if you calibrate during loader execution */
#define CALIBRATING_RESULT 0
#define CALIBRATION_RESULT 0
 
/demos/trunk/loader/common/nload.c
12,11 → 12,12
#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 = CALIBRATING_RESULT; //Calibration const, it converts usec to cycles
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
/demos/trunk/loader/shark/func.h
1,6 → 1,7
#ifndef FUNC_H
#define FUNC_H
#ifndef __FUNC_H__
#define __FUNC_H__
 
#include "kernel/kern.h"
#include "shark.h"
 
#define get_current_exec_task() exec_shadow
15,7 → 16,6
#define generic_task_endcycle() task_endcycle()
#define generic_end_simulation() sys_end()
#define printf cprintf
#endif
 
#endif
 
/demos/trunk/loader/shark/shark.c
1,4 → 1,5
#include "func.h"
#include "common/calibrate.h"
 
extern int cal_cycles;
extern struct timespec zero_time;
13,7 → 14,7
long long i;
struct timespec start,end,diff;
 
if (cal_cycles != 0) return;
if (cal_cycles != 0) return 0;
 
kern_cli();
kern_gettime(&start);
/demos/trunk/loader/shark/shark.h
1,8 → 1,8
#ifndef SHARK_H
#define SHARK_H
#ifndef __SHARK_H__
#define __SHARK_H__
 
#include "kernel/kern.h"
#include "common/nload.h"
#include "common/lconst.h"
 
int calibrate_cycle();
void start_simulation();
12,6 → 12,6
void loader_task_activate(struct loader_task *l);
int get_server_from_contract(int contract);
 
int fsfinit();
void fsfinit();
 
#endif
/demos/trunk/loader/generators/makefile
6,6 → 6,6
 
clean:
 
rm *.o
rm event_gen
rm -f *.o
rm -f event_gen
 
/demos/trunk/loader/makefile
12,5 → 12,12
include $(BASE)/config/example.mk
 
nload:
make -f $(SUBMAKE) APP="./common/nload" INIT= OTHEROBJS="./shark/initfile.o ./shark/shark.o ./shark/fsfinit.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __FIRST__"
make -f $(SUBMAKE) APP="./common/nload" INIT= OTHEROBJS="./generators/event.o ./shark/initfile.o ./shark/shark.o ./shark/fsfinit.o" OTHERINCL="-I. -I./shark" SHARKOPT="__OLDCHAR__ __FIRST__"
 
allclean:
 
rm -f common/*.o
rm -f shark/*.o
rm -f generators/*.o
rm -f common/nload
 
/demos/trunk/oldload/dosread.c
0,0 → 1,68
#include <kernel/kern.h>
#include <stdlib.h>
#include "parser.h"
 
int dos_preload(char *file_name, long max_size, void **start_file, void **end_file)
{
DOS_FILE* file;
void *buf;
long rd;
file = DOS_fopen(file_name,"r");
if (file == NULL) return -1;
buf = malloc(max_size);
*start_file = buf;
while(((rd = DOS_fread(buf, sizeof(BYTE), 2048, file)) == 2048) &&
((buf - *start_file + rd) < (max_size-2048))) {
buf += rd;
}
*end_file = buf + rd;
DOS_fclose(file);
return(0);
}
 
int line_reader(void *start_file, void *end_file, struct timespec *total, struct loader_task **start_loader_task)
{
char *pbuf = start_file;
int res,line_num,total_loader_task;
struct loader_task *current = NULL;
 
NULL_TIMESPEC(total);
 
line_num = 0;
total_loader_task = 0;
while ((void *)(pbuf) < end_file) {
line_num++;
 
if (*start_loader_task == NULL)
res = line_parser(&pbuf, line_num, total, &current);
else
res = line_parser(&pbuf, line_num, total, &current->next);
 
if (res == 2) {
total_loader_task++;
if (*start_loader_task == NULL)
*start_loader_task = current;
else
current = current->next;
}
 
if (res == 3) break;
 
}
 
cprintf("Total decoded lines %d\n",line_num);
cprintf("Total loader task %d\n",total_loader_task);
cprintf("Simulation time sec = %ld usec = %ld\n",total->tv_sec,total->tv_nsec/1000);
 
return 0;
 
}
/demos/trunk/oldload/parser.h
0,0 → 1,77
#ifndef __PARSER_H__
#define __PARSER_H__
 
#include <kernel/kern.h>
 
#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_EXEC_GAUSS 14
#define PAR_EXEC_GAUSS_MAX 15
 
#define PAR_ACT_SINGLE 16
#define PAR_ACT_PERIODIC 17
#define PAR_ACT_MEAN 18
#define PAR_ACT_GAUSS 19
#define PAR_ACT_GAUSS_MAX 20
 
#define PAR_TASK_NRT 21
#define PAR_TASK_HARD 22
#define PAR_TASK_SOFT 23
#define PAR_TASK_BACK 24
#define PAR_TASK_FSF 25
 
#define PAR_NO_CRIT 26
#define PAR_CRIT 27
 
#define PAR_FSF_SERVER 28
 
#define PAR_LOCAL_SCHEDULER 29
#define PAR_POSIX 30
#define PAR_EDF 31
#define PAR_RM 32
 
struct loader_task {
int number;
int group;
bandwidth_t bandwidth;
int task_level;
int task_type;
struct timespec deadline;
struct timespec wcet;
int exec_type;
struct timespec exec_par_1;
struct timespec exec_par_2;
struct timespec exec_par_3;
int act_type;
struct timespec act_par_1;
struct timespec act_par_2;
struct timespec act_par_3;
struct timespec act_par_4;
int crit_type;
int resource;
struct timespec crit_par_1;
struct timespec crit_par_2;
struct timespec crit_par_3;
struct timespec crit_par_4;
int server;
int local_scheduler;
struct loader_task *next;
};
 
int line_parser(char **buf, int line_num, struct timespec *total, struct loader_task **last);
 
#endif
 
/demos/trunk/oldload/fsfinit.c
0,0 → 1,48
#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;
int i;
long long bw;
 
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 (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;
bw = (long long)(MAX_BANDWIDTH) * TIMESPEC2USEC(&c->cmin) / TIMESPEC2USEC(&c->tmax);
cprintf("FSF CONTRACT %d SERVER %d MIN BW %d.%03d\n", c->number, c->server,
(int)(bw * 100 / MAX_BANDWIDTH),
(int)(bw * 100000 / MAX_BANDWIDTH % 1000));
}
 
}
/demos/trunk/oldload/initfile.c
0,0 → 1,98
/*
* 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
*/
 
/*
* Copyright (C) 2000 Paolo Gai
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
 
#include "kernel/kern.h"
#include "modules/edf.h"
#include "modules/cbs.h"
#include "modules/posix.h"
#include "pthread.h"
#include "drivers/keyb.h"
#include "modules/sem.h"
#include "modules/dummy.h"
#include "modules/hartport.h"
 
#include "fsf_contract.h"
#include "fsf_server.h"
 
#include "modules/pi.h"
#include "modules/pc.h"
 
#define TICK 0
 
#define RRTICK 10000
 
TIME __kernel_register_levels__(void *arg)
{
struct multiboot_info *mb = (struct multiboot_info *)arg;
int grubstar_level;
 
EDF_register_level(EDF_ENABLE_ALL);
POSIX_register_level(RRTICK, 1, mb, 32);
grubstar_level = GRUBSTAR_register_level(FSF_MAX_N_SERVERS, 0);
FSF_register_module(grubstar_level);
dummy_register_level();
CBS_register_level(CBS_ENABLE_ALL,0);
 
SEM_register_module();
 
PI_register_module();
PC_register_module();
 
PTHREAD_register_module(1, 0, 1);
 
return TICK;
 
}
 
TASK __init__(void *arg)
{
struct multiboot_info *mb = (struct multiboot_info *)arg;
 
HARTPORT_init();
 
__call_main__(mb);
 
return (void *)0;
}
 
int main() {
 
return start_environment();
}
 
/demos/trunk/oldload/loader.c
0,0 → 1,648
#include <kernel/kern.h>
#include "parser.h"
#include "dosread.h"
 
#include "fsf_contract.h"
#include "fsf_server.h"
 
/* Memory pointers on loaded file */
extern void *start_file;
extern void *end_file;
 
/* Calibration Loops */
#define CALIBRATION_DELTA 10000
 
/* Mutex number */
#define MAX_MUTEX 10
 
/* Activate task output */
#define TASK_OUTPUT
 
struct timespec zero_time;
int cal_cycles = 0;
 
mutex_t mux_table[MAX_MUTEX];
 
/* Not Real-Time Task */
TASK nrt_test_task(void *arg)
{
long long i,exec_cycles = 0;
int exec_1,exec_2,exec_3;
int act_1,act_2,act_3,next_act;
int crit_1 = 0,crit_2 = 0,crit_3 = 0,crit_4 = 0;
int crit_start,crit_len;
long long crit_start_cycles = 0, crit_len_cycles = 0;
struct timespec next_time;
struct loader_task *l = (struct loader_task *)(arg);
char tmp[20];
act_1 = TIMESPEC2USEC(&l->act_par_2);
act_2 = TIMESPEC2USEC(&l->act_par_3);
act_3 = TIMESPEC2USEC(&l->act_par_4);
 
if (l->act_type == PAR_ACT_PERIODIC) {
kern_gettime(&next_time);
ADDUSEC2TIMESPEC(act_1,&next_time);
kern_event_post(&next_time,(void *)((void *)task_activate),(void *)exec_shadow);
}
 
if (l->act_type == PAR_ACT_MEAN) {
next_act = act_1 + rand() % act_2 - act_2/2;
kern_gettime(&next_time);
ADDUSEC2TIMESPEC(next_act,&next_time);
kern_event_post(&next_time,(void *)((void *)task_activate),(void *)exec_shadow);
}
 
if (l->act_type == PAR_ACT_GAUSS) {
}
 
if (l->act_type == PAR_ACT_GAUSS_MAX) {
}
exec_1 = TIMESPEC2USEC(&l->exec_par_1);
exec_2 = TIMESPEC2USEC(&l->exec_par_2);
exec_3 = TIMESPEC2USEC(&l->exec_par_3);
if (l->crit_type == PAR_CRIT) {
crit_1 = TIMESPEC2USEC(&l->crit_par_1);
crit_2 = TIMESPEC2USEC(&l->crit_par_2);
crit_3 = TIMESPEC2USEC(&l->crit_par_3);
crit_4 = TIMESPEC2USEC(&l->crit_par_4);
}
#ifdef TASK_OUTPUT
printf_xy((exec_shadow % 5) * 9 + 34, exec_shadow / 5 + 5, GREEN, "R[000000]");
#endif
if (l->exec_type == PAR_EXEC_CONST)
exec_cycles = (long long)(exec_1) * CALIBRATION_DELTA / cal_cycles;
if (l->exec_type == PAR_EXEC_MEAN)
exec_cycles = (long long)(exec_1 + rand() % exec_2 - exec_2/2)
* CALIBRATION_DELTA / cal_cycles;
if (l->exec_type == PAR_EXEC_GAUSS)
exec_cycles = 0;
 
if (l->exec_type == PAR_EXEC_GAUSS_MAX)
exec_cycles = 0;
 
if (l->crit_type == PAR_CRIT) {
crit_start = crit_1 + rand() % crit_2 - crit_2/2;
crit_len = crit_3 + rand() % crit_4 - crit_4/2;
crit_start_cycles = (long long)(crit_start) * CALIBRATION_DELTA / cal_cycles;
crit_len_cycles = (long long)(crit_len) * CALIBRATION_DELTA / cal_cycles;
exec_cycles -= crit_start_cycles + crit_len_cycles;
if (exec_cycles < 0) {
cprintf("Error: exec_cycles < 0\n");
sys_end();
}
}
 
if (l->crit_type == PAR_NO_CRIT)
for (i=0;i<exec_cycles;i++) kern_gettime(NULL);
else {
for (i=0;i<crit_start_cycles;i++) kern_gettime(NULL);
#ifdef TASK_OUTPUT
sprintf(tmp,"B[%02d][%02d]",exec_shadow,l->resource);
printf_xy((exec_shadow % 5) * 9 + 34, exec_shadow / 5 + 5, RED,tmp);
#endif
mutex_lock(&mux_table[l->resource]);
for (i=0;i<crit_len_cycles;i++) kern_gettime(NULL);
mutex_unlock(&mux_table[l->resource]);
#ifdef TASK_OUTPUT
printf_xy((exec_shadow % 5) * 9 + 34, exec_shadow / 5 + 5, GREEN,"R[000000]");
#endif
for (i=0;i<exec_cycles;i++) kern_gettime(NULL);
}
 
#ifdef TASK_OUTPUT
printf_xy((exec_shadow % 5) * 9 + 34, exec_shadow / 5 + 5, BLUE, "E[000000]");
#endif
return NULL;
}
 
/* Soft and hard Task */
TASK test_task(void *arg)
{
long long i,exec_cycles = 0;
int exec_1,exec_2,exec_3;
int act_1,act_2,act_3,next_act;
int crit_1 = 0,crit_2 = 0,crit_3 = 0,crit_4 = 0;
int crit_start,crit_len;
long long crit_start_cycles = 0, crit_len_cycles = 0;
struct timespec next_time;
int act = 0;
struct loader_task *l = (struct loader_task *)(arg);
char tmp[20];
act_1 = TIMESPEC2USEC(&l->act_par_2);
act_2 = TIMESPEC2USEC(&l->act_par_3);
act_3 = TIMESPEC2USEC(&l->act_par_4);
exec_1 = TIMESPEC2USEC(&l->exec_par_1);
exec_2 = TIMESPEC2USEC(&l->exec_par_2);
exec_3 = TIMESPEC2USEC(&l->exec_par_3);
 
if (l->crit_type == PAR_CRIT) {
crit_1 = TIMESPEC2USEC(&l->crit_par_1);
crit_2 = TIMESPEC2USEC(&l->crit_par_2);
crit_3 = TIMESPEC2USEC(&l->crit_par_3);
crit_4 = TIMESPEC2USEC(&l->crit_par_4);
}
 
while(1) {
 
task_testcancel();
 
act++;
 
#ifdef TASK_OUTPUT
sprintf(tmp,"X[%06d]",act);
printf_xy((exec_shadow % 5) * 9 + 34, exec_shadow / 5 + 5, GREEN, tmp);
#endif
 
if (l->act_type == PAR_ACT_MEAN) {
next_act = act_1 + rand() % act_2 - act_2/2;
kern_gettime(&next_time);
ADDUSEC2TIMESPEC(next_act,&next_time);
kern_event_post(&next_time,(void *)((void *)task_activate),(void *)exec_shadow);
}
 
if (l->act_type == PAR_ACT_GAUSS) {
}
 
if (l->act_type == PAR_ACT_GAUSS_MAX) {
}
 
if (l->exec_type == PAR_EXEC_CONST)
exec_cycles = (long long)(exec_1) * CALIBRATION_DELTA / cal_cycles;
if (l->exec_type == PAR_EXEC_MEAN)
exec_cycles = (long long)(exec_1 + rand() % exec_2 - exec_2/2)
* CALIBRATION_DELTA / cal_cycles;
if (l->exec_type == PAR_EXEC_GAUSS)
exec_cycles = 0;
 
if (l->exec_type == PAR_EXEC_GAUSS_MAX)
exec_cycles = 0;
if (l->crit_type == PAR_CRIT) {
crit_start = crit_1 + rand() % crit_2 - crit_2/2;
crit_len = crit_3 + rand() % crit_4 - crit_4/2;
crit_start_cycles = (long long)(crit_start) * CALIBRATION_DELTA / cal_cycles;
crit_len_cycles = (long long)(crit_len) * CALIBRATION_DELTA / cal_cycles;
exec_cycles -= crit_start_cycles + crit_len_cycles;
if (exec_cycles < 0) {
cprintf("Error: exec_cycles < 0\n");
sys_end();
}
}
if (l->crit_type == PAR_NO_CRIT)
for (i=0;i<exec_cycles;i++) kern_gettime(NULL);
else {
for (i=0;i<crit_start_cycles;i++) kern_gettime(NULL);
#ifdef TASK_OUTPUT
sprintf(tmp,"B[%02d][%02d]",exec_shadow,l->resource);
printf_xy((exec_shadow % 5) * 9 + 34, exec_shadow / 5 + 5, RED, tmp);
#endif
mutex_lock(&mux_table[l->resource]);
for (i=0;i<crit_len_cycles;i++) kern_gettime(NULL);
mutex_unlock(&mux_table[l->resource]);
#ifdef TASK_OUTPUT
sprintf(tmp,"X[%06d]",act);
printf_xy((exec_shadow % 5) * 9 + 34, exec_shadow / 5 + 5, GREEN, tmp);
#endif
for (i=0;i<exec_cycles;i++) kern_gettime(NULL);
}
task_endcycle();
}
return NULL;
}
 
/* Background Task */
TASK back_task(void *arg)
{
long long i,exec_cycles = 0;
int exec_1,exec_2,exec_3;
int act_1,act_2,act_3,next_act;
int crit_1 = 0,crit_2 = 0,crit_3 = 0,crit_4 = 0;
int crit_start,crit_len;
long long crit_start_cycles = 0, crit_len_cycles = 0;
struct timespec next_time;
int act = 0;
struct loader_task *l = (struct loader_task *)(arg);
char tmp[20];
act_1 = TIMESPEC2USEC(&l->act_par_2);
act_2 = TIMESPEC2USEC(&l->act_par_3);
act_3 = TIMESPEC2USEC(&l->act_par_4);
exec_1 = TIMESPEC2USEC(&l->exec_par_1);
exec_2 = TIMESPEC2USEC(&l->exec_par_2);
exec_3 = TIMESPEC2USEC(&l->exec_par_3);
 
if (l->crit_type == PAR_CRIT) {
crit_1 = TIMESPEC2USEC(&l->crit_par_1);
crit_2 = TIMESPEC2USEC(&l->crit_par_2);
crit_3 = TIMESPEC2USEC(&l->crit_par_3);
crit_4 = TIMESPEC2USEC(&l->crit_par_4);
}
 
while(1) {
 
task_testcancel();
 
act++;
 
#ifdef TASK_OUTPUT
sprintf(tmp,"X[%06d]",act);
printf_xy((exec_shadow % 5) * 9 + 34, exec_shadow / 5 + 5, GREEN, tmp);
#endif
 
if (l->act_type == PAR_ACT_MEAN) {
next_act = act_1 + rand() % act_2 - act_2/2;
kern_gettime(&next_time);
ADDUSEC2TIMESPEC(next_act,&next_time);
kern_event_post(&next_time,(void *)((void *)task_activate),(void *)exec_shadow);
}
 
if (l->act_type == PAR_ACT_GAUSS) {
}
 
if (l->act_type == PAR_ACT_GAUSS_MAX) {
}
 
if (l->exec_type == PAR_EXEC_CONST)
exec_cycles = (long long)(exec_1) * CALIBRATION_DELTA / cal_cycles;
if (l->exec_type == PAR_EXEC_MEAN)
exec_cycles = (long long)(exec_1 + rand() % exec_2 - exec_2/2)
* CALIBRATION_DELTA / cal_cycles;
if (l->exec_type == PAR_EXEC_GAUSS)
exec_cycles = 0;
 
if (l->exec_type == PAR_EXEC_GAUSS_MAX)
exec_cycles = 0;
if (l->crit_type == PAR_CRIT) {
crit_start = crit_1 + rand() % crit_2 - crit_2/2;
crit_len = crit_3 + rand() % crit_4 - crit_4/2;
crit_start_cycles = (long long)(crit_start) * CALIBRATION_DELTA / cal_cycles;
crit_len_cycles = (long long)(crit_len) * CALIBRATION_DELTA / cal_cycles;
exec_cycles -= crit_start_cycles + crit_len_cycles;
if (exec_cycles < 0) {
cprintf("Error: exec_cycles < 0\n");
sys_end();
}
}
if (l->crit_type == PAR_NO_CRIT)
for (i=0;i<exec_cycles;i++) kern_gettime(NULL);
else {
for (i=0;i<crit_start_cycles;i++) kern_gettime(NULL);
#ifdef TASK_OUTPUT
sprintf(tmp,"B[%02d][%02d]",exec_shadow,l->resource);
printf_xy((exec_shadow % 5) * 9 + 34, exec_shadow / 5 + 5, RED, tmp);
#endif
mutex_lock(&mux_table[l->resource]);
for (i=0;i<crit_len_cycles;i++) kern_gettime(NULL);
mutex_unlock(&mux_table[l->resource]);
#ifdef TASK_OUTPUT
sprintf(tmp,"X[%06d]",act);
printf_xy((exec_shadow % 5) * 9 + 34, exec_shadow / 5 + 5, GREEN, tmp);
#endif
for (i=0;i<exec_cycles;i++) kern_gettime(NULL);
}
}
return NULL;
}
 
/* Delay Calibration */
int calibrate_cycle()
{
long long i;
struct timespec start,end,diff;
 
kern_cli();
kern_gettime(&start);
for (i=0;i<CALIBRATION_DELTA;i++) kern_gettime(NULL);
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;
 
}
 
/* Mutex create */
void loader_mutex_create(struct loader_task *start_loader_task)
{
 
struct loader_task *current = start_loader_task;
int i,res = 0;
PI_mutexattr_t a;
int init_array[MAX_MUTEX];
 
PI_mutexattr_default(a);
 
for (i = 0;i < MAX_MUTEX;i++) init_array[i] = 0;
 
while (current != NULL) {
if (current->crit_type == PAR_CRIT) {
if (init_array[current->resource] == 0) {
mutex_init(&mux_table[current->resource],&a);
init_array[current->resource] = 1;
res++;
}
}
 
current = current->next;
 
}
 
cprintf("Created %d mutex\n",res);
 
}
 
/* Task create */
void loader_task_create(struct loader_task *start_loader_task)
{
 
struct loader_task *current = start_loader_task;
char tmp[30];
int i, total_task;
int total_group = 0;
PID p;
 
total_task = 0;
 
while (current != NULL) {
 
total_group++;
current->group = total_group;
current->bandwidth = 0;
 
for (i=0; i < current->number; i++) {
 
if (current->task_type == PAR_TASK_NRT) {
NRT_TASK_MODEL nrt;
nrt_task_default_model(nrt);
nrt_task_def_save_arrivals(nrt);
nrt_task_def_arg(nrt,(void *)(current));
nrt_task_def_ctrl_jet(nrt);
nrt_task_def_level(nrt,current->task_level);
nrt_task_def_group(nrt,total_group);
nrt_task_def_usemath(nrt);
 
sprintf(tmp,"NRT %d:%d",current->group,i);
p = task_create(tmp,nrt_test_task,&nrt,NULL);
if (p == NIL) {
cprintf("Error nrt task creating\n");
sys_end();
}
 
total_task++;
 
}
 
if (current->task_type == PAR_TASK_BACK) {
NRT_TASK_MODEL nrt;
nrt_task_default_model(nrt);
nrt_task_def_save_arrivals(nrt);
nrt_task_def_arg(nrt,(void *)(current));
nrt_task_def_ctrl_jet(nrt);
nrt_task_def_level(nrt,current->task_level);
nrt_task_def_group(nrt,total_group);
nrt_task_def_usemath(nrt);
 
sprintf(tmp,"BACK %d:%d",current->group,i);
p = task_create(tmp,back_task,&nrt,NULL);
if (p == NIL) {
cprintf("Error back task creating\n");
sys_end();
}
 
total_task++;
 
}
 
if (current->task_type == PAR_TASK_HARD) {
HARD_TASK_MODEL ht;
hard_task_default_model(ht);
hard_task_def_arg(ht,(void *)(current));
hard_task_def_wcet(ht,TIMESPEC2USEC(&current->wcet));
hard_task_def_ctrl_jet(ht);
hard_task_def_level(ht,current->task_level);
hard_task_def_group(ht,total_group);
hard_task_def_usemath(ht);
 
if (current->act_type != PAR_ACT_PERIODIC) {
hard_task_def_mit(ht,TIMESPEC2USEC(&current->deadline));
current->bandwidth += MAX_BANDWIDTH / TIMESPEC2USEC(&current->deadline)
* TIMESPEC2USEC(&current->wcet);
hard_task_def_aperiodic(ht);
} else {
hard_task_def_mit(ht,TIMESPEC2USEC(&current->act_par_2));
current->bandwidth += MAX_BANDWIDTH / TIMESPEC2USEC(&current->act_par_2)
* TIMESPEC2USEC(&current->wcet);
}
sprintf(tmp,"HARD %d:%d",current->group,i);
p = task_create(tmp,test_task,&ht,NULL);
if (p == NIL) {
cprintf("Error hard task creating\n");
sys_end();
}
 
total_task++;
}
 
if (current->task_type == PAR_TASK_SOFT) {
SOFT_TASK_MODEL st;
soft_task_default_model(st);
soft_task_def_save_arrivals(st);
soft_task_def_arg(st,(void *)(current));
soft_task_def_met(st,TIMESPEC2USEC(&current->wcet));
soft_task_def_ctrl_jet(st);
soft_task_def_level(st,current->task_level);
soft_task_def_group(st,total_group);
soft_task_def_usemath(st);
 
if (current->act_type == PAR_ACT_PERIODIC) {
soft_task_def_period(st,TIMESPEC2USEC(&current->act_par_2));
current->bandwidth += MAX_BANDWIDTH / TIMESPEC2USEC(&current->act_par_2)
* TIMESPEC2USEC(&current->wcet);
} else if (current->act_type != PAR_ACT_SINGLE) {
soft_task_def_period(st,TIMESPEC2USEC(&current->act_par_2));
current->bandwidth += MAX_BANDWIDTH / TIMESPEC2USEC(&current->act_par_2)
* TIMESPEC2USEC(&current->wcet);
soft_task_def_aperiodic(st);
} else {
soft_task_def_period(st,TIMESPEC2USEC(&current->wcet)*1000);
current->bandwidth += MAX_BANDWIDTH / 1000;
soft_task_def_aperiodic(st);
}
sprintf(tmp,"SOFT %d:%d",current->group,i);
p = task_create(tmp,test_task,&st,NULL);
if (p == NIL) {
cprintf("Error soft task creating\n");
sys_end();
}
 
total_task++;
}
 
if (current->task_type == PAR_TASK_FSF) {
 
if (current->local_scheduler == PAR_POSIX) {
NRT_TASK_MODEL nrt;
pthread_t j;
int err;
 
nrt_task_default_model(nrt);
nrt_task_def_save_arrivals(nrt);
nrt_task_def_ctrl_jet(nrt);
nrt_task_def_usemath(nrt);
err = fsf_create_thread(current->server,&j,NULL,back_task,(void *)current,&nrt);
if (err) {
cprintf("Error fsf task creating\n");
sys_end();
}
}
 
if (current->local_scheduler == PAR_EDF) {
HARD_TASK_MODEL ht;
pthread_t j;
int err;
 
hard_task_default_model(ht);
hard_task_def_ctrl_jet(ht);
hard_task_def_mit(ht,TIMESPEC2USEC(&current->deadline));
hard_task_def_wcet(ht,TIMESPEC2USEC(&current->wcet));
hard_task_def_usemath(ht);
 
err = fsf_create_thread(current->server,&j,NULL,test_task,(void *)current,&ht);
if (err) {
cprintf("Error fsf task creating\n");
sys_end();
}
 
}
 
if (current->local_scheduler == PAR_RM) {
HARD_TASK_MODEL ht;
pthread_t j;
int err;
hard_task_default_model(ht);
hard_task_def_mit(ht,TIMESPEC2USEC(&current->deadline));
hard_task_def_wcet(ht,TIMESPEC2USEC(&current->wcet));
hard_task_def_ctrl_jet(ht);
hard_task_def_usemath(ht);
 
err = fsf_create_thread(current->server,&j,NULL,test_task,(void *)current,&ht);
if (err) {
cprintf("Error fsf task creating\n");
sys_end();
}
}
 
total_task++;
 
}
 
}
 
cprintf("Task group %d created. Worst case BW = %d.%d \n",
current->group,(int)( (long long)current->bandwidth * 100 / MAX_BANDWIDTH),
(int)( (long long)current->bandwidth* 100000 / MAX_BANDWIDTH % 1000));
 
current = current->next;
 
}
 
cprintf("Created %d tasks\n",total_task);
}
 
/* Set the first extivation events */
void loader_first_execution(struct loader_task *start_loader_task)
{
 
struct loader_task *current = start_loader_task;
struct timespec start_time;
 
while (current != NULL) {
 
if (current->task_type != PAR_TASK_FSF) {
ADDTIMESPEC(&zero_time,&current->act_par_1,&start_time);
 
kern_event_post(&start_time, (void *)((void *)group_activate), (void *)(current->group));
 
}
 
current = current->next;
 
}
 
}
 
void fsfinit(void);
 
int main()
{
 
struct loader_task *start_loader_task = NULL;
struct timespec total;
struct timespec end_time;
 
line_reader(start_file, end_file, &total, &start_loader_task);
 
srand(kern_gettime(NULL));
 
calibrate_cycle();
 
fsfinit();
 
loader_mutex_create(start_loader_task);
loader_task_create(start_loader_task);
kern_gettime(&zero_time);
 
loader_first_execution(start_loader_task);
 
ADDTIMESPEC(&zero_time,&total,&end_time);
kern_event_post(&end_time,(void *)((void *)(sys_end)),NULL);
 
return 0;
 
}
/demos/trunk/oldload/dosread.h
0,0 → 1,10
#ifndef __DOSREAD_H__
#define __DOSREAD_H__
 
#include "parser.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);
 
#endif
/demos/trunk/oldload/loadfile.txt
0,0 → 1,55
# TASK TYPE:TASK LEVEL:NUMBER OF:TASK ACT TYPE (PAR1,PAR2,...):DEADLINE:WCET
# :TASK EXEC TYPE (PAR1,PAR2,...):CRITICAL SESSION (PAR1,PAR2,PAR3,PAR4);
#
# TASK TYPE
# NRT - NON REAL TIME
# HARD - HARD REAL TIME
# SOFT - SOFT REAL TIME
# BACK - BACKGROUND TASK
#
# TASK EXEC TYPE
# EXEC_CONST(TIME)
# - CONSTANT EXEC TIME
# EXEC_MEAN(MEAN, DELTA)
# - VARIABLE EXEC TIME WITH CONSTANT DISTRIBUTION
# EXEC_GAUSS(MEAN, SIGMA)
# - VARIABLE EXEC TIME WITH GAUSSIAN DISTRIBUTION
# EXEC_GAUSS_MAX(MEAN, SIGMA, MAX)
# - VARIABLE EXEC TIME WITH GAUSSIAN DISTRIBUTION MAXIMIZED
#
# TASK ACTIVATION TIME
# ACT_SINGLE(START_TIME)
# ACT_PERIODIC(START_TIME, PERIOD)
# ACT_MEAN(START_TIME, MEAN, DELTA)
# ACT_GAUSS(START_TIME, MEAN, SIGMA)
# ACT_GAUSS_MAX(START_TIME, MEAN, SIGMA, MAX)
#
# CRITICAL SESSION
# CRIT(RES NUMBER, MEAN_START, DELTA_START, MEAN_LEN, DELTA_LEN)
# NO_CRIT
#
 
TOTAL_EXEC_TIME:[20][0];
 
BACK:[1]:[1]:ACT_SINGLE([4][0]):[0][0]:[0][0]
:EXEC_CONST([0][5000]):NO_CRIT;
 
HARD:[0]:[10]:ACT_PERIODIC([5][0],[0][100000]):[0][100000]:[0][1000]
:EXEC_CONST([0][50]):CRIT([0],[0][5],[0][10],[0][20],[0][1]);
 
FSF:[S0]:POSIX:[1]:ACT_SINGLE([0][0]):[0][0]:[0][0]
:EXEC_CONST([0][5000]):CRIT([1],[0][500],[0][1000],[0][2000],[0][1]);
 
FSF:[S1]:POSIX:[1]:ACT_SINGLE([0][0]):[0][0]:[0][0]
:EXEC_CONST([0][5000]):CRIT([1],[0][500],[0][1000],[0][2000],[0][1]);
 
FSF:[S2]:POSIX:[20]:ACT_SINGLE([0][0]):[0][0]:[0][0]
:EXEC_CONST([0][16000]):CRIT([2],[0][500],[0][1000],[0][5000],[0][10000]);
 
FSF:[S3]:EDF:[5]:ACT_PERIODIC([0][0],[0][200000]):[0][200000]:[0][20000]
:EXEC_CONST([0][15000]):CRIT([2],[0][5000],[0][10000],[0][5000],[0][1]);
 
FSF:[S3]:EDF:[5]:ACT_PERIODIC([0][0],[0][111111]):[0][111111]:[0][11111]
:EXEC_MEAN([0][10000],[0][5000]):NO_CRIT;
 
END
/demos/trunk/oldload/parser.c
0,0 → 1,485
#include <kernel/kern.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "parser.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 += 5;
return PAR_END;
}
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, "NRT:",4)) {
*val = PAR_TASK_NRT;
*buf += 4;
return PAR_FOUND;
}
if (!strncmp(*buf, "HARD:",5)) {
*val = PAR_TASK_HARD;
*buf += 5;
return PAR_FOUND;
}
if (!strncmp(*buf, "SOFT:",5)) {
*val = PAR_TASK_SOFT;
*buf += 5;
return PAR_FOUND;
}
if (!strncmp(*buf, "BACK:",5)) {
*val = PAR_TASK_BACK;
*buf += 5;
return PAR_FOUND;
}
if (!strncmp(*buf, "FSF:",4)) {
*val = PAR_TASK_FSF;
*buf += 4;
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_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;
}
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;
}
if (!strncmp(*buf,"ACT_GAUSS(",10)) {
*buf += 10;
*val = PAR_ACT_GAUSS;
return PAR_FOUND;;
}
if (!strncmp(*buf,"ACT_GAUSS_MAX(",14)) {
*buf += 14;
*val = PAR_ACT_GAUSS_MAX;
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;
}
if (!strncmp(*buf,"EXEC_GAUSS(",11)) {
*buf += 11;
*val = PAR_EXEC_GAUSS;
return PAR_FOUND;
}
if (!strncmp(*buf,"EXEC_GAUSS_MAX(",15)) {
*buf += 15;
*val = PAR_EXEC_GAUSS_MAX;
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;
 
case PAR_FSF_SERVER:
if (!strncmp(*buf,"[S",2)) {
*buf += 2;
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;
} else return PAR_ERROR;
break;
 
}
 
return PAR_ERROR;
 
}
 
void par_error(int line_num)
{
 
cprintf("\nParser error: line [%d]\n",line_num);
sys_end();
 
}
 
/* result:
* 0 -> nothing
* 1 -> total
* 2 -> new task-loader
* 3 -> end file
*/
int line_parser(char **pbuf, int line_num, struct timespec *total, 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_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
cprintf("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_TYPE, &time, &val);
if (res == PAR_FOUND) {
#ifdef PARSER_DEBUG
cprintf("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);
 
if (ld->task_type == PAR_TASK_FSF) {
res = find_break(pbuf,PAR_FSF_SERVER, &time, &val);
if (res == PAR_FOUND) {
#ifdef PARSER_DEBUG
cprintf("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
cprintf("TASK LOCAL SCHEDULER = %d\n",val);
#endif
ld->local_scheduler = val;
} else par_error(line_num);
} else {
res = find_break(pbuf,PAR_TASK_NUMBER, &time, &val);
if (res == PAR_FOUND) {
#ifdef PARSER_DEBUG
cprintf("TASK LEVEL = %d\n",val);
#endif
 
ld->task_level = val;
 
} else par_error(line_num);
}
 
res = find_break(pbuf,PAR_TASK_NUMBER, &time, &val);
if (res == PAR_FOUND) {
#ifdef PARSER_DEBUG
cprintf("TASK NUMBER = %d\n",val);
#endif
 
ld->number = val;
 
} else par_error(line_num);
 
res = find_break(pbuf,PAR_ACT_TYPE, &time, &val);
if (res == PAR_FOUND) {
#ifdef PARSER_DEBUG
cprintf("ACTIVATION TYPE: %d (",val);
#endif
 
ld->act_type = val;
res = find_break(pbuf,PAR_TIME, &time, &val);
if (res == PAR_FOUND) {
#ifdef PARSER_DEBUG
cprintf("[%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
cprintf(",[%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
cprintf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000);
#endif
TIMESPEC_ASSIGN(&ld->act_par_3,&time);
} else par_error(line_num);
}
 
if (ld->act_type != PAR_ACT_SINGLE && ld->act_type != PAR_ACT_PERIODIC &&
ld->act_type != PAR_ACT_MEAN && ld->act_type != PAR_ACT_GAUSS) {
res = find_break(pbuf,PAR_TIME, &time, &val);
if (res == PAR_FOUND) {
#ifdef PARSER_DEBUG
cprintf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000);
#endif
TIMESPEC_ASSIGN(&ld->act_par_4,&time);
} else par_error(line_num);
}
 
#ifdef PARSER_DEBUG
cprintf(")\n");
#endif
 
} else par_error(line_num);
 
res = find_break(pbuf,PAR_TIME, &time, &val);
if (res == PAR_FOUND) {
#ifdef PARSER_DEBUG
cprintf("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
cprintf("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_EXEC_TYPE, &time, &val);
if (res == PAR_FOUND) {
#ifdef PARSER_DEBUG
cprintf("EXEC TYPE: %d (",val);
#endif
ld->exec_type = val;
res = find_break(pbuf,PAR_TIME, &time, &val);
if (res == PAR_FOUND) {
#ifdef PARSER_DEBUG
cprintf("[%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
cprintf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000);
#endif
TIMESPEC_ASSIGN(&ld->exec_par_2,&time);
} else par_error(line_num);
}
if (ld->exec_type != PAR_EXEC_CONST && ld->exec_type != PAR_EXEC_MEAN &&
ld->exec_type != PAR_EXEC_GAUSS) {
res = find_break(pbuf,PAR_TIME, &time, &val);
if (res == PAR_FOUND) {
#ifdef PARSER_DEBUG
cprintf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000);
#endif
TIMESPEC_ASSIGN(&ld->exec_par_3,&time);
} else par_error(line_num);
}
#ifdef PARSER_DEBUG
cprintf(")\n");
#endif
 
} else par_error(line_num);
 
res = find_break(pbuf,PAR_CRIT_SESSION, &time, &val);
if (res == PAR_FOUND) {
#ifdef PARSER_DEBUG
cprintf("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
cprintf("[%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
cprintf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000);
#endif
TIMESPEC_ASSIGN(&ld->crit_par_1,&time);
} else par_error(line_num);
res = find_break(pbuf,PAR_TIME, &time, &val);
if (res == PAR_FOUND) {
#ifdef PARSER_DEBUG
cprintf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000);
#endif
TIMESPEC_ASSIGN(&ld->crit_par_2,&time);
} else par_error(line_num);
res = find_break(pbuf,PAR_TIME, &time, &val);
if (res == PAR_FOUND) {
#ifdef PARSER_DEBUG
cprintf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000);
#endif
TIMESPEC_ASSIGN(&ld->crit_par_3,&time);
} else par_error(line_num);
res = find_break(pbuf,PAR_TIME, &time, &val);
if (res == PAR_FOUND) {
#ifdef PARSER_DEBUG
cprintf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000);
#endif
TIMESPEC_ASSIGN(&ld->crit_par_4,&time);
} else par_error(line_num);
 
}
#ifdef PARSER_DEBUG
cprintf(")\n");
#endif
} else par_error(line_num);
 
return 2;
 
}
 
/demos/trunk/oldload/makefile
0,0 → 1,16
#
#
#
 
ifndef BASE
BASE=../..
endif
include $(BASE)/config/config.mk
 
PROGS = loader
 
include $(BASE)/config/example.mk
 
loader:
make -f $(SUBMAKE) APP=loader INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __FIRST__"