mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
MbedCRC.cpp
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2018 ARM Limited 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #include <stddef.h> 00019 #include "drivers/TableCRC.h" 00020 #include "drivers/MbedCRC.h" 00021 00022 namespace mbed { 00023 /** \addtogroup drivers */ 00024 /** @{*/ 00025 00026 SingletonPtr<PlatformMutex> mbed_crc_mutex; 00027 00028 /* Default values for different types of polynomials 00029 */ 00030 template<> 00031 MbedCRC<POLY_32BIT_ANSI, 32>::MbedCRC(): 00032 _initial_value(~(0x0)), _final_xor(~(0x0)), _reflect_data(true), _reflect_remainder(true), 00033 _crc_table((uint32_t *)Table_CRC_32bit_ANSI) 00034 { 00035 mbed_crc_ctor(); 00036 } 00037 00038 template<> 00039 MbedCRC<POLY_32BIT_REV_ANSI, 32>::MbedCRC(): 00040 _initial_value(~(0x0)), _final_xor(~(0x0)), _reflect_data(false), _reflect_remainder(false), 00041 _crc_table((uint32_t *)Table_CRC_32bit_Rev_ANSI) 00042 { 00043 mbed_crc_ctor(); 00044 } 00045 00046 template<> 00047 MbedCRC<POLY_16BIT_IBM, 16>::MbedCRC(): 00048 _initial_value(0), _final_xor(0), _reflect_data(true), _reflect_remainder(true), 00049 _crc_table((uint32_t *)Table_CRC_16bit_IBM) 00050 { 00051 mbed_crc_ctor(); 00052 } 00053 00054 template<> 00055 MbedCRC<POLY_16BIT_CCITT, 16>::MbedCRC(): 00056 _initial_value(~(0x0)), _final_xor(0), _reflect_data(false), _reflect_remainder(false), 00057 _crc_table((uint32_t *)Table_CRC_16bit_CCITT) 00058 { 00059 mbed_crc_ctor(); 00060 } 00061 00062 template<> 00063 MbedCRC<POLY_7BIT_SD, 7>::MbedCRC(): 00064 _initial_value(0), _final_xor(0), _reflect_data(false), _reflect_remainder(false), 00065 _crc_table((uint32_t *)Table_CRC_7Bit_SD) 00066 { 00067 mbed_crc_ctor(); 00068 } 00069 00070 template<> 00071 MbedCRC<POLY_8BIT_CCITT, 8>::MbedCRC(): 00072 _initial_value(0), _final_xor(0), _reflect_data(false), _reflect_remainder(false), 00073 _crc_table((uint32_t *)Table_CRC_8bit_CCITT) 00074 { 00075 mbed_crc_ctor(); 00076 } 00077 00078 /** @}*/ 00079 } // namespace mbed 00080
Generated on Tue Jul 12 2022 20:41:15 by 1.7.2