GNU Linux-libre 4.14.332-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / runtime / timer / src / timer.c
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 #include <type_support.h>               /* for uint32_t */
32 #include "ia_css_timer.h" /*struct ia_css_clock_tick */
33 #include "sh_css_legacy.h" /* IA_CSS_PIPE_ID_NUM*/
34 #include "gp_timer.h" /*gp_timer_read()*/
35 #include "assert_support.h"
36
37 enum ia_css_err
38 ia_css_timer_get_current_tick(
39         struct ia_css_clock_tick *curr_ts) {
40
41         assert(curr_ts !=  NULL);
42         if (curr_ts == NULL) {
43                 return IA_CSS_ERR_INVALID_ARGUMENTS;
44         }
45         curr_ts->ticks = (clock_value_t)gp_timer_read(GP_TIMER_SEL);
46         return IA_CSS_SUCCESS;
47 }
48