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 #ifndef __DEVICE_ACCESS_H_INCLUDED__
16 #define __DEVICE_ACCESS_H_INCLUDED__
20 * Define the public interface for physical system
21 * access functions to SRAM and registers. Access
22 * types are limited to those defined in <stdint.h>
23 * All accesses are aligned
25 * The address representation is private to the system
26 * and represented as/stored in "hrt_address".
28 * The system global address can differ by an offset;
29 * The device base address. This offset must be added
30 * by the implementation of the access function
32 * "store" is a transfer to the device
33 * "load" is a transfer from the device
36 #include <type_support.h>
39 * User provided file that defines the system address types:
40 * - hrt_address a type that can hold the (sub)system address range
42 #include "system_types.h"
44 * We cannot assume that the global system address size is the size of
45 * a pointer because a (say) 64-bit host can be simulated in a 32-bit
46 * environment. Only if the host environment is modelled as on the target
47 * we could use a pointer. Even then, prototyping may need to be done
48 * before the target environment is available. AS we cannot wait for that
49 * we are stuck with integer addresses
52 /*typedef char *sys_address;*/
53 typedef hrt_address sys_address;
55 /*! Set the (sub)system base address
57 \param base_addr[in] The offset on which the (sub)system is located
58 in the global address map
62 void device_set_base_address(
63 const sys_address base_addr);
65 /*! Get the (sub)system base address
69 sys_address device_get_base_address(void);
71 /*! Read an 8-bit value from a device register or memory in the device
73 \param addr[in] Local address
77 uint8_t ia_css_device_load_uint8(
78 const hrt_address addr);
80 /*! Read a 16-bit value from a device register or memory in the device
82 \param addr[in] Local address
86 uint16_t ia_css_device_load_uint16(
87 const hrt_address addr);
89 /*! Read a 32-bit value from a device register or memory in the device
91 \param addr[in] Local address
95 uint32_t ia_css_device_load_uint32(
96 const hrt_address addr);
98 /*! Read a 64-bit value from a device register or memory in the device
100 \param addr[in] Local address
104 uint64_t ia_css_device_load_uint64(
105 const hrt_address addr);
107 /*! Write an 8-bit value to a device register or memory in the device
109 \param addr[in] Local address
110 \param data[in] value
112 \return none, device[addr] = value
114 void ia_css_device_store_uint8(
115 const hrt_address addr,
118 /*! Write a 16-bit value to a device register or memory in the device
120 \param addr[in] Local address
121 \param data[in] value
123 \return none, device[addr] = value
125 void ia_css_device_store_uint16(
126 const hrt_address addr,
127 const uint16_t data);
129 /*! Write a 32-bit value to a device register or memory in the device
131 \param addr[in] Local address
132 \param data[in] value
134 \return none, device[addr] = value
136 void ia_css_device_store_uint32(
137 const hrt_address addr,
138 const uint32_t data);
140 /*! Write a 64-bit value to a device register or memory in the device
142 \param addr[in] Local address
143 \param data[in] value
145 \return none, device[addr] = value
147 void ia_css_device_store_uint64(
148 const hrt_address addr,
149 const uint64_t data);
151 /*! Read an array of bytes from device registers or memory in the device
153 \param addr[in] Local address
154 \param data[out] pointer to the destination array
155 \param size[in] number of bytes to read
159 void ia_css_device_load(
160 const hrt_address addr,
164 /*! Write an array of bytes to device registers or memory in the device
166 \param addr[in] Local address
167 \param data[in] pointer to the source array
168 \param size[in] number of bytes to write
172 void ia_css_device_store(
173 const hrt_address addr,
177 #endif /* __DEVICE_ACCESS_H_INCLUDED__ */