at91rm9200 shared: Clock driver clean up and ISR Handler Prototype Correction.

This commit is contained in:
Joel Sherrill
2012-04-19 13:15:34 -05:00
parent b2d947820e
commit 14010768ed

View File

@@ -9,10 +9,8 @@
* found in the file LICENSE in this distribution or at * found in the file LICENSE in this distribution or at
* *
* http://www.rtems.com/license/LICENSE. * http://www.rtems.com/license/LICENSE.
*
*
* $Id$
*/ */
#include <rtems.h> #include <rtems.h>
#include <rtems/clockdrv.h> #include <rtems/clockdrv.h>
#include <rtems/libio.h> #include <rtems/libio.h>
@@ -23,7 +21,6 @@
#include <at91rm9200.h> #include <at91rm9200.h>
#include <at91rm9200_pmc.h> #include <at91rm9200_pmc.h>
static unsigned long st_pimr_reload; static unsigned long st_pimr_reload;
/** /**
@@ -33,8 +30,8 @@ static unsigned long st_pimr_reload;
*/ */
static void clock_isr_on(const rtems_irq_connect_data *unused) static void clock_isr_on(const rtems_irq_connect_data *unused)
{ {
/* enable timer interrupt */ /* enable timer interrupt */
ST_REG(ST_IER) = ST_SR_PITS; ST_REG(ST_IER) = ST_SR_PITS;
} }
/** /**
@@ -44,9 +41,8 @@ static void clock_isr_on(const rtems_irq_connect_data *unused)
*/ */
static void clock_isr_off(const rtems_irq_connect_data *unused) static void clock_isr_off(const rtems_irq_connect_data *unused)
{ {
/* disable timer interrupt */ /* disable timer interrupt */
ST_REG(ST_IDR) = ST_SR_PITS; ST_REG(ST_IDR) = ST_SR_PITS;
return;
} }
/** /**
@@ -57,19 +53,21 @@ static void clock_isr_off(const rtems_irq_connect_data *unused)
*/ */
static int clock_isr_is_on(const rtems_irq_connect_data *irq) static int clock_isr_is_on(const rtems_irq_connect_data *irq)
{ {
/* check timer interrupt */ /* check timer interrupt */
return ST_REG(ST_IMR) & ST_SR_PITS; return ST_REG(ST_IMR) & ST_SR_PITS;
} }
rtems_isr Clock_isr(rtems_vector_number vector); void Clock_isr(rtems_irq_hdl_param arg);
/* Replace the first value with the clock's interrupt name. */ /* Replace the first value with the clock's interrupt name. */
rtems_irq_connect_data clock_isr_data = {AT91RM9200_INT_SYSIRQ, rtems_irq_connect_data clock_isr_data = {
(rtems_irq_hdl)Clock_isr, .name = AT91RM9200_INT_SYSIRQ,
NULL, .hdl = Clock_isr,
clock_isr_on, .handle = NULL,
clock_isr_off, .on = clock_isr_on,
clock_isr_is_on}; .off = clock_isr_off,
.isOn = clock_isr_is_on,
};
#define Clock_driver_support_install_isr( _new, _old ) \ #define Clock_driver_support_install_isr( _new, _old ) \
@@ -86,8 +84,8 @@ void Clock_driver_support_initialize_hardware(void)
/* the system timer is driven from SLCK */ /* the system timer is driven from SLCK */
slck = at91rm9200_get_slck(); slck = at91rm9200_get_slck();
st_pimr_value = st_pimr_value = (((rtems_configuration_get_microseconds_per_tick() * slck) +
(((rtems_configuration_get_microseconds_per_tick() * slck) + (1000000/2))/ 1000000); (1000000/2))/ 1000000);
st_pimr_reload = st_pimr_value; st_pimr_reload = st_pimr_value;
/* read the status to clear the int */ /* read the status to clear the int */
@@ -112,8 +110,6 @@ uint32_t bsp_clock_nanoseconds_since_last_tick(void)
#define Clock_driver_nanoseconds_since_last_tick \ #define Clock_driver_nanoseconds_since_last_tick \
bsp_clock_nanoseconds_since_last_tick bsp_clock_nanoseconds_since_last_tick
#define CLOCK_VECTOR 0
#define Clock_driver_support_at_tick() \ #define Clock_driver_support_at_tick() \
do { \ do { \
uint32_t st_str; \ uint32_t st_str; \
@@ -124,7 +120,7 @@ uint32_t bsp_clock_nanoseconds_since_last_tick(void)
void Clock_driver_support_shutdown_hardware( void ) void Clock_driver_support_shutdown_hardware( void )
{ {
BSP_remove_rtems_irq_handler(&clock_isr_data); BSP_remove_rtems_irq_handler(&clock_isr_data);
} }
#include "../../../../libbsp/shared/clockdrv_shell.h" #include "../../../../libbsp/shared/clockdrv_shell.h"