From d85c505ab0d9699600b3e5724a4badf6dbc1314b Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 19 Jul 2021 09:26:33 +0200 Subject: bsp/leon3: Use new GPTIMER register block API --- bsps/sparc/leon3/include/bsp/leon3.h | 44 +++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'bsps/sparc/leon3/include/bsp') diff --git a/bsps/sparc/leon3/include/bsp/leon3.h b/bsps/sparc/leon3/include/bsp/leon3.h index 75abc34fb7..aa3898e530 100644 --- a/bsps/sparc/leon3/include/bsp/leon3.h +++ b/bsps/sparc/leon3/include/bsp/leon3.h @@ -9,7 +9,7 @@ */ /* - * Copyright (C) 2021 embedded brains GmbH & Co. KG + * Copyright (C) 2014, 2021 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,6 +37,7 @@ #define LIBBSP_SPARC_LEON3_BSP_LEON3_H #include +#include #include @@ -151,6 +152,47 @@ static inline uint32_t leon3_get_data_cache_config_register( void ) return leon3_get_system_register( 0xc ); } +/** + * @brief This constant defines the index of the GPTIMER timer used by the + * clock driver. + */ +#if defined(RTEMS_MULTIPROCESSING) +#define LEON3_CLOCK_INDEX \ + ( rtems_configuration_get_user_multiprocessing_table() ? LEON3_Cpu_Index : 0 ) +#else +#define LEON3_CLOCK_INDEX 0 +#endif + +/** + * @brief This constant defines the index of the GPTIMER timer used by the + * CPU counter if the CPU counter uses the GPTIMER. + */ +#if defined(RTEMS_SMP) +#define LEON3_COUNTER_GPTIMER_INDEX ( LEON3_CLOCK_INDEX + 1 ) +#else +#define LEON3_COUNTER_GPTIMER_INDEX LEON3_CLOCK_INDEX +#endif + +/** + * @brief This constant defines the frequency set by the boot loader of the + * first GPTIMER instance. + * + * We assume that a boot loader (usually GRMON) initialized the GPTIMER 0 to + * run with 1MHz. This is used to determine all clock frequencies of the PnP + * devices. See also ambapp_freq_init() and ambapp_freq_get(). + */ +#define LEON3_GPTIMER_0_FREQUENCY_SET_BY_BOOT_LOADER 1000000 + +/** + * @brief This pointer provides the GPTIMER register block address. + */ +extern gptimer *LEON3_Timer_Regs; + +/** + * @brief This pointer provides the GPTIMER device information block. + */ +extern struct ambapp_dev *LEON3_Timer_Adev; + /** * @brief Gets the LEON up-counter low register (%ASR23) value. * -- cgit v1.2.3