From df93c0151ce146b66b5a0f848f429157c8c865e9 Mon Sep 17 00:00:00 2001 From: Steven Cartmell Date: Fri, 27 Apr 2018 16:45:06 +0100 Subject: [PATCH] Remove support for 7/8 bit CRC polynomials for K64F --- hal/crc_api.h | 30 ++++++++++++++++ .../TARGET_MCU_K64F/mbed_crc_api.c | 34 +++---------------- 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/hal/crc_api.h b/hal/crc_api.h index 4e778efc1b..867c69b778 100644 --- a/hal/crc_api.h +++ b/hal/crc_api.h @@ -1,3 +1,20 @@ +/** \addtogroup hal */ +/** @{*/ +/* mbed Microcontroller Library + * Copyright (c) 2018 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef MBED_CRC_HAL_API_H #define MBED_CRC_HAL_API_H @@ -24,6 +41,15 @@ typedef enum crc_polynomial { extern "C" { #endif +/** + * \defgroup hal_crc Hardware CRC + * + * The Hardware CRC HAL API provides a low-level interface to the Hardware CRC + * module of a target platform. + * + * @{ + */ + /** Determine if the current platform supports hardware CRC for given polynomial * * The purpose of this function is to inform the CRC Platform API whether the @@ -122,9 +148,13 @@ void hal_crc_compute_partial(const uint8_t *data, const size_t size); */ uint32_t hal_crc_get_result(void); +/**@}*/ + #ifdef __cplusplus }; #endif #endif // DEVICE_CRC #endif // MBED_CRC_HAL_API_H + +/**@}*/ diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/mbed_crc_api.c b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/mbed_crc_api.c index fa81e44bda..f8f25c5456 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/mbed_crc_api.c +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/mbed_crc_api.c @@ -11,12 +11,13 @@ bool hal_crc_is_supported(const uint32_t polynomial) { switch (polynomial) { - case POLY_8BIT_CCITT: - case POLY_7BIT_SD: case POLY_16BIT_CCITT: case POLY_16BIT_IBM: case POLY_32BIT_ANSI: return true; + case POLY_8BIT_CCITT: + case POLY_7BIT_SD: + return false; default: return false; } @@ -70,34 +71,9 @@ void hal_crc_compute_partial_start(const uint32_t polynomial) break; } - case POLY_8BIT_CCITT: - { - width = kCrcBits16; - - config.polynomial = polynomial; - config.seed = 0U; - config.reflectIn = false; - config.reflectOut = false; - config.complementChecksum = false; - config.crcBits = width; - config.crcResult = kCrcFinalChecksum; - + default: + MBED_ASSERT("Configuring Mbed CRC with unsupported polynomial"); break; - } - case POLY_7BIT_SD: - { - width = kCrcBits16; - - config.polynomial = polynomial; - config.seed = 0U; - config.reflectIn = false; - config.reflectOut = false; - config.complementChecksum = false; - config.crcBits = width; - config.crcResult = kCrcFinalChecksum; - - break; - } } CRC_Init(CRC0, &config);