2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 2015, Intel Corporation.
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.
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
15 #ifndef _css_receiver_2400_common_defs_h_
16 #define _css_receiver_2400_common_defs_h_
17 #ifndef _mipi_backend_common_defs_h_
18 #define _mipi_backend_common_defs_h_
20 #define _HRT_CSS_RECEIVER_2400_GEN_SHORT_DATA_WIDTH 16
21 #define _HRT_CSS_RECEIVER_2400_GEN_SHORT_CH_ID_WIDTH 2
22 #define _HRT_CSS_RECEIVER_2400_GEN_SHORT_FMT_TYPE_WIDTH 3
23 #define _HRT_CSS_RECEIVER_2400_GEN_SHORT_STR_REAL_WIDTH (_HRT_CSS_RECEIVER_2400_GEN_SHORT_DATA_WIDTH + _HRT_CSS_RECEIVER_2400_GEN_SHORT_CH_ID_WIDTH + _HRT_CSS_RECEIVER_2400_GEN_SHORT_FMT_TYPE_WIDTH)
24 #define _HRT_CSS_RECEIVER_2400_GEN_SHORT_STR_WIDTH 32 /* use 32 to be compatibel with streaming monitor !, MSB's of interface are tied to '0' */
26 /* Definition of data format ID at the interface CSS_receiver capture/acquisition units */
27 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_YUV420_8 24 /* 01 1000 YUV420 8-bit */
28 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_YUV420_10 25 /* 01 1001 YUV420 10-bit */
29 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_YUV420_8L 26 /* 01 1010 YUV420 8-bit legacy */
30 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_YUV422_8 30 /* 01 1110 YUV422 8-bit */
31 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_YUV422_10 31 /* 01 1111 YUV422 10-bit */
32 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_RGB444 32 /* 10 0000 RGB444 */
33 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_RGB555 33 /* 10 0001 RGB555 */
34 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_RGB565 34 /* 10 0010 RGB565 */
35 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_RGB666 35 /* 10 0011 RGB666 */
36 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_RGB888 36 /* 10 0100 RGB888 */
37 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_RAW6 40 /* 10 1000 RAW6 */
38 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_RAW7 41 /* 10 1001 RAW7 */
39 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_RAW8 42 /* 10 1010 RAW8 */
40 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_RAW10 43 /* 10 1011 RAW10 */
41 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_RAW12 44 /* 10 1100 RAW12 */
42 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_RAW14 45 /* 10 1101 RAW14 */
43 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_USR_DEF_1 48 /* 11 0000 JPEG [User Defined 8-bit Data Type 1] */
44 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_USR_DEF_2 49 /* 11 0001 User Defined 8-bit Data Type 2 */
45 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_USR_DEF_3 50 /* 11 0010 User Defined 8-bit Data Type 3 */
46 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_USR_DEF_4 51 /* 11 0011 User Defined 8-bit Data Type 4 */
47 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_USR_DEF_5 52 /* 11 0100 User Defined 8-bit Data Type 5 */
48 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_USR_DEF_6 53 /* 11 0101 User Defined 8-bit Data Type 6 */
49 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_USR_DEF_7 54 /* 11 0110 User Defined 8-bit Data Type 7 */
50 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_USR_DEF_8 55 /* 11 0111 User Defined 8-bit Data Type 8 */
51 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_Emb 18 /* 01 0010 embedded eight bit non image data */
52 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_SOF 0 /* 00 0000 frame start */
53 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_EOF 1 /* 00 0001 frame end */
54 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_SOL 2 /* 00 0010 line start */
55 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_EOL 3 /* 00 0011 line end */
56 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_GEN_SH1 8 /* 00 1000 Generic Short Packet Code 1 */
57 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_GEN_SH2 9 /* 00 1001 Generic Short Packet Code 2 */
58 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_GEN_SH3 10 /* 00 1010 Generic Short Packet Code 3 */
59 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_GEN_SH4 11 /* 00 1011 Generic Short Packet Code 4 */
60 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_GEN_SH5 12 /* 00 1100 Generic Short Packet Code 5 */
61 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_GEN_SH6 13 /* 00 1101 Generic Short Packet Code 6 */
62 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_GEN_SH7 14 /* 00 1110 Generic Short Packet Code 7 */
63 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_GEN_SH8 15 /* 00 1111 Generic Short Packet Code 8 */
64 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_YUV420_8_CSPS 28 /* 01 1100 YUV420 8-bit (Chroma Shifted Pixel Sampling) */
65 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_YUV420_10_CSPS 29 /* 01 1101 YUV420 10-bit (Chroma Shifted Pixel Sampling) */
66 /* used reserved mipi positions for these */
67 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_RAW16 46
68 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_RAW18 47
69 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_RAW18_2 37
70 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_RAW18_3 38
72 //_HRT_CSS_RECEIVER_2400_FMT_TYPE_CUSTOM 63
73 #define _HRT_MIPI_BACKEND_FMT_TYPE_CUSTOM 63
75 #define _HRT_CSS_RECEIVER_2400_DATA_FORMAT_ID_WIDTH 6
77 /* Definition of format_types at the interface CSS --> input_selector*/
78 /* !! Changes here should be copied to systems/isp/isp_css/bin/conv_transmitter_cmd.tcl !! */
79 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_RGB888 0 // 36 'h24
80 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_RGB555 1 // 33 'h
81 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_RGB444 2 // 32
82 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_RGB565 3 // 34
83 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_RGB666 4 // 35
84 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_RAW8 5 // 42
85 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_RAW10 6 // 43
86 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_RAW6 7 // 40
87 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_RAW7 8 // 41
88 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_RAW12 9 // 43
89 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_RAW14 10 // 45
90 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_YUV420_8 11 // 30
91 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_YUV420_10 12 // 25
92 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_YUV422_8 13 // 30
93 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_YUV422_10 14 // 31
94 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_USR_DEF_1 15 // 48
95 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_YUV420_8L 16 // 26
96 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_Emb 17 // 18
97 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_USR_DEF_2 18 // 49
98 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_USR_DEF_3 19 // 50
99 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_USR_DEF_4 20 // 51
100 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_USR_DEF_5 21 // 52
101 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_USR_DEF_6 22 // 53
102 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_USR_DEF_7 23 // 54
103 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_USR_DEF_8 24 // 55
104 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_YUV420_8_CSPS 25 // 28
105 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_YUV420_10_CSPS 26 // 29
106 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_RAW16 27 // ?
107 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_RAW18 28 // ?
108 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_RAW18_2 29 // ? Option 2 for depacketiser
109 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_RAW18_3 30 // ? Option 3 for depacketiser
110 #define _HRT_CSS_RECEIVER_2400_FMT_TYPE_CUSTOM 31 // to signal custom decoding
112 /* definition for state machine of data FIFO for decode different type of data */
113 #define _HRT_CSS_RECEIVER_2400_YUV420_8_REPEAT_PTN 1
114 #define _HRT_CSS_RECEIVER_2400_YUV420_10_REPEAT_PTN 5
115 #define _HRT_CSS_RECEIVER_2400_YUV420_8L_REPEAT_PTN 1
116 #define _HRT_CSS_RECEIVER_2400_YUV422_8_REPEAT_PTN 1
117 #define _HRT_CSS_RECEIVER_2400_YUV422_10_REPEAT_PTN 5
118 #define _HRT_CSS_RECEIVER_2400_RGB444_REPEAT_PTN 2
119 #define _HRT_CSS_RECEIVER_2400_RGB555_REPEAT_PTN 2
120 #define _HRT_CSS_RECEIVER_2400_RGB565_REPEAT_PTN 2
121 #define _HRT_CSS_RECEIVER_2400_RGB666_REPEAT_PTN 9
122 #define _HRT_CSS_RECEIVER_2400_RGB888_REPEAT_PTN 3
123 #define _HRT_CSS_RECEIVER_2400_RAW6_REPEAT_PTN 3
124 #define _HRT_CSS_RECEIVER_2400_RAW7_REPEAT_PTN 7
125 #define _HRT_CSS_RECEIVER_2400_RAW8_REPEAT_PTN 1
126 #define _HRT_CSS_RECEIVER_2400_RAW10_REPEAT_PTN 5
127 #define _HRT_CSS_RECEIVER_2400_RAW12_REPEAT_PTN 3
128 #define _HRT_CSS_RECEIVER_2400_RAW14_REPEAT_PTN 7
130 #define _HRT_CSS_RECEIVER_2400_MAX_REPEAT_PTN _HRT_CSS_RECEIVER_2400_RGB666_REPEAT_PTN
132 #define _HRT_CSS_RECEIVER_2400_BE_COMP_FMT_IDX 0
133 #define _HRT_CSS_RECEIVER_2400_BE_COMP_FMT_WIDTH 3
134 #define _HRT_CSS_RECEIVER_2400_BE_COMP_PRED_IDX 3
135 #define _HRT_CSS_RECEIVER_2400_BE_COMP_PRED_WIDTH 1
136 #define _HRT_CSS_RECEIVER_2400_BE_COMP_USD_BITS 4 /* bits per USD type */
138 #define _HRT_CSS_RECEIVER_2400_BE_RAW16_DATAID_IDX 0
139 #define _HRT_CSS_RECEIVER_2400_BE_RAW16_EN_IDX 6
140 #define _HRT_CSS_RECEIVER_2400_BE_RAW18_DATAID_IDX 0
141 #define _HRT_CSS_RECEIVER_2400_BE_RAW18_OPTION_IDX 6
142 #define _HRT_CSS_RECEIVER_2400_BE_RAW18_EN_IDX 8
144 #define _HRT_CSS_RECEIVER_2400_BE_COMP_NO_COMP 0
145 #define _HRT_CSS_RECEIVER_2400_BE_COMP_10_6_10 1
146 #define _HRT_CSS_RECEIVER_2400_BE_COMP_10_7_10 2
147 #define _HRT_CSS_RECEIVER_2400_BE_COMP_10_8_10 3
148 #define _HRT_CSS_RECEIVER_2400_BE_COMP_12_6_12 4
149 #define _HRT_CSS_RECEIVER_2400_BE_COMP_12_7_12 5
150 #define _HRT_CSS_RECEIVER_2400_BE_COMP_12_8_12 6
152 /* packet bit definition */
153 #define _HRT_CSS_RECEIVER_2400_PKT_SOP_IDX 32
154 #define _HRT_CSS_RECEIVER_2400_PKT_SOP_BITS 1
155 #define _HRT_CSS_RECEIVER_2400_PKT_CH_ID_IDX 22
156 #define _HRT_CSS_RECEIVER_2400_PKT_CH_ID_BITS 2
157 #define _HRT_CSS_RECEIVER_2400_PKT_FMT_ID_IDX 16
158 #define _HRT_CSS_RECEIVER_2400_PKT_FMT_ID_BITS 6
159 #define _HRT_CSS_RECEIVER_2400_PH_DATA_FIELD_IDX 0
160 #define _HRT_CSS_RECEIVER_2400_PH_DATA_FIELD_BITS 16
161 #define _HRT_CSS_RECEIVER_2400_PKT_PAYLOAD_IDX 0
162 #define _HRT_CSS_RECEIVER_2400_PKT_PAYLOAD_BITS 32
164 /*************************************************************************************************/
165 /* Custom Decoding */
166 /* These Custom Defs are defined based on design-time config in "mipi_backend_pixel_formatter.chdl" !! */
167 /*************************************************************************************************/
169 #define BE_CUST_EN_IDX 0 // 2bits
170 #define BE_CUST_EN_DATAID_IDX 2 // 6bits MIPI DATA ID
171 #define BE_CUST_EN_WIDTH 8
172 #define BE_CUST_MODE_ALL 1 // Enable Custom Decoding for all DATA IDs
173 #define BE_CUST_MODE_ONE 3 // Enable Custom Decoding for ONE DATA ID, programmed in CUST_EN_DATA_ID
175 // Data State config = {get_bits(6bits), valid(1bit)} //
176 #define BE_CUST_DATA_STATE_S0_IDX 0 // 7bits
177 #define BE_CUST_DATA_STATE_S1_IDX 8 //7 // 7bits
178 #define BE_CUST_DATA_STATE_S2_IDX 16//14 // 7bits /
179 #define BE_CUST_DATA_STATE_WIDTH 24//21
180 #define BE_CUST_DATA_STATE_VALID_IDX 0 // 1bits
181 #define BE_CUST_DATA_STATE_GETBITS_IDX 1 // 6bits
183 // Pixel Extractor config
184 #define BE_CUST_PIX_EXT_DATA_ALIGN_IDX 0 // 6bits
185 #define BE_CUST_PIX_EXT_PIX_ALIGN_IDX 6//5 // 5bits
186 #define BE_CUST_PIX_EXT_PIX_MASK_IDX 11//10 // 18bits
187 #define BE_CUST_PIX_EXT_PIX_EN_IDX 29 //28 // 1bits
189 #define BE_CUST_PIX_EXT_WIDTH 30//29
191 // Pixel Valid & EoP config = {[eop,valid](especial), [eop,valid](normal)}
192 #define BE_CUST_PIX_VALID_EOP_P0_IDX 0 // 4bits
193 #define BE_CUST_PIX_VALID_EOP_P1_IDX 4 // 4bits
194 #define BE_CUST_PIX_VALID_EOP_P2_IDX 8 // 4bits
195 #define BE_CUST_PIX_VALID_EOP_P3_IDX 12 // 4bits
196 #define BE_CUST_PIX_VALID_EOP_WIDTH 16
197 #define BE_CUST_PIX_VALID_EOP_NOR_VALID_IDX 0 // Normal (NO less get_bits case) Valid - 1bits
198 #define BE_CUST_PIX_VALID_EOP_NOR_EOP_IDX 1 // Normal (NO less get_bits case) EoP - 1bits
199 #define BE_CUST_PIX_VALID_EOP_ESP_VALID_IDX 2 // Especial (less get_bits case) Valid - 1bits
200 #define BE_CUST_PIX_VALID_EOP_ESP_EOP_IDX 3 // Especial (less get_bits case) EoP - 1bits
204 #endif /* _mipi_backend_common_defs_h_ */
205 #endif /* _css_receiver_2400_common_defs_h_ */