Update platform drivers
inc/crc8.h@10:b5115cd6b916, 2020-06-17 (annotated)
- Committer:
- EndaKilgarriff
- Date:
- Wed Jun 17 14:54:14 2020 +0000
- Revision:
- 10:b5115cd6b916
- Parent:
- 9:9e247b9c9abf
Roll back delay.cpp to previous version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
EndaKilgarriff | 9:9e247b9c9abf | 1 | /***************************************************************************//** |
EndaKilgarriff | 9:9e247b9c9abf | 2 | * @file crc8.h |
EndaKilgarriff | 9:9e247b9c9abf | 3 | * @brief Header file of CRC-8 computation. |
EndaKilgarriff | 9:9e247b9c9abf | 4 | * @author Darius Berghe (darius.berghe@analog.com) |
EndaKilgarriff | 9:9e247b9c9abf | 5 | ******************************************************************************** |
EndaKilgarriff | 9:9e247b9c9abf | 6 | * Copyright 2020(c) Analog Devices, Inc. |
EndaKilgarriff | 9:9e247b9c9abf | 7 | * |
EndaKilgarriff | 9:9e247b9c9abf | 8 | * All rights reserved. |
EndaKilgarriff | 9:9e247b9c9abf | 9 | * |
EndaKilgarriff | 9:9e247b9c9abf | 10 | * Redistribution and use in source and binary forms, with or without |
EndaKilgarriff | 9:9e247b9c9abf | 11 | * modification, are permitted provided that the following conditions are met: |
EndaKilgarriff | 9:9e247b9c9abf | 12 | * - Redistributions of source code must retain the above copyright |
EndaKilgarriff | 9:9e247b9c9abf | 13 | * notice, this list of conditions and the following disclaimer. |
EndaKilgarriff | 9:9e247b9c9abf | 14 | * - Redistributions in binary form must reproduce the above copyright |
EndaKilgarriff | 9:9e247b9c9abf | 15 | * notice, this list of conditions and the following disclaimer in |
EndaKilgarriff | 9:9e247b9c9abf | 16 | * the documentation and/or other materials provided with the |
EndaKilgarriff | 9:9e247b9c9abf | 17 | * distribution. |
EndaKilgarriff | 9:9e247b9c9abf | 18 | * - Neither the name of Analog Devices, Inc. nor the names of its |
EndaKilgarriff | 9:9e247b9c9abf | 19 | * contributors may be used to endorse or promote products derived |
EndaKilgarriff | 9:9e247b9c9abf | 20 | * from this software without specific prior written permission. |
EndaKilgarriff | 9:9e247b9c9abf | 21 | * - The use of this software may or may not infringe the patent rights |
EndaKilgarriff | 9:9e247b9c9abf | 22 | * of one or more patent holders. This license does not release you |
EndaKilgarriff | 9:9e247b9c9abf | 23 | * from the requirement that you obtain separate licenses from these |
EndaKilgarriff | 9:9e247b9c9abf | 24 | * patent holders to use this software. |
EndaKilgarriff | 9:9e247b9c9abf | 25 | * - Use of the software either in source or binary form, must be run |
EndaKilgarriff | 9:9e247b9c9abf | 26 | * on or directly connected to an Analog Devices Inc. component. |
EndaKilgarriff | 9:9e247b9c9abf | 27 | * |
EndaKilgarriff | 9:9e247b9c9abf | 28 | * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR |
EndaKilgarriff | 9:9e247b9c9abf | 29 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, |
EndaKilgarriff | 9:9e247b9c9abf | 30 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
EndaKilgarriff | 9:9e247b9c9abf | 31 | * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, |
EndaKilgarriff | 9:9e247b9c9abf | 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
EndaKilgarriff | 9:9e247b9c9abf | 33 | * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR |
EndaKilgarriff | 9:9e247b9c9abf | 34 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
EndaKilgarriff | 9:9e247b9c9abf | 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
EndaKilgarriff | 9:9e247b9c9abf | 36 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
EndaKilgarriff | 9:9e247b9c9abf | 37 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
EndaKilgarriff | 9:9e247b9c9abf | 38 | *******************************************************************************/ |
EndaKilgarriff | 9:9e247b9c9abf | 39 | #ifndef __CRC8_H |
EndaKilgarriff | 9:9e247b9c9abf | 40 | #define __CRC8_H |
EndaKilgarriff | 9:9e247b9c9abf | 41 | |
EndaKilgarriff | 9:9e247b9c9abf | 42 | #include <stdint.h> |
EndaKilgarriff | 9:9e247b9c9abf | 43 | #include <stddef.h> |
EndaKilgarriff | 9:9e247b9c9abf | 44 | |
EndaKilgarriff | 9:9e247b9c9abf | 45 | #define CRC8_TABLE_SIZE 256 |
EndaKilgarriff | 9:9e247b9c9abf | 46 | |
EndaKilgarriff | 9:9e247b9c9abf | 47 | #define DECLARE_CRC8_TABLE(_table) \ |
EndaKilgarriff | 9:9e247b9c9abf | 48 | static uint8_t _table[CRC8_TABLE_SIZE] |
EndaKilgarriff | 9:9e247b9c9abf | 49 | |
EndaKilgarriff | 9:9e247b9c9abf | 50 | void crc8_populate_msb(uint8_t * table, const uint8_t polynomial); |
EndaKilgarriff | 9:9e247b9c9abf | 51 | uint8_t crc8(const uint8_t * table, const uint8_t *pdata, size_t nbytes, |
EndaKilgarriff | 9:9e247b9c9abf | 52 | uint8_t crc); |
EndaKilgarriff | 9:9e247b9c9abf | 53 | |
EndaKilgarriff | 9:9e247b9c9abf | 54 | #endif // __CRC8_H |