4 * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 #include <linux/completion.h>
35 #include <linux/device.h>
39 #include <asm/semaphore.h>
41 #include "w1_family.h"
43 #define W1_MAXNAMELEN 32
44 #define W1_SLAVE_DATA_SIZE 128
46 #define W1_SEARCH 0xF0
47 #define W1_CONDITIONAL_SEARCH 0xEC
48 #define W1_CONVERT_TEMP 0x44
49 #define W1_SKIP_ROM 0xCC
50 #define W1_READ_SCRATCHPAD 0xBE
51 #define W1_READ_ROM 0x33
52 #define W1_READ_PSUPPLY 0xB4
53 #define W1_MATCH_ROM 0x55
55 #define W1_SLAVE_ACTIVE (1<<0)
60 unsigned char name[W1_MAXNAMELEN];
61 struct list_head w1_slave_entry;
62 struct w1_reg_num reg_num;
68 struct w1_master *master;
69 struct w1_family *family;
71 struct completion dev_released;
73 struct bin_attribute attr_bin;
74 struct device_attribute attr_name, attr_val;
81 u8 (*read_bit)(unsigned long);
82 void (*write_bit)(unsigned long, u8);
84 u8 (*read_byte)(unsigned long);
85 void (*write_byte)(unsigned long, u8);
87 u8 (*read_block)(unsigned long, u8 *, int);
88 void (*write_block)(unsigned long, u8 *, int);
90 u8 (*touch_bit)(unsigned long, u8);
92 u8 (*reset_bus)(unsigned long);
97 struct list_head w1_master_entry;
99 unsigned char name[W1_MAXNAMELEN];
100 struct list_head slist;
101 int max_slave_count, slave_count;
102 unsigned long attempts;
114 wait_queue_head_t kwait;
115 struct semaphore mutex;
117 struct device_driver *driver;
119 struct completion dev_released;
120 struct completion dev_exited;
122 struct w1_bus_master *bus_master;
128 int w1_create_master_attributes(struct w1_master *);
129 void w1_destroy_master_attributes(struct w1_master *);
131 #endif /* __KERNEL__ */