xref: /freebsd/sys/contrib/ncsw/Peripherals/FM/Pcd/crc64.h (revision c2c014f24c10f90d85126ac5fbd4d8524de32b1c)
1*852ba100SJustin Hibbits /*
2*852ba100SJustin Hibbits  * Copyright 2008-2012 Freescale Semiconductor Inc.
3*852ba100SJustin Hibbits  *
4*852ba100SJustin Hibbits  * Redistribution and use in source and binary forms, with or without
5*852ba100SJustin Hibbits  * modification, are permitted provided that the following conditions are met:
6*852ba100SJustin Hibbits  *     * Redistributions of source code must retain the above copyright
7*852ba100SJustin Hibbits  *       notice, this list of conditions and the following disclaimer.
8*852ba100SJustin Hibbits  *     * Redistributions in binary form must reproduce the above copyright
9*852ba100SJustin Hibbits  *       notice, this list of conditions and the following disclaimer in the
10*852ba100SJustin Hibbits  *       documentation and/or other materials provided with the distribution.
11*852ba100SJustin Hibbits  *     * Neither the name of Freescale Semiconductor nor the
12*852ba100SJustin Hibbits  *       names of its contributors may be used to endorse or promote products
13*852ba100SJustin Hibbits  *       derived from this software without specific prior written permission.
14*852ba100SJustin Hibbits  *
15*852ba100SJustin Hibbits  *
16*852ba100SJustin Hibbits  * ALTERNATIVELY, this software may be distributed under the terms of the
17*852ba100SJustin Hibbits  * GNU General Public License ("GPL") as published by the Free Software
18*852ba100SJustin Hibbits  * Foundation, either version 2 of that License or (at your option) any
19*852ba100SJustin Hibbits  * later version.
20*852ba100SJustin Hibbits  *
21*852ba100SJustin Hibbits  * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
22*852ba100SJustin Hibbits  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23*852ba100SJustin Hibbits  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24*852ba100SJustin Hibbits  * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
25*852ba100SJustin Hibbits  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26*852ba100SJustin Hibbits  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27*852ba100SJustin Hibbits  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28*852ba100SJustin Hibbits  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29*852ba100SJustin Hibbits  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30*852ba100SJustin Hibbits  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31*852ba100SJustin Hibbits  */
32*852ba100SJustin Hibbits 
33*852ba100SJustin Hibbits 
34*852ba100SJustin Hibbits  /**************************************************************************//**
35*852ba100SJustin Hibbits  @File          crc64.h
36*852ba100SJustin Hibbits 
37*852ba100SJustin Hibbits  @Description   brief This file contains the CRC64 Table, and __inline__
38*852ba100SJustin Hibbits                 functions used for calculating crc.
39*852ba100SJustin Hibbits *//***************************************************************************/
40*852ba100SJustin Hibbits #ifndef __CRC64_H
41*852ba100SJustin Hibbits #define __CRC64_H
42*852ba100SJustin Hibbits 
43*852ba100SJustin Hibbits #include "std_ext.h"
44*852ba100SJustin Hibbits 
45*852ba100SJustin Hibbits 
46*852ba100SJustin Hibbits #define BITS_PER_BYTE                   8
47*852ba100SJustin Hibbits 
48*852ba100SJustin Hibbits #define CRC64_EXPON_ECMA_182            0xC96C5795D7870F42ULL
49*852ba100SJustin Hibbits #define CRC64_DEFAULT_INITVAL           0xFFFFFFFFFFFFFFFFULL
50*852ba100SJustin Hibbits 
51*852ba100SJustin Hibbits #define CRC64_BYTE_MASK                 0xFF
52*852ba100SJustin Hibbits #define CRC64_TABLE_ENTRIES             ( 1 << BITS_PER_BYTE )
53*852ba100SJustin Hibbits #define CRC64_ODD_MASK                  1
54*852ba100SJustin Hibbits 
55*852ba100SJustin Hibbits 
56*852ba100SJustin Hibbits /**
57*852ba100SJustin Hibbits  \brief '64 bit crc' Table
58*852ba100SJustin Hibbits  */
59*852ba100SJustin Hibbits struct crc64_t {
60*852ba100SJustin Hibbits     uint64_t initial;                       /**< Initial seed */
61*852ba100SJustin Hibbits     uint64_t table[CRC64_TABLE_ENTRIES];    /**< CRC table entries */
62*852ba100SJustin Hibbits };
63*852ba100SJustin Hibbits 
64*852ba100SJustin Hibbits 
65*852ba100SJustin Hibbits static struct crc64_t CRC64_ECMA_182 = {
66*852ba100SJustin Hibbits     CRC64_DEFAULT_INITVAL,
67*852ba100SJustin Hibbits     {
68*852ba100SJustin Hibbits         0x0000000000000000ULL,
69*852ba100SJustin Hibbits         0xb32e4cbe03a75f6fULL,
70*852ba100SJustin Hibbits         0xf4843657a840a05bULL,
71*852ba100SJustin Hibbits         0x47aa7ae9abe7ff34ULL,
72*852ba100SJustin Hibbits         0x7bd0c384ff8f5e33ULL,
73*852ba100SJustin Hibbits         0xc8fe8f3afc28015cULL,
74*852ba100SJustin Hibbits         0x8f54f5d357cffe68ULL,
75*852ba100SJustin Hibbits         0x3c7ab96d5468a107ULL,
76*852ba100SJustin Hibbits         0xf7a18709ff1ebc66ULL,
77*852ba100SJustin Hibbits         0x448fcbb7fcb9e309ULL,
78*852ba100SJustin Hibbits         0x0325b15e575e1c3dULL,
79*852ba100SJustin Hibbits         0xb00bfde054f94352ULL,
80*852ba100SJustin Hibbits         0x8c71448d0091e255ULL,
81*852ba100SJustin Hibbits         0x3f5f08330336bd3aULL,
82*852ba100SJustin Hibbits         0x78f572daa8d1420eULL,
83*852ba100SJustin Hibbits         0xcbdb3e64ab761d61ULL,
84*852ba100SJustin Hibbits         0x7d9ba13851336649ULL,
85*852ba100SJustin Hibbits         0xceb5ed8652943926ULL,
86*852ba100SJustin Hibbits         0x891f976ff973c612ULL,
87*852ba100SJustin Hibbits         0x3a31dbd1fad4997dULL,
88*852ba100SJustin Hibbits         0x064b62bcaebc387aULL,
89*852ba100SJustin Hibbits         0xb5652e02ad1b6715ULL,
90*852ba100SJustin Hibbits         0xf2cf54eb06fc9821ULL,
91*852ba100SJustin Hibbits         0x41e11855055bc74eULL,
92*852ba100SJustin Hibbits         0x8a3a2631ae2dda2fULL,
93*852ba100SJustin Hibbits         0x39146a8fad8a8540ULL,
94*852ba100SJustin Hibbits         0x7ebe1066066d7a74ULL,
95*852ba100SJustin Hibbits         0xcd905cd805ca251bULL,
96*852ba100SJustin Hibbits         0xf1eae5b551a2841cULL,
97*852ba100SJustin Hibbits         0x42c4a90b5205db73ULL,
98*852ba100SJustin Hibbits         0x056ed3e2f9e22447ULL,
99*852ba100SJustin Hibbits         0xb6409f5cfa457b28ULL,
100*852ba100SJustin Hibbits         0xfb374270a266cc92ULL,
101*852ba100SJustin Hibbits         0x48190ecea1c193fdULL,
102*852ba100SJustin Hibbits         0x0fb374270a266cc9ULL,
103*852ba100SJustin Hibbits         0xbc9d3899098133a6ULL,
104*852ba100SJustin Hibbits         0x80e781f45de992a1ULL,
105*852ba100SJustin Hibbits         0x33c9cd4a5e4ecdceULL,
106*852ba100SJustin Hibbits         0x7463b7a3f5a932faULL,
107*852ba100SJustin Hibbits         0xc74dfb1df60e6d95ULL,
108*852ba100SJustin Hibbits         0x0c96c5795d7870f4ULL,
109*852ba100SJustin Hibbits         0xbfb889c75edf2f9bULL,
110*852ba100SJustin Hibbits         0xf812f32ef538d0afULL,
111*852ba100SJustin Hibbits         0x4b3cbf90f69f8fc0ULL,
112*852ba100SJustin Hibbits         0x774606fda2f72ec7ULL,
113*852ba100SJustin Hibbits         0xc4684a43a15071a8ULL,
114*852ba100SJustin Hibbits         0x83c230aa0ab78e9cULL,
115*852ba100SJustin Hibbits         0x30ec7c140910d1f3ULL,
116*852ba100SJustin Hibbits         0x86ace348f355aadbULL,
117*852ba100SJustin Hibbits         0x3582aff6f0f2f5b4ULL,
118*852ba100SJustin Hibbits         0x7228d51f5b150a80ULL,
119*852ba100SJustin Hibbits         0xc10699a158b255efULL,
120*852ba100SJustin Hibbits         0xfd7c20cc0cdaf4e8ULL,
121*852ba100SJustin Hibbits         0x4e526c720f7dab87ULL,
122*852ba100SJustin Hibbits         0x09f8169ba49a54b3ULL,
123*852ba100SJustin Hibbits         0xbad65a25a73d0bdcULL,
124*852ba100SJustin Hibbits         0x710d64410c4b16bdULL,
125*852ba100SJustin Hibbits         0xc22328ff0fec49d2ULL,
126*852ba100SJustin Hibbits         0x85895216a40bb6e6ULL,
127*852ba100SJustin Hibbits         0x36a71ea8a7ace989ULL,
128*852ba100SJustin Hibbits         0x0adda7c5f3c4488eULL,
129*852ba100SJustin Hibbits         0xb9f3eb7bf06317e1ULL,
130*852ba100SJustin Hibbits         0xfe5991925b84e8d5ULL,
131*852ba100SJustin Hibbits         0x4d77dd2c5823b7baULL,
132*852ba100SJustin Hibbits         0x64b62bcaebc387a1ULL,
133*852ba100SJustin Hibbits         0xd7986774e864d8ceULL,
134*852ba100SJustin Hibbits         0x90321d9d438327faULL,
135*852ba100SJustin Hibbits         0x231c512340247895ULL,
136*852ba100SJustin Hibbits         0x1f66e84e144cd992ULL,
137*852ba100SJustin Hibbits         0xac48a4f017eb86fdULL,
138*852ba100SJustin Hibbits         0xebe2de19bc0c79c9ULL,
139*852ba100SJustin Hibbits         0x58cc92a7bfab26a6ULL,
140*852ba100SJustin Hibbits         0x9317acc314dd3bc7ULL,
141*852ba100SJustin Hibbits         0x2039e07d177a64a8ULL,
142*852ba100SJustin Hibbits         0x67939a94bc9d9b9cULL,
143*852ba100SJustin Hibbits         0xd4bdd62abf3ac4f3ULL,
144*852ba100SJustin Hibbits         0xe8c76f47eb5265f4ULL,
145*852ba100SJustin Hibbits         0x5be923f9e8f53a9bULL,
146*852ba100SJustin Hibbits         0x1c4359104312c5afULL,
147*852ba100SJustin Hibbits         0xaf6d15ae40b59ac0ULL,
148*852ba100SJustin Hibbits         0x192d8af2baf0e1e8ULL,
149*852ba100SJustin Hibbits         0xaa03c64cb957be87ULL,
150*852ba100SJustin Hibbits         0xeda9bca512b041b3ULL,
151*852ba100SJustin Hibbits         0x5e87f01b11171edcULL,
152*852ba100SJustin Hibbits         0x62fd4976457fbfdbULL,
153*852ba100SJustin Hibbits         0xd1d305c846d8e0b4ULL,
154*852ba100SJustin Hibbits         0x96797f21ed3f1f80ULL,
155*852ba100SJustin Hibbits         0x2557339fee9840efULL,
156*852ba100SJustin Hibbits         0xee8c0dfb45ee5d8eULL,
157*852ba100SJustin Hibbits         0x5da24145464902e1ULL,
158*852ba100SJustin Hibbits         0x1a083bacedaefdd5ULL,
159*852ba100SJustin Hibbits         0xa9267712ee09a2baULL,
160*852ba100SJustin Hibbits         0x955cce7fba6103bdULL,
161*852ba100SJustin Hibbits         0x267282c1b9c65cd2ULL,
162*852ba100SJustin Hibbits         0x61d8f8281221a3e6ULL,
163*852ba100SJustin Hibbits         0xd2f6b4961186fc89ULL,
164*852ba100SJustin Hibbits         0x9f8169ba49a54b33ULL,
165*852ba100SJustin Hibbits         0x2caf25044a02145cULL,
166*852ba100SJustin Hibbits         0x6b055fede1e5eb68ULL,
167*852ba100SJustin Hibbits         0xd82b1353e242b407ULL,
168*852ba100SJustin Hibbits         0xe451aa3eb62a1500ULL,
169*852ba100SJustin Hibbits         0x577fe680b58d4a6fULL,
170*852ba100SJustin Hibbits         0x10d59c691e6ab55bULL,
171*852ba100SJustin Hibbits         0xa3fbd0d71dcdea34ULL,
172*852ba100SJustin Hibbits         0x6820eeb3b6bbf755ULL,
173*852ba100SJustin Hibbits         0xdb0ea20db51ca83aULL,
174*852ba100SJustin Hibbits         0x9ca4d8e41efb570eULL,
175*852ba100SJustin Hibbits         0x2f8a945a1d5c0861ULL,
176*852ba100SJustin Hibbits         0x13f02d374934a966ULL,
177*852ba100SJustin Hibbits         0xa0de61894a93f609ULL,
178*852ba100SJustin Hibbits         0xe7741b60e174093dULL,
179*852ba100SJustin Hibbits         0x545a57dee2d35652ULL,
180*852ba100SJustin Hibbits         0xe21ac88218962d7aULL,
181*852ba100SJustin Hibbits         0x5134843c1b317215ULL,
182*852ba100SJustin Hibbits         0x169efed5b0d68d21ULL,
183*852ba100SJustin Hibbits         0xa5b0b26bb371d24eULL,
184*852ba100SJustin Hibbits         0x99ca0b06e7197349ULL,
185*852ba100SJustin Hibbits         0x2ae447b8e4be2c26ULL,
186*852ba100SJustin Hibbits         0x6d4e3d514f59d312ULL,
187*852ba100SJustin Hibbits         0xde6071ef4cfe8c7dULL,
188*852ba100SJustin Hibbits         0x15bb4f8be788911cULL,
189*852ba100SJustin Hibbits         0xa6950335e42fce73ULL,
190*852ba100SJustin Hibbits         0xe13f79dc4fc83147ULL,
191*852ba100SJustin Hibbits         0x521135624c6f6e28ULL,
192*852ba100SJustin Hibbits         0x6e6b8c0f1807cf2fULL,
193*852ba100SJustin Hibbits         0xdd45c0b11ba09040ULL,
194*852ba100SJustin Hibbits         0x9aefba58b0476f74ULL,
195*852ba100SJustin Hibbits         0x29c1f6e6b3e0301bULL,
196*852ba100SJustin Hibbits         0xc96c5795d7870f42ULL,
197*852ba100SJustin Hibbits         0x7a421b2bd420502dULL,
198*852ba100SJustin Hibbits         0x3de861c27fc7af19ULL,
199*852ba100SJustin Hibbits         0x8ec62d7c7c60f076ULL,
200*852ba100SJustin Hibbits         0xb2bc941128085171ULL,
201*852ba100SJustin Hibbits         0x0192d8af2baf0e1eULL,
202*852ba100SJustin Hibbits         0x4638a2468048f12aULL,
203*852ba100SJustin Hibbits         0xf516eef883efae45ULL,
204*852ba100SJustin Hibbits         0x3ecdd09c2899b324ULL,
205*852ba100SJustin Hibbits         0x8de39c222b3eec4bULL,
206*852ba100SJustin Hibbits         0xca49e6cb80d9137fULL,
207*852ba100SJustin Hibbits         0x7967aa75837e4c10ULL,
208*852ba100SJustin Hibbits         0x451d1318d716ed17ULL,
209*852ba100SJustin Hibbits         0xf6335fa6d4b1b278ULL,
210*852ba100SJustin Hibbits         0xb199254f7f564d4cULL,
211*852ba100SJustin Hibbits         0x02b769f17cf11223ULL,
212*852ba100SJustin Hibbits         0xb4f7f6ad86b4690bULL,
213*852ba100SJustin Hibbits         0x07d9ba1385133664ULL,
214*852ba100SJustin Hibbits         0x4073c0fa2ef4c950ULL,
215*852ba100SJustin Hibbits         0xf35d8c442d53963fULL,
216*852ba100SJustin Hibbits         0xcf273529793b3738ULL,
217*852ba100SJustin Hibbits         0x7c0979977a9c6857ULL,
218*852ba100SJustin Hibbits         0x3ba3037ed17b9763ULL,
219*852ba100SJustin Hibbits         0x888d4fc0d2dcc80cULL,
220*852ba100SJustin Hibbits         0x435671a479aad56dULL,
221*852ba100SJustin Hibbits         0xf0783d1a7a0d8a02ULL,
222*852ba100SJustin Hibbits         0xb7d247f3d1ea7536ULL,
223*852ba100SJustin Hibbits         0x04fc0b4dd24d2a59ULL,
224*852ba100SJustin Hibbits         0x3886b22086258b5eULL,
225*852ba100SJustin Hibbits         0x8ba8fe9e8582d431ULL,
226*852ba100SJustin Hibbits         0xcc0284772e652b05ULL,
227*852ba100SJustin Hibbits         0x7f2cc8c92dc2746aULL,
228*852ba100SJustin Hibbits         0x325b15e575e1c3d0ULL,
229*852ba100SJustin Hibbits         0x8175595b76469cbfULL,
230*852ba100SJustin Hibbits         0xc6df23b2dda1638bULL,
231*852ba100SJustin Hibbits         0x75f16f0cde063ce4ULL,
232*852ba100SJustin Hibbits         0x498bd6618a6e9de3ULL,
233*852ba100SJustin Hibbits         0xfaa59adf89c9c28cULL,
234*852ba100SJustin Hibbits         0xbd0fe036222e3db8ULL,
235*852ba100SJustin Hibbits         0x0e21ac88218962d7ULL,
236*852ba100SJustin Hibbits         0xc5fa92ec8aff7fb6ULL,
237*852ba100SJustin Hibbits         0x76d4de52895820d9ULL,
238*852ba100SJustin Hibbits         0x317ea4bb22bfdfedULL,
239*852ba100SJustin Hibbits         0x8250e80521188082ULL,
240*852ba100SJustin Hibbits         0xbe2a516875702185ULL,
241*852ba100SJustin Hibbits         0x0d041dd676d77eeaULL,
242*852ba100SJustin Hibbits         0x4aae673fdd3081deULL,
243*852ba100SJustin Hibbits         0xf9802b81de97deb1ULL,
244*852ba100SJustin Hibbits         0x4fc0b4dd24d2a599ULL,
245*852ba100SJustin Hibbits         0xfceef8632775faf6ULL,
246*852ba100SJustin Hibbits         0xbb44828a8c9205c2ULL,
247*852ba100SJustin Hibbits         0x086ace348f355aadULL,
248*852ba100SJustin Hibbits         0x34107759db5dfbaaULL,
249*852ba100SJustin Hibbits         0x873e3be7d8faa4c5ULL,
250*852ba100SJustin Hibbits         0xc094410e731d5bf1ULL,
251*852ba100SJustin Hibbits         0x73ba0db070ba049eULL,
252*852ba100SJustin Hibbits         0xb86133d4dbcc19ffULL,
253*852ba100SJustin Hibbits         0x0b4f7f6ad86b4690ULL,
254*852ba100SJustin Hibbits         0x4ce50583738cb9a4ULL,
255*852ba100SJustin Hibbits         0xffcb493d702be6cbULL,
256*852ba100SJustin Hibbits         0xc3b1f050244347ccULL,
257*852ba100SJustin Hibbits         0x709fbcee27e418a3ULL,
258*852ba100SJustin Hibbits         0x3735c6078c03e797ULL,
259*852ba100SJustin Hibbits         0x841b8ab98fa4b8f8ULL,
260*852ba100SJustin Hibbits         0xadda7c5f3c4488e3ULL,
261*852ba100SJustin Hibbits         0x1ef430e13fe3d78cULL,
262*852ba100SJustin Hibbits         0x595e4a08940428b8ULL,
263*852ba100SJustin Hibbits         0xea7006b697a377d7ULL,
264*852ba100SJustin Hibbits         0xd60abfdbc3cbd6d0ULL,
265*852ba100SJustin Hibbits         0x6524f365c06c89bfULL,
266*852ba100SJustin Hibbits         0x228e898c6b8b768bULL,
267*852ba100SJustin Hibbits         0x91a0c532682c29e4ULL,
268*852ba100SJustin Hibbits         0x5a7bfb56c35a3485ULL,
269*852ba100SJustin Hibbits         0xe955b7e8c0fd6beaULL,
270*852ba100SJustin Hibbits         0xaeffcd016b1a94deULL,
271*852ba100SJustin Hibbits         0x1dd181bf68bdcbb1ULL,
272*852ba100SJustin Hibbits         0x21ab38d23cd56ab6ULL,
273*852ba100SJustin Hibbits         0x9285746c3f7235d9ULL,
274*852ba100SJustin Hibbits         0xd52f0e859495caedULL,
275*852ba100SJustin Hibbits         0x6601423b97329582ULL,
276*852ba100SJustin Hibbits         0xd041dd676d77eeaaULL,
277*852ba100SJustin Hibbits         0x636f91d96ed0b1c5ULL,
278*852ba100SJustin Hibbits         0x24c5eb30c5374ef1ULL,
279*852ba100SJustin Hibbits         0x97eba78ec690119eULL,
280*852ba100SJustin Hibbits         0xab911ee392f8b099ULL,
281*852ba100SJustin Hibbits         0x18bf525d915feff6ULL,
282*852ba100SJustin Hibbits         0x5f1528b43ab810c2ULL,
283*852ba100SJustin Hibbits         0xec3b640a391f4fadULL,
284*852ba100SJustin Hibbits         0x27e05a6e926952ccULL,
285*852ba100SJustin Hibbits         0x94ce16d091ce0da3ULL,
286*852ba100SJustin Hibbits         0xd3646c393a29f297ULL,
287*852ba100SJustin Hibbits         0x604a2087398eadf8ULL,
288*852ba100SJustin Hibbits         0x5c3099ea6de60cffULL,
289*852ba100SJustin Hibbits         0xef1ed5546e415390ULL,
290*852ba100SJustin Hibbits         0xa8b4afbdc5a6aca4ULL,
291*852ba100SJustin Hibbits         0x1b9ae303c601f3cbULL,
292*852ba100SJustin Hibbits         0x56ed3e2f9e224471ULL,
293*852ba100SJustin Hibbits         0xe5c372919d851b1eULL,
294*852ba100SJustin Hibbits         0xa26908783662e42aULL,
295*852ba100SJustin Hibbits         0x114744c635c5bb45ULL,
296*852ba100SJustin Hibbits         0x2d3dfdab61ad1a42ULL,
297*852ba100SJustin Hibbits         0x9e13b115620a452dULL,
298*852ba100SJustin Hibbits         0xd9b9cbfcc9edba19ULL,
299*852ba100SJustin Hibbits         0x6a978742ca4ae576ULL,
300*852ba100SJustin Hibbits         0xa14cb926613cf817ULL,
301*852ba100SJustin Hibbits         0x1262f598629ba778ULL,
302*852ba100SJustin Hibbits         0x55c88f71c97c584cULL,
303*852ba100SJustin Hibbits         0xe6e6c3cfcadb0723ULL,
304*852ba100SJustin Hibbits         0xda9c7aa29eb3a624ULL,
305*852ba100SJustin Hibbits         0x69b2361c9d14f94bULL,
306*852ba100SJustin Hibbits         0x2e184cf536f3067fULL,
307*852ba100SJustin Hibbits         0x9d36004b35545910ULL,
308*852ba100SJustin Hibbits         0x2b769f17cf112238ULL,
309*852ba100SJustin Hibbits         0x9858d3a9ccb67d57ULL,
310*852ba100SJustin Hibbits         0xdff2a94067518263ULL,
311*852ba100SJustin Hibbits         0x6cdce5fe64f6dd0cULL,
312*852ba100SJustin Hibbits         0x50a65c93309e7c0bULL,
313*852ba100SJustin Hibbits         0xe388102d33392364ULL,
314*852ba100SJustin Hibbits         0xa4226ac498dedc50ULL,
315*852ba100SJustin Hibbits         0x170c267a9b79833fULL,
316*852ba100SJustin Hibbits         0xdcd7181e300f9e5eULL,
317*852ba100SJustin Hibbits         0x6ff954a033a8c131ULL,
318*852ba100SJustin Hibbits         0x28532e49984f3e05ULL,
319*852ba100SJustin Hibbits         0x9b7d62f79be8616aULL,
320*852ba100SJustin Hibbits         0xa707db9acf80c06dULL,
321*852ba100SJustin Hibbits         0x14299724cc279f02ULL,
322*852ba100SJustin Hibbits         0x5383edcd67c06036ULL,
323*852ba100SJustin Hibbits         0xe0ada17364673f59ULL
324*852ba100SJustin Hibbits     }
325*852ba100SJustin Hibbits };
326*852ba100SJustin Hibbits 
327*852ba100SJustin Hibbits 
328*852ba100SJustin Hibbits /**
329*852ba100SJustin Hibbits  \brief Initializes the crc seed
330*852ba100SJustin Hibbits  */
crc64_init(void)331*852ba100SJustin Hibbits static __inline__ uint64_t crc64_init(void)
332*852ba100SJustin Hibbits {
333*852ba100SJustin Hibbits     return CRC64_ECMA_182.initial;
334*852ba100SJustin Hibbits }
335*852ba100SJustin Hibbits 
336*852ba100SJustin Hibbits /**
337*852ba100SJustin Hibbits  \brief Computes 64 bit the crc
338*852ba100SJustin Hibbits  \param[in] data Pointer to the Data in the frame
339*852ba100SJustin Hibbits  \param[in] len Length of the Data
340*852ba100SJustin Hibbits  \param[in] crc seed
341*852ba100SJustin Hibbits  \return calculated crc
342*852ba100SJustin Hibbits  */
crc64_compute(void const * data,uint32_t len,uint64_t seed)343*852ba100SJustin Hibbits static __inline__ uint64_t crc64_compute(void const *data,
344*852ba100SJustin Hibbits                                          uint32_t   len,
345*852ba100SJustin Hibbits                                          uint64_t   seed)
346*852ba100SJustin Hibbits {
347*852ba100SJustin Hibbits     uint32_t i;
348*852ba100SJustin Hibbits     uint64_t crc = seed;
349*852ba100SJustin Hibbits     uint8_t *bdata = (uint8_t *) data;
350*852ba100SJustin Hibbits 
351*852ba100SJustin Hibbits     for (i = 0; i < len; i++)
352*852ba100SJustin Hibbits         crc =
353*852ba100SJustin Hibbits             CRC64_ECMA_182.
354*852ba100SJustin Hibbits             table[(crc ^ *bdata++) & CRC64_BYTE_MASK] ^ (crc >> 8);
355*852ba100SJustin Hibbits 
356*852ba100SJustin Hibbits     return crc;
357*852ba100SJustin Hibbits }
358*852ba100SJustin Hibbits 
359*852ba100SJustin Hibbits 
360*852ba100SJustin Hibbits #endif /* __CRC64_H */
361