Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
w1.c File Reference
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/list.h>
#include <linux/interrupt.h>
#include <linux/spinlock.h>
#include <linux/timer.h>
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/kthread.h>
#include <linux/freezer.h>
#include <linux/atomic.h>
#include "w1.h"
#include "w1_log.h"
#include "w1_int.h"
#include "w1_family.h"
#include "w1_netlink.h"

Go to the source code of this file.

Macros

#define W1_MASTER_ATTR_RO(_name, _mode)
 
#define W1_MASTER_ATTR_RW(_name, _mode)
 

Functions

 MODULE_LICENSE ("GPL")
 
 MODULE_AUTHOR ("Evgeniy Polyakov <[email protected]>")
 
 MODULE_DESCRIPTION ("Driver for 1-wire Dallas network protocol.")
 
 module_param_named (timeout, w1_timeout, int, 0)
 
 module_param_named (max_slave_count, w1_max_slave_count, int, 0)
 
 module_param_named (slave_ttl, w1_max_slave_ttl, int, 0)
 
 DEFINE_MUTEX (w1_mlock)
 
 LIST_HEAD (w1_masters)
 
int w1_create_master_attributes (struct w1_master *master)
 
void w1_destroy_master_attributes (struct w1_master *master)
 
void w1_slave_detach (struct w1_slave *sl)
 
struct w1_master * w1_search_master_id (u32 id)
 
struct w1_slave * w1_search_slave (struct w1_reg_num *id)
 
void w1_reconnect_slaves (struct w1_family *f, int attach)
 
void w1_slave_found (struct w1_master *dev, u64 rn)
 
void w1_search (struct w1_master *dev, u8 search_type, w1_slave_found_callback cb)
 
void w1_search_process_cb (struct w1_master *dev, u8 search_type, w1_slave_found_callback cb)
 
int w1_process (void *data)
 
 module_init (w1_init)
 
 module_exit (w1_fini)
 

Variables

int w1_max_slave_count = 10
 
int w1_max_slave_ttl = 10
 
struct device_driver w1_master_driver
 
struct device w1_master_device
 

Macro Definition Documentation

#define W1_MASTER_ATTR_RO (   _name,
  _mode 
)
Value:
struct device_attribute w1_master_attribute_##_name = \
__ATTR(w1_master_##_name, _mode, \
w1_master_attribute_show_##_name, NULL)

Definition at line 502 of file w1.c.

#define W1_MASTER_ATTR_RW (   _name,
  _mode 
)
Value:
struct device_attribute w1_master_attribute_##_name = \
__ATTR(w1_master_##_name, _mode, \
w1_master_attribute_show_##_name, \
w1_master_attribute_store_##_name)

Definition at line 507 of file w1.c.

Function Documentation

DEFINE_MUTEX ( w1_mlock  )
LIST_HEAD ( w1_masters  )
MODULE_AUTHOR ( "Evgeniy Polyakov <[email protected]>"  )
MODULE_DESCRIPTION ( "Driver for 1-wire Dallas network protocol."  )
module_exit ( w1_fini  )
module_init ( w1_init  )
MODULE_LICENSE ( "GPL"  )
module_param_named ( timeout  ,
w1_timeout  ,
int  ,
 
)
module_param_named ( max_slave_count  ,
w1_max_slave_count  ,
int  ,
 
)
module_param_named ( slave_ttl  ,
w1_max_slave_ttl  ,
int  ,
 
)
int w1_create_master_attributes ( struct w1_master *  master)

Definition at line 544 of file w1.c.

void w1_destroy_master_attributes ( struct w1_master *  master)

Definition at line 549 of file w1.c.

int w1_process ( void data)

Definition at line 977 of file w1.c.

void w1_reconnect_slaves ( struct w1_family f,
int  attach 
)

Definition at line 794 of file w1.c.

void w1_search ( struct w1_master *  dev,
u8  search_type,
w1_slave_found_callback  cb 
)

Performs a ROM Search & registers any devices found. The 1-wire search is a simple binary tree search. For each bit of the address, we read two bits and write one bit. The bit written will put to sleep all devies that don't match that bit. When the two reads differ, the direction choice is obvious. When both bits are 0, we must choose a path to take. When we can scan all 64 bits without having to choose a path, we are done.

See "Application note 187 1-wire search algorithm" at www.maxim-ic.com

The master device to search Function to call when a device is found

Read two bits and write one bit

Definition at line 863 of file w1.c.

struct w1_master* w1_search_master_id ( u32  id)
read

Definition at line 747 of file w1.c.

void w1_search_process_cb ( struct w1_master *  dev,
u8  search_type,
w1_slave_found_callback  cb 
)

Definition at line 951 of file w1.c.

struct w1_slave* w1_search_slave ( struct w1_reg_num id)
read

Definition at line 765 of file w1.c.

void w1_slave_detach ( struct w1_slave *  sl)

Definition at line 723 of file w1.c.

void w1_slave_found ( struct w1_master *  dev,
u64  rn 
)

Definition at line 828 of file w1.c.

Variable Documentation

struct device w1_master_device
Initial value:
= {
.parent = NULL,
.bus = &w1_bus_type,
.init_name = "w1 bus master",
.driver = &w1_master_driver,
.release = &w1_master_release
}

Definition at line 197 of file w1.c.

struct device_driver w1_master_driver
Initial value:
= {
.name = "w1_master_driver",
.bus = &w1_bus_type,
.probe = w1_master_probe,
}

Definition at line 191 of file w1.c.

int w1_max_slave_count = 10

Definition at line 49 of file w1.c.

int w1_max_slave_ttl = 10

Definition at line 50 of file w1.c.