1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Support for Intel Camera Imaging ISP subsystem.
4 * Copyright (c) 2010-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#ifndef __GPIO_PRIVATE_H_INCLUDED__
17#define __GPIO_PRIVATE_H_INCLUDED__
18
19#include "gpio_public.h"
20
21#include "device_access.h"
22
23#include "assert_support.h"
24
25STORAGE_CLASS_GPIO_C void gpio_reg_store(
26    const gpio_ID_t	ID,
27    const unsigned int		reg,
28    const hrt_data			value)
29{
30	OP___assert(ID < N_GPIO_ID);
31	OP___assert(GPIO_BASE[ID] != (hrt_address) - 1);
32	ia_css_device_store_uint32(GPIO_BASE[ID] + reg * sizeof(hrt_data), value);
33	return;
34}
35
36STORAGE_CLASS_GPIO_C hrt_data gpio_reg_load(
37    const gpio_ID_t	ID,
38    const unsigned int		reg)
39{
40	OP___assert(ID < N_GPIO_ID);
41	OP___assert(GPIO_BASE[ID] != (hrt_address) - 1);
42	return ia_css_device_load_uint32(GPIO_BASE[ID] + reg * sizeof(hrt_data));
43}
44
45#endif /* __GPIO_PRIVATE_H_INCLUDED__ */
46