The DEVICE_FOO macros are always defined (either 0 or 1).
This patch replaces any instances of a define check on a DEVICE_FOO
macro with value test instead.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
CRC used in LittleFS is Reversed ANSI, hence new polynomial added.
Reversed polynomials perform shift in reverse direction of standard
polynomial, and we do not have option to notify reverse shift to hardware.
Hence this option is available in software only.
- Move CRC polynomial enum into HAL layer, so it's accessible from platform
implementations
- Add enum to CRC class to indicate which mode the CRC class should use:
HARDWARE, TABLE, or BITWISE
- Add calls to HAL Hardware CRC API to each of the compute functions when the
class is in HARDWARE mode.
- Add missing constructor call to template constructor, and remove const from
delegating constructor.
Define the HAL API header for the Hardware CRC module. This set of functions
allows hardware acceleration of a subset of CRC algorithms for supported
platforms by providing access to the hardware CRC module of certain platforms.
The API is defined as four separate functions:
- hal_crc_is_supported(polynomial)
Indicates to the caller if the specific CRC polynomial is supported.
- hal_crc_compute_partial_start(const uint32_t polynomial)
Initializes the hardware CRC module with the given polynomial.
- hal_crc_compute_partial(*data, size)
Writes an array of bytes to the CRC module to be appended to the calculation
- hal_crc_get_result()
Applies the final transformations to the data and returns the result to the
caller.