00001 00004 /* -*- coding: iso-8859-1 -*- 00005 * Copyright (C) 2008 TTTech Computertechnik AG 00006 * **************************************************************************** 00007 * Name 00008 * hw_timer.h 00009 * 00010 * Purpose 00011 * API for timer hardware. 00012 * 00013 * Revision Dates 00014 * 06-Mai-2008 (AAD) Creation 00015 * 01-Dec-2008 (KSE) [29628] Add doxygen-style comments 00016 * 02-Dec-2008 (KSE) [29628] Include common.h 00017 * 02-Dec-2008 (KSE) [29628] Changed include names 00018 *-- 00019 */ 00020 00021 #ifndef TTE_HW_TIMER_H_ 00022 #define TTE_HW_TIMER_H_ 00023 00024 #include "tte_target.h" 00025 #include "tte_common.h" 00026 #include "tte_environment.h" 00027 00028 /*************************************************************************** 00029 * HW Time definition and manipulation routines 00030 ***************************************************************************/ 00031 00034 typedef TTE_TIMER_TYPE hwtime_t; 00035 00036 00038 extern hwtime_t hwtime_from_ns(int64_t ns); 00039 00040 00044 extern int64_t hwtime_to_ns(hwtime_t ht); 00045 00046 00051 extern hwtime_t hwtime_add_ns(hwtime_t ht, int64_t ns); 00052 00053 00059 extern int64_t hwtime_sub(hwtime_t ht1, hwtime_t ht2); 00060 00061 00062 /*************************************************************************** 00063 * Timer programming and time-stamp capturing 00064 ***************************************************************************/ 00065 00066 00069 typedef void (*tte_isr_callback_t) (uint8_t ctrl); 00070 00071 00081 extern int32_t hw_timer_disable_timer(void); 00082 00085 extern void hw_timer_exit(void); 00086 00087 00101 extern int32_t hw_timer_get_timestamp(hwtime_t *ts); 00102 00103 00104 00113 extern int32_t hw_timer_init(void); 00114 00115 00126 extern int32_t hw_timer_start_timer_abs(hwtime_t time); 00127 00128 00139 extern int32_t hw_timer_start_timer_rel(hwtime_t time); 00140 00141 00157 extern int32_t tte_register_timer_callback(uint8_t ctrl, tte_isr_callback_t cb); 00158 00159 00160 #endif /* TTE_HW_TIMER_H_ */ 00161