mirror of https://github.com/ARMmbed/mbed-os.git
K64F CRC driver: Fix coding style
parent
ee6a07e7ab
commit
a499341b2d
|
@ -25,54 +25,54 @@ static uint32_t final_xor;
|
|||
|
||||
bool hal_crc_is_supported(const crc_mbed_config_t* config)
|
||||
{
|
||||
if (config == NULL) {
|
||||
return false;
|
||||
}
|
||||
if (config == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((config->width != 32) && (config->width != 16)) {
|
||||
return false;
|
||||
}
|
||||
if ((config->width != 32) && (config->width != 16)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void hal_crc_compute_partial_start(const crc_mbed_config_t* config)
|
||||
{
|
||||
if (config == NULL) {
|
||||
return;
|
||||
}
|
||||
if (config == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
width = (config->width == 32) ? kCrcBits32 : kCrcBits16;
|
||||
final_xor = config->final_xor;
|
||||
width = (config->width == 32) ? kCrcBits32 : kCrcBits16;
|
||||
final_xor = config->final_xor;
|
||||
|
||||
crc_config_t platform_config;
|
||||
platform_config.polynomial = config->polynomial;
|
||||
platform_config.seed = config->initial_xor;
|
||||
platform_config.reflectIn = config->reflect_in;
|
||||
platform_config.reflectOut = config->reflect_out;
|
||||
if ((width == kCrcBits16 && config->final_xor == 0xFFFFU) ||
|
||||
(width == kCrcBits32 && config->final_xor == 0xFFFFFFFFU)) {
|
||||
platform_config.complementChecksum = true;
|
||||
} else {
|
||||
platform_config.complementChecksum = false;
|
||||
}
|
||||
platform_config.crcBits = width;
|
||||
platform_config.crcResult = kCrcFinalChecksum;
|
||||
crc_config_t platform_config;
|
||||
platform_config.polynomial = config->polynomial;
|
||||
platform_config.seed = config->initial_xor;
|
||||
platform_config.reflectIn = config->reflect_in;
|
||||
platform_config.reflectOut = config->reflect_out;
|
||||
if ((width == kCrcBits16 && config->final_xor == 0xFFFFU) ||
|
||||
(width == kCrcBits32 && config->final_xor == 0xFFFFFFFFU)) {
|
||||
platform_config.complementChecksum = true;
|
||||
} else {
|
||||
platform_config.complementChecksum = false;
|
||||
}
|
||||
platform_config.crcBits = width;
|
||||
platform_config.crcResult = kCrcFinalChecksum;
|
||||
|
||||
CRC_Init(CRC0, &platform_config);
|
||||
CRC_Init(CRC0, &platform_config);
|
||||
}
|
||||
|
||||
void hal_crc_compute_partial(const uint8_t *data, const size_t size)
|
||||
{
|
||||
if (data == NULL) {
|
||||
return;
|
||||
}
|
||||
if (data == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (size == 0) {
|
||||
return;
|
||||
}
|
||||
if (size == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
CRC_WriteData(CRC0, data, size);
|
||||
CRC_WriteData(CRC0, data, size);
|
||||
}
|
||||
|
||||
uint32_t hal_crc_get_result(void)
|
||||
|
|
Loading…
Reference in New Issue