Skip to content

Commit

Permalink
K64F CRC driver: Fix coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
mprse committed Jun 7, 2018
1 parent ee6a07e commit a499341
Showing 1 changed file with 36 additions and 36 deletions.
Expand Up @@ -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;
}

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_Init(CRC0, &platform_config);
if (config == NULL) {
return;
}

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_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)
Expand Down

0 comments on commit a499341

Please sign in to comment.