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 __SP_PRIVATE_H_INCLUDED__
16 #define __SP_PRIVATE_H_INCLUDED__
18 #include "sp_public.h"
20 #include "device_access.h"
22 #include "assert_support.h"
24 STORAGE_CLASS_SP_C void sp_ctrl_store(
26 const hrt_address reg,
30 assert(SP_CTRL_BASE[ID] != (hrt_address)-1);
31 ia_css_device_store_uint32(SP_CTRL_BASE[ID] + reg*sizeof(hrt_data), value);
35 STORAGE_CLASS_SP_C hrt_data sp_ctrl_load(
37 const hrt_address reg)
40 assert(SP_CTRL_BASE[ID] != (hrt_address)-1);
41 return ia_css_device_load_uint32(SP_CTRL_BASE[ID] + reg*sizeof(hrt_data));
44 STORAGE_CLASS_SP_C bool sp_ctrl_getbit(
46 const hrt_address reg,
47 const unsigned int bit)
49 hrt_data val = sp_ctrl_load(ID, reg);
50 return (val & (1UL << bit)) != 0;
53 STORAGE_CLASS_SP_C void sp_ctrl_setbit(
55 const hrt_address reg,
56 const unsigned int bit)
58 hrt_data data = sp_ctrl_load(ID, reg);
59 sp_ctrl_store(ID, reg, (data | (1UL << bit)));
63 STORAGE_CLASS_SP_C void sp_ctrl_clearbit(
65 const hrt_address reg,
66 const unsigned int bit)
68 hrt_data data = sp_ctrl_load(ID, reg);
69 sp_ctrl_store(ID, reg, (data & ~(1UL << bit)));
73 STORAGE_CLASS_SP_C void sp_dmem_store(
80 assert(SP_DMEM_BASE[ID] != (hrt_address)-1);
81 ia_css_device_store(SP_DMEM_BASE[ID] + addr, data, size);
85 STORAGE_CLASS_SP_C void sp_dmem_load(
87 const hrt_address addr,
92 assert(SP_DMEM_BASE[ID] != (hrt_address)-1);
93 ia_css_device_load(SP_DMEM_BASE[ID] + addr, data, size);
97 STORAGE_CLASS_SP_C void sp_dmem_store_uint8(
102 assert(ID < N_SP_ID);
103 assert(SP_DMEM_BASE[ID] != (hrt_address)-1);
105 ia_css_device_store_uint8(SP_DMEM_BASE[SP0_ID] + addr, data);
109 STORAGE_CLASS_SP_C void sp_dmem_store_uint16(
114 assert(ID < N_SP_ID);
115 assert(SP_DMEM_BASE[ID] != (hrt_address)-1);
117 ia_css_device_store_uint16(SP_DMEM_BASE[SP0_ID] + addr, data);
121 STORAGE_CLASS_SP_C void sp_dmem_store_uint32(
126 assert(ID < N_SP_ID);
127 assert(SP_DMEM_BASE[ID] != (hrt_address)-1);
129 ia_css_device_store_uint32(SP_DMEM_BASE[SP0_ID] + addr, data);
133 STORAGE_CLASS_SP_C uint8_t sp_dmem_load_uint8(
135 const hrt_address addr)
137 assert(ID < N_SP_ID);
138 assert(SP_DMEM_BASE[ID] != (hrt_address)-1);
140 return ia_css_device_load_uint8(SP_DMEM_BASE[SP0_ID] + addr);
143 STORAGE_CLASS_SP_C uint16_t sp_dmem_load_uint16(
145 const hrt_address addr)
147 assert(ID < N_SP_ID);
148 assert(SP_DMEM_BASE[ID] != (hrt_address)-1);
150 return ia_css_device_load_uint16(SP_DMEM_BASE[SP0_ID] + addr);
153 STORAGE_CLASS_SP_C uint32_t sp_dmem_load_uint32(
155 const hrt_address addr)
157 assert(ID < N_SP_ID);
158 assert(SP_DMEM_BASE[ID] != (hrt_address)-1);
160 return ia_css_device_load_uint32(SP_DMEM_BASE[SP0_ID] + addr);
163 #endif /* __SP_PRIVATE_H_INCLUDED__ */