Lines Matching +full:crc +full:- +full:enabled
5 * SPDX-License-Identifier: Apache-2.0
26 * @param data - array of data to encode
27 * @param encode - action to be performed - true(encode), false(decode)
42 * https://www.analog.com/en/app-notes/how-to-program-the-max14906-quadchannel- in max149x6_crc()
43 * industrial-digital-output-digital-input.html in max149x6_crc()
47 data_bit = (data[0] >> (7 - i)) & 0x01; in max149x6_crc()
57 data_bit = (data[1] >> (7 - i)) & 0x01; in max149x6_crc()
67 data_bit = (extra_byte >> (7 - i)) & 0x01; in max149x6_crc()
82 * @param dev - MAX149x6 device config.
83 * @param addr - Register value to which data is written.
84 * @param val - Value which is to be written to requested register.
90 uint8_t crc; in max149x6_reg_transceive() local
96 const struct max149x6_config *config = dev->config; in max149x6_reg_transceive()
100 .len = config->pkt_size, in max149x6_reg_transceive()
106 .len = config->pkt_size, in max149x6_reg_transceive()
110 if (config->crc_en & 0) { in max149x6_reg_transceive()
115 FIELD_PREP(MAX149x6_CHIP_ADDR_MASK, config->spi_addr) | in max149x6_reg_transceive()
119 /* If CRC enabled calculate it */ in max149x6_reg_transceive()
120 if (config->crc_en) { in max149x6_reg_transceive()
125 ret = spi_transceive_dt(&config->spi, &tx, &rx); in max149x6_reg_transceive()
132 /* if CRC enabled check readed */ in max149x6_reg_transceive()
133 if (config->crc_en) { in max149x6_reg_transceive()
134 crc = max149x6_crc(&local_rx_buff[0], false); in max149x6_reg_transceive()
135 if (crc != (local_rx_buff[2] & 0x1F)) { in max149x6_reg_transceive()
136 LOG_ERR("READ CRC ERR (%d)-(%d)\n", crc, (local_rx_buff[2] & 0x1F)); in max149x6_reg_transceive()
137 return -EINVAL; in max149x6_reg_transceive()
145 /* In case of write we are getting 2 diagnostic bytes - byte0 & byte1 in max149x6_reg_transceive()