xref: /linux/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/sp_local.h (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2010-2015, Intel Corporation.
5  *
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.
9  *
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
13  * more details.
14  */
15 
16 #ifndef __SP_LOCAL_H_INCLUDED__
17 #define __SP_LOCAL_H_INCLUDED__
18 
19 #include <type_support.h>
20 #include "sp_global.h"
21 
22 #define sp_address_of(var)	(HIVE_ADDR_ ## var)
23 
24 /*
25  * deprecated
26  */
27 #define store_sp_int(var, value) \
28 	sp_dmem_store_uint32(SP0_ID, (unsigned int)sp_address_of(var), \
29 		(uint32_t)(value))
30 
31 #define store_sp_ptr(var, value) \
32 	sp_dmem_store_uint32(SP0_ID, (unsigned int)sp_address_of(var), \
33 		(uint32_t)(value))
34 
35 #define load_sp_uint(var) \
36 	sp_dmem_load_uint32(SP0_ID, (unsigned int)sp_address_of(var))
37 
38 #define load_sp_array_uint8(array_name, index) \
39 	sp_dmem_load_uint8(SP0_ID, (unsigned int)sp_address_of(array_name) + \
40 		(index) * sizeof(uint8_t))
41 
42 #define load_sp_array_uint16(array_name, index) \
43 	sp_dmem_load_uint16(SP0_ID, (unsigned int)sp_address_of(array_name) + \
44 		(index) * sizeof(uint16_t))
45 
46 #define load_sp_array_uint(array_name, index) \
47 	sp_dmem_load_uint32(SP0_ID, (unsigned int)sp_address_of(array_name) + \
48 		(index) * sizeof(uint32_t))
49 
50 #define store_sp_var(var, data, bytes) \
51 	sp_dmem_store(SP0_ID, (unsigned int)sp_address_of(var), data, bytes)
52 
53 #define store_sp_array_uint8(array_name, index, value) \
54 	sp_dmem_store_uint8(SP0_ID, (unsigned int)sp_address_of(array_name) + \
55 		(index) * sizeof(uint8_t), value)
56 
57 #define store_sp_array_uint16(array_name, index, value) \
58 	sp_dmem_store_uint16(SP0_ID, (unsigned int)sp_address_of(array_name) + \
59 		(index) * sizeof(uint16_t), value)
60 
61 #define store_sp_array_uint(array_name, index, value) \
62 	sp_dmem_store_uint32(SP0_ID, (unsigned int)sp_address_of(array_name) + \
63 		(index) * sizeof(uint32_t), value)
64 
65 #define store_sp_var_with_offset(var, offset, data, bytes) \
66 	sp_dmem_store(SP0_ID, (unsigned int)sp_address_of(var) + \
67 		offset, data, bytes)
68 
69 #define load_sp_var(var, data, bytes) \
70 	sp_dmem_load(SP0_ID, (unsigned int)sp_address_of(var), data, bytes)
71 
72 #define load_sp_var_with_offset(var, offset, data, bytes) \
73 	sp_dmem_load(SP0_ID, (unsigned int)sp_address_of(var) + offset, \
74 		data, bytes)
75 
76 #endif /* __SP_LOCAL_H_INCLUDED__ */
77