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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [or1ksim/] [support/] [sched.h] - Blame information for rev 1771

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 807 markom
/* sched.h -- Abstract entities header file handling job scheduler
2 1748 jeremybenn
 
3 807 markom
   Copyright (C) 2001 Marko Mlinar, markom@opencores.org
4 1390 nogj
   Copyright (C) 2005 György `nog' Jeney, nog@sdf.lonestar.org
5 1748 jeremybenn
   Copyright (C) 2008 Embecosm Limited
6 807 markom
 
7 1748 jeremybenn
   Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
8 807 markom
 
9 1748 jeremybenn
   This file is part of Or1ksim, the OpenRISC 1000 Architectural Simulator.
10 807 markom
 
11 1748 jeremybenn
   This program is free software; you can redistribute it and/or modify it
12
   under the terms of the GNU General Public License as published by the Free
13
   Software Foundation; either version 3 of the License, or (at your option)
14
   any later version.
15 807 markom
 
16 1748 jeremybenn
   This program is distributed in the hope that it will be useful, but WITHOUT
17
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
19
   more details.
20 807 markom
 
21 1748 jeremybenn
   You should have received a copy of the GNU General Public License along
22
   with this program.  If not, see <http://www.gnu.org/licenses/>.  */
23
 
24
/* This program is commented throughout in a fashion suitable for processing
25
   with Doxygen. */
26
 
27
 
28 807 markom
#ifndef _SCHED_H_
29
#define _SCHED_H_
30
 
31 1748 jeremybenn
/*! Macro to add a job to the scheduler */
32 1688 nogj
#define SCHED_ADD(job_func, job_param, job_time) sched_add(job_func, job_param, job_time, #job_func)
33 1748 jeremybenn
 
34
/*! Macro to remove a job from the scheduler */
35 1751 jeremybenn
#define SCHED_FIND_REMOVE(f, p) sched_find_remove(f, p)
36 1390 nogj
 
37 1748 jeremybenn
/*! Structure for holding one job entry */
38
struct sched_entry
39
{
40
  int32_t time;                 /* Clock cycles before job starts */
41
  void *param;                  /* Parameter to pass to the function */
42
  void (*func) (void *);        /* Function to call when time reaches 0 */
43 1390 nogj
  struct sched_entry *next;
44 807 markom
};
45
 
46 1748 jeremybenn
/*! Heap of jobs */
47
struct scheduler_struct
48
{
49 1390 nogj
  struct sched_entry *free_job_queue;
50
  struct sched_entry *job_queue;
51 807 markom
};
52
 
53 1748 jeremybenn
/* Global data structures for external use */
54 807 markom
extern struct scheduler_struct scheduler;
55
 
56 1748 jeremybenn
/* Function prototypes for external use */
57
extern void sched_init ();
58
extern void sched_reset ();
59
extern void sched_next_insn (void  (*func) (void *),
60
                             void *dat);
61
extern void sched_find_remove (void        (*job_func) (void *),
62 1751 jeremybenn
                               void       *dat);
63 1748 jeremybenn
extern void sched_add (void        (*job_func) (void *),
64
                       void       *job_param,
65
                       int32_t     job_time,
66
                       const char *func);
67
extern void do_scheduler ();
68 1452 nogj
 
69 807 markom
#endif /* _SCHED_H_ */

powered by: WebSVN 2.1.0

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