[PATCH] bsp/tms570: fix get time resolution after infrastructure change to timecounter.

Daniel Gutson daniel.gutson at tallertechnologies.com
Wed Jul 15 14:08:00 UTC 2015


On Wed, Jul 15, 2015 at 8:46 AM, Premysl Houdek <kom541000 at gmail.com> wrote:
> Signed-off-by: Premysl Houdek <kom541000 at gmail.com>
> ---
>  c/src/lib/libbsp/arm/tms570/clock/clock.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/c/src/lib/libbsp/arm/tms570/clock/clock.c b/c/src/lib/libbsp/arm/tms570/clock/clock.c
> index 98ee5d9..0770570 100644
> --- a/c/src/lib/libbsp/arm/tms570/clock/clock.c
> +++ b/c/src/lib/libbsp/arm/tms570/clock/clock.c
> @@ -50,12 +50,17 @@ static void tms570_clock_driver_support_initialize_hardware( void )
>  {
>
>    uint32_t microsec_per_tick = rtems_configuration_get_microseconds_per_tick();
> +  uint32_t tc_frequency = 1000000;
> +  uint32_t tc_prescaller;

Can't these be const? (Remember http://gamesfromwithin.com/the-const-nazi)

>
>    rtems_counter_initialize_converter(BSP_PLL_OUT_CLOCK);
>
> +  tc_prescaller = (BSP_PLL_OUT_CLOCK + tc_frequency) / (tc_frequency * 2);
> +  tc_frequency = (BSP_PLL_OUT_CLOCK + tc_prescaller) / (tc_prescaller * 2);
> +
>    /* Hardware specific initialize */
>    TMS570_RTI.RTIGCTRL = 0;
> -  TMS570_RTI.RTICPUC0 = BSP_PLL_OUT_CLOCK /1000000 / 2; /* prescaler */
> +  TMS570_RTI.RTICPUC0 = tc_prescaller; /* prescaler */
>    TMS570_RTI.RTITBCTRL = 2;
>    TMS570_RTI.RTICAPCTRL = 0;
>    TMS570_RTI.RTICOMPCTRL = 0;
> @@ -76,7 +81,7 @@ static void tms570_clock_driver_support_initialize_hardware( void )
>    /* set timecounter */
>    tms570_rti_tc.tc_get_timecount = tms570_rti_get_timecount;
>    tms570_rti_tc.tc_counter_mask = 0xffffffff;
> -  tms570_rti_tc.tc_frequency = BSP_PLL_OUT_CLOCK;
> +  tms570_rti_tc.tc_frequency = tc_frequency;
>    tms570_rti_tc.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER;
>    rtems_timecounter_install(&tms570_rti_tc);
>  }
> --
> 1.9.1
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel



-- 

Daniel F. Gutson
Chief Engineering Officer, SPD

San Lorenzo 47, 3rd Floor, Office 5
Córdoba, Argentina

Phone:   +54 351 4217888 / +54 351 4218211
Skype:    dgutson
LinkedIn: http://ar.linkedin.com/in/danielgutson



More information about the devel mailing list