25 #include <linux/kernel.h>
26 #include <linux/module.h>
28 #include <linux/device.h>
29 #include <linux/types.h>
34 #include "../w1_int.h"
35 #include "../w1_family.h"
37 #define CRC16_VALID 0xb001
40 #define COUNTER_COUNT 4
41 #define READ_BYTE_COUNT 42
52 struct w1_slave *
sl = dev_to_w1_slave(device);
53 struct w1_master *
dev = sl->master;
65 rom_addr = (12 << 5) + 31;
67 wrbuf[1] = rom_addr & 0xFF;
68 wrbuf[2] = rom_addr >> 8;
73 for (p = 0; p < 4; p++) {
86 rbuf[(p * READ_BYTE_COUNT) + ii]);
87 if (read_byte_count != (p + 1) * READ_BYTE_COUNT) {
89 "w1_counter_read() returned %u bytes "
90 "instead of %d bytes wanted.\n",
98 crc =
crc16(crc, rbuf, 11);
106 ((p - 1) * READ_BYTE_COUNT),
111 for (ii = 4; ii > 0; ii--) {
117 c,
"crc=YES c=%d\n", result);
131 static int w1_f1d_add_slave(
struct w1_slave *sl)
136 static void w1_f1d_remove_slave(
struct w1_slave *sl)
142 .add_slave = w1_f1d_add_slave,
143 .remove_slave = w1_f1d_remove_slave,
148 .fops = &w1_f1d_fops,
151 static int __init w1_f1d_init(
void)
156 static void __exit w1_f1d_exit(
void)