新聞中心
系統(tǒng)I2C驅(qū)動(dòng)說明:

姑蘇ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場(chǎng)景,ssl證書未來市場(chǎng)廣闊!成為創(chuàng)新互聯(lián)建站的ssl證書銷售渠道,可以享受市場(chǎng)價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18982081108(備注:SSL證書合作)期待與您的合作!
I2C(Inter-Integrated Circuit)是一種消息式命令和響應(yīng)式控制系統(tǒng),通常被用于多系統(tǒng)(主機(jī)系統(tǒng)和外設(shè))之間的總線通信。由于I2C電力低且性能好,它經(jīng)常用于執(zhí)行不同的異構(gòu)系統(tǒng)之間的感應(yīng),控制,存儲(chǔ)和數(shù)據(jù)交換操作,并被廣泛應(yīng)用在許多行業(yè)中。
linux是一個(gè)自由和開放源代碼的操作系統(tǒng),具有優(yōu)秀的I/O性能,因此它在開發(fā)中使用I2C更為常見。Linux提供了一種可以完全控制I2C總線的方式,使應(yīng)用程序可以完全控制I2C總線,而不需要專用硬件。因此,在Linux中使用I2C驅(qū)動(dòng)是必不可少的。
I2C驅(qū)動(dòng)在Linux中的應(yīng)用:
Linux下的I2C驅(qū)動(dòng)分三類:驅(qū)動(dòng)程序?qū)?,設(shè)備和速度層次。驅(qū)動(dòng)程序?qū)拥腎2C驅(qū)動(dòng)用于初始化設(shè)備,設(shè)定總線的時(shí)鐘頻率,激活和管理總線中設(shè)備的活動(dòng),以及實(shí)現(xiàn)設(shè)備之間的數(shù)據(jù)傳輸。設(shè)備層的I2C驅(qū)動(dòng)可以明確管理特定于一個(gè)設(shè)備的I2C接口,并進(jìn)一步延展到驅(qū)動(dòng)程序中支持功能。速度層次的I2C驅(qū)動(dòng)涉及對(duì)總線線速,協(xié)議和時(shí)鐘延遲的控制。
為了給Linux內(nèi)核提供內(nèi)核態(tài)I2C驅(qū)動(dòng),內(nèi)核應(yīng)該支持以下特性:在內(nèi)核空間調(diào)用I2C接口,控制I2C總線中設(shè)備的活動(dòng),在內(nèi)核空間進(jìn)行數(shù)據(jù)傳輸,通過芯片的全部特性控制設(shè)備,在內(nèi)核空間調(diào)用I2C命令,并且I2C應(yīng)用程序可以實(shí)現(xiàn)對(duì)應(yīng)用程序的控制。
下面是Linux下的I2C Linux驅(qū)動(dòng)程序:
/*
* i2c-core.c – a device driver for the I2C bus interface
*
* This file is part of the Linux kernel.
*
* Copyright (C) 2002-2009 Albert Huang
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include
#include
#include
/* Linux I2C bus driver structure */
static struct i2c_driver i2c_core_driver = {
.driver = {
.name = “i2c-core”
},
.id_table = i2c_core_ids,
.probe = i2c_core_probe,
.remove = i2c_core_remove,
};
/* register the I2C driver in the Linux kernel */
static int __init i2c_core_init(void)
{
return i2c_add_driver(&i2c_core_driver);
}
/* unregister the I2C driver in the Linux kernel */
static void __exit i2c_core_exit(void)
{
i2c_del_driver(&i2c_core_driver);
}
module_init(i2c_core_init);
module_exit(i2c_core_exit);
總結(jié):
I2C驅(qū)動(dòng)在Linux中得到了廣泛的應(yīng)用,它提供了在Linux中完全控制I2C總線的方式,并且可以讓應(yīng)用程序完全控制I2C總線,而無需使用專用的硬件設(shè)備。Linux下的I2C驅(qū)動(dòng)主要由驅(qū)動(dòng)程序?qū)?,設(shè)備層和速度層三部分組成,他們分別實(shí)現(xiàn)了Linux內(nèi)核的I2C控制功能,控制I2C總線的活動(dòng),設(shè)置總線的時(shí)鐘頻率,進(jìn)行數(shù)據(jù)傳輸和設(shè)備管理等操作。
成都服務(wù)器托管選創(chuàng)新互聯(lián),先上架開通再付費(fèi)。
創(chuàng)新互聯(lián)(www.cdcxhl.com)專業(yè)-網(wǎng)站建設(shè),軟件開發(fā)老牌服務(wù)商!微信小程序開發(fā),APP開發(fā),網(wǎng)站制作,網(wǎng)站營(yíng)銷推廣服務(wù)眾多企業(yè)。電話:028-86922220
分享題目:系統(tǒng)i2c驅(qū)動(dòng)在Linux系統(tǒng)上的應(yīng)用(i2c驅(qū)動(dòng)linux)
網(wǎng)站URL:http://m.5511xx.com/article/ccdipjg.html


咨詢
建站咨詢
