Changeset 8
- Timestamp:
- 11/19/98 04:07:18 (10 years ago)
- Files:
-
- lm-sensors/trunk/CONTRIBUTORS (added)
- lm-sensors/trunk/COPYING (added)
- lm-sensors/trunk/Makefile (modified) (7 diffs)
- lm-sensors/trunk/TODO (added)
- lm-sensors/trunk/doc/design (modified) (4 diffs)
- lm-sensors/trunk/i2c/MODIFICATIONS (added)
- lm-sensors/trunk/i2c/Module.mk (modified) (2 diffs)
- lm-sensors/trunk/i2c/algo-bit.c (modified) (2 diffs)
- lm-sensors/trunk/i2c/bit-lp.c (modified) (2 diffs)
- lm-sensors/trunk/i2c/detect/Module.mk (added)
- lm-sensors/trunk/i2c/drivers/Module.mk (added)
- lm-sensors/trunk/i2c/eeprom/Module.mk (added)
- lm-sensors/trunk/i2c/i2c-core.c (modified) (2 diffs)
- lm-sensors/trunk/i2c/i2c-dev.c (modified) (2 diffs)
- lm-sensors/trunk/kernel (added)
- lm-sensors/trunk/kernel/Module.mk (added)
- lm-sensors/trunk/kernel/include (added)
- lm-sensors/trunk/kernel/include/smbus.h (added)
- lm-sensors/trunk/kernel/smbus.c (added)
- lm-sensors/trunk/src (added)
- lm-sensors/trunk/src/Module.mk (added)
- lm-sensors/trunk/src/smbus.c (added)
- lm-sensors/trunk/src/smbus.h (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
lm-sensors/trunk/Makefile
r6 r8 1 # Makefile - Makefile for a Linux module for reading sensor data. 2 # Copyright (c) 1998 Frodo Looijaard <frodol@dds.nl> 3 # 4 # This program is free software; you can redistribute it and/or modify 5 # it under the terms of the GNU General Public License as published by 6 # the Free Software Foundation; either version 2 of the License, or 7 # (at your option) any later version. 8 # 9 # This program is distributed in the hope that it will be useful, 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 # GNU General Public License for more details. 13 # 14 # You should have received a copy of the GNU General Public License 15 # along with this program; if not, write to the Free Software 16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 18 1 19 # Uncomment the third line on SMP systems if the magic invocation fails. 2 20 SMP := $(shell if grep -q '^SMP[[:space:]]*=' /usr/src/linux/Makefile; then echo 1; else echo 0; fi) … … 13 31 # i2c modules. WARNING! If the i2c module version does not match the 14 32 # smbus/sensor module versions, you will get into severe problems. 33 # If you want to use a self-compiled version of the i2c modules, make 34 # sure <linux/i2c.h> contains the *correct* i2c header file! 15 35 I2C := 1 16 36 #I2C := 0 … … 46 66 47 67 # The subdirectories we need to build things in 48 MODULES := 68 MODULES := src 49 69 ifeq ($(I2C),1) 50 MODULES += i2c 70 MODULES += i2c i2c/detect i2c/drivers i2c/eeprom 51 71 endif 52 72 … … 54 74 MKDIR := mkdir -p 55 75 RM := rm -f 76 CC := gcc 56 77 57 78 # Determine the default compiler flags 58 CFLAGS := -D__KERNEL__ -DMODULE -I. -O2 -fomit-frame-pointer 79 # CFLAGS is to create in-kernel object files (modules); EXCFLAGS is to create 80 # non-kernel object files (which are linked into executables). 81 CFLAGS := -D__KERNEL__ -DMODULE -I. -Ii2c -O2 -fomit-frame-pointer 82 EXCFLAGS := -I. -O2 -Ii2c 59 83 60 84 ifeq ($(SMP),1) … … 65 89 CFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \ 66 90 -Wcast-align -Wwrite-strings -Wnested-externs -Winline 91 EXCFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \ 92 -Wcast-align -Wwrite-strings -Wnested-externs -Winline 67 93 endif 68 94 … … 71 97 endif 72 98 73 .PHONY: all clean install version package 99 ifeq ($(I2C),1) 100 CFLAGS += -DI2C 101 endif 102 103 .PHONY: all clean install version package dep 74 104 75 105 # Make all the default rule … … 79 109 include $(patsubst %,%/Module.mk,$(MODULES)) 80 110 111 # Making the dependency files - done automatically! 112 dep: 81 113 82 all ::114 all :: 83 115 84 install ::116 install :: all 85 117 86 118 clean:: 87 119 $(RM) lm_sensors-* 88 120 89 # Create a dependency file. Tricky. 121 # Create a dependency file. Tricky. We sed rule puts dir/file.d and dir/file.c 122 # in front of the dependency file rule. 90 123 %.d: %.c 91 gcc-M -MG $(CFLAGS) $< | \92 sed -e 's@ /[^ ]*@@g' -e 's@^\(.*\)\.o:@\1.d \1.o:@' > $@124 $(CC) -M -MG $(CFLAGS) $< | \ 125 sed -e 's@^\(.*\)\.o:@$*.d $*.o Makefile '`dirname $*.d`/Module.mk':@' > $@ 93 126 94 127 lm-sensors/trunk/doc/design
r3 r8 5 5 6 6 Document version 1.0, 19981101. 7 1.1, 19981111. 8 1.2, 19981118. 7 9 8 10 … … 131 133 Main SMBus handling 132 134 Unites I2C adapters and SMBus hosts (like the PIIX4) 135 Defines smbus_algorithm 133 136 134 137 piix4.o … … 332 335 we can add a hook somewhere in the i2c module to help us decide this. 333 336 334 335 A driver, client and adapter 336 ------------------- 337 This module consists in fact of two separate parts: first of all, it extends 338 all i2c structs to accomodate the new smbus fields. Second, it defines a 339 new algorithm (smbus_algorithm), that will be used by all non-i2c adapters. 340 341 342 A driver, client and algorithm 343 ------------------------------ 337 344 338 345 We will not need to extend i2c_driver, i2c_client or i2c_adapter. This means … … 347 354 348 355 349 An a lgorithm356 An adapter 350 357 ------------ 351 358 352 struct smbus_a lgorithm{359 struct smbus_adapter { 353 360 char name[32]; 354 361 unsigned int id; 355 int (* master_xfer) (struct smbus_adapter *adap, struct smbus_msg msgs[], 356 int num); 357 int (* slave_send) (struct smbus_adapter *,char *, int); 358 int (* slave_recv) (struct smbus_adapter *,char *, int); 359 int (* algo_control) (struct smbus_adapter *, unsigned int, unsigned long); 360 int (* client_register) (struct smbus_client *); 361 int (* client_unregister) (struct smbus_client *); 362 363 int (* smbus_access) (struct smbus_adapter *, __u8 addr, char read_write, 362 struct smbus_algorithm *algo; 363 void *data; 364 #ifdef SPINLOCK 365 spinlock_t lock; 366 unsigned long lockflags; 367 #else 368 struct semaphore lock; 369 #endif 370 unsigned int flags; 371 struct smbus_client *clients[I2C_CLIENT_MAX]; 372 int client_count; 373 int timeout; 374 int retries; 375 376 /* Here ended i2c_algorithm */ 377 s32 (* smbus_access) (__u8 addr, char read_write, 364 378 __u8 command, int size, union smbus_data * data); 365 379 } 366 380 367 368 A description of the above struct: 369 smbus_access: A function to access the SMBus. If the algorithm describes 370 a i2c bus, it will use master_xfer to simulate this operation. In 371 case of a PIIX4, master_xfer, slave_send and slave_recv will not be 372 implemented. 381 A description of the above struct: 382 smbus_access: A function to access the SMBus. It is only used for non-i2c 383 smbus adapters. 373 384 374 385 lm-sensors/trunk/i2c/Module.mk
r6 r8 1 # Module.mk - Makefile for a Linux module for reading sensor data. 2 # Copyright (c) 1998 Frodo Looijaard <frodol@dds.nl> 3 # 4 # This program is free software; you can redistribute it and/or modify 5 # it under the terms of the GNU General Public License as published by 6 # the Free Software Foundation; either version 2 of the License, or 7 # (at your option) any later version. 8 # 9 # This program is distributed in the hope that it will be useful, 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 # GNU General Public License for more details. 13 # 14 # You should have received a copy of the GNU General Public License 15 # along with this program; if not, write to the Free Software 16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 1 18 # Note that MODULE_DIR (the directory in which this file resides) is a 2 19 # 'simply expanded variable'. That means that its value is substituted … … 4 21 MODULE_DIR := i2c 5 22 6 TARGETS := $(MODULE_DIR)/i2c-core.o $(MODULE_DIR)/algo-bit.o \ 7 $(MODULE_DIR)/i2c-dev.o $(MODULE_DIR)/bit-lp.o \ 8 $(MODULE_DIR)/bit-velle.o $(MODULE_DIR)/bit-mb.o 23 # Regrettably, even 'simply expanded variables' will not put their currently 24 # defined value verbatim into the command-list of rules... 25 I2CTARGETS := $(MODULE_DIR)/i2c-core.o $(MODULE_DIR)/algo-bit.o \ 26 $(MODULE_DIR)/i2c-dev.o $(MODULE_DIR)/bit-lp.o \ 27 $(MODULE_DIR)/bit-velle.o $(MODULE_DIR)/bit-mb.o 9 28 10 29 # Include all dependency files 11 include $( TARGETS:.o=.d)30 include $(I2CTARGETS:.o=.d) 12 31 13 all :: $( TARGETS)32 all :: $(I2CTARGETS) 14 33 15 install :: $(TARGETS)34 install :: 16 35 $(MKDIR) $(MODDIR) 17 install -o root -g root -m 644 $( TARGETS) $(MODDIR)36 install -o root -g root -m 644 $(I2CTARGETS) $(MODDIR) 18 37 19 38 clean :: 20 $(RM) $( TARGETS) $(TARGETS:.o=.d)39 $(RM) $(I2CTARGETS) $(I2CTARGETS:.o=.d) lm-sensors/trunk/i2c/algo-bit.c
r7 r8 18 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 19 19 /* ------------------------------------------------------------------------- */ 20 static char alg_rcsid[] = "$Id: algo-bit.c,v 1. 1 1998/11/02 20:29:27 frodoExp $";20 static char alg_rcsid[] = "$Id: algo-bit.c,v 1.2 1998/11/03 03:48:44 phil Exp $"; 21 21 22 22 #include <linux/kernel.h> … … 639 639 MODULE_PARM_DESC(i2c_debug,"debug level - 0 off; 1 normal; 2,3 more verbose; 9 bit-protocol"); 640 640 641 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0))642 EXPORT_SYMBOL(i2c_bit_add_bus);643 EXPORT_SYMBOL(i2c_bit_del_bus);644 #endif645 641 646 642 int init_module(void) lm-sensors/trunk/i2c/bit-lp.c
r3 r8 18 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 19 19 /* ------------------------------------------------------------------------- */ 20 static char rcsid[] = "$Id: bit-lp.c,v 1. 5 1998/09/28 06:45:38 i2c Exp i2c$";20 static char rcsid[] = "$Id: bit-lp.c,v 1.1 1998/11/02 20:29:27 frodo Exp $"; 21 21 /* ------------------------------------------------------------------------- */ 22 22 … … 152 152 MODULE_PARM(base, "i"); 153 153 154 EXPORT_NO_SYMBOLS;155 156 154 int init_module(void) 157 155 { lm-sensors/trunk/i2c/i2c-core.c
r7 r8 18 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 19 19 /* ------------------------------------------------------------------------- */ 20 #define RCSID "$Id: i2c-core.c,v 1. 1 1998/11/02 20:29:27 frodoExp $"20 #define RCSID "$Id: i2c-core.c,v 1.2 1998/11/03 03:48:44 phil Exp $" 21 21 /* ------------------------------------------------------------------------- */ 22 22 … … 442 442 MODULE_PARM_DESC(i2c_debug,"debug level"); 443 443 444 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)) 445 EXPORT_SYMBOL(i2c_add_algorithm); 446 EXPORT_SYMBOL(i2c_del_algorithm); 447 EXPORT_SYMBOL(i2c_add_adapter); 448 EXPORT_SYMBOL(i2c_del_adapter); 449 EXPORT_SYMBOL(i2c_add_driver); 450 EXPORT_SYMBOL(i2c_del_driver); 451 EXPORT_SYMBOL(i2c_attach_client); 452 EXPORT_SYMBOL(i2c_detach_client); 453 454 EXPORT_SYMBOL(i2c_master_send); 455 EXPORT_SYMBOL(i2c_master_recv); 456 EXPORT_SYMBOL(i2c_control); 457 EXPORT_SYMBOL(i2c_transfer); 444 int init_module(void) 445 { 446 return i2c_init(); 447 } 448 449 void cleanup_module(void) 450 { 451 } 458 452 #endif 459 460 int init_module(void)461 {462 return i2c_init();463 }464 465 void cleanup_module(void)466 {467 }468 #endiflm-sensors/trunk/i2c/i2c-dev.c
r3 r8 18 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 19 19 /* ------------------------------------------------------------------------- */ 20 #define RCSID "$Id: i2c-dev.c,v 1. 6 1998/09/28 06:45:38 i2c Exp i2c$"20 #define RCSID "$Id: i2c-dev.c,v 1.1 1998/11/02 20:29:27 frodo Exp $" 21 21 /* ------------------------------------------------------------------------- */ 22 22 … … 338 338 MODULE_DESCRIPTION("I2C-Bus character device interface"); 339 339 340 EXPORT_NO_SYMBOLS;341 342 340 int init_module(void) 343 341 {
