I2C adapter -- 1

Source: Internet
Author: User

What is an I2C adapter?
I read an article about the Linux I2C system, saying that there are two main hardware: one client, one adapter, and the I2C architecture centered around them.
But what is adapter? Is it an I2C controller? If so, isn't the I2C controller having a few registers?
For example, the I2C Controller in a single-chip microcomputer can work on her twice.

I don't quite understand the I2C adapter here.

Wmmy2008 published on
The I2C adapter is a struct used to abstract a physical I2C bus, and is also soft together with the Linux device driver architecture ..

SK | fisker published on
[I = s] This post was last edited by SK | fisker on [/I]

I mean the hardware I2C adapter ~
Not familiar with hardware
(Ah, actually not familiar with software)

I just looked at the adapter related to S3C2410.CodeIt is found that the core is actually reading and writing the several I2C control registers. No other hardware was operated from start to end.
It is hard to say that -- S3C2410 is integrated with I2C adapter, but its operation interface is those I2C registers, so we don't need to care about the so-called adapter hardware details.
But if you understand it like this, there is a new question: why is there a client (slave) driver in addition to the Adapter Driver ?! As mentioned above, after the adapter is connected to the slave, the CPU directly reads and writes the adapter (/dev/i2c-0) is not over, because the CPU, adapter and slave are in this relationship:
CPU ---- adapter ---- slave
I really don't know why I have another slave driver.

I have a lot of typing, but I don't know whether to make it clear.
I sincerely hope you will share your thoughts on this post.

Wmmy2008 published on
[B] Reply [url = http://linux.chinaunix.net/bbs/redirect.php? Goto = findpost & pid = 7280820 & ptid = 1168450] 3 # [/url] [I] SK | fisker [/I] [/B]

If you only talk about hardware, it is an I2C controller integrated in the CPU (An interface of the I2C bus. However, this interface is used to control the SCL line.) (The register is provided to the user. The so-called adapter and client are not provided on the hardware. The adapter and client are all abstracted by the Linux driver software, I don't know whether it's clear or not? --This sentence is correct.

SK | fisker posted on
[B] Reply [url = http://linux.chinaunix.net/bbs/redirect.php? Goto = findpost & pid = 7280841 & ptid = 1168450] 4 # [/url] [I] wmmy2008 [/I] [/B]

I have read several articles about the embedded excellent area I2CArticleYou know what's going on.
In fact, I2C driver can also bypass the client this thing, direct access to/dev/i2c-x
However, the so-called "adapter" does exist, but it is just a concept-so are some register-controlled items. --There is no error in this understanding.
Alas, it's a perfect place.

Linux beginners March
A specific I2C Device Driver requires two interfaces. One is an interface for the I2C core layer, which is mounted to the I2C adapter layer to implement access to the I2C bus and I2C devices, including the implementation of attach_adapter, detach_client, command and other interface functions. The other is the interface at the user application layer, which provides the userProgramInterfaces for accessing I2C devices, including interfaces for implementing open, release, read, write, and most important IOCTL standard file operations.

Linux beginners March
The interface functions of I2C core layer are described as follows:

Attach_adapter: When the I2C driver calls i2c_add_driver () for registration, it calls this function for every I2C adapter (corresponding to an I2C bus) found, check whether the I2C adapter meets the specified I2C driver conditions. If yes, connect the I2C adapter and use the I2C adapter to access the I2C bus and I2C devices..

Detach_client: the I2C driver calls this function when deleting an I2C device and clears the data structure describing this I2C device. In this way, the device cannot be accessed later.

Command: to implement a series of sub-functions based on the features of the device, it is the underlying implementation of the ioctl function in the user interface ---Very correct

Published on 0vk0
The development process of an I2C device driver. The key to implementation is divided into two parts: 1. Several specific function functions in the struct i2c_drvier data structure must be implemented for the I2C core interface. These functions are the basis for communication between I2C drivers and I2C bus physical layer (I2C Controller) and I2C device devices. 2. for user application layer interfaces, you must implement some specific functions in the struct file_operation data structure, such as open, release, read, write, and lseek functions. Among the above two types of interfaces, the interface for I2C core is the basis for access to I2C devices, to achieve specific access to the I2C bus; the interface for the user's application layer is convenient for application development, an essential part of implementing specific device functions.

Readkernel published on
I2C adapter is an I2C Bus Controller Interface abstracted from software.
A physical I2C bus can be attached to multiple hardware devices (slave), and a CPU can be attached to multiple I2C buses (imagine a PCI Bus)
The I2C bus controller is the hardware interface for the CPU to access the I2C bus, that is, the registers you mentioned ---Correct

The Linux I2C framework is so complicated that it is designed for universality and compliance with the Linux kernel driver model.

Single-chip microcomputer software is also a natural habit.

Star316 published on

Simply put, your Development Board has several I2C interfaces, there are several adapters, that is, there are several I2C bus, I2C client corresponds to your peripheral I2C device, there are several clients that insert these devices into the Development Board and correspond to one of the bus. The corresponding one corresponds to one of the adapters, and the following is the matching between the client and the adapter, next we will do what we should do --Puyi Tong



Note: The excellent article URL associated with it

Http://bbs.chinaunix.net/thread-3622012-1-1.html

Http://bbs.chinaunix.net/thread-2014978-1-1.html

Http://bbs.chinaunix.net/thread-2038280-1-1.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.