diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-05-01 19:16:04 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-05-01 19:16:04 +0000 |
commit | 716f6bede98614f69a223f9eac9acd14efbbf563 (patch) | |
tree | d1006d839e9cc9cfb5d42a4f5521ae18189c7a32 /c | |
parent | 2007-05-01 Ray Xu <xr@trasin.net> (diff) | |
download | rtems-716f6bede98614f69a223f9eac9acd14efbbf563.tar.bz2 |
2007-05-01 Ray Xu <xr@trasin.net>
* lpc22xx/clock/clockdrv.c, lpc22xx/include/lpc22xx.h,
lpc22xx/irq/bsp_irq_asm.S, lpc22xx/irq/bsp_irq_init.c,
lpc22xx/irq/irq.c, lpc22xx/irq/irq.h, lpc22xx/timer/timer.c: Update
BSP to address changes between 4.7 and CVS head as well as to address
comments from Ralf and Joel.
Diffstat (limited to 'c')
-rw-r--r-- | c/src/lib/libcpu/arm/ChangeLog | 8 | ||||
-rw-r--r-- | c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c | 25 | ||||
-rw-r--r-- | c/src/lib/libcpu/arm/lpc22xx/include/lpc22xx.h | 5 | ||||
-rw-r--r-- | c/src/lib/libcpu/arm/lpc22xx/irq/bsp_irq_asm.S | 6 | ||||
-rw-r--r-- | c/src/lib/libcpu/arm/lpc22xx/irq/bsp_irq_init.c | 14 | ||||
-rw-r--r-- | c/src/lib/libcpu/arm/lpc22xx/irq/irq.c | 3 | ||||
-rw-r--r-- | c/src/lib/libcpu/arm/lpc22xx/irq/irq.h | 2 | ||||
-rw-r--r-- | c/src/lib/libcpu/arm/lpc22xx/timer/timer.c | 27 |
8 files changed, 46 insertions, 44 deletions
diff --git a/c/src/lib/libcpu/arm/ChangeLog b/c/src/lib/libcpu/arm/ChangeLog index 146caed0e7..206ec46c9f 100644 --- a/c/src/lib/libcpu/arm/ChangeLog +++ b/c/src/lib/libcpu/arm/ChangeLog @@ -1,3 +1,11 @@ +2007-05-01 Ray Xu <xr@trasin.net> + + * lpc22xx/clock/clockdrv.c, lpc22xx/include/lpc22xx.h, + lpc22xx/irq/bsp_irq_asm.S, lpc22xx/irq/bsp_irq_init.c, + lpc22xx/irq/irq.c, lpc22xx/irq/irq.h, lpc22xx/timer/timer.c: Update + BSP to address changes between 4.7 and CVS head as well as to address + comments from Ralf and Joel. + 2007-04-25 Ralf Corsépius <ralf.corsepius@rtems.org> * lpc22xx/clock/clockdrv.c, lpc22xx/include/lpc22xx.h, diff --git a/c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c b/c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c index b486b09b8c..ef3e847731 100644 --- a/c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c +++ b/c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c @@ -1,6 +1,8 @@ /* - * LPC22XX clock specific using the System Timer - * set the Time0 + * LPC22XX/LPC21xx clock specific using the System Timer + * Copyright (c) 2006 by Ray <rayx.cn@gmail.com> + * Set the Time0 to generate click for RTEMS + * * This is hardware specific part of the clock driver. At the end of this * file, the generic part of the driver is #included. * @@ -76,9 +78,9 @@ rtems_irq_connect_data clock_isr_data = {LPC22xx_INTERRUPT_TIMER0, * NOPs. */ - /* set timer to generate interrupt every BSP_Configuration.microseconds_per_tick */ - /* MR0/(LPC22xx_Fpclk/(PR0+1)) = 10/1000 = 0.01s */ - + /* set timer to generate interrupt every BSP_Configuration.microseconds_per_tick + * MR0/(LPC22xx_Fpclk/(PR0+1)) = 10/1000 = 0.01s + */ #define Clock_driver_support_initialize_hardware() \ do { \ @@ -104,6 +106,19 @@ rtems_irq_connect_data clock_isr_data = {LPC22xx_INTERRUPT_TIMER0, BSP_remove_rtems_irq_handler(&clock_isr_data); \ } while (0) +uint32_t bsp_clock_nanoseconds_since_last_tick(void) +{ + uint32_t clicks; + + clicks = T0TC; /*T0TC is the 32bit time counter 0*/ + + return (uint32_t) (BSP_Configuration.microseconds_per_tick - clicks) * 1000; +} + +#define Clock_driver_nanoseconds_since_last_tick bsp_clock_nanoseconds_since_last_tick + + + /** * Enables clock interrupt. * diff --git a/c/src/lib/libcpu/arm/lpc22xx/include/lpc22xx.h b/c/src/lib/libcpu/arm/lpc22xx/include/lpc22xx.h index 22c8c8e91b..da11ca876e 100644 --- a/c/src/lib/libcpu/arm/lpc22xx/include/lpc22xx.h +++ b/c/src/lib/libcpu/arm/lpc22xx/include/lpc22xx.h @@ -1,8 +1,7 @@ /* - * Motorola LPC22XX Register definitions + * Philips LPC22XX/LPC21xx Register definitions * - * Copyright (c) 2003 by Cogent Computer Systems - * Written by Jay Monkman <jtm@lopingdog.com> + * Copyright (c) 2006 by Ray <rayx.cn@gmail.com> * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at diff --git a/c/src/lib/libcpu/arm/lpc22xx/irq/bsp_irq_asm.S b/c/src/lib/libcpu/arm/lpc22xx/irq/bsp_irq_asm.S index 9b9fdc598c..43d32a6b0a 100644 --- a/c/src/lib/libcpu/arm/lpc22xx/irq/bsp_irq_asm.S +++ b/c/src/lib/libcpu/arm/lpc22xx/irq/bsp_irq_asm.S @@ -1,9 +1,7 @@ /* - * LPC22XX Intererrupt handler + * LPC22XX/LPC21xx Intererrupt handler * - * Copyright (c) 2002 by Jay Monkman <jtm@lopingdog.com> - * - * Modified by ray + * Modified by Ray <rayx.cn@gmail.com> 2006 from Jay Monkman's code * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at diff --git a/c/src/lib/libcpu/arm/lpc22xx/irq/bsp_irq_init.c b/c/src/lib/libcpu/arm/lpc22xx/irq/bsp_irq_init.c index bd5346f90b..08a747168e 100644 --- a/c/src/lib/libcpu/arm/lpc22xx/irq/bsp_irq_init.c +++ b/c/src/lib/libcpu/arm/lpc22xx/irq/bsp_irq_init.c @@ -1,8 +1,6 @@ /* - * Motorola LPC22XX Interrupt handler - * - * Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com> - * + * Motorola LPC22XX/LPC21xx Interrupt handler + * Modified by Ray 2006 <rayx.cn@gmail.com> to support LPC ARM * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * @@ -24,10 +22,17 @@ extern void default_int_handler(); */ void BSP_rtems_irq_mngt_init() { + long *vectorTable; + int i; /* disable all interrupts */ VICIntEnClr = 0xFFFFFFFF; + vectorTable = (long *) VECTOR_TABLE; + /* Initialize the vector table contents with default handler */ + for (i=0; i<BSP_MAX_INT; i++) { + *(vectorTable + i) = (long)(default_int_handler); + } /* * Set IRQHandler @@ -62,6 +67,5 @@ void BSP_rtems_irq_mngt_init() VICProtection = 0; VICIntSelect = 0; - } diff --git a/c/src/lib/libcpu/arm/lpc22xx/irq/irq.c b/c/src/lib/libcpu/arm/lpc22xx/irq/irq.c index 6c2ce2285c..47b0af3a66 100644 --- a/c/src/lib/libcpu/arm/lpc22xx/irq/irq.c +++ b/c/src/lib/libcpu/arm/lpc22xx/irq/irq.c @@ -1,8 +1,7 @@ /* * Philps LPC22XX Interrupt handler * - * Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com> - * Modified by ray + * Copyright (c) 2006 by Ray<rayx.cn@gmail.com> to support LPC ARM * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * diff --git a/c/src/lib/libcpu/arm/lpc22xx/irq/irq.h b/c/src/lib/libcpu/arm/lpc22xx/irq/irq.h index 45b2d1e2ba..69a2ef596a 100644 --- a/c/src/lib/libcpu/arm/lpc22xx/irq/irq.h +++ b/c/src/lib/libcpu/arm/lpc22xx/irq/irq.h @@ -1,7 +1,7 @@ /* * Interrupt handler Header file * - * Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com> + * Copyright (c) 2006 by Ray <rayx.cn@gmail.com> to support LPC ARM * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at diff --git a/c/src/lib/libcpu/arm/lpc22xx/timer/timer.c b/c/src/lib/libcpu/arm/lpc22xx/timer/timer.c index 7c0f452d05..50082a6f7a 100644 --- a/c/src/lib/libcpu/arm/lpc22xx/timer/timer.c +++ b/c/src/lib/libcpu/arm/lpc22xx/timer/timer.c @@ -3,7 +3,7 @@ * * This uses Timer1 for timing measurments. * - * By Ray xu, modify form Mc9328mxl RTEMS DSP + * By Ray xu<rayx.cn@gmail.com>, modify form Mc9328mxl RTEMS DSP * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -44,12 +44,6 @@ rtems_boolean Timer_driver_Find_average_overhead; */ void Timer_initialize( void ) { - T1TCR &= 0; /* disable and clear timer 0 */ - g_start = (T1TC/(LPC22xx_Fpclk/1000000)); - T1PC = 0; /* TC is incrementet on every pclk.*/ - T1MR0 = ((LPC22xx_Fpclk/1000* BSP_Configuration.microseconds_per_tick) / 1000); /* initialize the timer period and prescaler */ - T1EMR = 0; /*No external match*/ - T1TCR = 1; /*enable timer1*/ g_freq = LPC22xx_Fpclk / 1000; } @@ -73,27 +67,12 @@ int Read_timer( void ) uint32_t t; unsigned long long total; - t = (T1TC/(LPC22xx_Fpclk/1000000)); + return (T0TC/(LPC22xx_Fpclk/1000000)); /* * Total is calculated by taking into account the number of timer overflow * interrupts since the timer was initialized and clicks since the last - * interrupts. currently it is not supported + * interrupts. */ - - total = (t - g_start); - - /* convert to nanoseconds */ - - if ( Timer_driver_Find_average_overhead == 1 ) { - return (int) total; - } else if ( total < LEAST_VALID ) { - return 0; - } - /* - * Somehow convert total into microseconds - */ - - return (total - AVG_OVERHEAD); } /* |