takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

Embed: (wiki syntax)

« Back to documentation index

crc hal tests

crc hal tests
[Hardware CRC]

The crc HAL tests ensure driver conformance to defined behaviour. More...

Functions

void crc_is_supported_test ()
 Test that hal_crc_is_supported() function returns true if given polynomial/width is supported, false otherwise (at least one predefined polynomial/width must be supported).
void crc_calc_single_test ()
 Test that CRC module can be successfully configured, fed with data and the result can be successfully obtained.
void crc_calc_multi_test ()
 Test that hal_crc_compute_partial() function can be call multiple times in succession in order to provide additional data to CRC module.
void crc_reconfigure_test ()
 Test that calling hal_crc_compute_partial_start() without finalising the CRC calculation overrides the current configuration and partial result.
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 equal to 0.
void crc_is_supported_invalid_param_test ()
 Test that hal_crc_is_supported() returns false if pointer to the config structure is undefined.

Detailed Description

The crc HAL tests ensure driver conformance to defined behaviour.

To run the crc hal tests use the command:

mbed test -t <toolchain> -m <target> -n tests-mbed_hal-crc*


Function Documentation

void crc_calc_multi_test (  )

Test that hal_crc_compute_partial() function can be call multiple times in succession in order to provide additional data to CRC module.

Given is platform with hardware CRC support and CRC module is configured. When hal_crc_compute_partial() function is called multiple times. Then each call provides additional data to CRC module.

Definition at line 84 of file mbed-os/TESTS/mbed_hal/crc/main.cpp.

void crc_calc_single_test (  )

Test that CRC module can be successfully configured, fed with data and the result can be successfully obtained.

Given is platform with hardware CRC support.

When hal_crc_compute_partial_start() function is called. Then it configures CRC module with the given polynomial.

When hal_crc_compute_partial() function is called with valid buffer and data length. Then it feeds CRC module with data.

When hal_crc_get_result() function is called. Then CRC value for the given data is returned.

Definition at line 68 of file mbed-os/TESTS/mbed_hal/crc/main.cpp.

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 equal to 0.

Given is platform with hardware CRC support. When hal_crc_compute_partial() is called with invalid parameters. Then no data is provided to CRC module and no exception is generated.

Definition at line 156 of file mbed-os/TESTS/mbed_hal/crc/main.cpp.

void crc_is_supported_invalid_param_test (  )

Test that hal_crc_is_supported() returns false if pointer to the config structure is undefined.

Given is platform with hardware CRC support. When hal_crc_is_supported() is called with invalid parameter. Then function returns false.

Definition at line 184 of file mbed-os/TESTS/mbed_hal/crc/main.cpp.

void crc_is_supported_test (  )

Test that hal_crc_is_supported() function returns true if given polynomial/width is supported, false otherwise (at least one predefined polynomial/width must be supported).

Given is platform with hardware CRC support.

When given polynomial/width is supported. Then hal_crc_is_supported() function returns true.

When given polynomial/width is not supported. Then hal_crc_is_supported() function returns false.

Note: At least one predefined polynomial/width config must be supported.

Definition at line 51 of file mbed-os/TESTS/mbed_hal/crc/main.cpp.

void crc_reconfigure_test (  )

Test that calling hal_crc_compute_partial_start() without finalising the CRC calculation overrides the current configuration and partial result.

Given is platform with hardware CRC support. When CRC module has been configured and fed with data and reconfigured (without reading the result). Then the configuration has been overwritten and the new data can be successfully processed.

Definition at line 108 of file mbed-os/TESTS/mbed_hal/crc/main.cpp.