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