CRC drivers accelerate the CRC subsystem with a hardware CRC unit. They are optional: without one, the subsystem computes every CRC in software.
The CRC unit class, struct pbl_crc, sits under CONFIG_CRC_HW, which the
application enables. Its drivers select the hidden CONFIG_CRC_HW_ACCEL
symbol and implement one operation per algorithm. Each takes a running value
and a buffer, processes a prefix of it that is a whole number of 32-bit
words, and returns its length in bytes.
The subsystem calls the unit of the crc role.
The subsystem includes include/pbl/drivers/crc.h, where the unit is
opaque. CRC drivers include include/pbl/drivers/crc/driver.h, which adds
the unit structure, its operations and the class state and initializer
macros.
Returning less than the full length is always allowed: the subsystem finishes in software. The class returns 0 before the device is ready, as when its self-test failed, and a driver returns 0 whenever the hardware cannot be used for any other reason, so callers never see a failure.
The API reference documents the interface.
Generated from PebbleOS 7416f78a1. This page is maintained in the pebbleos repository: docs/drivers/crc/index.md.