On 2014-02-24 16:45, Daniel Hellstrom wrote:
On 02/24/2014 04:16 PM, Sebastian Huber wrote:
On 2014-02-24 15:20, Daniel Hellstrom wrote:
Sebastian, I think it's a good solution to rely on the GPTIMER[0].timer0 as a
fallback.

Looks good to me, and should work on the TSIM/GRSIM and LEON3 hardware.

Assuming that the frequency has been initialized to 1MHz for secondary GPTIMER
may be wrong when invoked from a boot loader, however this can be fixed later
if determined a problem.

Thanks for the quick review.  I checked in a slightly different version that
uses now only the first GPTIMER to determine the frequency:

http://git.rtems.org/rtems/commit/?id=a4bc90af4ee55e72b18de4b64da6338634490760


Ok. that is much better I think. But it is not 100% correct, you can not be
sure that the timers are clocked at the same frequency. To your help is the
function call:

freq_hz = ambapp_freq_get(&ambapp_plb, adev_gptimer1);

That will return the frequency of any APB or AHB device in the system, the call
can be made after the frequency of the AMBA bus have been initialized in
amba_initialize() calling ambapp_freq_init().

Ok, I used the clock driver as a reference:

#define Clock_driver_support_initialize_hardware() \
  do { \
    LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX].reload = \
      rtems_configuration_get_microseconds_per_tick() - 1; \
    \
    LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX].ctrl = \
      LEON3_GPTIMER_EN | LEON3_GPTIMER_RL | \
        LEON3_GPTIMER_LD | LEON3_GPTIMER_IRQEN; \
  } while (0)

It simply assumes that the frequency is 1MHz. Is it possible to use ambapp_freq_get() here also?

Has the ambapp_freq_get() any dependencies to the boot loader?


Basically we don't have to use AMBA PnP to search for GPTIMER[0], since we
assume that initialization has been performed by the system clock driver we
could might as well assume that the LEON3_Timer_Regs variable is initialized
too? The problem is that the CPU cycle counter is initialized before the timer
driver, but is that working for all other platform also or are we really sure
no other platform depend upon the system clock initialisation to complete?

The CPU counter should work before drivers are initialized.

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
_______________________________________________
rtems-devel mailing list
rtems-devel@rtems.org
http://www.rtems.org/mailman/listinfo/rtems-devel

Reply via email to