39static const char*
s_tag =
"CRC";
42typedef enum : uint8_t {
50typedef enum : uint8_t {
93typedef enum : uint32_t {
121 const uint32_t word_count = len >> 2U;
122 for (uint32_t i = 0U; i < word_count; i++) {
123 const uint32_t base = i << 2U;
124 const uint32_t packed = (uint32_t)data[base + 0U] | ((uint32_t)data[base + 1U] << 8U) |
125 ((uint32_t)data[base + 2U] << 16U) |
152 for (uint32_t i = 0U; i < len; i++) {
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_RETURN_ON_ERROR(err, tag, message)
Early return on error, propagating the code upward.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
static void internal_crc_feed_bytes(const uint8_t *data, uint32_t len)
Feed len bytes through the calculator via the 8-bit alias.
static bool internal_ra8_crc_is_32bit_poly(ra8_crc_poly_t poly)
Determine if a polynomial uses 32-bit data input.
ra8_err_t ra8_crc_exit_stop(void)
Exit MSTP-gated stop.
ra8_err_t ra8_crc_init(ra8_crc_poly_t poly)
Configure the CRC block for a given polynomial.
ra8_crccr0_bit_t
Bit positions inside CRCCR0 (HUM Ch 48.2.1 p 3181).
@ k_ra8_crccr0_dorclr_shift
CRCCR0.DORCLR bit position.
@ k_ra8_crccr0_gps_mask
CRCCR0.GPS[2:0] mask.
@ k_ra8_crccr0_dorclr
CRCCR0.DORCLR mask (write-only).
@ k_ra8_crccr0_lms_shift
CRCCR0.LMS bit position.
ra8_err_t ra8_crc_compute(const uint8_t *data, uint32_t len, uint32_t *out_crc)
Compute a CRC over a byte buffer.
crc_shift_t
Byte-3 shift for little-endian word assembly.
@ k_crc_shift_byte3
CRC shift byte3.
void ra8_crc_reset(void)
Clear the running CRC state.
static void internal_crc_feed_words(const uint8_t *data, uint32_t len)
Feed len bytes through the calculator as packed 32-bit words.
ra8_err_t ra8_crc_enter_stop(void)
Put CRC into MSTP-gated stop.
ra8_err_t ra8_crc_deinit(void)
Tear down the CRC block (disable + MSTP release).
ra8_err_t ra8_crc_get_status(uint8_t *out_poly)
Read the current polynomial selection (CRCCR0.GPS).
ra8_err_t ra8_crc_set_poly(ra8_crc_poly_t poly)
Change the CRC polynomial at runtime without a reset.
ra8_crc_seed_t
Standard init / xor-out value for IEEE-style 32-bit CRCs.
@ k_ra8_crc_32bit_seed
IEEE-802.3 / Castagnoli init = xor-out.
CRC hardware calculator driver header.
CRC calculator register layout for the Renesas RA8D2.
ra8_crc_poly_t
Polynomial selection values written to CRCCR0.GPS[2:0].
@ k_ra8_crc_poly_32_ieee802_3
GPS=100 CRC-32 (IEEE 802.3).
@ k_ra8_crc_poly_32c_rev
GPS=101 CRC-32C (Castagnoli, reflected).
static volatile r_crc_regs_t * ra8_crc(void)
Get pointer to the CRC peripheral register block.
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Lightweight Logging Interface for ra8-firmware.
#define ra8_log_info_val(tag, message, value)
RA8 log info val.
Ref-counted Module Stop Control wrapper for the RA8D2.
ra8_err_t ra8_mstp_enable(ra8_mstp_t id)
Reference-counted "ungate this peripheral" request.
ra8_err_t ra8_mstp_disable(ra8_mstp_t id)
Reference-counted "gate this peripheral" request.
@ k_ra8_mstp_crc
MSTPC1 CRC.
CRC peripheral register block.
volatile uint32_t CRCDOR
+0x08 Output Data (32-bit, CRC-32/32C).
volatile uint8_t CRCCR0
+0x00 Control Register 0 (GPS/LMS/DORCLR).
volatile uint8_t CRCDIR_BY
+0x04 Input Data (8-bit alias).
volatile uint32_t CRCDIR
+0x04 Input Data (32-bit, CRC-32/32C).
volatile uint8_t CRCCR1
+0x01 Control Register 1 (CRCSWR/CRCSEN).