Zephyr API Documentation 4.2.99
A Scalable Open Source RTOS
|
Interfaces for Cyclic Redundancy Check (CRC) devices. More...
Files | |
file | crc.h |
CRC public API header file. |
Data Structures | |
struct | crc_ctx |
CRC context structure. More... | |
struct | crc_driver_api |
Typedefs | |
typedef uint32_t | crc_init_val_t |
Provides a type to hold CRC initial seed value. | |
typedef uint32_t | crc_poly_t |
Provides a type to hold CRC polynomial value. | |
typedef uint32_t | crc_result_t |
Provides a type to hold CRC result value. | |
typedef int(* | crc_api_begin) (const struct device *dev, struct crc_ctx *ctx) |
Callback API upon CRC calculation begin See crc_begin() for argument description. | |
typedef int(* | crc_api_update) (const struct device *dev, struct crc_ctx *ctx, const void *buffer, size_t bufsize) |
Callback API upon CRC calculation stream update See crc_update() for argument description. | |
typedef int(* | crc_api_finish) (const struct device *dev, struct crc_ctx *ctx) |
Callback API upon CRC calculation finish See crc_finish() for argument description. |
Enumerations | |
enum | crc_state { CRC_STATE_IDLE = 0 , CRC_STATE_IN_PROGRESS } |
CRC state enumeration. More... |
Functions | |
int | crc_begin (const struct device *dev, struct crc_ctx *ctx) |
Configure CRC unit for calculation. | |
int | crc_update (const struct device *dev, struct crc_ctx *ctx, const void *buffer, size_t bufsize) |
Perform CRC calculation on the provided data buffer and retrieve result. | |
int | crc_finish (const struct device *dev, struct crc_ctx *ctx) |
Finalize CRC calculation. | |
static int | crc_verify (struct crc_ctx *ctx, crc_result_t expected) |
Verify CRC result. |
CRC input/output string flags | |
#define | CRC_FLAG_REVERSE_INPUT BIT(0) |
Reverse input string. | |
#define | CRC_FLAG_REVERSE_OUTPUT BIT(1) |
Reverse output string. |
Interfaces for Cyclic Redundancy Check (CRC) devices.
#define CRC_FLAG_REVERSE_INPUT BIT(0) |
#include <zephyr/drivers/crc.h>
Reverse input string.
#define CRC_FLAG_REVERSE_OUTPUT BIT(1) |
#include <zephyr/drivers/crc.h>
Reverse output string.
#include <zephyr/drivers/crc.h>
Callback API upon CRC calculation begin See crc_begin() for argument description.
#include <zephyr/drivers/crc.h>
Callback API upon CRC calculation finish See crc_finish() for argument description.
typedef int(* crc_api_update) (const struct device *dev, struct crc_ctx *ctx, const void *buffer, size_t bufsize) |
#include <zephyr/drivers/crc.h>
Callback API upon CRC calculation stream update See crc_update() for argument description.
typedef uint32_t crc_init_val_t |
#include <zephyr/drivers/crc.h>
Provides a type to hold CRC initial seed value.
typedef uint32_t crc_poly_t |
#include <zephyr/drivers/crc.h>
Provides a type to hold CRC polynomial value.
See CRC_POLYNOMIAL for predefined polynomial values.
typedef uint32_t crc_result_t |
#include <zephyr/drivers/crc.h>
Provides a type to hold CRC result value.
enum crc_state |
#include <zephyr/drivers/crc.h>
CRC state enumeration.
Enumerator | |
---|---|
CRC_STATE_IDLE | CRC device is in IDLE state. |
CRC_STATE_IN_PROGRESS | CRC calculation is in-progress. |
#include <zephyr/drivers/crc.h>
Configure CRC unit for calculation.
dev | Pointer to the device structure |
ctx | Pointer to the CRC context structure |
0 | if successful |
-ENOSYS | if function is not implemented |
errno | code on failure |
#include <zephyr/drivers/crc.h>
Finalize CRC calculation.
dev | Pointer to the device structure |
ctx | Pointer to the CRC context structure |
0 | if successful |
-ENOSYS | if function is not implemented |
errno | code on failure |
int crc_update | ( | const struct device * | dev, |
struct crc_ctx * | ctx, | ||
const void * | buffer, | ||
size_t | bufsize ) |
#include <zephyr/drivers/crc.h>
Perform CRC calculation on the provided data buffer and retrieve result.
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 |
0 | if successful |
-ENOSYS | if function is not implemented |
errno | code on failure |
|
inlinestatic |
#include <zephyr/drivers/crc.h>
Verify CRC result.
ctx | Pointer to the CRC context structure |
expected | Expected CRC result |
0 | if successful |
-EBUSY | if CRC calculation is not completed |
-EPERM | if CRC verification failed |