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