Автор работы: Пользователь скрыл имя, 17 Января 2012 в 14:29, курсовая работа
В настоящее время только Philips производит более 150 наименований I2C-совместимых устройств, функционально предназначенных работы в электронном оборудовании различного назначения. В их числе ИС памяти, видеопроцессоров и модулей обработки аудио- и видео-сигналов, АЦП и ЦАП, драйверы ЖК-индикаторов, процессоры со встоенным аппаратным контроллером I2C шины и многое другое.
Введение 5
1 Шина управления I2C 10
2 Исследование драйвера 14
Заключение 15
Список использованных источников 16
663 force_##chip6, force_##chip7, \
664 NULL }; \
665 I2C_CLIENT_INSMOD_COMMON
666
667 #define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7,
668 chip8) \
669 enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
670 chip7, chip8 }; \
671 I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
672 "boldly assume to be present"); \
673 I2C_CLIENT_MODULE_PARM_FORCE(c
674 I2C_CLIENT_MODULE_PARM_FORCE(c
675 I2C_CLIENT_MODULE_PARM_FORCE(c
676 I2C_CLIENT_MODULE_PARM_FORCE(c
677 I2C_CLIENT_MODULE_PARM_FORCE(c
678 I2C_CLIENT_MODULE_PARM_FORCE(c
679 I2C_CLIENT_MODULE_PARM_FORCE(c
680 I2C_CLIENT_MODULE_PARM_FORCE(c
681 static unsigned short *forces[] = { force, force_##chip1, \
682 force_##chip2, force_##chip3, \
683 force_##chip4, force_##chip5, \
684 force_##chip6, force_##chip7, \
685 force_##chip8, NULL }; \
686 I2C_CLIENT_INSMOD_COMMON
687
688 #endif /* _LINUX_I2C_H */
1 /* i2c-core.c - a device driver for the iic-bus interface */
2 /* ------------------------------
3 */
4 /* Copyright (C) 1995-99 Simon G. Vogl
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19 /* ------------------------------
20 */
21
22 /* With some changes from Kyцsti Mдlkki <kmalkki@cc.hut.fi>.
23 All SMBus-related things are written by Frodo Looijaard <frodol@dds.nl>
24 SMBus 2.0 support by Mark Studebaker <mdsxyz123@yahoo.com> and
25 Jean Delvare <khali@linux-fr.org> */
26
27 #include <linux/module.h>
28 #include <linux/kernel.h>
29 #include <linux/errno.h>
30 #include <linux/slab.h>
31 #include <linux/i2c.h>
32 #include <linux/init.h>
33 #include <linux/idr.h>
34 #include <linux/seq_file.h>
35 #include <linux/platform_device.h>
36 #include <asm/uaccess.h>
37
38
39 static LIST_HEAD(adapters);
40 static LIST_HEAD(drivers);
41 static DECLARE_MUTEX(core_lists);
42 static DEFINE_IDR(i2c_adapter_idr);
43
44 /* match always succeeds, as we want the probe() to tell if we really
45
46 static int i2c_device_match(struct device *dev, struct device_driver *drv)
47 {
48 return 1;
49 }
50
51 static int i2c_bus_suspend(struct device * dev, pm_message_t state)
52 {
53 int rc = 0;
54
55 if (dev->driver && dev->driver->suspend)
56 rc = dev->driver->suspend(dev, state);
57 return rc;
58 }
59
60 static int i2c_bus_resume(struct device * dev)
61 {
62 int rc = 0;
63
64 if (dev->driver && dev->driver->resume)
65 rc = dev->driver->resume(dev);
66 return rc;
67 }
68
69 struct bus_type i2c_bus_type = {
70 .name = "i2c",
71 .match = i2c_device_match,
72 .suspend = i2c_bus_suspend,
73 .resume = i2c_bus_resume,
74 };
75
76 static int i2c_device_probe(struct device *dev)
77 {
78 return -ENODEV;
79 }
80
81 static int i2c_device_remove(struct device *dev)
82 {
83 return 0;
84 }
85
86 void i2c_adapter_dev_release(struct device *dev)
87 {
88 struct i2c_adapter *adap = dev_to_i2c_adapter(dev);
89 complete(&adap->dev_released);
90 }
91
92 struct device_driver i2c_adapter_driver = {
93 .owner = THIS_MODULE,
94 .name = "i2c_adapter",
95 .bus = &i2c_bus_type,
96 .probe = i2c_device_probe,
97 .remove = i2c_device_remove,
98 };
99
100 static void i2c_adapter_class_dev_release(
101 {
102 struct i2c_adapter *adap = class_dev_to_i2c_adapter(dev);
103 complete(&adap->class_dev_
104 }
105
106 struct class i2c_adapter_class = {
107 .owner = THIS_MODULE,
108 .name = "i2c-adapter",
109 .release =
&i2c_adapter_class_dev_release
110 };
111
112 static ssize_t show_adapter_name(struct device *dev, struct
113
114 {
115 struct i2c_adapter *adap = dev_to_i2c_adapter(dev);
116 return sprintf(buf, "%s\n", adap->name);
117 }
118 static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL);
119
120
121 static void i2c_client_release(struct device *dev)
122 {
123 struct i2c_client *client = to_i2c_client(dev);
124 complete(&client->released);
125 }
126
127 static ssize_t show_client_name(struct device *dev, struct device_attribute
128
Информация о работе Исследование драйвера ядра Linux для шины I2C