Changeset 40716bf in rtems


Ignore:
Timestamp:
Oct 12, 2014, 6:59:50 PM (5 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master
Children:
5105833c
Parents:
48f8a98f
git-author:
Joel Sherrill <joel.sherrill@…> (10/12/14 18:59:50)
git-committer:
Joel Sherrill <joel.sherrill@…> (10/13/14 15:33:29)
Message:

libcpu/m68k/mcf5206/clock/ckinit.c: Fix warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libcpu/m68k/mcf5206/clock/ckinit.c

    r48f8a98f r40716bf  
    44 *  This driver initailizes timer1 on the MCF5206E as the
    55 *  main system clock
    6  *
     6 */
     7
     8/*
    79 *  Author: Victor V. Vengerov <vvv@oktet.ru>
    810 *
     
    3032volatile uint32_t   Clock_driver_ticks;
    3133
    32 
    33 /*
    34  * These are set by clock driver during its init
    35  */
    36 
    37 rtems_device_major_number rtems_clock_major = ~0;
    38 rtems_device_minor_number rtems_clock_minor;
    39 
    4034rtems_isr (*rtems_clock_hook)(rtems_vector_number) = NULL;
    4135
    42 /* Clock_isr --
    43  *     This handles the timer interrupt by clearing the timer's interrupt
    44  *     flag and announcing the clock tick to the system.
    45  *
    46  * PARAMETERS:
    47  *     vector - timer interrupt vector number
    48  *
    49  * RETURNS:
    50  *     none
    51  */
    52 rtems_isr
     36static rtems_isr
    5337Clock_isr (rtems_vector_number vector)
    5438{
     
    6347}
    6448
    65 
    66 /* Clock_exit --
    67  *     This shuts down the timer if it was enabled and removes it
    68  *     from the MCF5206E interrupt mask.
    69  *
    70  * PARAMETERS:
    71  *     none
    72  *
    73  * RETURNS:
    74  *     none
    75  */
    7649void
    7750Clock_exit(void)
    7851{
    79     if (rtems_configuration_get_ticks_per_timeslice())
    80     {
    81         /* disable all timer1 interrupts */
    82         *MCF5206E_IMR(MBAR) |= MCF5206E_INTR_BIT(MCF5206E_INTR_TIMER_1);
     52  /* disable all timer1 interrupts */
     53  *MCF5206E_IMR(MBAR) |= MCF5206E_INTR_BIT(MCF5206E_INTR_TIMER_1);
    8354
    84         /* reset timer1 */
    85         *MCF5206E_TMR(MBAR,1) = MCF5206E_TMR_ICLK_STOP;
     55  /* reset timer1 */
     56  *MCF5206E_TMR(MBAR,1) = MCF5206E_TMR_ICLK_STOP;
    8657
    87         /* clear pending */
    88         *MCF5206E_TER(MBAR,1) = MCF5206E_TER_REF | MCF5206E_TER_CAP;
    89     }
     58  /* clear pending */
     59  *MCF5206E_TER(MBAR,1) = MCF5206E_TER_REF | MCF5206E_TER_CAP;
    9060}
    9161
    9262
    93 /* Install_clock --
    94  *     This initialises timer1 with the BSP timeslice config value
    95  *     as a reference and sets up the interrupt handler for clock ticks.
    96  *
    97  * PARAMETERS:
    98  *     clock_isr - clock interrupt handler routine
    99  *
    100  * RETURNS:
    101  *     none.
    102  */
    10363static void
    10464Install_clock(rtems_isr_entry clock_isr)
    10565{
    106     Clock_driver_ticks = 0;
    107     if (rtems_configuration_get_ticks_per_timeslice())
    108     {
    109         /* Configure timer1 interrupts */
    110         *MCF5206E_ICR(MBAR,MCF5206E_INTR_TIMER_1) =
    111             MCF5206E_ICR_AVEC |
    112             ((BSP_INTLVL_TIMER1 << MCF5206E_ICR_IL_S) & MCF5206E_ICR_IL) |
    113             ((BSP_INTPRIO_TIMER1 << MCF5206E_ICR_IP_S) & MCF5206E_ICR_IP);
     66  Clock_driver_ticks = 0;
    11467
    115         /* Register the interrupt handler */
    116         set_vector(clock_isr, BSP_INTVEC_TIMER1, 1);
     68  /* Configure timer1 interrupts */
     69  *MCF5206E_ICR(MBAR,MCF5206E_INTR_TIMER_1) =
     70      MCF5206E_ICR_AVEC |
     71      ((BSP_INTLVL_TIMER1 << MCF5206E_ICR_IL_S) & MCF5206E_ICR_IL) |
     72      ((BSP_INTPRIO_TIMER1 << MCF5206E_ICR_IP_S) & MCF5206E_ICR_IP);
    11773
    118         /* Reset timer 1 */
    119         *MCF5206E_TMR(MBAR, 1) = MCF5206E_TMR_RST;
    120         *MCF5206E_TMR(MBAR, 1) = MCF5206E_TMR_ICLK_STOP;
    121         *MCF5206E_TMR(MBAR, 1) = MCF5206E_TMR_RST;
    122         *MCF5206E_TCN(MBAR, 1) = 0; /* Reset counter */
    123         *MCF5206E_TER(MBAR, 1) = MCF5206E_TER_REF | MCF5206E_TER_CAP;
     74  /* Register the interrupt handler */
     75  set_vector(clock_isr, BSP_INTVEC_TIMER1, 1);
    12476
    125         /* Set Timer 1 prescaler so that it counts in microseconds */
    126         *MCF5206E_TMR(MBAR, 1) =
    127             (((BSP_SYSTEM_FREQUENCY/1000000 - 1) << MCF5206E_TMR_PS_S) &
    128              MCF5206E_TMR_PS) |
    129             MCF5206E_TMR_CE_NONE | MCF5206E_TMR_ORI | MCF5206E_TMR_FRR |
    130             MCF5206E_TMR_RST;
     77  /* Reset timer 1 */
     78  *MCF5206E_TMR(MBAR, 1) = MCF5206E_TMR_RST;
     79  *MCF5206E_TMR(MBAR, 1) = MCF5206E_TMR_ICLK_STOP;
     80  *MCF5206E_TMR(MBAR, 1) = MCF5206E_TMR_RST;
     81  *MCF5206E_TCN(MBAR, 1) = 0; /* Reset counter */
     82  *MCF5206E_TER(MBAR, 1) = MCF5206E_TER_REF | MCF5206E_TER_CAP;
    13183
    132         /* Set the timer timeout value from the BSP config */
    133         *MCF5206E_TRR(MBAR, 1) = rtems_configuration_get_microseconds_per_tick() - 1;
     84  /* Set Timer 1 prescaler so that it counts in microseconds */
     85  *MCF5206E_TMR(MBAR, 1) =
     86      (((BSP_SYSTEM_FREQUENCY/1000000 - 1) << MCF5206E_TMR_PS_S) &
     87       MCF5206E_TMR_PS) |
     88      MCF5206E_TMR_CE_NONE | MCF5206E_TMR_ORI | MCF5206E_TMR_FRR |
     89      MCF5206E_TMR_RST;
    13490
    135         /* Feed system frequency to the timer */
    136         *MCF5206E_TMR(MBAR, 1) |= MCF5206E_TMR_ICLK_MSCLK;
     91  /* Set the timer timeout value from the BSP config */
     92  *MCF5206E_TRR(MBAR, 1) = rtems_configuration_get_microseconds_per_tick() - 1;
    13793
    138         /* Enable timer 1 interrupts */
    139         *MCF5206E_IMR(MBAR) &= ~MCF5206E_INTR_BIT(MCF5206E_INTR_TIMER_1);
     94  /* Feed system frequency to the timer */
     95  *MCF5206E_TMR(MBAR, 1) |= MCF5206E_TMR_ICLK_MSCLK;
    14096
    141         /* Register the driver exit procedure so we can shutdown */
    142         atexit(Clock_exit);
    143     }
     97  /* Enable timer 1 interrupts */
     98  *MCF5206E_IMR(MBAR) &= ~MCF5206E_INTR_BIT(MCF5206E_INTR_TIMER_1);
     99
     100  /* Register the driver exit procedure so we can shutdown */
     101  atexit(Clock_exit);
    144102}
    145103
    146 
    147 /* Clock_initialize --
    148  *     This is called to setup the clock driver. It calls the hardware
    149  *     setup function and make the driver major/minor values available
    150  *     for other.
    151  *
    152  * PARAMETERS:
    153  *     major - clock device major number
    154  *     minor - clock device minor number
    155  *     pargp - device driver initialization argument (not used)
    156  *
    157  * RETURNS:
    158  *     RTEMS status code
    159  */
    160104rtems_device_driver
    161105Clock_initialize(rtems_device_major_number major,
     
    163107                 void *pargp)
    164108{
    165     Install_clock (Clock_isr);
     109  Install_clock (Clock_isr);
    166110
    167     /* Make major/minor avail to others such as shared memory driver */
    168     rtems_clock_major = major;
    169     rtems_clock_minor = minor;
    170 
    171     return RTEMS_SUCCESSFUL;
     111  return RTEMS_SUCCESSFUL;
    172112}
Note: See TracChangeset for help on using the changeset viewer.