Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1303 → Rev 1304

/demos/trunk/loader/common/nload.h
19,8 → 19,12
int act_number; //Number of activations precalcolated
int act_current; //Actual activation number
 
int resource;
int muxstatus;
 
struct timespec *act; //Activation list
struct timespec *exec; //Execution time list
struct timespec *block; //Blocking time
 
};
 
/demos/trunk/loader/common/nload.c
79,7 → 79,7
*/
void *periodic_task(void *arg)
{
long long i,exec_cycles = 0;
long long i,exec_cycles = 0,block_cycles = 0;
int act = 0;
struct loader_task *l = (struct loader_task *)(arg);
 
105,13 → 105,38
#endif
exec_cycles = (long long)(TIMESPEC2USEC(&l->exec[l->act_current-1])) * CALIBRATION_DELTA / cal_cycles;
block_cycles = (long long)(TIMESPEC2USEC(&l->block[l->act_current-1])) * CALIBRATION_DELTA / cal_cycles;
 
/* Execution delay */
for (i=0;i<exec_cycles;i++)
__asm__ __volatile__ ("xorl %%eax,%%eax\n\t"
"cpuid\n\t"
:::"eax","ebx","ecx","edx");
if (l->muxstatus == 2) {
#ifdef TASK_OUTPUT
#ifdef OS_SHARK
sprintf(tmp,"C[LOCK%02d]",l->resource);
printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, RED, tmp);
#endif
#endif
 
generic_lock_mutex(l->resource);
for (i=0;i<block_cycles;i++)
__asm__ __volatile__ ("xorl %%eax,%%eax\n\t"
"cpuid\n\t"
:::"eax","ebx","ecx","edx");
generic_unlock_mutex(l->resource);
#ifdef TASK_OUTPUT
#ifdef OS_SHARK
sprintf(tmp,"C[FREE%02d]",l->resource);
printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, GREEN, tmp);
#endif
#endif
 
}
 
end_job_periodic_task();
 
generic_task_endcycle();
142,7 → 167,7
*/
void *back_task(void *arg)
{
long long i,exec_cycles = 0;
long long i,exec_cycles = 0,block_cycles = 0;
int act = 0;
struct loader_task *l = (struct loader_task *)(arg);
#ifdef TASK_OUTPUT
167,13 → 192,38
#endif
exec_cycles = (long long)(TIMESPEC2USEC(&l->exec[l->act_current-1])) * CALIBRATION_DELTA / cal_cycles;
block_cycles = (long long)(TIMESPEC2USEC(&l->block[l->act_current-1])) * CALIBRATION_DELTA / cal_cycles;
/* Execution delay */
for (i=0;i<exec_cycles;i++)
__asm__ __volatile__ ("xorl %%eax,%%eax\n\t"
"cpuid\n\t"
:::"eax","ebx","ecx","edx");
if (l->muxstatus == 2) {
 
#ifdef TASK_OUTPUT
#ifdef OS_SHARK
sprintf(tmp,"B[LOCK%02d]",l->resource);
printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, RED, tmp);
#endif
#endif
 
generic_lock_mutex(l->resource);
for (i=0;i<block_cycles;i++)
__asm__ __volatile__ ("xorl %%eax,%%eax\n\t"
"cpuid\n\t"
:::"eax","ebx","ecx","edx");
generic_unlock_mutex(l->resource);
 
#ifdef TASK_OUTPUT
#ifdef OS_SHARK
sprintf(tmp,"C[FREE%02d]",l->resource);
printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, GREEN, tmp);
#endif
#endif
 
}
 
end_job_back_task();
 
act++;