The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Thu Nov 08 11:45:42 2018 +0000
Revision:
171:3a7713b1edbc
Parent:
TARGET_RO359B/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K24F/TARGET_MCU_K24F1M/TARGET_RO359B/crc.h@143:86740a56073b
mbed library. Release version 164

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 143:86740a56073b 1 /**********************************************************************
AnnaBridge 143:86740a56073b 2 *
AnnaBridge 143:86740a56073b 3 * Filename: crc.h
AnnaBridge 143:86740a56073b 4 *
AnnaBridge 143:86740a56073b 5 * Description: A header file describing the various CRC standards.
AnnaBridge 143:86740a56073b 6 *
AnnaBridge 143:86740a56073b 7 * Notes:
AnnaBridge 143:86740a56073b 8 *
AnnaBridge 143:86740a56073b 9 *
AnnaBridge 143:86740a56073b 10 * Copyright (c) 2000 by Michael Barr. This software is placed into
AnnaBridge 143:86740a56073b 11 * the public domain and may be used for any purpose. However, this
AnnaBridge 143:86740a56073b 12 * notice must not be changed or removed and no warranty is either
AnnaBridge 143:86740a56073b 13 * expressed or implied by its publication or distribution.
AnnaBridge 143:86740a56073b 14 **********************************************************************/
AnnaBridge 143:86740a56073b 15
AnnaBridge 143:86740a56073b 16 #ifndef _crc_h
AnnaBridge 143:86740a56073b 17 #define _crc_h
AnnaBridge 143:86740a56073b 18
AnnaBridge 143:86740a56073b 19
AnnaBridge 143:86740a56073b 20 #define FALSE 0
AnnaBridge 143:86740a56073b 21 #define TRUE !FALSE
AnnaBridge 143:86740a56073b 22
AnnaBridge 143:86740a56073b 23 /*
AnnaBridge 143:86740a56073b 24 * Select the CRC standard from the list that follows.
AnnaBridge 143:86740a56073b 25 */
AnnaBridge 143:86740a56073b 26 #define CRC16
AnnaBridge 143:86740a56073b 27
AnnaBridge 143:86740a56073b 28
AnnaBridge 143:86740a56073b 29 #if defined(CRC_CCITT)
AnnaBridge 143:86740a56073b 30
AnnaBridge 143:86740a56073b 31 typedef unsigned short crc;
AnnaBridge 143:86740a56073b 32
AnnaBridge 143:86740a56073b 33 #define CRC_NAME "CRC-CCITT"
AnnaBridge 143:86740a56073b 34 #define POLYNOMIAL 0x1021
AnnaBridge 143:86740a56073b 35 #define INITIAL_REMAINDER 0xFFFF
AnnaBridge 143:86740a56073b 36 #define FINAL_XOR_VALUE 0x0000
AnnaBridge 143:86740a56073b 37 #define REFLECT_DATA FALSE
AnnaBridge 143:86740a56073b 38 #define REFLECT_REMAINDER FALSE
AnnaBridge 143:86740a56073b 39 #define CHECK_VALUE 0x29B1
AnnaBridge 143:86740a56073b 40
AnnaBridge 143:86740a56073b 41 #elif defined(CRC16)
AnnaBridge 143:86740a56073b 42
AnnaBridge 143:86740a56073b 43 typedef unsigned short crc;
AnnaBridge 143:86740a56073b 44
AnnaBridge 143:86740a56073b 45 #define CRC_NAME "CRC-16"
AnnaBridge 143:86740a56073b 46 #define POLYNOMIAL 0x8005
AnnaBridge 143:86740a56073b 47 #define INITIAL_REMAINDER 0x0000
AnnaBridge 143:86740a56073b 48 #define FINAL_XOR_VALUE 0x0000
AnnaBridge 143:86740a56073b 49 #define REFLECT_DATA TRUE
AnnaBridge 143:86740a56073b 50 #define REFLECT_REMAINDER TRUE
AnnaBridge 143:86740a56073b 51 #define CHECK_VALUE 0xBB3D
AnnaBridge 143:86740a56073b 52
AnnaBridge 143:86740a56073b 53 #elif defined(CRC32)
AnnaBridge 143:86740a56073b 54
AnnaBridge 143:86740a56073b 55 typedef unsigned long crc;
AnnaBridge 143:86740a56073b 56
AnnaBridge 143:86740a56073b 57 #define CRC_NAME "CRC-32"
AnnaBridge 143:86740a56073b 58 #define POLYNOMIAL 0x04C11DB7
AnnaBridge 143:86740a56073b 59 #define INITIAL_REMAINDER 0xFFFFFFFF
AnnaBridge 143:86740a56073b 60 #define FINAL_XOR_VALUE 0xFFFFFFFF
AnnaBridge 143:86740a56073b 61 #define REFLECT_DATA TRUE
AnnaBridge 143:86740a56073b 62 #define REFLECT_REMAINDER TRUE
AnnaBridge 143:86740a56073b 63 #define CHECK_VALUE 0xCBF43926
AnnaBridge 143:86740a56073b 64
AnnaBridge 143:86740a56073b 65 #else
AnnaBridge 143:86740a56073b 66
AnnaBridge 143:86740a56073b 67 #error "One of CRC_CCITT, CRC16, or CRC32 must be #define'd."
AnnaBridge 143:86740a56073b 68
AnnaBridge 143:86740a56073b 69 #endif
AnnaBridge 143:86740a56073b 70
AnnaBridge 143:86740a56073b 71
AnnaBridge 143:86740a56073b 72 void crcInit(void);
AnnaBridge 143:86740a56073b 73 crc crcSlow(unsigned char const message[], int nBytes);
AnnaBridge 143:86740a56073b 74 crc crcFast(unsigned char const message[], int nBytes);
AnnaBridge 143:86740a56073b 75
AnnaBridge 143:86740a56073b 76
AnnaBridge 143:86740a56073b 77 #endif /* _crc_h */