Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1185 → Rev 1186

/demos/trunk/fsf/test1.c
41,8 → 41,10
#include "modules/cbs.h"
 
#include "pthread.h"
#include "posix.h"
 
#include "fsf_contract.h"
#include "cbsstar.h"
 
#include "modules/dummy.h"
 
71,12 → 73,12
TIME __kernel_register_levels__(void *arg)
{
struct multiboot_info *mb = (struct multiboot_info *)arg;
int posix_level, cbsstar_level;
int cbsstar_level;
 
EDF_register_level(EDF_ENABLE_ALL);
posix_level = POSIX_register_level(RRTICK, 1, mb, 32);
POSIX_register_level(RRTICK, 1, mb, 32);
cbsstar_level = CBSSTAR_register_level(4, 0);
FSF_register_module(posix_level, cbsstar_level);
FSF_register_module(cbsstar_level);
dummy_register_level();
 
// for the keyboard...
241,7 → 243,6
struct timespec budget2 = {0,30000000};
PID t1, t2;
int err;
 
kern_printf("(Start Create)");
 
270,35 → 271,10
 
group_activate(1);
 
err = pthread_create(&j1, NULL, star, (void *)"A");
if (err) {
perror("Could not create task A ...");
sys_end();
}
 
err = pthread_create(&j2, NULL, periodic_star, (void *)"B");
if (err) {
perror("Could not create task B ...");
sys_end();
}
 
err = pthread_create(&j3, NULL, star, (void *)"C");
if (err) {
perror("Could not create task C ...");
sys_end();
}
 
err = pthread_create(&j4, NULL, periodic_star, (void *)"D");
if (err) {
perror("Could not create task D ...");
sys_end();
}
fsf_initialize_contract(&contract1);
fsf_set_contract_basic_parameters(&contract1,&budget1,&period1,NULL,NULL,FSF_DEFAULT_WORKLOAD);
fsf_initialize_contract(&contract2);
fsf_set_contract_basic_parameters(&contract2,&budget2,&period2,NULL,NULL,FSF_DEFAULT_WORKLOAD);
fsf_set_local_scheduler_parameter(&contract2,FSF_SCHEDULER_EDF);
 
kern_printf("(End Create)");
 
309,56 → 285,31
 
char ch = 0;
int err;
NRT_TASK_MODEL nrt;
HARD_TASK_MODEL ht;
 
pthread_mutex_init(&mux,NULL);
 
create();
 
nrt_task_default_model(nrt);
nrt_task_def_save_arrivals(nrt);
 
hard_task_default_model(ht);
hard_task_def_mit(ht,1000000);
hard_task_def_wcet(ht,10000);
 
do {
ch = keyb_getch(BLOCK);
 
switch(ch) {
case '1':
err = fsf_bind_thread_to_server(server1,j1,&nrt);
err = fsf_create_thread(server1,&j1,NULL,star,NULL,NULL);
kern_printf("(%d)",err);
break;
case '2':
err = fsf_bind_thread_to_server(server2,j2,&ht);
err = fsf_create_thread(server2,&j2,NULL,star,NULL,NULL);
kern_printf("(%d)",err);
break;
case '3':
err = fsf_bind_thread_to_server(server1,j3,&nrt);
err = fsf_create_thread(server1,&j3,NULL,star,NULL,NULL);
kern_printf("(%d)",err);
break;
case '4':
err = fsf_bind_thread_to_server(server2,j4,&ht);
err = fsf_create_thread(server2,&j4,NULL,star,NULL,NULL);
kern_printf("(%d)",err);
break;
case '5':
err = fsf_unbind_thread_from_server(j1);
kern_printf("(%d)",err);
break;
case '6':
err = fsf_unbind_thread_from_server(j2);
kern_printf("(%d)",err);
break;
case '7':
err = fsf_unbind_thread_from_server(j3);
kern_printf("(%d)",err);
break;
case '8':
err = fsf_unbind_thread_from_server(j4);
kern_printf("(%d)",err);
break;
case 'q':
err = fsf_negotiate_contract(&contract1,&server1);
cprintf("(%d)",err);