@@ -25,54 +25,54 @@ static uint32_t final_xor;
25
25
26
26
bool hal_crc_is_supported (const crc_mbed_config_t * config )
27
27
{
28
- if (config == NULL ) {
29
- return false;
30
- }
28
+ if (config == NULL ) {
29
+ return false;
30
+ }
31
31
32
- if ((config -> width != 32 ) && (config -> width != 16 )) {
33
- return false;
34
- }
32
+ if ((config -> width != 32 ) && (config -> width != 16 )) {
33
+ return false;
34
+ }
35
35
36
- return true;
36
+ return true;
37
37
}
38
38
39
39
void hal_crc_compute_partial_start (const crc_mbed_config_t * config )
40
40
{
41
- if (config == NULL ) {
42
- return ;
43
- }
44
-
45
- width = (config -> width == 32 ) ? kCrcBits32 : kCrcBits16 ;
46
- final_xor = config -> final_xor ;
47
-
48
- crc_config_t platform_config ;
49
- platform_config .polynomial = config -> polynomial ;
50
- platform_config .seed = config -> initial_xor ;
51
- platform_config .reflectIn = config -> reflect_in ;
52
- platform_config .reflectOut = config -> reflect_out ;
53
- if ((width == kCrcBits16 && config -> final_xor == 0xFFFFU ) ||
54
- (width == kCrcBits32 && config -> final_xor == 0xFFFFFFFFU )) {
55
- platform_config .complementChecksum = true;
56
- } else {
57
- platform_config .complementChecksum = false;
58
- }
59
- platform_config .crcBits = width ;
60
- platform_config .crcResult = kCrcFinalChecksum ;
61
-
62
- CRC_Init (CRC0 , & platform_config );
41
+ if (config == NULL ) {
42
+ return ;
43
+ }
44
+
45
+ width = (config -> width == 32 ) ? kCrcBits32 : kCrcBits16 ;
46
+ final_xor = config -> final_xor ;
47
+
48
+ crc_config_t platform_config ;
49
+ platform_config .polynomial = config -> polynomial ;
50
+ platform_config .seed = config -> initial_xor ;
51
+ platform_config .reflectIn = config -> reflect_in ;
52
+ platform_config .reflectOut = config -> reflect_out ;
53
+ if ((width == kCrcBits16 && config -> final_xor == 0xFFFFU ) ||
54
+ (width == kCrcBits32 && config -> final_xor == 0xFFFFFFFFU )) {
55
+ platform_config .complementChecksum = true;
56
+ } else {
57
+ platform_config .complementChecksum = false;
58
+ }
59
+ platform_config .crcBits = width ;
60
+ platform_config .crcResult = kCrcFinalChecksum ;
61
+
62
+ CRC_Init (CRC0 , & platform_config );
63
63
}
64
64
65
65
void hal_crc_compute_partial (const uint8_t * data , const size_t size )
66
66
{
67
- if (data == NULL ) {
68
- return ;
69
- }
67
+ if (data == NULL ) {
68
+ return ;
69
+ }
70
70
71
- if (size == 0 ) {
72
- return ;
73
- }
71
+ if (size == 0 ) {
72
+ return ;
73
+ }
74
74
75
- CRC_WriteData (CRC0 , data , size );
75
+ CRC_WriteData (CRC0 , data , size );
76
76
}
77
77
78
78
uint32_t hal_crc_get_result (void )
0 commit comments