xref: /linux/drivers/staging/media/atomisp/pci/hive_types.h (revision 3503d56cc7233ced602e38a4c13caa64f00ab2aa)
1 /* SPDX-License-Identifier: GPL-2.0 */
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_HIVE_TYPES_H
17 #define _HRT_HIVE_TYPES_H
18 
19 #include "version.h"
20 #include "defs.h"
21 
22 #ifndef HRTCAT3
23 #define _HRTCAT3(m, n, o)     m##n##o
24 #define HRTCAT3(m, n, o)      _HRTCAT3(m, n, o)
25 #endif
26 
27 #ifndef HRTCAT4
28 #define _HRTCAT4(m, n, o, p)     m##n##o##p
29 #define HRTCAT4(m, n, o, p)      _HRTCAT4(m, n, o, p)
30 #endif
31 
32 #ifndef HRTMIN
33 #define HRTMIN(a, b) (((a) < (b)) ? (a) : (b))
34 #endif
35 
36 #ifndef HRTMAX
37 #define HRTMAX(a, b) (((a) > (b)) ? (a) : (b))
38 #endif
39 
40 /* boolean data type */
41 typedef unsigned int hive_bool;
42 #define hive_false 0
43 #define hive_true  1
44 
45 typedef char                 hive_int8;
46 typedef short                hive_int16;
47 typedef int                  hive_int32;
48 typedef long long            hive_int64;
49 
50 typedef unsigned char        hive_uint8;
51 typedef unsigned short       hive_uint16;
52 typedef unsigned int         hive_uint32;
53 typedef unsigned long long   hive_uint64;
54 
55 /* by default assume 32 bit master port (both data and address) */
56 #ifndef HRT_DATA_WIDTH
57 #define HRT_DATA_WIDTH 32
58 #endif
59 #ifndef HRT_ADDRESS_WIDTH
60 #define HRT_ADDRESS_WIDTH 32
61 #endif
62 
63 #define HRT_DATA_BYTES    (HRT_DATA_WIDTH / 8)
64 #define HRT_ADDRESS_BYTES (HRT_ADDRESS_WIDTH / 8)
65 
66 #if HRT_DATA_WIDTH == 64
67 typedef hive_uint64 hrt_data;
68 #elif HRT_DATA_WIDTH == 32
69 typedef hive_uint32 hrt_data;
70 #else
71 #error data width not supported
72 #endif
73 
74 #if HRT_ADDRESS_WIDTH == 64
75 typedef hive_uint64 hrt_address;
76 #elif HRT_ADDRESS_WIDTH == 32
77 typedef hive_uint32 hrt_address;
78 #else
79 #error adddres width not supported
80 #endif
81 
82 /* use 64 bit addresses in simulation, where possible */
83 typedef hive_uint64  hive_sim_address;
84 
85 /* below is for csim, not for hrt, rename and move this elsewhere */
86 
87 typedef unsigned int hive_uint;
88 typedef hive_uint32  hive_address;
89 typedef hive_address hive_slave_address;
90 typedef hive_address hive_mem_address;
91 
92 /* MMIO devices */
93 typedef hive_uint    hive_mmio_id;
94 typedef hive_mmio_id hive_slave_id;
95 typedef hive_mmio_id hive_port_id;
96 typedef hive_mmio_id hive_master_id;
97 typedef hive_mmio_id hive_mem_id;
98 typedef hive_mmio_id hive_dev_id;
99 typedef hive_mmio_id hive_fifo_id;
100 
101 typedef hive_uint      hive_hier_id;
102 typedef hive_hier_id   hive_device_id;
103 typedef hive_device_id hive_proc_id;
104 typedef hive_device_id hive_cell_id;
105 typedef hive_device_id hive_host_id;
106 typedef hive_device_id hive_bus_id;
107 typedef hive_device_id hive_bridge_id;
108 typedef hive_device_id hive_fifo_adapter_id;
109 typedef hive_device_id hive_custom_device_id;
110 
111 typedef hive_uint hive_slot_id;
112 typedef hive_uint hive_fu_id;
113 typedef hive_uint hive_reg_file_id;
114 typedef hive_uint hive_reg_id;
115 
116 /* Streaming devices */
117 typedef hive_uint hive_outport_id;
118 typedef hive_uint hive_inport_id;
119 
120 typedef hive_uint hive_msink_id;
121 
122 /* HRT specific */
123 typedef char *hive_program;
124 typedef char *hive_function;
125 
126 #endif /* _HRT_HIVE_TYPES_H */
127