1 // SPDX-License-Identifier: GPL-2.0
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 
16 #include <type_support.h>		/* for uint32_t */
17 #include "ia_css_timer.h" /*struct ia_css_clock_tick */
18 #include "sh_css_legacy.h" /* IA_CSS_PIPE_ID_NUM*/
19 #include "gp_timer.h" /*gp_timer_read()*/
20 #include "assert_support.h"
21 
ia_css_timer_get_current_tick(struct ia_css_clock_tick * curr_ts)22 int ia_css_timer_get_current_tick(struct ia_css_clock_tick *curr_ts)
23 {
24 	assert(curr_ts);
25 	if (!curr_ts)
26 		return -EINVAL;
27 	curr_ts->ticks = (clock_value_t)gp_timer_read(GP_TIMER_SEL);
28 	return 0;
29 }
30