annotate Discovery/Inc/crcmodel.h @ 883:7755a476f164 Evo_2_23

Added compile switch for predive check menu: The predive check is still in development and not finalized => added compile switch and deactivated access per default.
author Ideenmodellierer
date Sat, 31 Aug 2024 18:14:40 +0200
parents 45b8f3c2acce
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 /// -*- coding: UTF-8 -*-
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 /// \file Discovery/Inc/crcmodel.h
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief Rocksoft CRC Model Algorithm
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 /// \author Ross Williams (ross@guest.adelaide.edu.au.) and Heinrichs Weikamp
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 /// \date 3 June 1993
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 /// \details
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 /// This is the header (.h) file for the reference
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 /// implementation of the Rocksoft^tm Model CRC Algorithm. For more
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 /// information on the Rocksoft^tm Model CRC Algorithm, see the document
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 /// titled "A Painless Guide to CRC Error Detection Algorithms" by Ross
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 /// Williams (ross@guest.adelaide.edu.au.). This document is likely to be in
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 /// "ftp.adelaide.edu.au/pub/rocksoft".
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 /// Note: Rocksoft is a trademark of Rocksoft Pty Ltd, Adelaide, Australia.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 /// $Id$
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 /// This program is free software: you can redistribute it and/or modify
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 /// it under the terms of the GNU General Public License as published by
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 /// the Free Software Foundation, either version 3 of the License, or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 /// (at your option) any later version.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 /// This program is distributed in the hope that it will be useful,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 /// GNU General Public License for more details.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 /// You should have received a copy of the GNU General Public License
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 //////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 /******************************************************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 /* Start of crcmodel.h */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 /******************************************************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 /* */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 /* Author : Ross Williams (ross@guest.adelaide.edu.au.). */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 /* Date : 3 June 1993. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 /* Status : Public domain. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 /* */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 /* Description : This is the header (.h) file for the reference */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 /* implementation of the Rocksoft^tm Model CRC Algorithm. For more */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 /* information on the Rocksoft^tm Model CRC Algorithm, see the document */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 /* titled "A Painless Guide to CRC Error Detection Algorithms" by Ross */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 /* Williams (ross@guest.adelaide.edu.au.). This document is likely to be in */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 /* "ftp.adelaide.edu.au/pub/rocksoft". */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 /* */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 /* Note: Rocksoft is a trademark of Rocksoft Pty Ltd, Adelaide, Australia. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 /* */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 /******************************************************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 /* */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 /* How to Use This Package */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 /* ----------------------- */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 /* Step 1: Declare a variable of type cm_t. Declare another variable */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 /* (p_cm say) of type p_cm_t and initialize it to point to the first */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 /* variable (e.g. p_cm_t p_cm = &cm_t). */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 /* */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 /* Step 2: Assign values to the parameter fields of the structure. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 /* If you don't know what to assign, see the document cited earlier. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 /* For example: */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 /* p_cm->cm_width = 16; */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 /* p_cm->cm_poly = 0x8005L; */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 /* p_cm->cm_init = 0L; */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 /* p_cm->cm_refin = TRUE; */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 /* p_cm->cm_refot = TRUE; */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 /* p_cm->cm_xorot = 0L; */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 /* Note: Poly is specified without its top bit (18005 becomes 8005). */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 /* Note: Width is one bit less than the raw poly width. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 /* */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 /* Step 3: Initialize the instance with a call cm_ini(p_cm); */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 /* */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 /* Step 4: Process zero or more message bytes by placing zero or more */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 /* successive calls to cm_nxt. Example: cm_nxt(p_cm,ch); */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 /* */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 /* Step 5: Extract the CRC value at any time by calling crc = cm_crc(p_cm); */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 /* If the CRC is a 16-bit value, it will be in the bottom 16 bits. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 /* */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 /******************************************************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 /* */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 /* Design Notes */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 /* ------------ */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 /* PORTABILITY: This package has been coded very conservatively so that */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 /* it will run on as many machines as possible. For example, all external */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 /* identifiers have been restricted to 6 characters and all internal ones to */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 /* 8 characters. The prefix cm (for Crc Model) is used as an attempt to avoid */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 /* namespace collisions. This package is endian independent. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 /* */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 /* EFFICIENCY: This package (and its interface) is not designed for */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 /* speed. The purpose of this package is to act as a well-defined reference */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 /* model for the specification of CRC algorithms. If you want speed, cook up */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 /* a specific table-driven implementation as described in the document cited */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 /* above. This package is designed for validation only; if you have found or */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 /* implemented a CRC algorithm and wish to describe it as a set of parameters */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 /* to the Rocksoft^tm Model CRC Algorithm, your CRC algorithm implementation */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 /* should behave identically to this package under those parameters. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 /* */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 /******************************************************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 #ifndef CRC_MODEL_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 #define CRC_MODEL_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 /******************************************************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 /* The following definitions are extracted from my style header file which */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 /* would be cumbersome to distribute with this package. The DONE_STYLE is the */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 /* idempotence symbol used in my style header file. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 #ifndef DONE_STYLE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114
776
45b8f3c2acce Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents: 38
diff changeset
115 #include <stdbool.h>
45b8f3c2acce Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents: 38
diff changeset
116
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 typedef unsigned long ulong;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 typedef unsigned char * p_ubyte_;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 #ifndef TRUE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 #define FALSE 0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 #define TRUE 1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 /* Change to the second definition if you don't have prototypes. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 #define P_(A) A
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 /* #define P_(A) () */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 /* Uncomment this definition if you don't have void. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 /* typedef int void; */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 /******************************************************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 /* CRC Model Abstract Type */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 /* ----------------------- */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 /* The following type stores the context of an executing instance of the */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 /* model algorithm. Most of the fields are model parameters which must be */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 /* set before the first initializing call to cm_ini. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 int cm_width; /* Parameter: Width in bits [8,32]. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 ulong cm_poly; /* Parameter: The algorithm's polynomial. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 ulong cm_init; /* Parameter: Initial register value. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 bool cm_refin; /* Parameter: Reflect input bytes? */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 bool cm_refot; /* Parameter: Reflect output CRC? */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 ulong cm_xorot; /* Parameter: XOR this to output CRC. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 ulong cm_reg; /* Context: Context during execution. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 } cm_t;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 typedef cm_t *p_cm_t;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 /******************************************************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 /* Functions That Implement The Model */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 /* ---------------------------------- */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 /* The following functions animate the cm_t abstraction. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 void cm_ini P_((p_cm_t p_cm));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 /* Initializes the argument CRC model instance. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 /* All parameter fields must be set before calling this. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 void cm_nxt P_((p_cm_t p_cm,int ch));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 /* Processes a single message byte [0,255]. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 void cm_blk P_((p_cm_t p_cm,p_ubyte_ blk_adr,ulong blk_len));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 /* Processes a block of message bytes. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 ulong cm_crc P_((p_cm_t p_cm));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 /* Returns the CRC value for the message bytes processed so far. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 /******************************************************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 /* Functions For Table Calculation */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 /* ------------------------------- */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 /* The following function can be used to calculate a CRC lookup table. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 /* It can also be used at run-time to create or check static tables. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 ulong cm_tab P_((p_cm_t p_cm,int index));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 /* Returns the i'th entry for the lookup table for the specified algorithm. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 /* The function examines the fields cm_width, cm_poly, cm_refin, and the */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 /* argument table index in the range [0,255] and returns the table entry in */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 /* the bottom cm_width bytes of the return value. */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 /******************************************************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 #endif // CRC_MODEL_H