libcpu/sh/sh7750/clock/ckinit.c: Fix warnings

This commit is contained in:
Joel Sherrill
2014-10-12 15:37:34 -05:00
parent 4172cf1b2b
commit 9fab016dac

View File

@@ -1,6 +1,8 @@
/* /*
* This file contains the generic RTEMS clock driver the Hitachi SH 7750 * This file contains the generic RTEMS clock driver the Hitachi SH 7750
* */
/*
* Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
* Author: Victor V. Vengerov <vvv@oktet.ru> * Author: Victor V. Vengerov <vvv@oktet.ru>
* *
@@ -16,7 +18,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <rtems/libio.h> #include <rtems/clockdrv.h>
#include <rtems/score/sh_io.h> #include <rtems/score/sh_io.h>
#include <rtems/score/sh.h> #include <rtems/score/sh.h>
#include <rtems/score/ispsh7750.h> #include <rtems/score/ispsh7750.h>
@@ -36,46 +38,31 @@ extern uint32_t bsp_clicks_per_second;
* The interrupt vector number associated with the clock tick device * The interrupt vector number associated with the clock tick device
* driver. * driver.
*/ */
#define CLOCK_VECTOR SH7750_EVT_TO_NUM(SH7750_EVT_TUNI0) #define CLOCK_VECTOR SH7750_EVT_TO_NUM(SH7750_EVT_TUNI0)
/* /*
* Clock_driver_ticks is a monotonically increasing counter of the * Clock_driver_ticks is a monotonically increasing counter of the
* number of clock ticks since the driver was initialized. * number of clock ticks since the driver was initialized.
*/ */
volatile uint32_t Clock_driver_ticks; volatile uint32_t Clock_driver_ticks;
static void Clock_exit( void );
static rtems_isr Clock_isr( rtems_vector_number vector ); static rtems_isr Clock_isr( rtems_vector_number vector );
/*
* These are set by clock driver during its init
*/
rtems_device_major_number rtems_clock_major = ~0;
rtems_device_minor_number rtems_clock_minor;
/* /*
* The previous ISR on this clock tick interrupt vector. * The previous ISR on this clock tick interrupt vector.
*/ */
rtems_isr_entry Old_ticker; rtems_isr_entry Old_ticker;
/* /*
* Isr Handler * Isr Handler
*/ */
/* Clock_isr -- /*
* Clock_isr
*
* Clock interrupt handling routine. * Clock interrupt handling routine.
*
* PARAMETERS:
* vector - interrupt vector number
*
* RETURNS:
* none
*/ */
rtems_isr static rtems_isr Clock_isr(rtems_vector_number vector)
Clock_isr(rtems_vector_number vector)
{ {
uint16_t tcr; uint16_t tcr;
@@ -90,21 +77,16 @@ Clock_isr(rtems_vector_number vector)
rtems_clock_tick(); rtems_clock_tick();
} }
/* Install_clock -- /*
* Install_clock
*
* Install a clock tick handler and reprograms the chip. This * Install a clock tick handler and reprograms the chip. This
* is used to initially establish the clock tick. * is used to initially establish the clock tick.
* *
* PARAMETERS:
* clock_isr - Clock interrupt stay routine
*
* RETURNS:
* none
*
* SIDE EFFECTS: * SIDE EFFECTS:
* Establish clock interrupt handler, configure Timer 0 hardware * Establish clock interrupt handler, configure Timer 0 hardware
*/ */
void static void Install_clock(rtems_isr_entry clock_isr)
Install_clock(rtems_isr_entry clock_isr)
{ {
int cpudiv = 1; /* CPU frequency divider */ int cpudiv = 1; /* CPU frequency divider */
int tidiv = 1; /* Timer input frequency divider */ int tidiv = 1; /* Timer input frequency divider */
@@ -119,8 +101,7 @@ Install_clock(rtems_isr_entry clock_isr)
Clock_driver_ticks = 0; Clock_driver_ticks = 0;
/* Get CPU frequency divider from clock unit */ /* Get CPU frequency divider from clock unit */
switch (read16(SH7750_FRQCR) & SH7750_FRQCR_IFC) switch (read16(SH7750_FRQCR) & SH7750_FRQCR_IFC) {
{
case SH7750_FRQCR_IFCDIV1: case SH7750_FRQCR_IFCDIV1:
cpudiv = 1; cpudiv = 1;
break; break;
@@ -150,8 +131,7 @@ Install_clock(rtems_isr_entry clock_isr)
} }
/* Get peripheral module frequency divider from clock unit */ /* Get peripheral module frequency divider from clock unit */
switch (read16(SH7750_FRQCR) & SH7750_FRQCR_PFC) switch (read16(SH7750_FRQCR) & SH7750_FRQCR_PFC) {
{
case SH7750_FRQCR_PFCDIV2: case SH7750_FRQCR_PFCDIV2:
tidiv = 2 * CLOCK_PRESCALER; tidiv = 2 * CLOCK_PRESCALER;
break; break;
@@ -216,19 +196,14 @@ Install_clock(rtems_isr_entry clock_isr)
/* /*
* Schedule the clock cleanup routine to execute if the application exits. * Schedule the clock cleanup routine to execute if the application exits.
*/ */
atexit( Clock_exit ); atexit( Clock_exit );
} }
/* Clock_exit -- /*
* Clock_exit
*
* Clean up before the application exits * Clean up before the application exits
* *
* PARAMETERS:
* none
*
* RETURNS:
* none
*
* SIDE EFFECTS: * SIDE EFFECTS:
* Stop Timer 0 counting, set timer 0 interrupt priority level to 0. * Stop Timer 0 counting, set timer 0 interrupt priority level to 0.
*/ */
@@ -252,29 +227,18 @@ Clock_exit(void)
/* old vector shall not be installed */ /* old vector shall not be installed */
} }
/* Clock_initialize -- /*
* Clock_initialize
*
* Device driver entry point for clock tick driver initialization. * Device driver entry point for clock tick driver initialization.
*
* PARAMETERS:
* major - clock major device number
* minor - clock minor device number
* pargp - driver initialize primitive argument, not used
*
* RETURNS:
* RTEMS_SUCCESSFUL
*/ */
rtems_device_driver rtems_device_driver Clock_initialize(
Clock_initialize(rtems_device_major_number major, rtems_device_major_number major,
rtems_device_minor_number minor, rtems_device_minor_number minor,
void *pargp) void *pargp
)
{ {
Install_clock( Clock_isr ); 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; return RTEMS_SUCCESSFUL;
} }