static ssize_t w1_f12_read_state( struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) { u8 w1_buf[6]={W1_F12_FUNC_READ_STATUS, 7, 0, 0, 0, 0}; struct w1_slave *sl = kobj_to_w1_slave(kobj); u16 crc=0; int i; ssize_t rtnval=1; if (off != 0) return 0; if (!buf) return -EINVAL; mutex_lock(&sl->master->bus_mutex); if (w1_reset_select_slave(sl)) { mutex_unlock(&sl->master->bus_mutex); return -EIO; } w1_write_block(sl->master, w1_buf, 3); w1_read_block(sl->master, w1_buf+3, 3); for (i=0; i<6; i++) crc=crc16_byte(crc, w1_buf[i]); if (crc==0xb001) /* good read? */ *buf=((w1_buf[3]>>5)&3)|0x30; else
/** * Compute the CRC-16 for the data buffer * * @param crc previous CRC value * @param buffer data pointer * @param len number of bytes in the buffer * @return the updated CRC value */ crc16_t crc16(crc16_t crc, const void *buffer, unsigned int len) { const unsigned char *cp = buffer; while (len--) crc = crc16_byte(crc, *cp++); return crc; }
/** * Compute the CRC-16 for the data buffer * * @param crc previous CRC value * @param buffer data pointer * @param len number of bytes in the buffer * @return the updated CRC value */ Uint16 crc16(const char * buffer, size_t len, Uint16 crc ) { while (len--) { crc = crc16_byte(crc, (Uint8)*buffer); ++buffer; } return crc; }
/** * crc16 - compute the CRC-16 for the data buffer * @crc: previous CRC value * @buffer: data pointer * @len: number of bytes in the buffer * * Returns the updated CRC value. */ uint16_t bd_crc16(uint16_t crc, uint8_t const *buffer, uint16_t len) { while (len--) crc = crc16_byte(crc, *buffer++); return crc; }
/** * crc16 - compute the CRC-16 for the data buffer * @crc: previous CRC value * @buffer: data pointer * @len: number of bytes in the buffer * * Returns the updated CRC value. */ u16 crc16(u16 crc, u8 const *buffer, size_t len) { while (len--) crc = crc16_byte(crc, *buffer++); return crc; }
/** * crc16 - compute the CRC-16 for the data buffer * @crc: previous CRC value * @buffer: data pointer * @len: number of bytes in the buffer * * Returns the updated CRC value. */ uint16 crc16(uint16 crc, uint8 const *buffer, uint32 len) { while(len--) crc = crc16_byte(crc, *buffer++); return crc; }
/** * crc16 - compute the CRC-16 for the data buffer * @crc: previous CRC value * @buffer: data pointer * @len: number of bytes in the buffer * * Returns the updated CRC value. */ R_API ut16 r_hash_crc16(ut16 crc, ut8 const *buffer, ut64 len) { while (len--) { crc = crc16_byte (crc, *buffer++); } return r_read_le16 (&crc); }
/** * crc16 - compute the CRC-16 for the data buffer * @crc: previous CRC value * @buffer: data pointer * @len: number of bytes in the buffer * * Returns the updated CRC value. */ unsigned short crc16(unsigned short crc, unsigned char const *buffer, size_t len) { while (len--) crc = crc16_byte(crc, *buffer++); return crc; }
/* * crc16 - compute the CRC-16 for the data buffer * @crc: previous CRC value * @buffer: data pointer * @len: number of bytes in the buffer * * Returns the updated CRC value. */ unsigned short crc16(unsigned short crc, unsigned char *buffer, unsigned int len) { while(len--) { crc = crc16_byte(crc, *buffer++); } return crc; }
static u16 crc16(u16 crc, u8 const *buffer, u32 len) { while (len--) crc = crc16_byte(crc, *buffer++); return crc; }