libcpu/powerpc/mpc8xx/clock: Fix warnings and clean up

This commit is contained in:
Joel Sherrill
2014-10-07 09:39:42 -05:00
parent 46e72c8d5a
commit 780eab400d
2 changed files with 55 additions and 45 deletions

View File

@@ -1,6 +1,9 @@
/**
* @file
* @brief mbx8xx Clock Tick connection code.
*/
/*
* Clock Tick interrupt conexion code.
*
* COPYRIGHT (c) 1989-1997.
* On-Line Applications Research Corporation (OAR).
*
@@ -21,12 +24,21 @@ extern void clockOff (void*);
extern int clockIsOn(void*);
extern void Clock_isr(void*);
static rtems_irq_connect_data clockIrqData = {BSP_PERIODIC_TIMER,
static rtems_irq_connect_data clockIrqData = {
BSP_PERIODIC_TIMER,
(rtems_irq_hdl)Clock_isr,
0,
(rtems_irq_enable)clockOn,
(rtems_irq_disable)clockOff,
(rtems_irq_is_enabled)clockIsOn};
(rtems_irq_is_enabled)clockIsOn
};
/*
* Prototypes
*/
int BSP_get_clock_irq_level(void);
int BSP_connect_clock_handler(rtems_irq_hdl hdl);
int BSP_disconnect_clock_handler(void);
int BSP_get_clock_irq_level(void)
{
@@ -52,10 +64,12 @@ int BSP_connect_clock_handler (rtems_irq_hdl hdl)
printk("Unable to get system clock handler\n");
rtems_fatal_error_occurred(1);
}
if (!BSP_remove_rtems_irq_handler(&clockIrqData)) {
printk("Unable to remove current system clock handler\n");
rtems_fatal_error_occurred(1);
}
/*
* Reinit structure
*/

View File

@@ -2,7 +2,9 @@
*
* This routine initializes the PIT on the MPC8xx.
* The tick frequency is specified by the bsp.
*
*/
/*
* Author: Jay Monkman (jmonkman@frasca.com)
* Copyright (C) 1998 by Frasca International, Inc.
*
@@ -49,14 +51,16 @@ extern int BSP_disconnect_clock_handler(void);
extern uint32_t bsp_clicks_per_usec;
extern uint32_t bsp_clock_speed;
void Clock_exit( void );
/*
* These are set by clock driver during its init
* Prototypes
*/
rtems_device_major_number rtems_clock_major = ~0;
rtems_device_minor_number rtems_clock_minor;
rtems_isr Clock_isr(rtems_vector_number vector);
void Clock_exit( void );
void clockOn(void* unused);
void clockOff(void* unused);
int clockIsOn(void* unused);
void Install_clock(rtems_isr_entry clock_isr);
void ReInstall_clock(rtems_isr_entry new_clock_isr);
/*
* ISR Handler
@@ -129,6 +133,7 @@ void clockOn(void* unused)
m8xx.sccr &= ~(1<<23);
}
if ((pit_value > 0xffff) || force_prescaler) {
/*
* try to activate prescaler
@@ -152,12 +157,12 @@ if ((pit_value > 0xffff) || force_prescaler){
m8xx.piscr = M8xx_PISCR_PIRQ(desiredLevel) |
M8xx_PISCR_PTE | M8xx_PISCR_PS | M8xx_PISCR_PIE;
}
/*
* Called via atexit()
* Remove the clock interrupt handler by setting handler to NULL
*/
void
clockOff(void* unused)
void clockOff(void* unused)
{
/* disable PIT and PIT interrupts */
m8xx.piscr &= ~(M8xx_PISCR_PTE | M8xx_PISCR_PIE);
@@ -165,7 +170,8 @@ clockOff(void* unused)
int clockIsOn(void* unused)
{
if (m8xx.piscr & M8xx_PISCR_PIE) return 1;
if (m8xx.piscr & M8xx_PISCR_PIE)
return 1;
return 0;
}
@@ -173,8 +179,7 @@ int clockIsOn(void* unused)
* Called via atexit()
* Remove the clock interrupt handler by setting handler to NULL
*/
void
Clock_exit(void)
void Clock_exit(void)
{
(void) BSP_disconnect_clock_handler ();
}
@@ -187,13 +192,11 @@ void Install_clock(rtems_isr_entry clock_isr)
atexit(Clock_exit);
}
void
ReInstall_clock(rtems_isr_entry new_clock_isr)
void ReInstall_clock(rtems_isr_entry new_clock_isr)
{
BSP_connect_clock_handler (new_clock_isr);
}
rtems_device_driver Clock_initialize(
rtems_device_major_number major,
rtems_device_minor_number minor,
@@ -202,12 +205,5 @@ rtems_device_driver Clock_initialize(
{
Install_clock( Clock_isr );
/*
* make major/minor avail to others such as shared memory driver
*/
rtems_clock_major = major;
rtems_clock_minor = minor;
return RTEMS_SUCCESSFUL;
}