1 /* 2 * Copyright 2021-2023 NXP 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 #ifndef OSIF_TIMER_CUSTOM_H 7 #define OSIF_TIMER_CUSTOM_H 8 9 /** 10 * @file 11 * 12 * @addtogroup osif_drv 13 * @{ 14 */ 15 16 #ifdef __cplusplus 17 extern "C"{ 18 #endif 19 20 /*================================================================================================== 21 * INCLUDE FILES 22 * 1) system and project includes 23 * 2) needed interfaces from external units 24 * 3) internal and external interfaces from this unit 25 ==================================================================================================*/ 26 #include "StandardTypes.h" 27 28 /*================================================================================================== 29 * SOURCE FILE VERSION INFORMATION 30 ==================================================================================================*/ 31 #define OSIF_TIMER_CUSTOM_VENDOR_ID 43 32 #define OSIF_TIMER_CUSTOM_AR_RELEASE_MAJOR_VERSION 4 33 #define OSIF_TIMER_CUSTOM_AR_RELEASE_MINOR_VERSION 7 34 #define OSIF_TIMER_CUSTOM_AR_RELEASE_REVISION_VERSION 0 35 #define OSIF_TIMER_CUSTOM_SW_MAJOR_VERSION 1 36 #define OSIF_TIMER_CUSTOM_SW_MINOR_VERSION 0 37 #define OSIF_TIMER_CUSTOM_SW_PATCH_VERSION 0 38 39 /*================================================================================================== 40 * FILE VERSION CHECKS 41 ==================================================================================================*/ 42 /* Checks against StandardTypes.h */ 43 #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK 44 #if ((OSIF_TIMER_CUSTOM_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \ 45 (OSIF_TIMER_CUSTOM_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION)) 46 #error "AutoSar Version Numbers of OsIf_Timer_Custom.h and StandardTypes.h are different" 47 #endif 48 #endif /* DISABLE_MCAL_INTERMODULE_ASR_CHECK */ 49 50 /*================================================================================================== 51 * CONSTANTS 52 ==================================================================================================*/ 53 54 /*================================================================================================== 55 * DEFINES AND MACROS 56 ==================================================================================================*/ 57 58 /*================================================================================================== 59 * ENUMS 60 ==================================================================================================*/ 61 62 /*================================================================================================== 63 * STRUCTURES AND OTHER TYPEDEFS 64 ==================================================================================================*/ 65 66 /*================================================================================================== 67 * GLOBAL VARIABLE DECLARATIONS 68 ==================================================================================================*/ 69 70 /*================================================================================================== 71 * FUNCTION PROTOTYPES 72 ==================================================================================================*/ 73 #define BASENXP_START_SEC_CODE 74 #include "BaseNXP_MemMap.h" 75 76 /*! 77 * @brief Initialize the custom timer. 78 * 79 * This function initialize the custom timer. 80 */ 81 void OsIf_Timer_Custom_Init(void); 82 83 /*! 84 * @brief Get counter value from custom timer. 85 * 86 * This function get counter value from custom timer. 87 * 88 * @return Counter value 89 */ 90 uint32 OsIf_Timer_Custom_GetCounter(void); 91 92 /*! 93 * @brief Get elapsed value from custom timer. 94 * 95 * This function get elapsed value from custom timer. 96 * 97 * @param[in] CurrentRef The pointer to current reference point 98 * @return Elapsed value 99 */ 100 uint32 OsIf_Timer_Custom_GetElapsed(uint32 * const CurrentRef); 101 102 /*! 103 * @brief Set custom timer frequency. 104 * 105 * This function set custom timer frequency. 106 * 107 * @param[in] Freq Frequency value 108 */ 109 void OsIf_Timer_Custom_SetTimerFrequency(uint32 Freq); 110 111 /*! 112 * @brief Convert micro second to ticks based on custom timer frequency. 113 * 114 * This function Convert micro second to ticks based on custom timer frequency. 115 * 116 * @param[in] Micros Micro second 117 * @return Ticks 118 */ 119 uint32 OsIf_Timer_Custom_MicrosToTicks(uint32 Micros); 120 121 #define BASENXP_STOP_SEC_CODE 122 #include "BaseNXP_MemMap.h" 123 124 #ifdef __cplusplus 125 } 126 #endif 127 128 /** @} */ 129 130 #endif /* OSIF_TIMER_CUSTOM_H */ 131