Scroll to navigation

STRUCT W1_BUS_MASTER(9) W1 API internal to the kernel STRUCT W1_BUS_MASTER(9)

NAME

struct_w1_bus_master - operations available on a bus master

SYNOPSIS

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); };

MEMBERS

void * data

the first parameter in all the functions below

u8 (*)(void *) read_bit

Sample the line level return the level read (0 or 1)

void (*)(void *, u8) write_bit

Sets the line level

u8 (*)(void *, u8) touch_bit

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)

u8 (*)(void *) read_byte

Reads a bytes. Same as 8 touch_bit(1) calls. return the byte read

void (*)(void *, u8) write_byte

Writes a byte. Same as 8 touch_bit(x) calls.

u8 (*)(void *, u8 *, int) read_block

Same as a series of read_byte calls return the number of bytes read

void (*)(void *, const u8 *, int) write_block

Same as a series of write_byte calls

u8 (*)(void *, u8) triplet

Combines two reads and a smart write for ROM searches return bit0=Id bit1=comp_id bit2=dir_taken

u8 (*)(void *) reset_bus

long write-0 with a read for the presence pulse detection return -1=Error, 0=Device present, 1=No device present

u8 (*)(void *, int) set_pullup

Put out a strong pull-up pulse of the specified duration. return -1=Error, 0=completed

void (*)(void *, struct w1_master *,u8, w1_slave_found_callback) search

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

NOTE

read_bit and write_bit are very low level functions and should only be used with hardware that doesn't really support 1-wire operations, like a parallel/serial port. Either define read_bit and write_bit OR define, at minimum, touch_bit and reset_bus.

AUTHOR

David Fries <David@Fries.net>

Author.

COPYRIGHT

June 2017 Kernel Hackers Manual 4.11