OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [or1ksim/] [support/] [sched.c] - Diff between revs 1365 and 1390

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 1365 Rev 1390
Line 43... Line 43...
 
 
/* Dummy function, representing a guard, which protects heap from
/* Dummy function, representing a guard, which protects heap from
   emptying */
   emptying */
void sched_guard (void *dat)
void sched_guard (void *dat)
{
{
  SCHED_INIT ();
  if(scheduler.job_queue)
 
    SCHED_ADD(sched_guard, dat, SCHED_TIME_MAX);
 
  else {
 
    scheduler.job_queue = scheduler.free_job_queue;
 
    scheduler.free_job_queue = scheduler.free_job_queue->next;
 
    scheduler.job_queue->next = NULL;
 
    scheduler.job_queue->func = sched_guard;
 
    scheduler.job_queue->time = SCHED_TIME_MAX;
 
#if DYNAMIC_EXECUTION
 
    set_sched_cycle(SCHED_TIME_MAX);
 
#endif
 
  }
 
}
 
 
 
void sched_reset(void)
 
{
 
  struct sched_entry *cur, *next;
 
 
 
  for(cur = scheduler.job_queue; cur; cur = next) {
 
    next = cur->next;
 
    cur->next = scheduler.free_job_queue;
 
    scheduler.free_job_queue = cur;
 
  }
 
  scheduler.job_queue = NULL;
 
  sched_guard(NULL);
 
}
 
 
 
void sched_init(void)
 
{
 
  int i;
 
  struct sched_entry *new;
 
 
 
  scheduler.free_job_queue = NULL;
 
 
 
  for(i = 0; i < SCHED_HEAP_SIZE; i++) {
 
    if(!(new = malloc(sizeof(struct sched_entry)))) {
 
      fprintf(stderr, "Out-of-memory while allocateing scheduler queue\n");
 
      exit(1);
 
    }
 
    new->next = scheduler.free_job_queue;
 
    scheduler.free_job_queue = new;
 
  }
 
  scheduler.job_queue = NULL;
 
  sched_guard(NULL);
}
}
#warning Scheduler should continue from previous cycles not current ones
#warning Scheduler should continue from previous cycles not current ones
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.