3 * Support for Intel Camera Imaging ISP subsystem.
4 * Copyright (c) 2015, Intel Corporation.
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.
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
17 Support for Intel Camera Imaging ISP subsystem.
18 Copyright (c) 2010 - 2015, Intel Corporation.
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.
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
31 #ifndef __DEVICE_ACCESS_H_INCLUDED__
32 #define __DEVICE_ACCESS_H_INCLUDED__
36 * Define the public interface for physical system
37 * access functions to SRAM and registers. Access
38 * types are limited to those defined in <stdint.h>
39 * All accesses are aligned
41 * The address representation is private to the system
42 * and represented as/stored in "hrt_address".
44 * The system global address can differ by an offset;
45 * The device base address. This offset must be added
46 * by the implementation of the access function
48 * "store" is a transfer to the device
49 * "load" is a transfer from the device
52 #include <type_support.h>
55 * User provided file that defines the system address types:
56 * - hrt_address a type that can hold the (sub)system address range
58 #include "system_types.h"
60 * We cannot assume that the global system address size is the size of
61 * a pointer because a (say) 64-bit host can be simulated in a 32-bit
62 * environment. Only if the host environment is modelled as on the target
63 * we could use a pointer. Even then, prototyping may need to be done
64 * before the target environment is available. AS we cannot wait for that
65 * we are stuck with integer addresses
68 /*typedef char *sys_address;*/
69 typedef hrt_address sys_address;
71 /*! Set the (sub)system base address
73 \param base_addr[in] The offset on which the (sub)system is located
74 in the global address map
78 void device_set_base_address(
79 const sys_address base_addr);
81 /*! Get the (sub)system base address
85 sys_address device_get_base_address(void);
87 /*! Read an 8-bit value from a device register or memory in the device
89 \param addr[in] Local address
93 uint8_t ia_css_device_load_uint8(
94 const hrt_address addr);
96 /*! Read a 16-bit value from a device register or memory in the device
98 \param addr[in] Local address
102 uint16_t ia_css_device_load_uint16(
103 const hrt_address addr);
105 /*! Read a 32-bit value from a device register or memory in the device
107 \param addr[in] Local address
111 uint32_t ia_css_device_load_uint32(
112 const hrt_address addr);
114 /*! Read a 64-bit value from a device register or memory in the device
116 \param addr[in] Local address
120 uint64_t ia_css_device_load_uint64(
121 const hrt_address addr);
123 /*! Write an 8-bit value to a device register or memory in the device
125 \param addr[in] Local address
126 \param data[in] value
128 \return none, device[addr] = value
130 void ia_css_device_store_uint8(
131 const hrt_address addr,
134 /*! Write a 16-bit value to a device register or memory in the device
136 \param addr[in] Local address
137 \param data[in] value
139 \return none, device[addr] = value
141 void ia_css_device_store_uint16(
142 const hrt_address addr,
143 const uint16_t data);
145 /*! Write a 32-bit value to a device register or memory in the device
147 \param addr[in] Local address
148 \param data[in] value
150 \return none, device[addr] = value
152 void ia_css_device_store_uint32(
153 const hrt_address addr,
154 const uint32_t data);
156 /*! Write a 64-bit value to a device register or memory in the device
158 \param addr[in] Local address
159 \param data[in] value
161 \return none, device[addr] = value
163 void ia_css_device_store_uint64(
164 const hrt_address addr,
165 const uint64_t data);
167 /*! Read an array of bytes from device registers or memory in the device
169 \param addr[in] Local address
170 \param data[out] pointer to the destination array
171 \param size[in] number of bytes to read
175 void ia_css_device_load(
176 const hrt_address addr,
180 /*! Write an array of bytes to device registers or memory in the device
182 \param addr[in] Local address
183 \param data[in] pointer to the source array
184 \param size[in] number of bytes to write
188 void ia_css_device_store(
189 const hrt_address addr,
193 #endif /* __DEVICE_ACCESS_H_INCLUDED__ */