|
Message
From: =?unknown-8bit?Q?Gy=F6rgy?= 'nog' Jeney<nog@s...>
Date: Thu Mar 24 21:09:15 CET 2005
Subject: [openrisc] [or1ksim #42] Use the new debug functions in the tick
timer
Hi,This makes the tick timer debugable by makeing it use the new debug channels. ChangeLog: * Make the tick timer use the new debug functions.
nog. -------------- next part -------------- --- /home/nog/or1ksim-split/support/dbchs.h 2005-03-22 16:57:32.000000000 +0100 +++ ./support/dbchs.h 2005-03-17 18:07:52.000000000 +0100 @@ -20,4 +20,5 @@ /* Declatrations of all debug channels */ DECLARE_DEBUG_CHANNEL(sched) +DECLARE_DEBUG_CHANNEL(tick) DECLARE_DEBUG_CHANNEL(uart) --- tick/tick.c 2005-03-22 16:57:30.000000000 +0100 +++ /home/nog/or1ksim-split/tick/tick.c 2005-03-22 17:51:53.000000000 +0100 @@ -41,6 +41,9 @@ #include "sprs.h" #include "sim-config.h" #include "sched.h" +#include "debug.h" + +DEFAULT_DEBUG_CHANNEL(tick); /* When did the timer start to count */ int cycles_start = 0; @@ -64,12 +67,14 @@ void tick_job (void *param) { int mode = (ttmr & SPR_TTMR_M) >> 30; - /*debug (7, "tick_job%i, param %i\n", param, mode);*/ + TRACE("tick_job param: %i, mode: %i at %lli (%lli)\n", (int)param, mode, + runtime.sim.cycles, runtime.cpu.instructions); switch (mode) { case 1: if (!param) { sprs[SPR_TTCR] = ttcr = 0; cycles_start = runtime.sim.cycles - ttcr; + TRACE("Scheduleing timer job for %li\n", (ttmr & SPR_TTMR_PERIOD) - ttcr); SCHED_ADD(tick_job, (void *)0, (ttmr & SPR_TTMR_PERIOD) - ttcr); } case 2: @@ -91,12 +96,14 @@ void spr_write_ttcr (unsigned long value) { unsigned mode = (ttmr & SPR_TTMR_M) >> 30; - /*debug (7, "ttcr = %08x\n", value);*/ + TRACE("set ttcr = %"PRIxREG"\n", value); ttcr = value; /* Remove previous if it exists */ + TRACE("Removeing scheduled jobs\n"); SCHED_FIND_REMOVE(tick_job, (void *)0); SCHED_FIND_REMOVE(tick_job, (void *)1); if (mode == 1 || mode == 2) { + TRACE("Scheduleing timer job for %li\n", (ttmr & SPR_TTMR_PERIOD) - ttcr); SCHED_ADD(tick_job, (void *)0, (ttmr & SPR_TTMR_PERIOD) - ttcr); cycles_start = runtime.sim.cycles - ttcr; } @@ -104,22 +111,26 @@ void spr_write_ttmr (unsigned long value) { - /*debug (7, "ttmr = %08x\n", value);*/ + TRACE("set ttmr = %"PRIxREG"\n", value); ttmr = value; /* Handle the modes properly. */ switch((ttmr & SPR_TTMR_M) >> 30) { case 0: /* Timer is disabled */ + TRACE("Removeing scheduled jobs\n"); 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; + TRACE("Removeing scheduled jobs\n"); SCHED_FIND_REMOVE(tick_job, (void *)0); SCHED_FIND_REMOVE(tick_job, (void *)1); + TRACE("Scheduleing timer job for %li\n", (ttmr & SPR_TTMR_PERIOD) - ttcr); SCHED_ADD(tick_job, (void *)0, (ttmr & SPR_TTMR_PERIOD) - ttcr); break; case 2: /* Stop the timer when match */ + TRACE("Removeing scheduled jobs\n"); SCHED_FIND_REMOVE(tick_job, (void *)0); SCHED_FIND_REMOVE(tick_job, (void *)1); break; @@ -130,6 +141,6 @@ unsigned long spr_read_ttcr () { - /*debug (7, "ttcr ---- %08x\n", runtime.sim.cycles - cycles_start);*/ + TRACE("read ttcr %lli\n", runtime.sim.cycles - cycles_start); return runtime.sim.cycles - cycles_start; }
|
 |