summaryrefslogtreecommitdiff
path: root/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_device_access.c
blob: 21b842379accbbeca68509890e31209cbd1518b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
 * Support for Intel Camera Imaging ISP subsystem.
 * Copyright (c) 2015, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 */

#include "ia_css_device_access.h"
#include <type_support.h>   /* for uint*, size_t */
#include <system_types.h>   /* for hrt_address */
#include <ia_css_env.h>     /* for ia_css_hw_access_env */
#include <assert_support.h> /* for assert */

static struct ia_css_hw_access_env my_env;

void
ia_css_device_access_init(const struct ia_css_hw_access_env *env)
{
	assert(env != NULL);

	my_env = *env;
}

uint8_t
ia_css_device_load_uint8(const hrt_address addr)
{
	return my_env.load_8(addr);
}

uint16_t
ia_css_device_load_uint16(const hrt_address addr)
{
	return my_env.load_16(addr);
}

uint32_t
ia_css_device_load_uint32(const hrt_address addr)
{
	return my_env.load_32(addr);
}

uint64_t
ia_css_device_load_uint64(const hrt_address addr)
{
	assert(0);

	(void)addr;
	return 0;
}

void
ia_css_device_store_uint8(const hrt_address addr, const uint8_t data)
{
	my_env.store_8(addr, data);
}

void
ia_css_device_store_uint16(const hrt_address addr, const uint16_t data)
{
	my_env.store_16(addr, data);
}

void
ia_css_device_store_uint32(const hrt_address addr, const uint32_t data)
{
	my_env.store_32(addr, data);
}

void
ia_css_device_store_uint64(const hrt_address addr, const uint64_t data)
{
	assert(0);

	(void)addr;
	(void)data;
}

void
ia_css_device_load(const hrt_address addr, void *data, const size_t size)
{
	my_env.load(addr, data, (uint32_t)size);
}

void
ia_css_device_store(const hrt_address addr, const void *data, const size_t size)
{
	my_env.store(addr, data, (uint32_t)size);
}