Skip to content

Commit 307021e

Browse files
committed
Add testing requirements to HAL CRC header file.
1 parent 1eed0b9 commit 307021e

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

hal/crc_api.h

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,64 @@ extern "C" {
6262
* The Hardware CRC HAL API provides a low-level interface to the Hardware CRC
6363
* module of a target platform.
6464
*
65+
* # Defined behaviour
66+
*
67+
* * Function hal_crc_is_supported() returns true if platform supports hardware
68+
* CRC for the given polynomial/width - verified by test ::crc_is_supported_test.
69+
* * Function hal_crc_is_supported() returns false if platform does not support hardware
70+
* CRC for the given polynomial/width - verified by test ::crc_is_supported_test.
71+
* * Function hal_crc_is_supported() returns false if given pointer to configuration
72+
* structure is undefined (NULL) - verified by test ::crc_is_supported_invalid_param_test.
73+
* * If CRC module does not support one of the following settings: initial_xor, final_xor
74+
* reflect_in, reflect_out, then these operations should be handled by the driver
75+
* - Verified by test ::crc_calc_single_test.
76+
* * Platform which supports hardware CRC must be able to handle at least one of the predefined
77+
* polynomial/width configurations that can be constructed in the MbedCRC class: POLY_8BIT_CCITT,
78+
* POLY_7BIT_SD, POLY_16BIT_CCITT, POLY_16BIT_IBM, POLY_32BIT_ANSI
79+
* - verified by test ::crc_is_supported_test, ::crc_calc_single_test.
80+
* * Function hal_crc_compute_partial_start() configures CRC module with the given configuration
81+
* - Verified by test ::crc_calc_single_test.
82+
* * Calling hal_crc_compute_partial_start() without finalising the
83+
* CRC calculation overrides the current configuration - Verified by test ::crc_reconfigure_test.
84+
* * Function hal_crc_compute_partial() writes data to the CRC module - verified by test ::crc_calc_single_test.
85+
* * Function hal_crc_compute_partial() can be call multiple times in succession in order to
86+
* provide additional data to CRC module - verified by test ::crc_calc_multi_test.
87+
* * Function hal_crc_compute_partial() does nothing if pointer to buffer is undefined or
88+
* data length is equal to 0 - verified by test ::crc_compute_partial_invalid_param_test.
89+
* * Function hal_crc_get_result() returns the checksum result from the CRC module
90+
* - verified by tests ::crc_calc_single_test, ::crc_calc_multi_test, ::crc_reconfigure_test.
91+
*
92+
* # Undefined behaviour
93+
*
94+
* * Calling hal_crc_compute_partial_start() function with invalid (unsupported) polynomial.
95+
* * Calling hal_crc_compute_partial() or hal_crc_get_result() functions before hal_crc_compute_partial_start().
96+
* * Calling hal_crc_get_result() function multiple times.
97+
*
98+
* # Non-functional requirements
99+
*
100+
* * CRC configuration provides the following settings:
101+
* * polynomial - CRC Polynomial,
102+
* * width - CRC bit width,
103+
* * initial_xor - seed value for the computation,
104+
* * final_xor - final xor value for the computation,
105+
* * reflect_in - reflect bits on input,
106+
* * reflect_out - reflect bits in final result before returning.
107+
*
108+
* # Potential bugs
109+
*
65110
* @{
66111
*/
67112

113+
/**
114+
* \defgroup hal_crc_tests crc hal tests
115+
* The crc HAL tests ensure driver conformance to defined behaviour.
116+
*
117+
* To run the crc hal tests use the command:
118+
*
119+
* mbed test -t <toolchain> -m <target> -n tests-mbed_hal-crc*
120+
*
121+
*/
122+
68123
/** Determine if the current platform supports hardware CRC for given polynomial
69124
*
70125
* The purpose of this function is to inform the CRC Platform API whether the

0 commit comments

Comments
 (0)