mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Thu Nov 08 11:46:34 2018 +0000
Revision:
188:bcfe06ba3d64
Parent:
187:0387e8f68319
Child:
189:f392fc9709a3
mbed-dev library. Release version 164

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 184:08ed48f1de7f 1 /* mbed Microcontroller Library
AnnaBridge 184:08ed48f1de7f 2 * Copyright (c) 2018 ARM Limited
AnnaBridge 184:08ed48f1de7f 3 *
AnnaBridge 184:08ed48f1de7f 4 * Licensed under the Apache License, Version 2.0 (the "License");
AnnaBridge 184:08ed48f1de7f 5 * you may not use this file except in compliance with the License.
AnnaBridge 184:08ed48f1de7f 6 * You may obtain a copy of the License at
AnnaBridge 184:08ed48f1de7f 7 *
AnnaBridge 184:08ed48f1de7f 8 * http://www.apache.org/licenses/LICENSE-2.0
AnnaBridge 184:08ed48f1de7f 9 *
AnnaBridge 184:08ed48f1de7f 10 * Unless required by applicable law or agreed to in writing, software
AnnaBridge 184:08ed48f1de7f 11 * distributed under the License is distributed on an "AS IS" BASIS,
AnnaBridge 184:08ed48f1de7f 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
AnnaBridge 184:08ed48f1de7f 13 * See the License for the specific language governing permissions and
AnnaBridge 184:08ed48f1de7f 14 * limitations under the License.
AnnaBridge 184:08ed48f1de7f 15 */
AnnaBridge 184:08ed48f1de7f 16
AnnaBridge 184:08ed48f1de7f 17 #include <stddef.h>
AnnaBridge 184:08ed48f1de7f 18 #include "drivers/TableCRC.h"
AnnaBridge 184:08ed48f1de7f 19 #include "drivers/MbedCRC.h"
AnnaBridge 184:08ed48f1de7f 20
AnnaBridge 184:08ed48f1de7f 21 namespace mbed {
AnnaBridge 184:08ed48f1de7f 22 /** \addtogroup drivers */
AnnaBridge 184:08ed48f1de7f 23 /** @{*/
AnnaBridge 184:08ed48f1de7f 24
AnnaBridge 188:bcfe06ba3d64 25 SingletonPtr<PlatformMutex> mbed_crc_mutex;
AnnaBridge 188:bcfe06ba3d64 26
AnnaBridge 184:08ed48f1de7f 27 /* Default values for different types of polynomials
AnnaBridge 184:08ed48f1de7f 28 */
AnnaBridge 184:08ed48f1de7f 29 template<>
AnnaBridge 188:bcfe06ba3d64 30 MbedCRC<POLY_32BIT_ANSI, 32>::MbedCRC():
AnnaBridge 188:bcfe06ba3d64 31 _initial_value(~(0x0)), _final_xor(~(0x0)), _reflect_data(true), _reflect_remainder(true),
AnnaBridge 187:0387e8f68319 32 _crc_table((uint32_t *)Table_CRC_32bit_ANSI)
AnnaBridge 184:08ed48f1de7f 33 {
AnnaBridge 184:08ed48f1de7f 34 mbed_crc_ctor();
AnnaBridge 184:08ed48f1de7f 35 }
AnnaBridge 184:08ed48f1de7f 36
AnnaBridge 184:08ed48f1de7f 37 template<>
AnnaBridge 188:bcfe06ba3d64 38 MbedCRC<POLY_32BIT_REV_ANSI, 32>::MbedCRC():
AnnaBridge 188:bcfe06ba3d64 39 _initial_value(~(0x0)), _final_xor(~(0x0)), _reflect_data(false), _reflect_remainder(false),
AnnaBridge 188:bcfe06ba3d64 40 _crc_table((uint32_t *)Table_CRC_32bit_Rev_ANSI)
AnnaBridge 184:08ed48f1de7f 41 {
AnnaBridge 184:08ed48f1de7f 42 mbed_crc_ctor();
AnnaBridge 184:08ed48f1de7f 43 }
AnnaBridge 184:08ed48f1de7f 44
AnnaBridge 184:08ed48f1de7f 45 template<>
AnnaBridge 184:08ed48f1de7f 46 MbedCRC<POLY_16BIT_IBM, 16>::MbedCRC():
AnnaBridge 184:08ed48f1de7f 47 _initial_value(0), _final_xor(0), _reflect_data(true), _reflect_remainder(true),
AnnaBridge 184:08ed48f1de7f 48 _crc_table((uint32_t *)Table_CRC_16bit_IBM)
AnnaBridge 184:08ed48f1de7f 49 {
AnnaBridge 184:08ed48f1de7f 50 mbed_crc_ctor();
AnnaBridge 184:08ed48f1de7f 51 }
AnnaBridge 184:08ed48f1de7f 52
AnnaBridge 184:08ed48f1de7f 53 template<>
AnnaBridge 184:08ed48f1de7f 54 MbedCRC<POLY_16BIT_CCITT, 16>::MbedCRC():
AnnaBridge 184:08ed48f1de7f 55 _initial_value(~(0x0)), _final_xor(0), _reflect_data(false), _reflect_remainder(false),
AnnaBridge 184:08ed48f1de7f 56 _crc_table((uint32_t *)Table_CRC_16bit_CCITT)
AnnaBridge 184:08ed48f1de7f 57 {
AnnaBridge 184:08ed48f1de7f 58 mbed_crc_ctor();
AnnaBridge 184:08ed48f1de7f 59 }
AnnaBridge 184:08ed48f1de7f 60
AnnaBridge 184:08ed48f1de7f 61 template<>
AnnaBridge 184:08ed48f1de7f 62 MbedCRC<POLY_7BIT_SD, 7>::MbedCRC():
AnnaBridge 184:08ed48f1de7f 63 _initial_value(0), _final_xor(0), _reflect_data(false), _reflect_remainder(false),
AnnaBridge 184:08ed48f1de7f 64 _crc_table((uint32_t *)Table_CRC_7Bit_SD)
AnnaBridge 184:08ed48f1de7f 65 {
AnnaBridge 184:08ed48f1de7f 66 mbed_crc_ctor();
AnnaBridge 184:08ed48f1de7f 67 }
AnnaBridge 184:08ed48f1de7f 68
AnnaBridge 184:08ed48f1de7f 69 template<>
AnnaBridge 184:08ed48f1de7f 70 MbedCRC<POLY_8BIT_CCITT, 8>::MbedCRC():
AnnaBridge 184:08ed48f1de7f 71 _initial_value(0), _final_xor(0), _reflect_data(false), _reflect_remainder(false),
AnnaBridge 184:08ed48f1de7f 72 _crc_table((uint32_t *)Table_CRC_8bit_CCITT)
AnnaBridge 184:08ed48f1de7f 73 {
AnnaBridge 184:08ed48f1de7f 74 mbed_crc_ctor();
AnnaBridge 184:08ed48f1de7f 75 }
AnnaBridge 184:08ed48f1de7f 76
AnnaBridge 184:08ed48f1de7f 77 /** @}*/
AnnaBridge 184:08ed48f1de7f 78 } // namespace mbed
AnnaBridge 184:08ed48f1de7f 79