struct w1_bus_master — operations available on a bus master
struct w1_bus_master {
void * data;
u8 (* read_bit) (void *);
void (* write_bit) (void *, u8);
u8 (* touch_bit) (void *, u8);
u8 (* read_byte) (void *);
void (* write_byte) (void *, u8);
u8 (* read_block) (void *, u8 *, int);
void (* write_block) (void *, const u8 *, int);
u8 (* triplet) (void *, u8);
u8 (* reset_bus) (void *);
u8 (* set_pullup) (void *, int);
void (* search) (void *, struct w1_master *,u8, w1_slave_found_callback);
}; the first parameter in all the functions below
Sample the line level return the level read (0 or 1)
Sets the line level
the lowest-level function for devices that really support the
1-wire protocol.
touch_bit(0) = write-0 cycle
touch_bit(1) = write-1 / read cycle
return the bit read (0 or 1)
Reads a bytes. Same as 8 touch_bit(1) calls.
return the byte read
Writes a byte. Same as 8 touch_bit(x) calls.
Same as a series of read_byte calls
return the number of bytes read
Same as a series of write_byte calls
Combines two reads and a smart write for ROM searches
return bit0=Id bit1=comp_id bit2=dir_taken
long write-0 with a read for the presence pulse detection
return -1=Error, 0=Device present, 1=No device present
Put out a strong pull-up pulse of the specified duration.
return -1=Error, 0=completed
Really nice hardware can handles the different types of ROM search w1_master* is passed to the slave found callback. u8 is search_type, W1_SEARCH or W1_ALARM_SEARCH