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

Subversion Repositories or1k_old

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 1364 to Rev 1365
    Reverse comparison

Rev 1364 → Rev 1365

/trunk/or1ksim/tick/tick.c
61,7 → 61,7
}
 
/* Job handler for tick timer */
void tick_job (int param)
void tick_job (void *param)
{
int mode = (ttmr & SPR_TTMR_M) >> 30;
/*debug (7, "tick_job%i, param %i\n", param, mode);*/
70,7 → 70,7
if (!param) {
sprs[SPR_TTCR] = ttcr = 0;
cycles_start = runtime.sim.cycles - ttcr;
SCHED_ADD(tick_job, 0, runtime.sim.cycles + (ttmr & SPR_TTMR_PERIOD) - ttcr);
SCHED_ADD(tick_job, (void *)0, runtime.sim.cycles + (ttmr & SPR_TTMR_PERIOD) - ttcr);
}
case 2:
if (ttmr & SPR_TTMR_IE) {
81,7 → 81,7
else
/* If TEE is currently not set we have to pend tick exception
by rescheduling. */
SCHED_ADD(tick_job, 1, runtime.sim.cycles + 1);
SCHED_ADD(tick_job, (void *)1, runtime.sim.cycles + 1);
}
break;
}
94,10 → 94,10
/*debug (7, "ttcr = %08x\n", value);*/
ttcr = value;
/* Remove previous if it exists */
SCHED_FIND_REMOVE(tick_job, 0);
SCHED_FIND_REMOVE(tick_job, 1);
SCHED_FIND_REMOVE(tick_job, (void *)0);
SCHED_FIND_REMOVE(tick_job, (void *)1);
if (mode == 1 || mode == 2) {
SCHED_ADD(tick_job, 0, runtime.sim.cycles + (ttmr & SPR_TTMR_PERIOD) - ttcr);
SCHED_ADD(tick_job, (void *)0, runtime.sim.cycles + (ttmr & SPR_TTMR_PERIOD) - ttcr);
cycles_start = runtime.sim.cycles - ttcr;
}
}
109,19 → 109,19
/* Handle the modes properly. */
switch((ttmr & SPR_TTMR_M) >> 30) {
case 0: /* Timer is disabled */
SCHED_FIND_REMOVE(tick_job, 0);
SCHED_FIND_REMOVE(tick_job, 1);
SCHED_FIND_REMOVE(tick_job, (void *)0);
SCHED_FIND_REMOVE(tick_job, (void *)1);
break;
case 1: /* Timer should auto restart */
sprs[SPR_TTCR] = ttcr = 0;
cycles_start = runtime.sim.cycles;
SCHED_FIND_REMOVE(tick_job, 0);
SCHED_FIND_REMOVE(tick_job, 1);
SCHED_ADD(tick_job, 0, runtime.sim.cycles + (ttmr & SPR_TTMR_PERIOD) - ttcr);
SCHED_FIND_REMOVE(tick_job, (void *)0);
SCHED_FIND_REMOVE(tick_job, (void *)1);
SCHED_ADD(tick_job, (void *)0, runtime.sim.cycles + (ttmr & SPR_TTMR_PERIOD) - ttcr);
break;
case 2: /* Stop the timer when match */
SCHED_FIND_REMOVE(tick_job, 0);
SCHED_FIND_REMOVE(tick_job, 1);
SCHED_FIND_REMOVE(tick_job, (void *)0);
SCHED_FIND_REMOVE(tick_job, (void *)1);
break;
case 3: /* Timer keeps running -- do nothing*/
break;
/trunk/or1ksim/peripheral/atadevice.c
32,7 → 32,6
#include "port.h"
#include "arch.h"
#include "abstract.h"
#include "sched.h"
 
#include "messages.h"
#include "atadevice.h"
/trunk/or1ksim/toplevel.c
76,7 → 76,7
#include "cuc.h"
 
/* CVS revision number. */
const char rcsrev[] = "$Revision: 1.106 $";
const char rcsrev[] = "$Revision: 1.107 $";
 
inline void debug(int level, const char *format, ...)
{
349,8 → 349,8
/* Executes jobs in time queue */
static inline void do_scheduler ()
{
void (*func)(int);
int param;
void (*func)(void *);
void *param;
 
/* Execute all jobs till now */
do {
/trunk/or1ksim/support/sched.c
28,6 → 28,15
#include <limits.h>
 
#include "config.h"
 
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
 
#include "port.h"
#include "arch.h"
#include "sim-config.h"
#include "config.h"
#include "sched.h"
 
struct scheduler_struct scheduler;
34,7 → 43,7
 
/* Dummy function, representing a guard, which protects heap from
emptying */
void sched_guard (int i)
void sched_guard (void *dat)
{
SCHED_INIT ();
}
/trunk/or1ksim/support/sched.h
30,8 → 30,8
/* Structure for holding one job entry */
struct sched_entry {
long long time; /* Clock cycles before job starts */
int param; /* Parameter to pass to the function */
void (*func)(int); /* Function to call when time reaches 0 */
void *param; /* Parameter to pass to the function */
void (*func)(void *); /* Function to call when time reaches 0 */
};
 
/* Heap of jobs */
44,7 → 44,7
 
/* Dummy function, representing a guard, which protects heap from
emptying */
extern void sched_guard (int i);
extern void sched_guard (void *);
 
/* Init scheduler -- clear the heap */
#define SCHED_INIT() {\
64,19 → 64,32
#endif
 
/* Adds new job to the queue */
#define SCHED_ADD(job_func, job_param, job_time) {\
int ___i;\
if (SCHED_DEBUG > 0) PRINTF ("%s@%i:SCHED_ADD(func %p, param %i, time %i)\n", __FUNCTION__, runtime.sim.cycles, (job_func), (job_param), (job_time));\
SCHED_PRINT_JOBS();\
if (SCHED_DEBUG > 1) PRINTF ("--------\n");\
___i = scheduler.size++;\
while (___i > 1 && scheduler.heap[___i / 2].time > (job_time)) scheduler.heap[___i] = scheduler.heap[___i /= 2];\
scheduler.heap[___i].func = (job_func);\
scheduler.heap[___i].param = (job_param);\
scheduler.heap[___i].time = (job_time);\
SCHED_PRINT_JOBS();\
static inline void sched_add(void (*job_func)(void *), void *job_param,
long long job_time, const char *func)
{
int i;
 
if (SCHED_DEBUG > 0)
PRINTF ("%s@%lli:SCHED_ADD(func %p, param %p, time %lli)\n", func,
runtime.sim.cycles, job_func, job_param, job_time);
SCHED_PRINT_JOBS();
 
if (SCHED_DEBUG > 1) PRINTF ("--------\n");\
 
i = scheduler.size++;
while (i > 1 && scheduler.heap[i / 2].time > job_time) {
scheduler.heap[i] = scheduler.heap[i / 2];
i /= 2;
}
 
scheduler.heap[i].func = job_func;
scheduler.heap[i].param = job_param;
scheduler.heap[i].time = job_time;
SCHED_PRINT_JOBS();
}
 
#define SCHED_ADD(job_func, job_param, job_time) sched_add(job_func, job_param, job_time, __FUNCTION__)
 
/* Removes an item from the heap */
#define SCHED_REMOVE_ITEM(index) {\
struct sched_entry *tmp;\

powered by: WebSVN 2.1.0

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