-
-
Notifications
You must be signed in to change notification settings - Fork 175
/
hal_stm32_crc.c
85 lines (59 loc) · 2.5 KB
/
hal_stm32_crc.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//
// Copyright (c) .NET Foundation and Contributors
// See LICENSE file in the project root for full license information.
//
// This driver is slightly different from the usual ChibiOS drivers because the calls don't require an instance of the driver.
// The reason for this is that the hardware only has a single instance of the peripheral
// so there is no point on wasting memory with calling functions with dummy arguments.
#include <hal.h>
#include <hal_nf_community.h>
#if (HAL_NF_USE_STM32_CRC == TRUE)
///////////////////////////////////////////////////////////////////////////////
// Driver local definitions. //
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Driver exported variables. //
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Driver local variables and types. //
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Driver local functions. //
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Driver exported functions. //
///////////////////////////////////////////////////////////////////////////////
// Initializes the CRC Driver
void crcInit(void) {
crc_lld_init();
}
// Configures and activates the CRC peripheral
void crcStart(const crcConfig *config) {
// better lock this to setup the driver and start the peripheral
osalSysLock();
crc_lld_start(config);
osalSysUnlock();
}
// Deactivates the CRC peripheral
void crcStop() {
// better lock this to stop the peripheral
osalSysLock();
crc_lld_stop();
osalSysUnlock();
}
// Resets the current CRC calculation
void crcReset() {
osalSysLock();
crc_lld_reset();
osalSysUnlock();
}
uint32_t crcCompute(const void* buffer, const uint32_t size, const uint32_t initialCrc) {
return crc_lld_compute(buffer, size, initialCrc);
}
void crcAquireModule() {
crc_lld_aquire();
}
void crcReleaseModule() {
crc_lld_release();
}
#endif