Mistake on this page?
Report an issue in GitHub or email us
crc_api_tests.h
1 /* mbed Microcontroller Library
2  * Copyright (c) 2018 ARM Limited
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 /** \addtogroup hal_crc_tests */
19 /** @{*/
20 
21 #ifndef MBED_CRC_API_TESTS_H
22 #define MBED_CRC_API_TESTS_H
23 
24 #include "device.h"
25 
26 #if DEVICE_CRC
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /** Test that hal_crc_is_supported() function returns true if given polynomial/width
33  * is supported, false otherwise (at least one predefined polynomial/width must be supported).
34  *
35  * Given is platform with hardware CRC support.
36  *
37  * When given polynomial/width is supported.
38  * Then hal_crc_is_supported() function returns true.
39  *
40  * When given polynomial/width is not supported.
41  * Then hal_crc_is_supported() function returns false.
42  *
43  * Note:
44  * At least one predefined polynomial/width config must be supported.
45  *
46  */
48 
49 /** Test that CRC module can be successfully configured, fed with data and the result can
50  * be successfully obtained.
51  *
52  * Given is platform with hardware CRC support.
53  *
54  * When hal_crc_compute_partial_start() function is called.
55  * Then it configures CRC module with the given polynomial.
56  *
57  * When hal_crc_compute_partial() function is called with valid buffer and data length.
58  * Then it feeds CRC module with data.
59  *
60  * When hal_crc_get_result() function is called.
61  * Then CRC value for the given data is returned.
62  *
63  */
65 
66 /** Test that hal_crc_compute_partial() function can be call multiple times in
67  * succession in order to provide additional data to CRC module.
68  *
69  * Given is platform with hardware CRC support and CRC module is configured.
70  * When hal_crc_compute_partial() function is called multiple times.
71  * Then each call provides additional data to CRC module.
72  *
73  */
74 void crc_calc_multi_test();
75 
76 /** Test that calling hal_crc_compute_partial_start() without finalising the
77  * CRC calculation overrides the current configuration and partial result.
78  *
79  * Given is platform with hardware CRC support.
80  * When CRC module has been configured and fed with data and reconfigured (without reading the result).
81  * Then the configuration has been overwritten and the new data can be successfully processed.
82  *
83  */
85 
86 /** Test that hal_crc_compute_partial() does nothing if pointer to buffer is undefined or
87  * data length is equal to 0.
88  *
89  * Given is platform with hardware CRC support.
90  * When hal_crc_compute_partial() is called with invalid parameters.
91  * Then no data is provided to CRC module and no exception is generated.
92  *
93  */
95 
96 /** Test that hal_crc_is_supported() returns false if pointer to the config structure is undefined.
97  *
98  * Given is platform with hardware CRC support.
99  * When hal_crc_is_supported() is called with invalid parameter.
100  * Then function returns false.
101  *
102  */
104 
105 /**@}*/
106 
107 #ifdef __cplusplus
108 }
109 #endif
110 
111 #endif
112 
113 #endif
114 
115 /**@}*/
void crc_compute_partial_invalid_param_test()
Test that hal_crc_compute_partial() does nothing if pointer to buffer is undefined or data length is ...
void crc_reconfigure_test()
Test that calling hal_crc_compute_partial_start() without finalising the CRC calculation overrides th...
void crc_calc_single_test()
Test that CRC module can be successfully configured, fed with data and the result can be successfully...
void crc_is_supported_test()
Test that hal_crc_is_supported() function returns true if given polynomial/width is supported...
void crc_calc_multi_test()
Test that hal_crc_compute_partial() function can be call multiple times in succession in order to pro...
void crc_is_supported_invalid_param_test()
Test that hal_crc_is_supported() returns false if pointer to the config structure is undefined...
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.