当前位置:网站首页>Two ideas of I2C driver implementation (I2C dev.c and I2C core.c)
Two ideas of I2C driver implementation (I2C dev.c and I2C core.c)
2022-06-21 06:56:00 【Snail taking off】
1、 take I2C How the controller is exposed to the application (i2c-dev.c)
(1)i2c-dev.c The idea of mode is to provide and I2C The way in which the devices on the bus send and receive data , But not responsible for specific timing or business , The specific timing and business are realized by the upper business ;
(2) The embodiment of this way : Register at I2C After driving , Will see "/dev/i2c-n(n=0,1,2······)" Device node , Used to open the device node , And then through read、write、ioctl Wait for the interface to connect with I2C Interface device communication ;
(3) This way is not often used , Because it is necessary to put the timing of operating specific hardware into the application , Application developers are required to understand the specific hardware operation sequence , Also understand I2C bus protocol . The general timing is to be implemented in the driver , Try to shield the difference of hardware for the application ;
(4) Such as reading data : Application first open Open the device node , then ioctl Set the device to be operated in I2C Address on the bus , Finally, according to I2C Read between bus protocol and device / Writing data ;
a key : This method is directly provided to the application I2C Operation method of the controller , every last "/dev/i2c-n(n=0、1、2、······)", Each device node represents Soc One of them I2C controller , The application can operate the device node, that is, operate I2C controller , Go and mount in I2C Slave devices on the bus communicate ;
2、 take I2C The controller is abstracted as a common driver ( i2c-core.c)
(1) take I2C The communication sequence is abstracted into a simple read-write interface , for I2C Interface device driver calls , This method is generally used with other driver frameworks ;
(2) In this way I2C The driver is equivalent to the kernel I2C Communication is abstracted , Because of all the I2C The interface equipment adopts I2C Bus protocol for communication , Then we will I2C Communication is abstracted into one for others I2C Basic function driver of interface device driver call ;
(3) Is equivalent to I2C The driver is implemented as a common driver , Be similar to platform Bus , It may not involve specific hardware differences , all I2C Interface devices can be shared I2C Drive to read and write data ;
(4) for example I2C Interface touch screen : The application operates the touch screen through input Subsystem operation , adopt open"/dev/eventn" Device node , The application only needs to accept the reported input events , I don't care how the touch screen reports , I don't even know if the touch screen is used I2C The bus interacts with the host ;
3、 Compare the two ways
(1)i2c-dev.c The way to put I2C The operating method of the equipment is exposed to the application , The timing of the specific operating hardware is controlled by the application , Can do some non-standard I2C Functions of the protocol , But it increases the difficulty and workload of application development , Is not commonly used ;
(2) take I2C The controller is abstracted into a common driver for other drivers to call , Masked the application I2C Content of communication , It simplifies the difficulty of application development ;
(3) take I2C The controller is abstracted into a common driver for other drivers to call ,I2C The framework that drives itself is complex , Increase the learning difficulty of those responsible for driving development ;
(4)i2c-dev.c In the end, it is also called i2c-core.c File interface , It's just encapsulated ;
边栏推荐
- 关于#mysql#的问题,如何解决?
- 152-Solana入门(十六)- 创建MetaplexNFT
- Consistency between database and cache data
- 155 Solana storage array
- 工作那点事
- Debezium error report processing series 18: solve the problem that the table structure cannot be obtained
- 五层参考模型各层总结
- Hub, switch, router
- Introduction to missing data filling dataset (1) -- Introduction to multiple datasets and dataset preprocessing (beast, covertype, credit, EEG, iris and letter)
- [transfer] liurun: don't discuss business with people without logic
猜你喜欢

TweenMax不规则几何图形背景带动画js特效

Use the loupe cell browser to view the results of 10x single cell transcriptome analysis

异常的相关介绍

Filtre Bloom

C skill tree evaluation

Matplotlib subgraph beautification

Issue 6: which mainstream programming language should college students choose

(programming exercises of various regular numbers) the prime number in the output range, the factorization prime factor of an integer, the maximum common divisor and minimum common multiple of two num

【JS】截取字符串

关于#mysql#的问题,如何解决?
随机推荐
【基于栈的二叉树中序遍历】二叉树的中序遍历+栈,O(h)的空间复杂度
Bloom filter
【FPGA小波变换】基于FPGA的图像9/7整数小波变换verilog实现
[notes for personal use] detailed steps for connecting MyEclipse to MySQL database
[GNN] Application of GNN neural network toolbox and MATLAB simulation
PyG教程(1):初识Pytorch Geometric
The database has the problem of user changing password
Issue 6: which mainstream programming language should college students choose
Required Integer parameter ‘XXX‘ is not present
@nonnull annotation of Lombok
【转】刘润:不要和没有逻辑的人讨论业务
Building a hard core Gateway - resume
Product manager proficient in Axure tools
[input] input box event summary
Required Integer parameter ‘XXX‘ is not present
数据分析之:不同行业的常见指标
Understand this point
win10上vs2017配置Eigen3开发环境
老用户回来看看
Excel_submit