1 /*
2 Copyright (c) 2018, MIPI Alliance, Inc.
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions
7 are met:
8 
9 * Redistributions of source code must retain the above copyright
10   notice, this list of conditions and the following disclaimer.
11 
12 * Redistributions in binary form must reproduce the above copyright
13   notice, this list of conditions and the following disclaimer in
14   the documentation and/or other materials provided with the
15   distribution.
16 
17 * Neither the name of the copyright holder nor the names of its
18   contributors may be used to endorse or promote products derived
19   from this software without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33 
34 /*
35  * Contributors:
36  * Norbert Schulz (Intel Corporation) - Initial API and implementation
37  */
38 
39 #include "mipi_syst.h"
40 
41 #if defined(MIPI_SYST_PCFG_ENABLE_CHECKSUM) && !defined(MIPI_SYST_CRC_INTRINSIC)
42 
43 /*
44  * Pre-computed CRC-C values for all 8-bit values using
45  * polynomial 0x1EDC6F41 (Castagnoli).
46  */
47 
48 const mipi_syst_u32 mipi_syst_crc_table[256] = {
49 	0x00000000,
50 	0xF26B8303,
51 	0xE13B70F7,
52 	0x1350F3F4,
53 	0xC79A971F,
54 	0x35F1141C,
55 	0x26A1E7E8,
56 	0xD4CA64EB,
57 	0x8AD958CF,
58 	0x78B2DBCC,
59 	0x6BE22838,
60 	0x9989AB3B,
61 	0x4D43CFD0,
62 	0xBF284CD3,
63 	0xAC78BF27,
64 	0x5E133C24,
65 	0x105EC76F,
66 	0xE235446C,
67 	0xF165B798,
68 	0x030E349B,
69 	0xD7C45070,
70 	0x25AFD373,
71 	0x36FF2087,
72 	0xC494A384,
73 	0x9A879FA0,
74 	0x68EC1CA3,
75 	0x7BBCEF57,
76 	0x89D76C54,
77 	0x5D1D08BF,
78 	0xAF768BBC,
79 	0xBC267848,
80 	0x4E4DFB4B,
81 	0x20BD8EDE,
82 	0xD2D60DDD,
83 	0xC186FE29,
84 	0x33ED7D2A,
85 	0xE72719C1,
86 	0x154C9AC2,
87 	0x061C6936,
88 	0xF477EA35,
89 	0xAA64D611,
90 	0x580F5512,
91 	0x4B5FA6E6,
92 	0xB93425E5,
93 	0x6DFE410E,
94 	0x9F95C20D,
95 	0x8CC531F9,
96 	0x7EAEB2FA,
97 	0x30E349B1,
98 	0xC288CAB2,
99 	0xD1D83946,
100 	0x23B3BA45,
101 	0xF779DEAE,
102 	0x05125DAD,
103 	0x1642AE59,
104 	0xE4292D5A,
105 	0xBA3A117E,
106 	0x4851927D,
107 	0x5B016189,
108 	0xA96AE28A,
109 	0x7DA08661,
110 	0x8FCB0562,
111 	0x9C9BF696,
112 	0x6EF07595,
113 	0x417B1DBC,
114 	0xB3109EBF,
115 	0xA0406D4B,
116 	0x522BEE48,
117 	0x86E18AA3,
118 	0x748A09A0,
119 	0x67DAFA54,
120 	0x95B17957,
121 	0xCBA24573,
122 	0x39C9C670,
123 	0x2A993584,
124 	0xD8F2B687,
125 	0x0C38D26C,
126 	0xFE53516F,
127 	0xED03A29B,
128 	0x1F682198,
129 	0x5125DAD3,
130 	0xA34E59D0,
131 	0xB01EAA24,
132 	0x42752927,
133 	0x96BF4DCC,
134 	0x64D4CECF,
135 	0x77843D3B,
136 	0x85EFBE38,
137 	0xDBFC821C,
138 	0x2997011F,
139 	0x3AC7F2EB,
140 	0xC8AC71E8,
141 	0x1C661503,
142 	0xEE0D9600,
143 	0xFD5D65F4,
144 	0x0F36E6F7,
145 	0x61C69362,
146 	0x93AD1061,
147 	0x80FDE395,
148 	0x72966096,
149 	0xA65C047D,
150 	0x5437877E,
151 	0x4767748A,
152 	0xB50CF789,
153 	0xEB1FCBAD,
154 	0x197448AE,
155 	0x0A24BB5A,
156 	0xF84F3859,
157 	0x2C855CB2,
158 	0xDEEEDFB1,
159 	0xCDBE2C45,
160 	0x3FD5AF46,
161 	0x7198540D,
162 	0x83F3D70E,
163 	0x90A324FA,
164 	0x62C8A7F9,
165 	0xB602C312,
166 	0x44694011,
167 	0x5739B3E5,
168 	0xA55230E6,
169 	0xFB410CC2,
170 	0x092A8FC1,
171 	0x1A7A7C35,
172 	0xE811FF36,
173 	0x3CDB9BDD,
174 	0xCEB018DE,
175 	0xDDE0EB2A,
176 	0x2F8B6829,
177 	0x82F63B78,
178 	0x709DB87B,
179 	0x63CD4B8F,
180 	0x91A6C88C,
181 	0x456CAC67,
182 	0xB7072F64,
183 	0xA457DC90,
184 	0x563C5F93,
185 	0x082F63B7,
186 	0xFA44E0B4,
187 	0xE9141340,
188 	0x1B7F9043,
189 	0xCFB5F4A8,
190 	0x3DDE77AB,
191 	0x2E8E845F,
192 	0xDCE5075C,
193 	0x92A8FC17,
194 	0x60C37F14,
195 	0x73938CE0,
196 	0x81F80FE3,
197 	0x55326B08,
198 	0xA759E80B,
199 	0xB4091BFF,
200 	0x466298FC,
201 	0x1871A4D8,
202 	0xEA1A27DB,
203 	0xF94AD42F,
204 	0x0B21572C,
205 	0xDFEB33C7,
206 	0x2D80B0C4,
207 	0x3ED04330,
208 	0xCCBBC033,
209 	0xA24BB5A6,
210 	0x502036A5,
211 	0x4370C551,
212 	0xB11B4652,
213 	0x65D122B9,
214 	0x97BAA1BA,
215 	0x84EA524E,
216 	0x7681D14D,
217 	0x2892ED69,
218 	0xDAF96E6A,
219 	0xC9A99D9E,
220 	0x3BC21E9D,
221 	0xEF087A76,
222 	0x1D63F975,
223 	0x0E330A81,
224 	0xFC588982,
225 	0xB21572C9,
226 	0x407EF1CA,
227 	0x532E023E,
228 	0xA145813D,
229 	0x758FE5D6,
230 	0x87E466D5,
231 	0x94B49521,
232 	0x66DF1622,
233 	0x38CC2A06,
234 	0xCAA7A905,
235 	0xD9F75AF1,
236 	0x2B9CD9F2,
237 	0xFF56BD19,
238 	0x0D3D3E1A,
239 	0x1E6DCDEE,
240 	0xEC064EED,
241 	0xC38D26C4,
242 	0x31E6A5C7,
243 	0x22B65633,
244 	0xD0DDD530,
245 	0x0417B1DB,
246 	0xF67C32D8,
247 	0xE52CC12C,
248 	0x1747422F,
249 	0x49547E0B,
250 	0xBB3FFD08,
251 	0xA86F0EFC,
252 	0x5A048DFF,
253 	0x8ECEE914,
254 	0x7CA56A17,
255 	0x6FF599E3,
256 	0x9D9E1AE0,
257 	0xD3D3E1AB,
258 	0x21B862A8,
259 	0x32E8915C,
260 	0xC083125F,
261 	0x144976B4,
262 	0xE622F5B7,
263 	0xF5720643,
264 	0x07198540,
265 	0x590AB964,
266 	0xAB613A67,
267 	0xB831C993,
268 	0x4A5A4A90,
269 	0x9E902E7B,
270 	0x6CFBAD78,
271 	0x7FAB5E8C,
272 	0x8DC0DD8F,
273 	0xE330A81A,
274 	0x115B2B19,
275 	0x020BD8ED,
276 	0xF0605BEE,
277 	0x24AA3F05,
278 	0xD6C1BC06,
279 	0xC5914FF2,
280 	0x37FACCF1,
281 	0x69E9F0D5,
282 	0x9B8273D6,
283 	0x88D28022,
284 	0x7AB90321,
285 	0xAE7367CA,
286 	0x5C18E4C9,
287 	0x4F48173D,
288 	0xBD23943E,
289 	0xF36E6F75,
290 	0x0105EC76,
291 	0x12551F82,
292 	0xE03E9C81,
293 	0x34F4F86A,
294 	0xC69F7B69,
295 	0xD5CF889D,
296 	0x27A40B9E,
297 	0x79B737BA,
298 	0x8BDCB4B9,
299 	0x988C474D,
300 	0x6AE7C44E,
301 	0xBE2DA0A5,
302 	0x4C4623A6,
303 	0x5F16D052,
304 	0xAD7D5351
305 };
306 
307 
308 #if !defined(MIPI_SYST_PCFG_ENABLE_INLINE)
309 #define MIPI_SYST_PCFG_ENABLE_INLINE
310 #include "mipi_syst/crc32.h"
311 #endif
312 
313 #endif	/*  defined(MIPI_SYST_PCFG_ENABLE_CHECKSUM) && !defined(MIPI_SYST_CRC_INTRINSIC)) */