2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 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 __ISP_PRIVATE_H_INCLUDED__
16 #define __ISP_PRIVATE_H_INCLUDED__
18 #ifdef HRT_MEMORY_ACCESS
22 #include "isp_public.h"
24 #include "device_access.h"
26 #include "assert_support.h"
27 #include "type_support.h"
29 STORAGE_CLASS_ISP_C void isp_ctrl_store(
31 const unsigned int reg,
34 assert(ID < N_ISP_ID);
35 assert(ISP_CTRL_BASE[ID] != (hrt_address)-1);
36 #if !defined(HRT_MEMORY_ACCESS)
37 ia_css_device_store_uint32(ISP_CTRL_BASE[ID] + reg*sizeof(hrt_data), value);
39 hrt_master_port_store_32(ISP_CTRL_BASE[ID] + reg*sizeof(hrt_data), value);
44 STORAGE_CLASS_ISP_C hrt_data isp_ctrl_load(
46 const unsigned int reg)
48 assert(ID < N_ISP_ID);
49 assert(ISP_CTRL_BASE[ID] != (hrt_address)-1);
50 #if !defined(HRT_MEMORY_ACCESS)
51 return ia_css_device_load_uint32(ISP_CTRL_BASE[ID] + reg*sizeof(hrt_data));
53 return hrt_master_port_uload_32(ISP_CTRL_BASE[ID] + reg*sizeof(hrt_data));
57 STORAGE_CLASS_ISP_C bool isp_ctrl_getbit(
59 const unsigned int reg,
60 const unsigned int bit)
62 hrt_data val = isp_ctrl_load(ID, reg);
63 return (val & (1UL << bit)) != 0;
66 STORAGE_CLASS_ISP_C void isp_ctrl_setbit(
68 const unsigned int reg,
69 const unsigned int bit)
71 hrt_data data = isp_ctrl_load(ID, reg);
72 isp_ctrl_store(ID, reg, (data | (1UL << bit)));
76 STORAGE_CLASS_ISP_C void isp_ctrl_clearbit(
78 const unsigned int reg,
79 const unsigned int bit)
81 hrt_data data = isp_ctrl_load(ID, reg);
82 isp_ctrl_store(ID, reg, (data & ~(1UL << bit)));
86 STORAGE_CLASS_ISP_C void isp_dmem_store(
92 assert(ID < N_ISP_ID);
93 assert(ISP_DMEM_BASE[ID] != (hrt_address)-1);
94 #if !defined(HRT_MEMORY_ACCESS)
95 ia_css_device_store(ISP_DMEM_BASE[ID] + addr, data, size);
97 hrt_master_port_store(ISP_DMEM_BASE[ID] + addr, data, size);
102 STORAGE_CLASS_ISP_C void isp_dmem_load(
104 const unsigned int addr,
108 assert(ID < N_ISP_ID);
109 assert(ISP_DMEM_BASE[ID] != (hrt_address)-1);
110 #if !defined(HRT_MEMORY_ACCESS)
111 ia_css_device_load(ISP_DMEM_BASE[ID] + addr, data, size);
113 hrt_master_port_load(ISP_DMEM_BASE[ID] + addr, data, size);
118 STORAGE_CLASS_ISP_C void isp_dmem_store_uint32(
123 assert(ID < N_ISP_ID);
124 assert(ISP_DMEM_BASE[ID] != (hrt_address)-1);
126 #if !defined(HRT_MEMORY_ACCESS)
127 ia_css_device_store_uint32(ISP_DMEM_BASE[ID] + addr, data);
129 hrt_master_port_store_32(ISP_DMEM_BASE[ID] + addr, data);
134 STORAGE_CLASS_ISP_C uint32_t isp_dmem_load_uint32(
136 const unsigned int addr)
138 assert(ID < N_ISP_ID);
139 assert(ISP_DMEM_BASE[ID] != (hrt_address)-1);
141 #if !defined(HRT_MEMORY_ACCESS)
142 return ia_css_device_load_uint32(ISP_DMEM_BASE[ID] + addr);
144 return hrt_master_port_uload_32(ISP_DMEM_BASE[ID] + addr);
148 STORAGE_CLASS_ISP_C uint32_t isp_2w_cat_1w(
152 uint32_t out = ((uint32_t)(x1 & HIVE_ISP_VMEM_MASK) << ISP_VMEM_ELEMBITS)
153 | (x0 & HIVE_ISP_VMEM_MASK);
157 #endif /* __ISP_PRIVATE_H_INCLUDED__ */