|
43 | 43 | /** \defgroup util_crc <util/crc16.h>: CRC Computations
|
44 | 44 | \code#include <util/crc16.h>\endcode
|
45 | 45 |
|
46 |
| - This header file provides a optimized inline functions for calculating |
| 46 | + This header file provides optimized inline functions for calculating |
47 | 47 | cyclic redundancy checks (CRC) using common polynomials.
|
48 | 48 |
|
49 |
| - \par References: |
50 |
| -
|
51 |
| - \par |
52 |
| -
|
53 |
| - See the Dallas Semiconductor app note 27 for 8051 assembler example and |
54 |
| - general CRC optimization suggestions. The table on the last page of the |
55 |
| - app note is the key to understanding these implementations. |
56 |
| -
|
57 |
| - \par |
58 |
| -
|
59 |
| - Jack Crenshaw's "Implementing CRCs" article in the January 1992 issue of \e |
60 |
| - Embedded \e Systems \e Programming. This may be difficult to find, but it |
61 |
| - explains CRC's in very clear and concise terms. Well worth the effort to |
62 |
| - obtain a copy. |
63 |
| -
|
64 | 49 | A typical application would look like:
|
65 | 50 |
|
66 | 51 | \code
|
|
78 | 63 | return crc; // must be 0
|
79 | 64 | }
|
80 | 65 | \endcode
|
| 66 | +
|
| 67 | + \par References: |
| 68 | + See the Dallas Semiconductor app note 27 for 8051 assembler example and |
| 69 | + general CRC optimization suggestions. The table on the last page of the |
| 70 | + app note is the key to understanding these implementations. |
| 71 | + \par |
| 72 | + Jack Crenshaw's "Implementing CRCs" article in the January 1992 issue of \e |
| 73 | + Embedded \e Systems \e Programming. This may be difficult to find, but it |
| 74 | + explains CRC's in very clear and concise terms. Well worth the effort to |
| 75 | + obtain a copy. |
81 | 76 | */
|
82 | 77 |
|
83 | 78 | /** \ingroup util_crc
|
|
91 | 86 | The following is the equivalent functionality written in C.
|
92 | 87 |
|
93 | 88 | \code
|
94 |
| - uint16_t |
95 |
| - crc16_update (uint16_t crc, uint8_t a) |
| 89 | + static inline uint16_t |
| 90 | + _crc16_update (uint16_t crc, uint8_t a) |
96 | 91 | {
|
97 | 92 | crc ^= a;
|
98 | 93 | for (int i = 0; i < 8; ++i)
|
@@ -155,8 +150,8 @@ _crc16_update(uint16_t __crc, uint8_t __data)
|
155 | 150 | The following is the equivalent functionality written in C.
|
156 | 151 |
|
157 | 152 | \code
|
158 |
| - uint16_t |
159 |
| - crc_xmodem_update (uint16_t crc, uint8_t data) |
| 153 | + static inline uint16_t |
| 154 | + _crc_xmodem_update (uint16_t crc, uint8_t data) |
160 | 155 | {
|
161 | 156 | crc = crc ^ ((uint16_t)data << 8);
|
162 | 157 | for (int i = 0; i < 8; i++)
|
@@ -223,8 +218,8 @@ _crc_xmodem_update (uint16_t __crc, uint8_t __data)
|
223 | 218 | The following is the equivalent functionality written in C.
|
224 | 219 |
|
225 | 220 | \code
|
226 |
| - uint16_t |
227 |
| - crc_ccitt_update (uint16_t crc, uint8_t data) |
| 221 | + static inline uint16_t |
| 222 | + _crc_ccitt_update (uint16_t crc, uint8_t data) |
228 | 223 | {
|
229 | 224 | data ^= lo8 (crc);
|
230 | 225 | data ^= data << 4;
|
@@ -282,7 +277,7 @@ _crc_ccitt_update (uint16_t __crc, uint8_t __data)
|
282 | 277 | The following is the equivalent functionality written in C.
|
283 | 278 |
|
284 | 279 | \code
|
285 |
| - uint8_t |
| 280 | + static inline uint8_t |
286 | 281 | _crc_ibutton_update (uint8_t crc, uint8_t data)
|
287 | 282 | {
|
288 | 283 | crc = crc ^ data;
|
@@ -335,12 +330,12 @@ _crc_ibutton_update (uint8_t __crc, uint8_t __data)
|
335 | 330 | Reference: http://www.itu.int/rec/T-REC-I.432.1-199902-I/en
|
336 | 331 |
|
337 | 332 | The C equivalent has been originally written by Dave Hylands.
|
338 |
| - Assembly code is based on _crc_ibutton_update optimization. |
| 333 | + Assembly code is based on \c _crc_ibutton_update optimization. |
339 | 334 |
|
340 | 335 | The following is the equivalent functionality written in C.
|
341 | 336 |
|
342 | 337 | \code
|
343 |
| - uint8_t |
| 338 | + static inline uint8_t |
344 | 339 | _crc8_ccitt_update (uint8_t inCrc, uint8_t inData)
|
345 | 340 | {
|
346 | 341 | uint8_t data = inCrc ^ inData;
|
|
0 commit comments