summaryrefslogtreecommitdiff
path: root/examples/timer.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2002-12-07 00:20:59 +0000
committerwdenk <wdenk>2002-12-07 00:20:59 +0000
commit7c7a23bd5a0bc149d2edd665ec46381726b24e0c (patch)
treed859f82ea2561180db2ffd7569f0b9007d710769 /examples/timer.c
parent1f53a41603b9093c59741f4208fef0ab3790d6ce (diff)
downloadu-boot-imx-7c7a23bd5a0bc149d2edd665ec46381726b24e0c.zip
u-boot-imx-7c7a23bd5a0bc149d2edd665ec46381726b24e0c.tar.gz
u-boot-imx-7c7a23bd5a0bc149d2edd665ec46381726b24e0c.tar.bz2
* Patch by Hans-Joerg Frieden, 06 Dec 2002
Fix misc problems with AmigaOne support * Patch by Chris Hallinan, 3 Dec 2002: minor cleanup to the MPC8245 EPIC driver * Patch by Pierre Aubert , 28 Nov 2002 Add support for external (SIU) interrupts on MPC8xx * Patch by Pierre Aubert , 28 Nov 2002 Fix nested syscalls bug in standalone applications * Patch by David Müller, 27 Nov 2002: fix output of "pciinfo" command for CardBus bridge devices. * Fix bug in TQM8260 board detection - boards got stuck when board ID was not readable
Diffstat (limited to 'examples/timer.c')
-rw-r--r--examples/timer.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/examples/timer.c b/examples/timer.c
index 8d60fc8..33f53c0 100644
--- a/examples/timer.c
+++ b/examples/timer.c
@@ -122,6 +122,7 @@ int timer (int argc, char *argv[])
tid_8xx_cpmtimer_t hw;
tid_8xx_cpmtimer_t *hwp = &hw;
int c;
+ int running;
/* Pointer to CPM Timer structure */
cpmtimerp = &((immap_t *) gd->bd->bi_immr_base)->im_cpmtimer;
@@ -185,6 +186,7 @@ int timer (int argc, char *argv[])
*hwp->terp = (CPMT_EVENT_CAP | CPMT_EVENT_REF);
mon_printf (usage);
+ running = 0;
while ((c = mon_getc()) != 'q') {
if (c == 'b') {
@@ -197,6 +199,7 @@ int timer (int argc, char *argv[])
/* enable timer */
*hwp->tgcrp |= (CPMT_GCR_RST << TID_TIMER_ID);
+ running = 1;
#ifdef DEBUG
mon_printf ("tgcr=0x%x, tmr=0x%x, trr=0x%x,"
@@ -210,6 +213,7 @@ int timer (int argc, char *argv[])
mon_printf ("Stopping timer\n");
*hwp->tgcrp &= ~(CPMT_GCR_MASK << TID_TIMER_ID);
+ running = 0;
#ifdef DEBUG
mon_printf ("tgcr=0x%x, tmr=0x%x, trr=0x%x,"
@@ -252,6 +256,12 @@ int timer (int argc, char *argv[])
}
mon_printf (usage);
}
+ if (running) {
+ mon_printf ("Stopping timer\n");
+ *hwp->tgcrp &= ~(CPMT_GCR_MASK << TID_TIMER_ID);
+ mon_free_hdlr (hwp->cpm_vec);
+ }
+
return (0);
}