Changeset 8a442b5 in rtems


Ignore:
Timestamp:
10/12/14 15:06:05 (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, 5, master
Children:
d1347a37
Parents:
767164a
git-author:
Joel Sherrill <joel.sherrill@…> (10/12/14 15:06:05)
git-committer:
Joel Sherrill <joel.sherrill@…> (10/13/14 15:33:26)
Message:

gen68340/clock/ckinit.c: Fix warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/m68k/gen68340/clock/ckinit.c

    r767164a r8a442b5  
    11/*
    22 * This routine initializes the MC68340/349 Periodic Interval Timer
    3  *
     3 */
     4
     5/*
    46 * Based on the `gen68360' board support package, and covered by the
    57 * original distribution terms.
     
    1517
    1618/*
    17  * Input parameters:    NONE
    18  *
    19  * Output parameters:   NONE
    20  *
    21  * COPYRIGHT (c) 1989-1999.
     19 * COPYRIGHT (c) 1989-2014.
    2220 * On-Line Applications Research Corporation (OAR).
    2321 *
     
    2725 */
    2826
    29 #include <stdlib.h>                     /* for atexit() */
     27#include <stdlib.h>       /* for atexit() */
    3028#include <bsp.h>
    3129#include <m68340.h>
    3230
    33 #define CLOCK_VECTOR    120             /* clock isr routine vector in the vbr */
    34 #define CLOCK_IRQ_LEVEL 6               /* clock isr level */
     31#define CLOCK_VECTOR     120 /* clock isr routine vector in the vbr */
     32#define CLOCK_IRQ_LEVEL  6   /* clock isr level */
    3533
    3634/*
     
    4139
    4240/*
    43  * These are set by clock driver during its init
    44  */
    45 rtems_device_major_number rtems_clock_major = ~0;
    46 rtems_device_minor_number rtems_clock_minor;
    47 
    48 /*
    4941 * Periodic interval timer interrupt handler
    5042 */
    51 
    52 /******************************************************
    53   Name: Clock_isr
    54   Input parameters: irq vector
    55   Output parameters: none
    56   Description: update # of clock ticks
    57  *****************************************************/
    58 rtems_isr
     43static rtems_isr
    5944Clock_isr (rtems_vector_number vector)
    6045{
    61         /*
    62         * Announce the clock tick
    63         */
    64         Clock_driver_ticks++;
    65         rtems_clock_tick();
     46  /*
     47  * Announce the clock tick
     48  */
     49  Clock_driver_ticks++;
     50  rtems_clock_tick();
    6651}
    6752
    68 /******************************************************
    69   Name: clock_exit
    70   Input parameters: -
    71   Output parameters: -
    72   Description: turn off periodic time at shutdown
    73  *****************************************************/
    7453void
    7554Clock_exit (void)
    7655{
    77         /*
    78         * Turn off periodic interval timer
    79         */
    80         SIMPITR = 0;
     56  /*
     57  * Turn off periodic interval timer
     58  */
     59  SIMPITR = 0;
    8160}
    8261
    83 /******************************************************
    84   Name: Install_clock
    85   Input parameters: the Clock Interrupt Subroutine
    86   Output parameters: -
    87   Description: initialize the periodic interval ticker
    88                called by Clock_Initialize
    89  *****************************************************/
    9062static void
    9163Install_clock (rtems_isr_entry clock_isr)
    9264{
    93         uint32_t   pitr_tmp;
    94         uint32_t   usecs_per_tick;
     65  uint32_t   pitr_tmp;
     66  uint32_t   usecs_per_tick;
    9567
    96         Clock_driver_ticks = 0;
     68  Clock_driver_ticks = 0;
    9769
    98         set_vector (clock_isr, CLOCK_VECTOR, 1);
     70  set_vector (clock_isr, CLOCK_VECTOR, 1);
    9971
    100         /* sets the Periodic Interrupt Control Register PICR */
    101         /* voir a quoi correspond exactement le Clock Vector */
     72  /* sets the Periodic Interrupt Control Register PICR */
     73  SIMPICR = ( CLOCK_IRQ_LEVEL << 8 ) | ( CLOCK_VECTOR );
    10274
    103         SIMPICR = ( CLOCK_IRQ_LEVEL << 8 ) | ( CLOCK_VECTOR );
     75  /* sets the PITR count value */
     76  /* this assumes a 32.765 kHz crystal */
    10477
    105         /* sets the PITR count value */
    106         /* this assumes a 32.765 kHz crystal */
     78  usecs_per_tick = rtems_configuration_get_microseconds_per_tick();
     79  /* find out whether prescaler should be enabled or not */
     80  if ( usecs_per_tick <= 31128 ) {
     81     pitr_tmp = ( usecs_per_tick * 8192 ) / 1000000 ;
     82  } else {
     83     pitr_tmp = ( usecs_per_tick / 1000000 ) * 16;
     84     /* enable it */
     85     pitr_tmp |= 0x100;
     86  }
    10787
    108         usecs_per_tick = rtems_configuration_get_microseconds_per_tick();
    109         /* find out whether prescaler should be enabled or not */
    110         if ( usecs_per_tick <= 31128 ) {
    111            pitr_tmp = ( usecs_per_tick * 8192 ) / 1000000 ;
    112         } else {
    113            pitr_tmp = ( usecs_per_tick / 1000000 ) * 16;
    114            /* enable it */
    115            pitr_tmp |= 0x100;
    116         }
     88  SIMPITR = (unsigned char) pitr_tmp;
    11789
    118         SIMPITR = (unsigned char) pitr_tmp;
    119 
    120         atexit (Clock_exit);
     90  atexit (Clock_exit);
    12191}
    12292
    123 /******************************************************
    124   Name: Clock_initialize
    125   Input parameters: major & minor numbers
    126   Output parameters: -
    127   Description: main entry for clock initialization
    128                calls the bsp dependant routine
    129  *****************************************************/
    13093rtems_device_driver
    13194Clock_initialize(
    132         rtems_device_major_number major,
    133         rtems_device_minor_number minor,
    134         void *pargp
     95  rtems_device_major_number major,
     96  rtems_device_minor_number minor,
     97  void *pargp
    13598)
    13699{
    137         Install_clock (Clock_isr);
     100  Install_clock (Clock_isr);
    138101
    139         /*
    140          * make major/minor avail to others such as shared memory driver
    141          */
    142         rtems_clock_major = major;
    143         rtems_clock_minor = minor;
    144 
    145         return RTEMS_SUCCESSFUL;
     102  return RTEMS_SUCCESSFUL;
    146103}
Note: See TracChangeset for help on using the changeset viewer.