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