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
20 #include "system_api.h"
21 #include "hive_types.h"
23 #define hrt_int_type_of_char char
24 #define hrt_int_type_of_uchar unsigned char
25 #define hrt_int_type_of_short short
26 #define hrt_int_type_of_ushort unsigned short
27 #define hrt_int_type_of_int int
28 #define hrt_int_type_of_uint unsigned int
29 #define hrt_int_type_of_long long
30 #define hrt_int_type_of_ulong unsigned long
31 #define hrt_int_type_of_ptr unsigned int
33 #define hrt_host_type_of_char char
34 #define hrt_host_type_of_uchar unsigned char
35 #define hrt_host_type_of_short short
36 #define hrt_host_type_of_ushort unsigned short
37 #define hrt_host_type_of_int int
38 #define hrt_host_type_of_uint unsigned int
39 #define hrt_host_type_of_long long
40 #define hrt_host_type_of_ulong unsigned long
41 #define hrt_host_type_of_ptr void*
43 #define HRT_TYPE_BYTES(cell, type) (HRT_TYPE_BITS(cell, type)/8)
44 #define HRT_HOST_TYPE(cell_type) HRTCAT(hrt_host_type_of_, cell_type)
45 #define HRT_INT_TYPE(type) HRTCAT(hrt_int_type_of_, type)
49 #ifdef C_RUN_DYNAMIC_LINK_PROGRAMS
50 extern void *csim_processor_get_crun_symbol(hive_proc_id p, const char *sym);
51 #define _hrt_cell_get_crun_symbol(cell,sym) csim_processor_get_crun_symbol(cell,HRTSTR(sym))
52 #define _hrt_cell_get_crun_indexed_symbol(cell,sym) csim_processor_get_crun_symbol(cell,HRTSTR(sym))
54 #define _hrt_cell_get_crun_symbol(cell,sym) (&sym)
55 #define _hrt_cell_get_crun_indexed_symbol(cell,sym) (sym)
56 #endif // C_RUN_DYNAMIC_LINK_PROGRAMS
58 #define hrt_scalar_store(cell, type, var, data) \
59 ((*(HRT_HOST_TYPE(type)*)_hrt_cell_get_crun_symbol(cell,var)) = (data))
60 #define hrt_scalar_load(cell, type, var) \
61 ((*(HRT_HOST_TYPE(type)*)_hrt_cell_get_crun_symbol(cell,var)))
63 #define hrt_indexed_store(cell, type, array, index, data) \
64 ((((HRT_HOST_TYPE(type)*)_hrt_cell_get_crun_indexed_symbol(cell,array))[index]) = (data))
65 #define hrt_indexed_load(cell, type, array, index) \
66 (((HRT_HOST_TYPE(type)*)_hrt_cell_get_crun_indexed_symbol(cell,array))[index])
70 #define hrt_scalar_store(cell, type, var, data) \
71 HRTCAT(hrt_mem_store_,HRT_TYPE_BITS(cell, type))(\
73 HRTCAT(HIVE_MEM_,var), \
74 HRTCAT(HIVE_ADDR_,var), \
75 (HRT_INT_TYPE(type))(data))
77 #define hrt_scalar_load(cell, type, var) \
78 (HRT_HOST_TYPE(type))(HRTCAT4(_hrt_mem_load_,HRT_PROC_TYPE(cell),_,type) ( \
80 HRTCAT(HIVE_MEM_,var), \
81 HRTCAT(HIVE_ADDR_,var)))
83 #define hrt_indexed_store(cell, type, array, index, data) \
84 HRTCAT(hrt_mem_store_,HRT_TYPE_BITS(cell, type))(\
86 HRTCAT(HIVE_MEM_,array), \
87 (HRTCAT(HIVE_ADDR_,array))+((index)*HRT_TYPE_BYTES(cell, type)), \
88 (HRT_INT_TYPE(type))(data))
90 #define hrt_indexed_load(cell, type, array, index) \
91 (HRT_HOST_TYPE(type))(HRTCAT4(_hrt_mem_load_,HRT_PROC_TYPE(cell),_,type) ( \
93 HRTCAT(HIVE_MEM_,array), \
94 (HRTCAT(HIVE_ADDR_,array))+((index)*HRT_TYPE_BYTES(cell, type))))
98 #endif /* _HRT_VAR_H */