Platform drivers for Mbed.

Dependents:   EVAL-CN0535-FMCZ EVAL-CN0535-FMCZ EVAL-AD568x-AD569x EVAL-AD7606 ... more

Committer:
mahphalke
Date:
Fri Mar 19 12:10:16 2021 +0530
Revision:
16:61ad39564f45
Parent:
11:a2dcf0ebb5b5
Added uart changes

Who changed what in which revision?

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