Skip to content

Commit 5e98eea

Browse files
author
Steven Cartmell
committed
HAL CRC: Add additional thread safety notes to the API
1 parent d53ffb7 commit 5e98eea

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

hal/crc_api.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ extern "C" {
8181
* and final xor of 0xFFFFFFFF, and reflection of both input and output. If any
8282
* of these settings cannot be configured the polynomial is not supported.
8383
*
84+
* This function is thread safe, it safe to call from multiple contexts if
85+
* required.
86+
*
8487
* \param config Contains CRC configuration parameters for initialising the
8588
* hardware CRC module. For example, polynomial and initial seed
8689
* values.
@@ -112,7 +115,7 @@ bool hal_crc_is_supported(const crc_mbed_config_t* config);
112115
*
113116
* This function is not thread safe, a CRC calculation must not be started from
114117
* two different threads or contexts at the same time, calling this function
115-
* from two different contexts may lead to configurations being overwrite and
118+
* from two different contexts may lead to configurations being overwritten and
116119
* results being lost.
117120
*
118121
* \param config Contains CRC configuration parameters for initialising the
@@ -165,6 +168,10 @@ void hal_crc_compute_partial(const uint8_t *data, const size_t size);
165168
* value on successive calls is undefined as the contents of the register after
166169
* accessing them is platform-specific.
167170
*
171+
* This function is not thread safe. There is only one instance of the CRC
172+
* module active at a time, calling this function from multiple contexts may
173+
* return incorrect data or affect the current state of the module.
174+
*
168175
* \return The final CRC checksum after the reflections and final calculations
169176
* have been applied.
170177
*/

0 commit comments

Comments
 (0)