Home
last modified time | relevance | path

Searched refs:crc (Results 1 – 25 of 57) sorted by relevance

123

/Zephyr-Core-3.7.0/lib/crc/
Dcrc32c_sw.c27 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()
Dcrc16_sw.c11 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()
40 crc = (crc >> 1U) ^ poly; in crc16_reflect()
[all …]
Dcrc32_sw.c14 uint32_t crc32_ieee_update(uint32_t crc, const uint8_t *data, size_t len) in crc32_ieee_update() argument
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()
Dcrc8_sw.c32 uint8_t crc = initial_value; in crc8() local
36 crc ^= src[i]; in crc8()
40 if ((crc & 0x01) != 0) { in crc8()
41 crc = (crc >> 1) ^ polynomial; in crc8()
43 crc >>= 1; in crc8()
46 if ((crc & 0x80) != 0) { in crc8()
47 crc = (crc << 1) ^ polynomial; in crc8()
49 crc <<= 1; in crc8()
55 return crc; in crc8()
Dcrc4_sw.c12 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()
Dcrc24_sw.c17 uint32_t crc24_pgp_update(uint32_t crc, const uint8_t *data, size_t len) in crc24_pgp_update() argument
22 crc ^= (*data++) << 16; in crc24_pgp_update()
24 crc <<= 1; in crc24_pgp_update()
25 if (crc & 0x01000000) in crc24_pgp_update()
26 crc ^= CRC24_PGP_POLY; in crc24_pgp_update()
30 return crc; in crc24_pgp_update()
/Zephyr-Core-3.7.0/modules/littlefs/
Dzephyr_lfs_crc.c14 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.7.0/tests/net/lib/lwm2m/interop/src/
Dfirmware_update.c17 static uint32_t crc; variable
25 LOG_INF("UPDATE, (CRC %u)", crc); in firmware_update_cb()
45 crc = crc32_ieee(data, data_len); in firmware_block_received_cb()
47 crc = crc32_ieee_update(crc, data, data_len); in firmware_block_received_cb()
50 offset, data_len, last_block, crc); in firmware_block_received_cb()
/Zephyr-Core-3.7.0/tests/unit/crc/
Dmain.c16 ZTEST(crc, test_crc32c) in ZTEST() argument
43 ZTEST(crc, test_crc32_ieee) in ZTEST() argument
54 ZTEST(crc, test_crc24_pgp) in ZTEST() argument
70 ZTEST(crc, test_crc16) in ZTEST() argument
88 ZTEST(crc, test_crc16_ansi) in ZTEST() argument
103 ZTEST(crc, test_crc16_ccitt) in ZTEST() argument
109 uint16_t crc; in ZTEST() local
128 crc = crc16_ccitt(0, test3, sizeof(test3) - sizeof(uint16_t)); in ZTEST()
129 test3[sizeof(test3)-2] = (uint8_t)(crc >> 0); in ZTEST()
130 test3[sizeof(test3)-1] = (uint8_t)(crc >> 8); in ZTEST()
[all …]
/Zephyr-Core-3.7.0/samples/boards/nrf/system_off/src/
Dretained.c136 #define RETAINED_CRC_OFFSET offsetof(struct retained_data, crc)
137 #define RETAINED_CHECKED_SIZE (RETAINED_CRC_OFFSET + sizeof(retained.crc))
147 uint32_t crc = crc32_ieee((const uint8_t *)&retained, in retained_validate() local
149 bool valid = (crc == residue); in retained_validate()
177 uint32_t crc = crc32_ieee((const uint8_t *)&retained, in retained_update() local
180 retained.crc = sys_cpu_to_le32(crc); in retained_update()
Dretained.h35 uint32_t crc; member
/Zephyr-Core-3.7.0/subsys/mgmt/mcumgr/transport/src/
Dserial_util.c73 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()
179 uint16_t crc; in mcumgr_serial_tx_pkt() local
194 crc = mcumgr_serial_calc_crc(data, len); in mcumgr_serial_tx_pkt()
272 raw[0] = (crc & 0xff00) >> 8; in mcumgr_serial_tx_pkt()
273 raw[1] = crc & 0x00ff; in mcumgr_serial_tx_pkt()
280 raw[1] = (crc & 0xff00) >> 8; in mcumgr_serial_tx_pkt()
281 raw[2] = crc & 0x00ff; in mcumgr_serial_tx_pkt()
289 raw[2] = (crc & 0xff00) >> 8; in mcumgr_serial_tx_pkt()
[all …]
Dsmp_dummy.c362 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()
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()
550 uint16_t crc, mcumgr_serial_tx_cb cb, in mcumgr_dummy_tx_frame() argument
601 raw[0] = (crc & 0xff00) >> 8; in mcumgr_dummy_tx_frame()
602 raw[1] = crc & 0x00ff; in mcumgr_dummy_tx_frame()
614 raw[1] = (crc & 0xff00) >> 8; in mcumgr_dummy_tx_frame()
[all …]
/Zephyr-Core-3.7.0/drivers/crypto/
Dcrypto_ataes132a_priv.h118 uint16_t crc; in ataes132a_atmel_crc() local
122 for (i = 0, crc = 0U; i < length; i++) { in ataes132a_atmel_crc()
125 higher_crc_bit = crc >> 15; in ataes132a_atmel_crc()
126 double_carry = (crc & BIT(8)) << 1; in ataes132a_atmel_crc()
127 crc <<= 1; in ataes132a_atmel_crc()
128 crc |= double_carry; in ataes132a_atmel_crc()
131 crc ^= CRC16_POLY; in ataes132a_atmel_crc()
136 *(uint16_t *)output = crc << 8 | crc >> 8; in ataes132a_atmel_crc()
Dcrypto_ataes132a.c52 uint8_t crc[2]; in ataes132a_send_command() local
80 ataes132a_atmel_crc(data->command_buffer, nparams + 3, crc); in ataes132a_send_command()
81 data->command_buffer[nparams + 3] = crc[0]; in ataes132a_send_command()
82 data->command_buffer[nparams + 4] = crc[1]; in ataes132a_send_command()
115 ataes132a_atmel_crc(data->command_buffer, count - 2, crc); in ataes132a_send_command()
119 LOG_DBG("CALCULATED CRC %x%x", crc[0], crc[1]); in ataes132a_send_command()
122 while (crc[0] != data->command_buffer[count - 2] || in ataes132a_send_command()
123 crc[1] != data->command_buffer[count - 1]) { in ataes132a_send_command()
134 ataes132a_atmel_crc(data->command_buffer, count - 2, crc); in ataes132a_send_command()
141 LOG_DBG("CALCULATED CRC %x%x", crc[0], crc[1]); in ataes132a_send_command()
/Zephyr-Core-3.7.0/drivers/fpga/
Dfpga_ice40.c80 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
228 crc = crc32_ieee((uint8_t *)image_ptr, img_size); in fpga_ice40_load_gpio()
229 if (data->loaded && crc == data->crc) { in fpga_ice40_load_gpio()
230 LOG_WRN("already loaded with image CRC32c: 0x%08x", data->crc); in fpga_ice40_load_gpio()
[all …]
/Zephyr-Core-3.7.0/tests/net/ppp/driver/src/
Dmain.c271 uint16_t crc; in check_fcs() local
278 crc = crc16_ccitt(0xffff, buf->data, buf->len); in check_fcs()
283 crc = crc16_ccitt(crc, buf->data, buf->len); in check_fcs()
287 *fcs = crc; in check_fcs()
289 if (crc != 0xf0b8) { in check_fcs()
363 uint16_t crc; in calc_fcs() local
370 crc = crc16_ccitt(0xffff, buf->data, buf->len); in calc_fcs()
375 crc = crc16_ccitt(crc, buf->data, buf->len); in calc_fcs()
379 crc ^= 0xffff; in calc_fcs()
381 *fcs = crc; in calc_fcs()
/Zephyr-Core-3.7.0/tests/net/lib/lwm2m/interop/pytest/
Dtest_blockwise.py41 crc = int(re.search('CRC ([0-9]+)', line).group(1))
43 assert crc == zlib.crc32(fw)
71 crc = int(re.search('CRC ([0-9]+)', line).group(1))
73 assert crc == zlib.crc32(fw)
94 crc = int(lines[0])
95 assert crc == zlib.crc32(data)
102 assert crc == zlib.crc32(data)
/Zephyr-Core-3.7.0/include/zephyr/sys/
Dcrc.h247 uint32_t crc32_ieee_update(uint32_t crc, const uint8_t *data, size_t len);
261 uint32_t crc32_c(uint32_t crc, const uint8_t *data,
348 uint32_t crc24_pgp_update(uint32_t crc, const uint8_t *data, size_t len);
400 uint32_t crc = crc24_pgp_update(seed, src, len); in crc_by_type() local
403 crc &= CRC24_FINAL_VALUE_MASK; in crc_by_type()
404 return crc; in crc_by_type()
/Zephyr-Core-3.7.0/samples/arch/smp/pktqueue/src/
Dmain.c74 uint16_t crc; in init_datagram_queue() local
76 crc = crc16(POLYNOMIAL, 0x0000, in init_datagram_queue()
80 descriptors[queue_num][i].ptr[CRC_BYTE_1] = (uint8_t)(crc >> 8); in init_datagram_queue()
81 descriptors[queue_num][i].ptr[CRC_BYTE_2] = (uint8_t)(crc); in init_datagram_queue()
97 uint16_t crc, crc_orig; in test_thread() local
108 crc = crc16(POLYNOMIAL, 0x0000, qin_ptr->ptr, SIZE_OF_HEADER); in test_thread()
111 if (crc == crc_orig) { in test_thread()
/Zephyr-Core-3.7.0/modules/canopennode/
Dcanopen_program.c291 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
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.7.0/soc/microchip/mec/common/spigen/
Dmec_spi_gen.py96 def crc8(crc, data): argument
102 crc = ((crc << 4) & 0xff) ^ (CRC_TABLE[(crc >> 4) ^ (v >> 4)])
103 crc = ((crc << 4) & 0xff) ^ (CRC_TABLE[(crc >> 4) ^ (v & 0xf)])
104 return crc ^ 0x55
/Zephyr-Core-3.7.0/drivers/bluetooth/hci/
Dhci_nxp_setup.c273 uint8_t crc; in fw_upload_request_check_crc() local
276 crc = fw_upload_crc8(buffer, A6REQ_PAYLOAD_LEN + REQ_HEADER_LEN); in fw_upload_request_check_crc()
277 if (crc != buffer[A6REQ_PAYLOAD_LEN + REQ_HEADER_LEN]) { in fw_upload_request_check_crc()
282 crc = fw_upload_crc8(buffer, AbREQ_PAYLOAD_LEN + REQ_HEADER_LEN); in fw_upload_request_check_crc()
283 if (crc != buffer[AbREQ_PAYLOAD_LEN + REQ_HEADER_LEN]) { in fw_upload_request_check_crc()
712 uint32_t crc; in fw_upload_change_speed() local
724 crc = sys_cpu_to_le32(hdr_len); in fw_upload_change_speed()
725 memcpy(cmd5_hdrData + 8, &crc, 4); in fw_upload_change_speed()
726 crc = fw_upload_update_crc32(0, (char *)cmd5_hdrData, 12); in fw_upload_change_speed()
727 crc = sys_cpu_to_be32(crc); in fw_upload_change_speed()
[all …]
/Zephyr-Core-3.7.0/soc/nuvoton/npcx/common/ecst/
Decst.py734 crc = _finalize_crc(crc_calc)
735 crc_to_write = crc.to_bytes(4, "little")
736 crc_to_print = _hex_print_format(crc)
770 crc = _finalize_crc(crc_calc)
771 crc_to_write = crc.to_bytes(4, "little")
772 crc_to_print = _hex_print_format(crc)
920 def _crc_update(cur, crc, table): argument
929 tmp = crc ^ l_crc
930 crc = (crc >> 8) ^ table[(tmp & 0xff)]
931 return crc
[all …]
/Zephyr-Core-3.7.0/drivers/net/
Dppp.c590 uint16_t crc; in ppp_check_fcs() local
597 crc = crc16_ccitt(0xffff, buf->data, buf->len); in ppp_check_fcs()
602 crc = crc16_ccitt(crc, buf->data, buf->len); in ppp_check_fcs()
606 if (crc != 0xf0b8) { in ppp_check_fcs()
607 LOG_DBG("Invalid FCS (0x%x)", crc); in ppp_check_fcs()
764 uint16_t crc; in calc_fcs() local
775 crc = crc16_ccitt(0xffff, (const uint8_t *)&c, sizeof(c)); in calc_fcs()
778 crc = crc16_ccitt(crc, (const uint8_t *)&protocol, in calc_fcs()
783 crc = crc16_ccitt(crc, buf->data, buf->len); in calc_fcs()
787 crc ^= 0xffff; in calc_fcs()
[all …]

123