1 /* 2 * Arm SCP/MCP Software 3 * Copyright (c) 2017-2022, Arm Limited and Contributors. All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 * 7 * Description: 8 * Generic Timer device driver module and definitions. 9 */ 10 11 #ifndef MOD_GTIMER_H 12 #define MOD_GTIMER_H 13 14 #include <fwk_id.h> 15 16 #include <stdint.h> 17 18 /*! 19 * \addtogroup GroupModules Modules 20 * \{ 21 */ 22 23 /*! 24 * \defgroup GroupModuleGtimer Generic Timer Driver 25 * 26 * \details Driver module for the generic timer. 27 * 28 * \{ 29 */ 30 31 /*! 32 * \brief Generic timer device descriptor 33 */ 34 struct mod_gtimer_dev_config { 35 /*! Address of the device's timer register */ 36 uintptr_t hw_timer; 37 38 /*! Address of the device's counter register */ 39 uintptr_t hw_counter; 40 41 /*! Address of the device's control register */ 42 uintptr_t control; 43 44 /*! The frequency in Hertz that the timer ticks at */ 45 const uint32_t frequency; 46 47 /*! Identifier of the clock that this device depends on */ 48 fwk_id_t clock_id; 49 50 /*! Skip initialisation of CNTCONTROL register */ 51 bool skip_cntcontrol_init; 52 }; 53 54 /*! 55 * \brief Get the framework time driver for a generic timer device. 56 * 57 * \details This function is intended to be used by a firmware to register a 58 * generic timer as the driver for the framework time component. 59 * 60 * \param[out] ctx Pointer to storage for the context passed to the driver. 61 * \param[in] cfg Generic timer configuration. 62 * 63 * \return Framework time driver for the given device. 64 */ 65 struct fwk_time_driver mod_gtimer_driver( 66 const void **ctx, 67 const struct mod_gtimer_dev_config *cfg); 68 69 /*! 70 * \} 71 */ 72 73 /*! 74 * \} 75 */ 76 77 #endif /* MOD_GTIMER_H */ 78