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 extern void device_set_base_address(
79 const sys_address base_addr);
82 /*! Get the (sub)system base address
86 extern sys_address device_get_base_address(void);
88 /*! Read an 8-bit value from a device register or memory in the device
90 \param addr[in] Local address
94 extern uint8_t ia_css_device_load_uint8(
95 const hrt_address addr);
97 /*! Read a 16-bit value from a device register or memory in the device
99 \param addr[in] Local address
103 extern uint16_t ia_css_device_load_uint16(
104 const hrt_address addr);
106 /*! Read a 32-bit value from a device register or memory in the device
108 \param addr[in] Local address
112 extern uint32_t ia_css_device_load_uint32(
113 const hrt_address addr);
115 /*! Read a 64-bit value from a device register or memory in the device
117 \param addr[in] Local address
121 extern uint64_t ia_css_device_load_uint64(
122 const hrt_address addr);
124 /*! Write an 8-bit value to a device register or memory in the device
126 \param addr[in] Local address
127 \param data[in] value
129 \return none, device[addr] = value
131 extern void ia_css_device_store_uint8(
132 const hrt_address addr,
135 /*! Write a 16-bit value to a device register or memory in the device
137 \param addr[in] Local address
138 \param data[in] value
140 \return none, device[addr] = value
142 extern void ia_css_device_store_uint16(
143 const hrt_address addr,
144 const uint16_t data);
146 /*! Write a 32-bit value to a device register or memory in the device
148 \param addr[in] Local address
149 \param data[in] value
151 \return none, device[addr] = value
153 extern void ia_css_device_store_uint32(
154 const hrt_address addr,
155 const uint32_t data);
157 /*! Write a 64-bit value to a device register or memory in the device
159 \param addr[in] Local address
160 \param data[in] value
162 \return none, device[addr] = value
164 extern void ia_css_device_store_uint64(
165 const hrt_address addr,
166 const uint64_t data);
168 /*! Read an array of bytes from device registers or memory in the device
170 \param addr[in] Local address
171 \param data[out] pointer to the destination array
172 \param size[in] number of bytes to read
176 extern void ia_css_device_load(
177 const hrt_address addr,
181 /*! Write an array of bytes to device registers or memory in the device
183 \param addr[in] Local address
184 \param data[in] pointer to the source array
185 \param size[in] number of bytes to write
189 extern void ia_css_device_store(
190 const hrt_address addr,
194 #endif /* __DEVICE_ACCESS_H_INCLUDED__ */