TIMER
|
TIMER.h
Go to the documentation of this file.
00001 00058 #ifndef TIMER_H 00059 #define TIMER_H 00060 /*********************************************************************************************************************** 00061 * HEADER FILES 00062 **********************************************************************************************************************/ 00063 #include "timer_conf.h" 00064 #ifdef TIMER_CCU4_USED 00065 #include <GLOBAL_CCU4/global_ccu4.h> 00066 #endif 00067 #ifdef TIMER_CCU8_USED 00068 #include <GLOBAL_CCU8/global_ccu8.h> 00069 #endif 00070 #include <DAVE_Common.h> 00071 00072 /*********************************************************************************************************************** 00073 * MACROS 00074 **********************************************************************************************************************/ 00075 00076 00077 /*********************************************************************************************************************** 00078 * ENUMS 00079 **********************************************************************************************************************/ 00088 typedef enum TIMER_MODULE 00089 { 00090 TIMER_MODULE_CCU4 = 0U, 00091 TIMER_MODULE_CCU8 00092 } TIMER_MODULE_t; 00093 00097 typedef enum TIMER_STATUS{ 00098 TIMER_STATUS_SUCCESS = 0U, 00099 TIMER_STATUS_FAILURE 00100 } TIMER_STATUS_t; 00101 00105 /*********************************************************************************************************************** 00106 * DATA STRUCTURES 00107 ***********************************************************************************************************************/ 00116 typedef struct TIMER 00117 { 00118 uint32_t time_interval_value_us; 00119 const uint32_t timer_max_value_us; 00120 const uint32_t timer_min_value_us; 00121 const uint32_t shadow_mask; 00122 #ifdef TIMER_CCU4_USED 00123 GLOBAL_CCU4_t* const global_ccu4_handler; 00124 XMC_CCU4_SLICE_t* const ccu4_slice_ptr; 00125 const uint8_t ccu4_slice_number; /* Timer being used */ 00126 XMC_CCU4_SLICE_COMPARE_CONFIG_t* const ccu4_slice_config_ptr; 00128 XMC_CCU4_SLICE_SR_ID_t const ccu4_period_match_node; 00129 #endif 00130 #ifdef TIMER_CCU8_USED 00131 GLOBAL_CCU8_t* const global_ccu8_handler; 00132 XMC_CCU8_SLICE_t* const ccu8_slice_ptr; 00133 const uint8_t ccu8_slice_number; /* Timer being used */ 00134 XMC_CCU8_SLICE_COMPARE_CONFIG_t* const ccu8_slice_config_ptr; 00136 XMC_CCU8_SLICE_SR_ID_t const ccu8_period_match_node; 00137 #endif 00138 TIMER_MODULE_t const timer_module; 00139 uint16_t period_value; 00140 bool const start_control; 00141 bool const period_match_enable; 00142 bool initialized; /* flag to indicate the initialization state of the APP instance */ 00143 } TIMER_t; 00144 00148 /*********************************************************************************************************************** 00149 * API Prototypes 00150 ***********************************************************************************************************************/ 00151 #ifdef __cplusplus 00152 extern "C" { 00153 #endif 00154 00190 DAVE_APP_VERSION_t TIMER_GetAppVersion(void); 00191 00223 TIMER_STATUS_t TIMER_Init(TIMER_t *const handle_ptr); 00224 00258 TIMER_STATUS_t TIMER_Start(TIMER_t *const handle_ptr); 00259 00300 TIMER_STATUS_t TIMER_Stop(TIMER_t *const handle_ptr); 00301 00339 uint32_t TIMER_GetTime(TIMER_t *const handle_ptr); 00340 00380 TIMER_STATUS_t TIMER_Clear(TIMER_t *const handle_ptr); 00381 00421 bool TIMER_GetTimerStatus(TIMER_t *const handle_ptr); 00422 00495 TIMER_STATUS_t TIMER_SetTimeInterval(TIMER_t *const handle_ptr, uint32_t time_interval); 00496 00554 bool TIMER_GetInterruptStatus(TIMER_t * const handle_ptr); 00555 00586 void TIMER_ClearEvent(TIMER_t *const handle_ptr); 00587 00591 #include "timer_extern.h" /* Included to access the APP Handles at Main.c */ 00592 00593 #ifdef __cplusplus 00594 } 00595 #endif 00596 00597 #endif /* TIMER_H */