forked from Imagelibrary/rtems
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.
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user