1 /*
2  * Copyright 2021-2022 NXP
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 #ifndef OSIF_TIMER_SYSTEM_INTERNAL_GENERICTIMER
7 #define OSIF_TIMER_SYSTEM_INTERNAL_GENERICTIMER
8 
9 #ifdef __cplusplus
10 extern "C"{
11 #endif
12 
13 /*==================================================================================================
14 *                                          INCLUDE FILES
15 * 1) system and project includes
16 * 2) needed interfaces from external units
17 * 3) internal and external interfaces from this unit
18 ==================================================================================================*/
19 #include "OsIf_Cfg.h"
20 
21 /*==================================================================================================
22 *                                 SOURCE FILE VERSION INFORMATION
23 ==================================================================================================*/
24 #define OSIF_TIMER_SYS_INTER_GENERICTIMER_VENDOR_ID                    43
25 #define OSIF_TIMER_SYS_INTER_GENERICTIMER_AR_RELEASE_MAJOR_VERSION     4
26 #define OSIF_TIMER_SYS_INTER_GENERICTIMER_AR_RELEASE_MINOR_VERSION     7
27 #define OSIF_TIMER_SYS_INTER_GENERICTIMER_AR_RELEASE_REVISION_VERSION  0
28 #define OSIF_TIMER_SYS_INTER_GENERICTIMER_SW_MAJOR_VERSION             0
29 #define OSIF_TIMER_SYS_INTER_GENERICTIMER_SW_MINOR_VERSION             9
30 #define OSIF_TIMER_SYS_INTER_GENERICTIMER_SW_PATCH_VERSION             0
31 
32 /*==================================================================================================
33 *                                       FILE VERSION CHECKS
34 ==================================================================================================*/
35 /* Checks against OsIf_Cfg.h */
36 #if (OSIF_TIMER_SYS_INTER_GENERICTIMER_VENDOR_ID != OSIF_CFG_VENDOR_ID)
37     #error "OsIf_Timer_System_Internal_GenericTimer.h and OsIf_Cfg.h have different vendor ids"
38 #endif
39 #if ((OSIF_TIMER_SYS_INTER_GENERICTIMER_AR_RELEASE_MAJOR_VERSION    != OSIF_CFG_AR_RELEASE_MAJOR_VERSION) || \
40      (OSIF_TIMER_SYS_INTER_GENERICTIMER_AR_RELEASE_MINOR_VERSION    != OSIF_CFG_AR_RELEASE_MINOR_VERSION) || \
41      (OSIF_TIMER_SYS_INTER_GENERICTIMER_AR_RELEASE_REVISION_VERSION != OSIF_CFG_AR_RELEASE_REVISION_VERSION))
42     #error "AUTOSAR Version Numbers of OsIf_Timer_System_Internal_GenericTimer.h and OsIf_Cfg.h are different"
43 #endif
44 #if ((OSIF_TIMER_SYS_INTER_GENERICTIMER_SW_MAJOR_VERSION != OSIF_CFG_SW_MAJOR_VERSION) || \
45      (OSIF_TIMER_SYS_INTER_GENERICTIMER_SW_MINOR_VERSION != OSIF_CFG_SW_MINOR_VERSION) || \
46      (OSIF_TIMER_SYS_INTER_GENERICTIMER_SW_PATCH_VERSION != OSIF_CFG_SW_PATCH_VERSION) \
47     )
48     #error "Software Version Numbers of OsIf_Timer_System_Internal_GenericTimer.h and OsIf_Cfg.h are different"
49 #endif
50 
51 /*==================================================================================================
52 *                                            CONSTANTS
53 ==================================================================================================*/
54 
55 /*==================================================================================================
56 *                                       DEFINES AND MACROS
57 ==================================================================================================*/
58 
59 /*==================================================================================================
60 *                                              ENUMS
61 ==================================================================================================*/
62 
63 /*==================================================================================================
64 *                                  STRUCTURES AND OTHER TYPEDEFS
65 ==================================================================================================*/
66 
67 /*==================================================================================================
68 *                                  GLOBAL VARIABLE DECLARATIONS
69 ==================================================================================================*/
70 
71 /*==================================================================================================
72 *                                       FUNCTION PROTOTYPES
73 ==================================================================================================*/
74 #if defined(OSIF_USE_GENERICTIMER)
75 #if (OSIF_USE_GENERICTIMER == STD_ON)
76 
77 #define BASENXP_START_SEC_CODE
78 #include "BaseNXP_MemMap.h"
79 /*!
80  * @brief Initialize SysTick timer
81  *
82  * This function initializes SysTick timer
83  *
84  * @param[in] SystemCounterFreq     System counter's frequency
85  * @return void
86  */
87 void OsIf_Timer_System_Internal_Init(uint32 SystemCounterFreq);
88 
89 /*!
90  * @brief Get current counter value of SysTick timer
91  *
92  * This function gets current counter value of SysTick timer
93  *
94  * @param[in] void
95  * @return current counter value
96  */
97 uint32 OsIf_Timer_System_Internal_GetCounter(void);
98 
99 /*!
100  * @brief Get elapsed time
101  *
102  * This function gets elapsed time
103  *
104  * @param[in] CurrentRef - pointer to old counter value
105  * @return elapsed time
106  */
107 uint32 OsIf_Timer_System_Internal_GetElapsed(uint32 * const CurrentRef);
108 
109 #define BASENXP_STOP_SEC_CODE
110 #include "BaseNXP_MemMap.h"
111 
112 #endif /* OSIF_USE_GENERICTIMER == STD_ON */
113 #endif /* defined(OSIF_USE_GENERICTIMER) */
114 
115 #ifdef __cplusplus
116 }
117 #endif
118 
119 #endif /* OSIF_TIMER_SYSTEM_INTERNAL_GENERICTIMER */
120