mirror of https://github.com/ARMmbed/mbed-os.git
HAL CRC: Add bit width parameter to crc_config_t
parent
e1ca2b32fc
commit
8e14b5977b
|
@ -203,6 +203,7 @@ public:
|
|||
if (_mode == HARDWARE) {
|
||||
crc_mbed_config_t config;
|
||||
config.polynomial = polynomial;
|
||||
config.width = width;
|
||||
config.initial_xor = _initial_value;
|
||||
config.final_xor = _final_xor;
|
||||
config.reflect_in = _reflect_data;
|
||||
|
@ -440,6 +441,7 @@ private:
|
|||
#ifdef DEVICE_CRC
|
||||
crc_mbed_config_t config;
|
||||
config.polynomial = polynomial;
|
||||
config.width = width;
|
||||
config.initial_xor = _initial_value;
|
||||
config.final_xor = _final_xor;
|
||||
config.reflect_in = _reflect_data;
|
||||
|
|
|
@ -38,6 +38,8 @@ typedef enum crc_polynomial {
|
|||
typedef struct crc_mbed_config {
|
||||
/// CRC Polynomial. Example polynomial: 0x21 = 0010_0011 = x^5+x+1
|
||||
uint32_t polynomial;
|
||||
/// CRC Bit Width
|
||||
uint32_t width;
|
||||
/// Initial seed value for the computation.
|
||||
uint32_t initial_xor;
|
||||
/// Final xor value for the computation.
|
||||
|
|
|
@ -12,7 +12,7 @@ bool hal_crc_is_supported(const crc_mbed_config_t* config)
|
|||
if (config == NULL)
|
||||
return false;
|
||||
|
||||
if ((config->polynomial & 0x80008000) == 0)
|
||||
if ((config->width != 32) || (config->width != 16))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue