2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 2010-2015, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 #include <type_support.h> /*uint32_t */
16 #include "gp_timer.h" /*system_local.h,
19 #ifndef __INLINE_GP_TIMER__
20 #include "gp_timer_private.h" /*device_access.h*/
21 #endif /* __INLINE_GP_TIMER__ */
22 #include "system_local.h"
24 /** FIXME: not sure if reg_load(), reg_store() should be API.
27 gp_timer_reg_load(uint32_t reg);
30 gp_timer_reg_store(uint32_t reg, uint32_t value);
33 gp_timer_reg_load(uint32_t reg)
35 return ia_css_device_load_uint32(
37 (reg * sizeof(uint32_t)));
41 gp_timer_reg_store(uint32_t reg, uint32_t value)
43 ia_css_device_store_uint32((GP_TIMER_BASE +
44 (reg * sizeof(uint32_t))),
48 void gp_timer_init(gp_timer_ID_t ID)
50 /* set_overall_enable*/
51 gp_timer_reg_store(_REG_GP_TIMER_OVERALL_ENABLE, 1);
54 gp_timer_reg_store(_REG_GP_TIMER_ENABLE_ID(ID), 1);
56 /* set signal select */
57 gp_timer_reg_store(_REG_GP_TIMER_SIGNAL_SELECT_ID(ID), GP_TIMER_SIGNAL_SELECT);
60 gp_timer_reg_store(_REG_GP_TIMER_COUNT_TYPE_ID(ID), GP_TIMER_COUNT_TYPE_LOW);
63 gp_timer_reg_store(_REG_GP_TIMER_RESET_REG, 0xFF);
67 gp_timer_read(gp_timer_ID_t ID)
69 return gp_timer_reg_load(_REG_GP_TIMER_VALUE_ID(ID));