/demos/trunk/loader/func.h |
---|
1,5 → 1,37 |
#ifndef FUNC_H |
#define FUNC_H |
struct loader_task { |
char name[20]; |
int number; |
int group; |
int server; |
int local_scheduler; |
struct timespec deadline; |
struct timespec wcet; |
int act_number; |
struct timespec *act; |
struct timespec *exec; |
}; |
#define LOADER_POSIX_SCHEDULER 0 |
#define LOADER_EDF_SCHEDULER 1 |
#define LOADER_RM_SCHEDULER 2 |
#define LOADER_MPEGSTAR_SCHEDULER 3 |
/* Calibration Loops */ |
#define CALIBRATION_DELTA 10000 |
extern int cal_cycles; |
extern struct timespec zero_time; |
#define SHARK |
#if defined SHARK |
#include "shark.h" |
#define get_current_exec_task() exec_shadow |
#define generic_calibration_func calibration_func |
#define generic_create_thread fsf_create_thread |
7,5 → 39,10 |
#define generic_set_next_activation set_next_activation |
#define generic_set_simulation_time set_simulation_time |
#define generic_get_task_model get_task_model |
#define generic_fsfinit() fsfinit() |
#define generic_task_endcycle() ; |
#endif |
#endif |
/demos/trunk/loader/newloader.c |
---|
2,12 → 2,11 |
#include "fsf_contract.h" |
#include "fsf_server.h" |
#include "func.h" |
#include "event_header.h" |
#include "func.h" |
/* Calibration Loops */ |
#define CALIBRATION_DELTA 10000 |
/* Activate task output */ |
#define TASK_OUTPUT |
14,20 → 13,20 |
int cal_cycles = 0; |
struct timespec zero_time; |
/* Soft and hard Task */ |
TASK test_task(void *arg) |
{ |
long long i,exec_cycles = 0; |
int crit_start,crit_len; |
long long crit_start_cycles = 0, crit_len_cycles = 0; |
struct timespec next_time; |
//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 = loader_task_list[get_current_exec_task()]; |
struct loader_task *l; |
l=&loader_task_list[get_current_exec_task()]; |
char tmp[20]; |
while((l->act_num)>act) { |
while((l->act_number)>act) { |
//task_testcancel(); |
39,9 → 38,9 |
#endif |
generic_set_next_activationn(&l->act[act]); |
generic_set_next_activation(&l->act[act]); |
exec_cycles = (long long)(TIMESPEC2USEC(l->exec[act])) * CALIBRATION_DELTA / cal_cycles; |
exec_cycles = (long long)(TIMESPEC2USEC(&l->exec[act])) * CALIBRATION_DELTA / cal_cycles; |
#ifdef TASK_OUTPUT |
sprintf(tmp,"X[%06d]",act); |
50,7 → 49,7 |
for (i=0;i<exec_cycles;i++) calibration_func(); |
generic_task_endcycle(); |
//generic_task_endcycle(); |
} |
97,12 → 96,12 |
{ |
struct loader_task *current = &loader_task_list[0]; |
char tmp[30]; |
//char tmp[30]; |
int i=0,k=0, total_task; |
int total_group = 0; |
PID p; |
//PID p; |
total_task = sizeof(loader_task_list)/sizeof(loader_task); |
total_task = sizeof(loader_task_list)/sizeof(struct loader_task); |
while (k<total_task) { |
k++; |
125,24 → 124,19 |
} |
} |
cprintf("Created %d tasks\n",total_task); |
} |
void generic_fsfinit(void); |
int main() |
{ |
struct loader_task *start_loader_task = &loader_task_list[0]; |
struct timespec total; |
struct timespec total={20,0}; |
generic_calibrate_cycle(); |
kern_gettime(&zero_time); |
generic_fsfinit(); |
150,7 → 144,7 |
loader_task_create(start_loader_task); |
generic_set_simulation_time(total); |
generic_set_simulation_time(&total); |
/demos/trunk/loader/initfile.c |
---|
80,7 → 80,7 |
PTHREAD_register_module(1, 0, 1); |
dos_preload("loadfile.txt",100000,&start_file,&end_file); |
//dos_preload("loadfile.txt",100000,&start_file,&end_file); |
return TICK; |
/demos/trunk/loader/shark.c |
---|
1,5 → 1,8 |
#include <func.h> |
#include <kernel/kern.h> |
#include "func.h" |
/* Delay Calibration */ |
int calibrate_cycle() |
{ |
20,7 → 23,7 |
} |
void *get_task_model(task_loader *current) { |
void *get_task_model(struct loader_task *current) { |
if (current->local_scheduler == LOADER_POSIX_SCHEDULER) { |
static NRT_TASK_MODEL nrt; |
62,8 → 65,6 |
struct timespec end_time; |
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); |
74,3 → 75,8 |
ADDTIMESPEC(&zero_time,next,&end_time); |
kern_event_post(&end_time,(void *)((void *)(task_activate(exec_shadow))),NULL); |
} |
int calibration_func() { |
return kern_gettime(NULL); |
} |
/demos/trunk/loader/makefile |
---|
7,10 → 7,10 |
endif |
include $(BASE)/config/config.mk |
PROGS = loader |
PROGS = newloader |
include $(BASE)/config/example.mk |
loader: |
make -f $(SUBMAKE) APP=loader INIT= OTHEROBJS="fsfinit.o initfile.o parser.o dosread.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __FIRST__" |
newloader: |
make -f $(SUBMAKE) APP=newloader INIT= OTHEROBJS="fsfinit.o initfile.o shark.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __FIRST__" |
/demos/trunk/loader/shark.h |
---|
0,0 → 1,10 |
#ifndef SHARK_H |
#define SHARK_H |
int calibrate_cycle(); |
void *get_task_model(struct loader_task *current); |
void set_simulation_time (struct timespec *total); |
void set_next_activation(struct timespec *next); |
int calibration_func(); |
#endif |