Interfaces for Cyclic Redundancy Check (CRC) devices.
More...
|
| file | crc.h |
| | CRC public API header file.
|
Interfaces for Cyclic Redundancy Check (CRC) devices.
◆ CRC_FLAG_REVERSE_INPUT
| #define CRC_FLAG_REVERSE_INPUT BIT(0) |
#include <crc.h>
Reverse input string.
◆ CRC_FLAG_REVERSE_OUTPUT
| #define CRC_FLAG_REVERSE_OUTPUT BIT(1) |
#include <crc.h>
Reverse output string.
◆ crc_init_val_t
#include <crc.h>
Provides a type to hold CRC initial seed value.
◆ crc_poly_t
#include <crc.h>
Provides a type to hold CRC polynomial value.
See CRC_POLYNOMIAL for predefined polynomial values.
◆ crc_result_t
#include <crc.h>
Provides a type to hold CRC result value.
◆ crc_state
#include <crc.h>
CRC state enumeration.
| Enumerator |
|---|
| CRC_STATE_IDLE | CRC device is in IDLE state.
|
| CRC_STATE_IN_PROGRESS | CRC calculation is in-progress.
|
◆ crc_begin()
| int crc_begin |
( |
const struct device * | dev, |
|
|
struct crc_ctx * | ctx ) |
#include <crc.h>
Configure CRC unit for calculation.
- Parameters
-
| dev | Pointer to the device structure |
| ctx | Pointer to the CRC context structure |
- Return values
-
| 0 | if successful |
| -ENOSYS | if function is not implemented |
| errno | code on failure |
◆ crc_finish()
| int crc_finish |
( |
const struct device * | dev, |
|
|
struct crc_ctx * | ctx ) |
#include <crc.h>
Finalize CRC calculation.
- Parameters
-
| dev | Pointer to the device structure |
| ctx | Pointer to the CRC context structure |
- Return values
-
| 0 | if successful |
| -ENOSYS | if function is not implemented |
| errno | code on failure |
◆ crc_update()
| int crc_update |
( |
const struct device * | dev, |
|
|
struct crc_ctx * | ctx, |
|
|
const void * | buffer, |
|
|
size_t | bufsize ) |
#include <crc.h>
Perform CRC calculation on the provided data buffer and retrieve result.
- Parameters
-
| dev | Pointer to the device structure |
| ctx | Pointer to the CRC context structure |
| buffer | Pointer to input data buffer |
| bufsize | Number of bytes in *buffer |
- Return values
-
| 0 | if successful |
| -ENOSYS | if function is not implemented |
| errno | code on failure |
◆ crc_verify()
#include <crc.h>
Verify CRC result.
- Parameters
-
| ctx | Pointer to the CRC context structure |
| expected | Expected CRC result |
- Return values
-
| 0 | if successful |
| -EBUSY | if CRC calculation is not completed |
| -EPERM | if CRC verification failed |