GNU Linux-libre 4.14.266-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / ia_css_timer.h
1 #ifndef ISP2401
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2015, Intel Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  */
15 #else
16 /**
17 Support for Intel Camera Imaging ISP subsystem.
18 Copyright (c) 2010 - 2015, Intel Corporation.
19
20 This program is free software; you can redistribute it and/or modify it
21 under the terms and conditions of the GNU General Public License,
22 version 2, as published by the Free Software Foundation.
23
24 This program is distributed in the hope it will be useful, but WITHOUT
25 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
26 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
27 more details.
28 */
29 #endif
30
31 #ifndef __IA_CSS_TIMER_H
32 #define __IA_CSS_TIMER_H
33
34 /** @file
35  * Timer interface definitions
36  */
37 #include <type_support.h>               /* for uint32_t */
38 #include "ia_css_err.h"
39
40 /** @brief timer reading definition */
41 typedef uint32_t clock_value_t;
42
43 /** @brief 32 bit clock tick,(timestamp based on timer-value of CSS-internal timer)*/
44 struct ia_css_clock_tick {
45         clock_value_t ticks; /**< measured time in ticks.*/
46 };
47
48 /** @brief TIMER event codes */
49 enum ia_css_tm_event {
50         IA_CSS_TM_EVENT_AFTER_INIT,
51         /**< Timer Event after Initialization */
52         IA_CSS_TM_EVENT_MAIN_END,
53         /**< Timer Event after end of Main */
54         IA_CSS_TM_EVENT_THREAD_START,
55         /**< Timer Event after thread start */
56         IA_CSS_TM_EVENT_FRAME_PROC_START,
57         /**< Timer Event after Frame Process Start */
58         IA_CSS_TM_EVENT_FRAME_PROC_END
59         /**< Timer Event after Frame Process End */
60 };
61
62 /** @brief code measurement common struct */
63 struct ia_css_time_meas {
64         clock_value_t   start_timer_value;      /**< measured time in ticks */
65         clock_value_t   end_timer_value;        /**< measured time in ticks */
66 };
67
68 /**@brief SIZE_OF_IA_CSS_CLOCK_TICK_STRUCT checks to ensure correct alignment for struct ia_css_clock_tick. */
69 #define SIZE_OF_IA_CSS_CLOCK_TICK_STRUCT sizeof(clock_value_t)
70 /** @brief checks to ensure correct alignment for ia_css_time_meas. */
71 #define SIZE_OF_IA_CSS_TIME_MEAS_STRUCT (sizeof(clock_value_t) \
72                                         + sizeof(clock_value_t))
73
74 /** @brief API to fetch timer count directly
75 *
76 * @param curr_ts [out] measured count value
77 * @return IA_CSS_SUCCESS if success
78 *
79 */
80 enum ia_css_err
81 ia_css_timer_get_current_tick(
82         struct ia_css_clock_tick *curr_ts);
83
84 #endif  /* __IA_CSS_TIMER_H */