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

姑蘇ssl適用于網(wǎng)站、小程序/APP、API接口等需要進行數(shù)據(jù)傳輸應用場景,ssl證書未來市場廣闊!成為創(chuàng)新互聯(lián)建站的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18982081108(備注:SSL證書合作)期待與您的合作!
I2C(Inter-Integrated Circuit)是一種消息式命令和響應式控制系統(tǒng),通常被用于多系統(tǒng)(主機系統(tǒng)和外設)之間的總線通信。由于I2C電力低且性能好,它經(jīng)常用于執(zhí)行不同的異構(gòu)系統(tǒng)之間的感應,控制,存儲和數(shù)據(jù)交換操作,并被廣泛應用在許多行業(yè)中。
linux是一個自由和開放源代碼的操作系統(tǒng),具有優(yōu)秀的I/O性能,因此它在開發(fā)中使用I2C更為常見。Linux提供了一種可以完全控制I2C總線的方式,使應用程序可以完全控制I2C總線,而不需要專用硬件。因此,在Linux中使用I2C驅(qū)動是必不可少的。
I2C驅(qū)動在Linux中的應用:
Linux下的I2C驅(qū)動分三類:驅(qū)動程序?qū)?,設備和速度層次。驅(qū)動程序?qū)拥腎2C驅(qū)動用于初始化設備,設定總線的時鐘頻率,激活和管理總線中設備的活動,以及實現(xiàn)設備之間的數(shù)據(jù)傳輸。設備層的I2C驅(qū)動可以明確管理特定于一個設備的I2C接口,并進一步延展到驅(qū)動程序中支持功能。速度層次的I2C驅(qū)動涉及對總線線速,協(xié)議和時鐘延遲的控制。
為了給Linux內(nèi)核提供內(nèi)核態(tài)I2C驅(qū)動,內(nèi)核應該支持以下特性:在內(nèi)核空間調(diào)用I2C接口,控制I2C總線中設備的活動,在內(nèi)核空間進行數(shù)據(jù)傳輸,通過芯片的全部特性控制設備,在內(nèi)核空間調(diào)用I2C命令,并且I2C應用程序可以實現(xiàn)對應用程序的控制。
下面是Linux下的I2C Linux驅(qū)動程序:
/*
* 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ū)動在Linux中得到了廣泛的應用,它提供了在Linux中完全控制I2C總線的方式,并且可以讓應用程序完全控制I2C總線,而無需使用專用的硬件設備。Linux下的I2C驅(qū)動主要由驅(qū)動程序?qū)?,設備層和速度層三部分組成,他們分別實現(xiàn)了Linux內(nèi)核的I2C控制功能,控制I2C總線的活動,設置總線的時鐘頻率,進行數(shù)據(jù)傳輸和設備管理等操作。
成都服務器托管選創(chuàng)新互聯(lián),先上架開通再付費。
創(chuàng)新互聯(lián)(www.cdcxhl.com)專業(yè)-網(wǎng)站建設,軟件開發(fā)老牌服務商!微信小程序開發(fā),APP開發(fā),網(wǎng)站制作,網(wǎng)站營銷推廣服務眾多企業(yè)。電話:028-86922220
新聞名稱:系統(tǒng)i2c驅(qū)動在Linux系統(tǒng)上的應用(i2c驅(qū)動linux)
URL分享:http://fisionsoft.com.cn/article/ccdipjg.html


咨詢
建站咨詢
