Changeset 780eab4 in rtems


Ignore:
Timestamp:
Oct 7, 2014, 2:39:42 PM (6 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master
Children:
0dae390
Parents:
46e72c8
git-author:
Joel Sherrill <joel.sherrill@…> (10/07/14 14:39:42)
git-committer:
Joel Sherrill <joel.sherrill@…> (10/09/14 15:11:54)
Message:

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

Location:
c/src/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/mbx8xx/clock/p_clock.c

    r46e72c8 r780eab4  
     1/**
     2 *  @file
     3 *  @brief mbx8xx Clock Tick connection code.
     4 */
     5
    16/*
    2  *  Clock Tick interrupt conexion code.
    3  *
    47 *  COPYRIGHT (c) 1989-1997.
    58 *  On-Line Applications Research Corporation (OAR).
     
    2225extern void Clock_isr(void*);
    2326
    24 static rtems_irq_connect_data clockIrqData = {BSP_PERIODIC_TIMER,
    25                                               (rtems_irq_hdl)Clock_isr,
    26                                               0,
    27                                               (rtems_irq_enable)clockOn,
    28                                               (rtems_irq_disable)clockOff,
    29                                               (rtems_irq_is_enabled)clockIsOn};
     27static rtems_irq_connect_data clockIrqData = {
     28  BSP_PERIODIC_TIMER,
     29  (rtems_irq_hdl)Clock_isr,
     30  0,
     31  (rtems_irq_enable)clockOn,
     32  (rtems_irq_disable)clockOff,
     33  (rtems_irq_is_enabled)clockIsOn
     34};
     35
     36/*
     37 * Prototypes
     38 */
     39int BSP_get_clock_irq_level(void);
     40int BSP_connect_clock_handler(rtems_irq_hdl hdl);
     41int BSP_disconnect_clock_handler(void);
    3042
    3143int BSP_get_clock_irq_level(void)
    3244{
    3345  /*
    34    * Caution : if you change this, you must change the
     46   * Caution: if you change this, you must change the
    3547   * definition of BSP_PERIODIC_TIMER accordingly
    3648   */
     
    3850}
    3951
    40 int BSP_disconnect_clock_handler (void)
     52int BSP_disconnect_clock_handler(void)
    4153{
    4254  if (!BSP_get_current_rtems_irq_handler(&clockIrqData)) {
     
    4759}
    4860
    49 int BSP_connect_clock_handler (rtems_irq_hdl hdl)
     61int BSP_connect_clock_handler(rtems_irq_hdl hdl)
    5062{
    5163  if (!BSP_get_current_rtems_irq_handler(&clockIrqData)) {
    52      printk("Unable to get system clock handler\n");
     64    printk("Unable to get system clock handler\n");
    5365    rtems_fatal_error_occurred(1);
    5466  }
    55   if (!BSP_remove_rtems_irq_handler (&clockIrqData)) {
    56    printk("Unable to remove current system clock handler\n");
     67
     68  if (!BSP_remove_rtems_irq_handler(&clockIrqData)) {
     69    printk("Unable to remove current system clock handler\n");
    5770    rtems_fatal_error_occurred(1);
    5871  }
     72
    5973  /*
    6074   * Reinit structure
  • c/src/lib/libcpu/powerpc/mpc8xx/clock/clock.c

    r46e72c8 r780eab4  
    33 *  This routine initializes the PIT on the MPC8xx.
    44 *  The tick frequency is specified by the bsp.
    5  *
     5 */
     6
     7/*
    68 *  Author: Jay Monkman (jmonkman@frasca.com)
    79 *  Copyright (C) 1998 by Frasca International, Inc.
     
    5052extern uint32_t bsp_clock_speed;
    5153
     54/*
     55 *  Prototypes
     56 */
     57rtems_isr Clock_isr(rtems_vector_number vector);
    5258void Clock_exit( void );
    53 
    54 /*
    55  * These are set by clock driver during its init
    56  */
    57 
    58 rtems_device_major_number rtems_clock_major = ~0;
    59 rtems_device_minor_number rtems_clock_minor;
     59void clockOn(void* unused);
     60void clockOff(void* unused);
     61int clockIsOn(void* unused);
     62void Install_clock(rtems_isr_entry clock_isr);
     63void ReInstall_clock(rtems_isr_entry new_clock_isr);
    6064
    6165/*
     
    104108      pdf_value  = (plprcr_val & (0x00000006)) >> (31-30);
    105109      extclk = (((uint64_t)bsp_clock_speed)
    106                 * ((pdf_value + 1) * (mfd_value + 1))
    107                 / (mfi_value * (mfd_value + 1) + mfn_value)
    108                 * (1 << s_value));
     110          * ((pdf_value + 1) * (mfd_value + 1))
     111          / (mfi_value * (mfd_value + 1) + mfn_value)
     112          * (1 << s_value));
    109113    }
    110114    else {
     
    117121    }
    118122    pit_value = (extclk
    119                 / 1000
    120                 / 4
    121                 * rtems_configuration_get_microseconds_per_tick()
    122                 / 1000);
     123      / 1000
     124      / 4
     125      * rtems_configuration_get_microseconds_per_tick()
     126      / 1000);
    123127    m8xx.sccr |=  (1<<23);
    124128    force_prescaler = true;
     
    126130  else {
    127131    pit_value = (rtems_configuration_get_microseconds_per_tick() *
    128                 bsp_clicks_per_usec);
     132                    bsp_clicks_per_usec);
    129133
    130134    m8xx.sccr &= ~(1<<23);
    131135  }
    132 if ((pit_value > 0xffff) || force_prescaler){
     136
     137  if ((pit_value > 0xffff) || force_prescaler) {
    133138    /*
    134139     * try to activate prescaler
     
    153158    M8xx_PISCR_PTE | M8xx_PISCR_PS | M8xx_PISCR_PIE;
    154159}
     160
    155161/*
    156162 * Called via atexit()
    157163 * Remove the clock interrupt handler by setting handler to NULL
    158164 */
    159 void
    160 clockOff(void* unused)
     165void clockOff(void* unused)
    161166{
    162167  /* disable PIT and PIT interrupts */
     
    166171int clockIsOn(void* unused)
    167172{
    168   if (m8xx.piscr & M8xx_PISCR_PIE) return 1;
     173  if (m8xx.piscr & M8xx_PISCR_PIE)
     174    return 1;
    169175  return 0;
    170176}
     
    174180 * Remove the clock interrupt handler by setting handler to NULL
    175181 */
    176 void
    177 Clock_exit(void)
     182void Clock_exit(void)
    178183{
    179184  (void) BSP_disconnect_clock_handler ();
     
    188193}
    189194
    190 void
    191 ReInstall_clock(rtems_isr_entry new_clock_isr)
     195void ReInstall_clock(rtems_isr_entry new_clock_isr)
    192196{
    193197  BSP_connect_clock_handler (new_clock_isr);
    194198}
    195 
    196199
    197200rtems_device_driver Clock_initialize(
     
    203206  Install_clock( Clock_isr );
    204207
    205   /*
    206    * make major/minor avail to others such as shared memory driver
    207    */
    208 
    209   rtems_clock_major = major;
    210   rtems_clock_minor = minor;
    211 
    212208  return RTEMS_SUCCESSFUL;
    213209}
Note: See TracChangeset for help on using the changeset viewer.