mbed library sources. Supersedes mbed-src.

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

Committer:
AnnaBridge
Date:
Wed Feb 20 22:31:08 2019 +0000
Revision:
189:f392fc9709a3
Parent:
188:bcfe06ba3d64
mbed library release version 165

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