Changeset 75acd9e in rtems for c/src/lib/libbsp/arm/tms570


Ignore:
Timestamp:
Apr 1, 2015, 1:33:25 PM (5 years ago)
Author:
Alexander Krutwig <alexander.krutwig@…>
Branches:
4.11, master
Children:
a9c4f15d
Parents:
7cd2484
git-author:
Alexander Krutwig <alexander.krutwig@…> (04/01/15 13:33:25)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/20/15 06:40:34)
Message:

bsps: Convert clock drivers to use a timecounter

Update #2271.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/tms570/clock/clock.c

    r7cd2484 r75acd9e  
    3131#include <bsp/tms570-rti.h>
    3232#include <rtems/counter.h>
     33#include <rtems/timecounter.h>
    3334
    34 /**
    35  *  holds HW counter value since last interrupt event
    36  *  sets in tms570_clock_driver_support_at_tick
    37  *  used in tms570_clock_driver_nanoseconds_since_last_tick
    38  */
    39 static uint32_t tms570_rti_last_tick_fcr0;
     35static struct timecounter tms570_rti_tc;
     36
     37static uint32_t tms570_rti_get_timecount(struct timecounter tc)
     38{
     39  return TMS570_RTI.RTIFRC0;
     40}
    4041
    4142/**
     
    7374  /* enable timer */
    7475  TMS570_RTI.RTIGCTRL = 1;
     76  /* set timecounter */
     77  tms570_rti_tc.tc_get_timecount = tms570_rti_get_timecount;
     78  tms570_rti_tc.tc_counter_mask = 0xffffffff;
     79  tms570_rti_tc.tc_frequency = BSP_PLL_OUT_CLOCK;
     80  tms570_rti_tc.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER;
     81  rtems_timecounter_install(&tms570_rti_tc);
    7582}
    7683
     
    8390{
    8491  TMS570_RTI.RTIINTFLAG = 0x00000001;
    85   tms570_rti_last_tick_fcr0 = TMS570_RTI.RTICOMP0 - TMS570_RTI.RTIUDCP0;
    8692}
    8793
     
    125131}
    126132
    127 /**
    128  * @brief returns the nanoseconds since last tick
    129  *
    130  * Return the nanoseconds since last tick
    131  *
    132  * @retval x nanoseconds
    133  *
    134  */
    135 static uint32_t tms570_clock_driver_nanoseconds_since_last_tick( void )
    136 {
    137   uint32_t actual_fcr0 = TMS570_RTI.RTIFRC0;
    138   uint32_t usec_since_tick;
    139 
    140   usec_since_tick = actual_fcr0 - tms570_rti_last_tick_fcr0;
    141 
    142   return usec_since_tick * 1000;
    143 }
    144 
    145133#define Clock_driver_support_initialize_hardware \
    146134                        tms570_clock_driver_support_initialize_hardware
     
    151139#define Clock_driver_support_shutdown_hardware \
    152140                        tms570_clock_driver_support_shutdown_hardware
    153 #define Clock_driver_nanoseconds_since_last_tick \
    154                         tms570_clock_driver_nanoseconds_since_last_tick
    155141
    156142#define Clock_driver_support_install_isr(Clock_isr, Old_ticker ) \
Note: See TracChangeset for help on using the changeset viewer.