forked from Imagelibrary/rtems
at91rm9200 shared: Clock driver clean up and ISR Handler Prototype Correction.
This commit is contained in:
@@ -9,10 +9,8 @@
|
||||
* found in the file LICENSE in this distribution or at
|
||||
*
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/clockdrv.h>
|
||||
#include <rtems/libio.h>
|
||||
@@ -23,7 +21,6 @@
|
||||
#include <at91rm9200.h>
|
||||
#include <at91rm9200_pmc.h>
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
/* enable timer interrupt */
|
||||
ST_REG(ST_IER) = ST_SR_PITS;
|
||||
/* enable timer interrupt */
|
||||
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)
|
||||
{
|
||||
/* disable timer interrupt */
|
||||
ST_REG(ST_IDR) = ST_SR_PITS;
|
||||
return;
|
||||
/* disable timer interrupt */
|
||||
ST_REG(ST_IDR) = ST_SR_PITS;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -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)
|
||||
{
|
||||
/* check timer interrupt */
|
||||
return ST_REG(ST_IMR) & ST_SR_PITS;
|
||||
/* check timer interrupt */
|
||||
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. */
|
||||
rtems_irq_connect_data clock_isr_data = {AT91RM9200_INT_SYSIRQ,
|
||||
(rtems_irq_hdl)Clock_isr,
|
||||
NULL,
|
||||
clock_isr_on,
|
||||
clock_isr_off,
|
||||
clock_isr_is_on};
|
||||
rtems_irq_connect_data clock_isr_data = {
|
||||
.name = AT91RM9200_INT_SYSIRQ,
|
||||
.hdl = Clock_isr,
|
||||
.handle = NULL,
|
||||
.on = clock_isr_on,
|
||||
.off = clock_isr_off,
|
||||
.isOn = clock_isr_is_on,
|
||||
};
|
||||
|
||||
|
||||
#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 */
|
||||
slck = at91rm9200_get_slck();
|
||||
st_pimr_value =
|
||||
(((rtems_configuration_get_microseconds_per_tick() * slck) + (1000000/2))/ 1000000);
|
||||
st_pimr_value = (((rtems_configuration_get_microseconds_per_tick() * slck) +
|
||||
(1000000/2))/ 1000000);
|
||||
st_pimr_reload = st_pimr_value;
|
||||
|
||||
/* 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 \
|
||||
bsp_clock_nanoseconds_since_last_tick
|
||||
|
||||
#define CLOCK_VECTOR 0
|
||||
|
||||
#define Clock_driver_support_at_tick() \
|
||||
do { \
|
||||
uint32_t st_str; \
|
||||
@@ -124,7 +120,7 @@ uint32_t bsp_clock_nanoseconds_since_last_tick(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"
|
||||
|
||||
Reference in New Issue
Block a user