Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1245 → Rev 1246

/demos/trunk/loader/func.h
17,6 → 17,8
#define generic_start_simulation start_simulation
#define generic_fsfinit() fsfinit()
#define generic_task_endcycle() task_endcycle()
#define generic_end_simulation() sys_end()
#define printf cprintf
#endif
 
#include "func.h"
/demos/trunk/loader/fsfinit.c
9,7 → 9,7
void fsfinit()
{
 
struct loader_contract *c = loader_contract_list;
struct loader_contract *c;
fsf_contract_parameters_t contract;
fsf_server_id_t server;
int i;
17,6 → 17,8
 
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);
36,7 → 38,7
fsf_negotiate_contract(&contract,&server);
c->server = server;
bw = MAX_BANDWIDTH * TIMESPEC2USEC(&c->tmax) / TIMESPEC2USEC(&c->cmin);
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/loader/load.txt
1,7 → 1,15
# CONTRACT SECTION
#
#
# CONTRACT NUMBER:CMIN:TMAX:CMAX:TMIN:WORKLOAD: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
51,15 → 59,15
TASK SECTION
 
BT:[0]:POSIX:[1]:[0][0]:[0][0]:ACT_SINGLE([3][0]):
:EXEC_CONST([0][16000]):CRIT([1],[0][500],[0][1000],[0][5000],[0][10000]);
:EXEC_CONST([0][16000]):NO_CRIT;
 
BT:[1]:POSIX:[1]:[0][0]:[0][0]:ACT_SINGLE([4][0]):
:EXEC_CONST([0][16000]):CRIT([2],[0][500],[0][1000],[0][5000],[0][10000]);
:EXEC_CONST([0][16000]):NO_CRIT;
 
BT:[2]:POSIX:[1]:[0][0]:[0][0]:ACT_SINGLE([5][0]):
:EXEC_CONST([0][16000]):CRIT([3],[0][500],[0][1000],[0][5000],[0][10000]);
:EXEC_CONST([0][16000]):NO_CRIT;
 
CT:[3]:EDF:[1]:[1][0]:[0][100000]:ACT_PERIODIC([6][0],[1][0]):
:EXEC_CONST([0][20000]):CRIT([4],[0][500],[0][1000],[0][5000],[0][10000]);
BT:[3]:POSIX:[1]:[0][0]:[0][0]:ACT_SINGLE([6][0]):
:EXEC_CONST([0][20000]):NO_CRIT;
 
END
/demos/trunk/loader/event_gen.h
4,27 → 4,27
 
struct loader_task {
 
char name[20];
int task_type;
int contract;
int local_scheduler;
int number;
int group;
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;
struct timespec wcet;
struct timespec deadline; //Task deadline
struct timespec wcet; //Task wcet
int act_number;
int act_current;
int act_number; //Number of activations precalcolated
int act_current; //Actual activation number
 
struct timespec *act;
struct timespec *exec;
struct timespec *act; //Activation list
struct timespec *exec; //Execution time list
 
};
 
struct loader_contract {
 
int number;
int number; //Contract number
struct timespec cmin;
struct timespec tmax;
struct timespec cmax;
31,7 → 31,7
struct timespec tmin;
int workload;
int local_scheduler;
int server;
int server; //Server number linked to this contract
 
};
 
/demos/trunk/loader/newloader.c
1,31 → 1,44
#include <kernel/kern.h>
/* 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"
#include "fsf_server.h"
#include "func.h"
#include <kernel/kern.h> //Shark dependent header, it's used only for TASK_OUTPUT debug
 
/* Activate task output */
#include "fsf_contract.h" //Framework main header
#include "func.h" //Generic function definitions
 
/* Activate task output debug */
#define TASK_OUTPUT
 
int cal_cycles=0;
struct timespec zero_time;
extern struct loader_task loader_task_list[];
extern int total_loader_task;
int cal_cycles = 0; //Calibration const, it converts usec in 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
 
/* oneshot Soft and hard Task */
/* OS: Oneshot Task:
begin
- execution
end
*/
void *oneshot_task(void *arg)
{
long long i,exec_cycles = 0;
int act = 0;
struct loader_task *l = (struct loader_task *)(arg);
char tmp[20];
 
#ifdef TASK_OUTPUT
sprintf(tmp,"X[%06d]",act);
sprintf(tmp,"[ONESHOT]");
printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, GREEN, tmp);
#endif
 
exec_cycles = (long long)(TIMESPEC2USEC(&l->exec[act])) * CALIBRATION_DELTA / cal_cycles;
exec_cycles = (long long)(TIMESPEC2USEC(&l->exec[l->act_current-1])) * CALIBRATION_DELTA / cal_cycles;
for (i=0;i<exec_cycles;i++)
__asm__ __volatile__ ("xorl %%eax,%%eax\n\t"
32,13 → 45,19
"cpuid\n\t"
:::"eax","ebx","ecx","edx");
generic_task_endcycle();
return NULL;
}
 
void * periodic_task(void *arg)
/* CT: Cyclical Task:
begin
while (1) {
- execution
- end_cycle
}
end (never end)
*/
void *periodic_task(void *arg)
{
long long i,exec_cycles = 0;
int act = 0;
48,11 → 67,11
while(1) {
 
#ifdef TASK_OUTPUT
sprintf(tmp,"X[%06d]",act);
sprintf(tmp,"C[%06d]",act);
printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, GREEN, tmp);
#endif
exec_cycles = (long long)(TIMESPEC2USEC(&l->exec[act])) * CALIBRATION_DELTA / cal_cycles;
exec_cycles = (long long)(TIMESPEC2USEC(&l->exec[l->act_current-1])) * CALIBRATION_DELTA / cal_cycles;
for (i=0;i<exec_cycles;i++)
__asm__ __volatile__ ("xorl %%eax,%%eax\n\t"
63,12 → 82,20
act++;
}
}
return NULL;
}
 
void * back_task(void *arg)
/* BT: Background Task:
begin
while (1) {
- execution
}
end (never end)
*/
void *back_task(void *arg)
{
long long i,exec_cycles = 0;
int act = 0;
78,11 → 105,11
while(1) {
 
#ifdef TASK_OUTPUT
sprintf(tmp,"X[%06d]",act);
sprintf(tmp,"B[%06d]",act);
printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, GREEN, tmp);
#endif
exec_cycles = (long long)(TIMESPEC2USEC(&l->exec[0])) * CALIBRATION_DELTA / cal_cycles;
exec_cycles = (long long)(TIMESPEC2USEC(&l->exec[l->act_current-1])) * CALIBRATION_DELTA / cal_cycles;
for (i=0;i<exec_cycles;i++)
__asm__ __volatile__ ("xorl %%eax,%%eax\n\t"
98,7 → 125,6
 
/* Task create */
/* this function create the task struct in memory */
 
void loader_task_create()
{
 
128,8 → 154,8
break;
}
if (err) {
cprintf("Error fsf task creating\n");
sys_end();
printf("Error fsf task creating\n");
generic_end_simulation();
}
}
138,12 → 164,12
 
}
cprintf("Created %d loader tasks\n",k);
printf("Created %d loader tasks\n",k);
 
}
 
 
/* Main Function */
int start_environment()
{