Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
crc_api_tests.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2018 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 /** \addtogroup hal_crc_tests */ 00018 /** @{*/ 00019 00020 #ifndef MBED_CRC_API_TESTS_H 00021 #define MBED_CRC_API_TESTS_H 00022 00023 #include "device.h" 00024 00025 #if DEVICE_CRC 00026 00027 #ifdef __cplusplus 00028 extern "C" { 00029 #endif 00030 00031 /** Test that hal_crc_is_supported() function returns true if given polynomial/width 00032 * is supported, false otherwise (at least one predefined polynomial/width must be supported). 00033 * 00034 * Given is platform with hardware CRC support. 00035 * 00036 * When given polynomial/width is supported. 00037 * Then hal_crc_is_supported() function returns true. 00038 * 00039 * When given polynomial/width is not supported. 00040 * Then hal_crc_is_supported() function returns false. 00041 * 00042 * Note: 00043 * At least one predefined polynomial/width config must be supported. 00044 * 00045 */ 00046 void crc_is_supported_test(); 00047 00048 /** Test that CRC module can be successfully configured, fed with data and the result can 00049 * be successfully obtained. 00050 * 00051 * Given is platform with hardware CRC support. 00052 * 00053 * When hal_crc_compute_partial_start() function is called. 00054 * Then it configures CRC module with the given polynomial. 00055 * 00056 * When hal_crc_compute_partial() function is called with valid buffer and data length. 00057 * Then it feeds CRC module with data. 00058 * 00059 * When hal_crc_get_result() function is called. 00060 * Then CRC value for the given data is returned. 00061 * 00062 */ 00063 void crc_calc_single_test(); 00064 00065 /** Test that hal_crc_compute_partial() function can be call multiple times in 00066 * succession in order to provide additional data to CRC module. 00067 * 00068 * Given is platform with hardware CRC support and CRC module is configured. 00069 * When hal_crc_compute_partial() function is called multiple times. 00070 * Then each call provides additional data to CRC module. 00071 * 00072 */ 00073 void crc_calc_multi_test(); 00074 00075 /** Test that calling hal_crc_compute_partial_start() without finalising the 00076 * CRC calculation overrides the current configuration and partial result. 00077 * 00078 * Given is platform with hardware CRC support. 00079 * When CRC module has been configured and fed with data and reconfigured (without reading the result). 00080 * Then the configuration has been overwritten and the new data can be successfully processed. 00081 * 00082 */ 00083 void crc_reconfigure_test(); 00084 00085 /** Test that hal_crc_compute_partial() does nothing if pointer to buffer is undefined or 00086 * data length is equal to 0. 00087 * 00088 * Given is platform with hardware CRC support. 00089 * When hal_crc_compute_partial() is called with invalid parameters. 00090 * Then no data is provided to CRC module and no exception is generated. 00091 * 00092 */ 00093 void crc_compute_partial_invalid_param_test(); 00094 00095 /** Test that hal_crc_is_supported() returns false if pointer to the config structure is undefined. 00096 * 00097 * Given is platform with hardware CRC support. 00098 * When hal_crc_is_supported() is called with invalid parameter. 00099 * Then function returns false. 00100 * 00101 */ 00102 void crc_is_supported_invalid_param_test(); 00103 00104 /**@}*/ 00105 00106 #ifdef __cplusplus 00107 } 00108 #endif 00109 00110 #endif 00111 00112 #endif 00113 00114 /**@}*/
Generated on Tue Aug 9 2022 00:37:04 by
1.7.2