Home
last modified time | relevance | path

Searched full:crc (Results 1 – 25 of 243) sorted by relevance

12345678910

/Zephyr-Core-3.5.0/include/zephyr/sys/
Dcrc.h12 * @brief CRC computation function
39 * @defgroup crc CRC
45 * @brief CRC algorithm enumeration
47 * These values should be used with the @ref crc dispatch function.
64 * @brief Generic function for computing a CRC-16 without input or output
67 * Compute CRC-16 by passing in the address of the input, the input length
71 * @note If you are planning to use a CRC based on poly 0x1012 the functions
76 * @param seed Initial value for the CRC computation
85 * @brief Generic function for computing a CRC-16 with input and output
88 * Compute CRC-16 by passing in the address of the input, the input length
[all …]
/Zephyr-Core-3.5.0/lib/crc/
Dcrc32c_sw.c7 #include <zephyr/sys/crc.h>
9 /* crc table generated from polynomial 0x1EDC6F41UL (Castagnoli) */
17 /* This value needs to be XORed with the final crc value once crc for
27 uint32_t crc32_c(uint32_t crc, const uint8_t *data, in crc32_c() argument
31 crc = CRC32C_INIT; in crc32_c()
35 crc = crc32c_table[(crc ^ data[i]) & 0x0F] ^ (crc >> 4); in crc32_c()
36 crc = crc32c_table[(crc ^ ((uint32_t)data[i] >> 4)) & 0x0F] ^ (crc >> 4); in crc32_c()
39 return last_pkt ? (crc ^ CRC32C_XOR_OUT) : crc; in crc32_c()
Dcrc32_sw.c7 #include <zephyr/sys/crc.h>
14 uint32_t crc32_ieee_update(uint32_t crc, const uint8_t *data, size_t len) in crc32_ieee_update() argument
16 /* crc table generated from polynomial 0xedb88320 */ in crc32_ieee_update()
24 crc = ~crc; in crc32_ieee_update()
29 crc = (crc >> 4) ^ table[(crc ^ byte) & 0x0f]; in crc32_ieee_update()
30 crc = (crc >> 4) ^ table[(crc ^ ((uint32_t)byte >> 4)) & 0x0f]; in crc32_ieee_update()
33 return (~crc); in crc32_ieee_update()
Dcrc16_sw.c7 #include <zephyr/sys/crc.h>
11 uint16_t crc = seed; in crc16() local
15 crc ^= (uint16_t)(src[i] << 8U); in crc16()
18 if (crc & 0x8000UL) { in crc16()
19 crc = (crc << 1U) ^ poly; in crc16()
21 crc = crc << 1U; in crc16()
27 return crc; in crc16()
32 uint16_t crc = seed; in crc16_reflect() local
36 crc ^= (uint16_t)src[i]; in crc16_reflect()
39 if (crc & 0x0001UL) { in crc16_reflect()
[all …]
Dcrc8_sw.c9 #include <zephyr/sys/crc.h>
32 uint8_t crc = initial_value; in crc8() local
36 crc ^= src[i]; in crc8()
40 if (crc & 0x01) { in crc8()
41 crc = (crc >> 1) ^ polynomial; in crc8()
43 crc >>= 1; in crc8()
46 if (crc & 0x80) { in crc8()
47 crc = (crc << 1) ^ polynomial; in crc8()
49 crc <<= 1; in crc8()
55 return crc; in crc8()
DKconfig4 config CRC config
5 bool "Cyclic redundancy check (CRC) Support"
7 Enable use of CRC.
9 if CRC
11 bool "CRC Shell"
15 Enable CRC checking for memory regions from the shell.
16 endif # CRC
Dcrc4_sw.c7 #include <zephyr/sys/crc.h>
12 uint8_t crc = initial_value; in crc4() local
17 crc ^= ((src[i] >> (4 * (1 - j))) & 0xf); in crc4()
21 if (crc & 0x01) { in crc4()
22 crc = (crc >> 1) ^ polynomial; in crc4()
24 crc >>= 1; in crc4()
27 if (crc & 0x8) { in crc4()
28 crc = (crc << 1) ^ polynomial; in crc4()
30 crc <<= 1; in crc4()
37 return crc & 0xF; in crc4()
/Zephyr-Core-3.5.0/tests/unit/crc/
Dmain.c8 #include <zephyr/sys/crc.h>
9 #include "../../../lib/crc/crc8_sw.c"
10 #include "../../../lib/crc/crc16_sw.c"
11 #include "../../../lib/crc/crc32_sw.c"
12 #include "../../../lib/crc/crc32c_sw.c"
13 #include "../../../lib/crc/crc7_sw.c"
15 ZTEST(crc, test_crc32c) in ZTEST() argument
30 * of one big stream whose CRC needs to be calculated. Note that the in ZTEST()
31 * CRC of the first string is passed over to the second crc calculation, in ZTEST()
42 ZTEST(crc, test_crc32_ieee) in ZTEST() argument
[all …]
Dtestcase.yaml2 utilities.crc:
5 - crc
/Zephyr-Core-3.5.0/modules/littlefs/
Dzephyr_lfs_crc.c9 /* Use the LFS naive CRC implementation until it has been decided which CRC to
13 /* Software CRC implementation with small lookup table */
14 uint32_t lfs_crc(uint32_t crc, const void *buffer, size_t size) in lfs_crc() argument
26 crc = (crc >> 4) ^ rtable[(crc ^ (data[i] >> 0)) & 0xf]; in lfs_crc()
27 crc = (crc >> 4) ^ rtable[(crc ^ (data[i] >> 4)) & 0xf]; in lfs_crc()
30 return crc; in lfs_crc()
/Zephyr-Core-3.5.0/samples/boards/nrf/system_off/src/
Dretained.c15 #include <zephyr/sys/crc.h>
136 #define RETAINED_CRC_OFFSET offsetof(struct retained_data, crc)
137 #define RETAINED_CHECKED_SIZE (RETAINED_CRC_OFFSET + sizeof(retained.crc))
141 /* The residue of a CRC is what you get from the CRC over the in retained_validate()
142 * message catenated with its CRC. This is the post-final-xor in retained_validate()
143 * residue for CRC-32 (CRC-32/ISO-HDLC) which Zephyr calls in retained_validate()
147 uint32_t crc = crc32_ieee((const uint8_t *)&retained, in retained_validate() local
149 bool valid = (crc == residue); in retained_validate()
151 /* If the CRC isn't valid, reset the retained data. */ in retained_validate()
177 uint32_t crc = crc32_ieee((const uint8_t *)&retained, in retained_update() local
[all …]
/Zephyr-Core-3.5.0/samples/arch/smp/pktqueue/src/
Dmain.c46 /* leave crc field zeroed */ in init_datagram_queue()
53 /* Compute crc for further comparison */ in init_datagram_queue()
54 uint16_t crc; in init_datagram_queue() local
56 crc = crc16(POLYNOMIAL, 0x0000, in init_datagram_queue()
59 /* Save crc value in header[CRC_BYTE_1-CRC_BYTE_2] field */ in init_datagram_queue()
60 descriptors[queue_num][i].ptr[CRC_BYTE_1] = (uint8_t)(crc >> 8); in init_datagram_queue()
61 descriptors[queue_num][i].ptr[CRC_BYTE_2] = (uint8_t)(crc); in init_datagram_queue()
77 uint16_t crc, crc_orig; in test_thread() local
81 /* Store original crc value from header */ in test_thread()
85 /* Crc field should be zero before crc calculation */ in test_thread()
[all …]
/Zephyr-Core-3.5.0/subsys/mgmt/mcumgr/transport/src/
Dserial_util.c12 #include <zephyr/sys/crc.h>
73 uint16_t crc; in mcumgr_serial_process_frag() local
132 crc = mcumgr_serial_calc_crc(rx_ctxt->nb->data, rx_ctxt->nb->len); in mcumgr_serial_process_frag()
133 if (crc != 0U) { in mcumgr_serial_process_frag()
138 /* Packet is complete; strip the CRC. */ in mcumgr_serial_process_frag()
167 * CRC.
179 uint16_t crc; in mcumgr_serial_tx_pkt() local
194 crc = mcumgr_serial_calc_crc(data, len); in mcumgr_serial_tx_pkt()
229 * in the two byte CRC. The frame can not be stretched and current logic does not in mcumgr_serial_tx_pkt()
230 * allow to send CRC separately so if CRC would not fit as a whole, shrink in mcumgr_serial_tx_pkt()
[all …]
Dsmp_dummy.c18 #include <zephyr/sys/crc.h>
362 uint16_t crc; in mcumgr_dummy_process_frag() local
417 crc = mcumgr_dummy_calc_crc(rx_ctxt->nb->data, rx_ctxt->nb->len); in mcumgr_dummy_process_frag()
418 if (crc != 0U) { in mcumgr_dummy_process_frag()
423 /* Packet is complete; strip the CRC. */ in mcumgr_dummy_process_frag()
447 uint16_t crc; in mcumgr_dummy_process_frag_outgoing() local
502 crc = mcumgr_dummy_calc_crc(tx_ctxt->nb->data, tx_ctxt->nb->len); in mcumgr_dummy_process_frag_outgoing()
503 if (crc != 0U) { in mcumgr_dummy_process_frag_outgoing()
508 /* Packet is complete; strip the CRC. */ in mcumgr_dummy_process_frag_outgoing()
538 * include a header or CRC.
[all …]
/Zephyr-Core-3.5.0/drivers/sensor/tmag5170/
DKconfig42 bool "Use CRC error detection"
44 select CRC
46 Verify CRC of RX data and append CRC to TX data
/Zephyr-Core-3.5.0/drivers/sensor/icp10125/
DKconfig17 bool "Check the CRC of measument data"
18 imply CRC
21 Verify the CRC checksum that appended to the measurement data.
/Zephyr-Core-3.5.0/soc/arm/nuvoton_npcx/common/ecst/
Decst.py436 print(f'- HDR - FW CRC Enabled - Offset '
561 """writes the fw crc start address and the crc size to the output file.
563 --crc start address should be 4 byte aligned, bigger than crc end address
564 --crc size should be 4 byte aligned, and be set to firmware length minus
565 crc start offset by default
566 --crc end address is crc start address + crc size bytes
579 # default value for crc size
591 message = f'Firmware crc offset address ' \
596 message = f'CRC start address ({fw_crc_start_to_print}) should' \
597 f' be less or equal to CRC end address ({fw_crc_end_to_print}) \n'
[all …]
/Zephyr-Core-3.5.0/drivers/fpga/
Dfpga_ice40.c21 #include <zephyr/sys/crc.h>
80 uint32_t crc; member
107 static void fpga_ice40_crc_to_str(uint32_t crc, char *s) in fpga_ice40_crc_to_str() argument
114 for (i = 0; i < sizeof(crc) * NIBBLES_PER_BYTE; ++i, crc >>= BITS_PER_NIBBLE) { in fpga_ice40_crc_to_str()
115 nibble = crc & GENMASK(BITS_PER_NIBBLE, 0); in fpga_ice40_crc_to_str()
117 s[sizeof(crc) * NIBBLES_PER_BYTE - i - 1] = ch; in fpga_ice40_crc_to_str()
120 s[sizeof(crc) * NIBBLES_PER_BYTE] = '\0'; in fpga_ice40_crc_to_str()
212 uint32_t crc; in fpga_ice40_load_gpio() local
227 /* crc check */ in fpga_ice40_load_gpio()
228 crc = crc32_ieee((uint8_t *)image_ptr, img_size); in fpga_ice40_load_gpio()
[all …]
/Zephyr-Core-3.5.0/drivers/sensor/ens210/
DKconfig42 bool "CRC Check"
45 Check the crc value after data reading.
58 or crc not ok.
/Zephyr-Core-3.5.0/drivers/adc/
DKconfig.lmp90xxx15 select CRC
38 bool "Use Cyclic Redundancy Check (CRC)"
41 Use Cyclic Redundancy Check (CRC) to verify the integrity of
/Zephyr-Core-3.5.0/subsys/fs/fcb/
DKconfig13 select CRC
22 This allows the FCB instances to disable CRC checks in
/Zephyr-Core-3.5.0/drivers/ethernet/
Deth_adin2111_priv.h49 /* Enable CRC Append */
71 /* Indicates that a CRC error was detected */
133 /* SPI register write buffer size without CRC */
135 /* SPI register write buffer with appended CRC size (1 for header, 1 for register) */
138 /* SPI register read buffer size with TA without CRC */
140 /* SPI register read buffer with TA and appended CRC size (1 header, 1 for register) */
143 /* SPI read fifo cmd buffer size with TA without CRC */
145 /* SPI read fifo cmd buffer with TA and appended CRC size */
/Zephyr-Core-3.5.0/subsys/modem/
DKconfig27 select CRC
37 select CRC
/Zephyr-Core-3.5.0/modules/canopennode/
Dcanopen_program.c13 #include <zephyr/sys/crc.h>
279 /** @brief Calculate crc for region in flash
284 * @pcrc Pointer to uint32_t where crc will be written if return value is 0
291 uint32_t crc = 0; in flash_crc() local
303 crc = crc32_ieee_update(crc, buffer, len); in flash_crc()
309 *pcrc = crc; in flash_crc()
319 uint32_t crc = 0; in canopen_odf_1f56() local
334 /* Reading from flash and calculating crc can take 100ms or more, and in canopen_odf_1f56()
381 err = flash_crc(flash_area, offset, len, &crc); in canopen_odf_1f56()
394 CO_setUint32(odf_arg->data, crc); in canopen_odf_1f56()
/Zephyr-Core-3.5.0/dts/bindings/retention/
Dzephyr,retention.yaml63 data size). Value is size in bytes (0 for none, 1 for 8-bit CRC, 2 for
64 16-bit CRC, 4 for 32-bit CRC). Default is to not use a checksum.

12345678910