GNU Linux-libre 4.14.266-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / css_2400_system / hrt / var.h
1 #ifndef ISP2401
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 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 _HRT_VAR_H
17 #define _HRT_VAR_H
18
19 #include "version.h"
20 #include "system_api.h"
21 #include "hive_types.h"
22
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
32
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*
42
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)
46
47 #define hrt_scalar_store(cell, type, var, data) \
48   HRTCAT(hrt_mem_store_,HRT_TYPE_BITS(cell, type))(\
49                cell, \
50                HRTCAT(HIVE_MEM_,var), \
51                HRTCAT(HIVE_ADDR_,var), \
52                (HRT_INT_TYPE(type))(data))
53
54 #define hrt_scalar_load(cell, type, var) \
55   (HRT_HOST_TYPE(type))(HRTCAT4(_hrt_mem_load_,HRT_PROC_TYPE(cell),_,type) ( \
56                cell, \
57                HRTCAT(HIVE_MEM_,var), \
58                HRTCAT(HIVE_ADDR_,var)))
59
60 #define hrt_indexed_store(cell, type, array, index, data) \
61   HRTCAT(hrt_mem_store_,HRT_TYPE_BITS(cell, type))(\
62                cell, \
63                HRTCAT(HIVE_MEM_,array), \
64                (HRTCAT(HIVE_ADDR_,array))+((index)*HRT_TYPE_BYTES(cell, type)), \
65                (HRT_INT_TYPE(type))(data))
66
67 #define hrt_indexed_load(cell, type, array, index) \
68   (HRT_HOST_TYPE(type))(HRTCAT4(_hrt_mem_load_,HRT_PROC_TYPE(cell),_,type) ( \
69          cell, \
70                HRTCAT(HIVE_MEM_,array), \
71                (HRTCAT(HIVE_ADDR_,array))+((index)*HRT_TYPE_BYTES(cell, type))))
72
73 #endif /* _HRT_VAR_H */
74 #endif