亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? the i2c layer.htm

?? LINUX內核編程的一些程序例子
?? HTM
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0061)http://www.geocities.com/marco_corvi/games/lkpe/i2c/index.htm -->
<HTML><HEAD><TITLE>The I2C layer</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"><LINK 
href="The I2C layer_file/style.css" rel=stylesheet>
<META content="MSHTML 6.00.2800.1170" name=GENERATOR></HEAD>
<BODY>
<H2>The I2C layer</H2>
<DIV>References:<BR><A href="http://secure.netroedge.com/~lm78/" 
target=_top>http://secure.netroedge.com/~lm78/</A><BR>Documentation/i2c<BR></DIV><BR 
clear=all><BR clear=all><BR clear=all>
<DIV><IMG height=55 src="The I2C layer_file/i2clogo.jpg" width=50 align=left 
VALIGN="TOP"> I2C (Inter-Integrated Circuit), pronounced "i square c", is a 
simple two wire bus protocol developed by Philips for intercommunication among 
integrated circuits. It has become a de-facto standard due to its semplicity and 
the possibility to manage flexible addressing. </DIV>
<DIV>The I2C core layer manages bus adapters, device drivers and device clients. 
Devices can be on the i2c bus or an attached bus (eg, isa); drivers manages 
classes of devices, and clients describe individual devices. The I2C core 
provides the communication protocol(s). It uses a callback mechanims the set up 
the relations among the components. Callbacks that manage the components 
relations cannot be NULL, the other callbacks may be NULL if the object does not 
need to do anything. </DIV>
<DIV>Every object (driver, client, adapter, and algorithm) has a name (an 
descriptive string up to 32 chars), an id (unique identification number), and 
flags (that define how it should be used). clients and adapters have a private 
data field which can point to specific structures. </DIV>
<DIV>The <B>driver</B> id's in the range 0xf000 to 0xffff are reserved for local 
use. So one can use one of these to test an I2C driver. As for the flags it is 
important to define I2C_DF_NOTIFY so that the driver is notified whenever a new 
adapter is found. Finally the driver's name should be a descriptive string (up 
to 40 chars). </DIV>
<DIV>The driver's inc/dec_use() can just be MOD_INC/DEC_USE_COUNT, so that the 
driver's code is not unloaded while an application is using it, if the driver is 
compiled as a module. command() is an ioctl-like interface. attach_adapter() is 
called by the I2C core when the driver is registered or when a new adapter is 
inserted. detach_client() is called when a client is removed. </DIV>
<DIV>The <B>client</B> represents an individual device. It has a pointer to its 
driver and to the adapter used for communications. Clients that want to have 
usage_count managed by I2C core should set the flags I2C_CLIENT_ALLOW_USE, and 
I2C_CLIENT_ALLOW_MULTIPLE_USE for multiple use. These are checked by 
i2c_use_client() and i2c_release_client(). </DIV>
<DIV>The <B>algorithm</B> encompasses the data manipulation of a transfer. 
functionality() shuold return a flag of supported functionalities (I2C_FUNC_XXX 
things). master_xfer() is the core transfer function, on which other i/o 
functions rely. </DIV>
<DIV>The <B>adapter</B> describes a bus. It has a pointer to the algorithm used 
to transfer data, a list of clients, and two methods to allow client 
registration and unregistration. </DIV><BR clear=all><IMG height=480 
src="The I2C layer_file/i2c.gif" width=640> <BR clear=all>
<H3>The I2C core functions</H3>
<DIV><B>The object management functions</B> 
<UL>
  <LI>i2c_adapter_id(adapter) returns the adapter's id; 
  <LI>i2c_get_functionality(adapter) if the adapter's algorithm has the 
  functionality() method returns its result, otherwise returns 0xffffffff, which 
  means "every functionality"; 
  <LI>i2c_check_functionality(adapter, func) checks if func is included in 
  i2c_get_functionality(adapter) (this is always true if the adapter's algorithm 
  does not implement functionality(); 
  <LI>i2c_check_addr(adapter, addr) returns -EBUSY if there is already a client 
  of the adapter that is using the address; <BR>
  <LI>i2c_add_adapter(adapter) inserts the adapter in the adapters[] array and 
  for each driver, that has flags I2C_DF_NOTIFY | I2C_DF_DUMMY, calls the 
  attach_adapter() callback; 
  <LI>i2c_del_adapter(adapter) for each client of the adapter calls the driver's 
  detach_client() callback, and finally it removes the adapter from adapters[]; 
  <BR>
  <LI>i2c_add_driver(driver) inserts the driver in the drivers[] array and, if 
  the driver flags has I2C_DF_NOTIFY | I2C_DF_DUMMY, calls the driver's callback 
  attach_adapter() on each adapters[]; 
  <LI>i2c_del_driver(driver) scans the adapters[] list and, for each adapter 
  client that has that driver, calls the driver's detach_client() callback; <BR>
  <LI>i2c_attach_client(client): the client must have address (addr) and 
  adapter. It first checks that the client address is not busy (i2c_check_addr). 
  Then inserts the client in the adapter's clients[] list, and calls the 
  adapter's client_register() callback. 
  <LI>i2c_inc_use_client() and i2c_dec_use_client() are called when an 
  application opens/closes a client. They forward to the client's driver and 
  adapter inc/dec_use methods; 
  <LI>i2c_get_client(dr_id, ad_id, client) ... 
  <LI>i2c_use_client() and i2c_release_client() change the client's usage_count 
  and call the i2c/inc/dec_use_client(). </LI></UL></DIV>
<DIV><B>The bus functions</B> 
<UL>
  <LI>transfer(adapter, msg[], num) calls the adapter's algorithm master_xfer(), 
  if there is one; 
  <LI>i2c_master_send(client, buf, cnt) and i2c_master_recv(client, buf, cnt) 
  prepares a message and calls the adapter's algorithm master_xfer(), if there 
  is one; 
  <LI>i2c_probe(adapter, address_data, found_fct) scans the addresses from 0x00 
  to 0x7f (seven bit address line): skip if the address is in use 
  (i2c_check_addr), if the adapter id is among the "force" list call the 
  found_fct(adapter,addr,0,0), otherwise skip if it is among the "ignore", or do 
  a probe if it is "normal" or "probe": examine if there is a client with 
  i2c_smbus_xfer(adapter,addr,0,0,0,I2C_SMBUS_QUICK,NULL) and call the 
  found_fct(adapter,addr,0,-1). </LI></UL>
<DIV>
<DIV><B>The smbus functions</B> <BR>The I/O functions are defined in terms of 
i2c_smbus_xfer(): 
<UL>
  <LI>i2c_smbus_xfer(adapter, addr, flags, rw, cmd, size, data) if the adapter's 
  algorithm has smbus_xfer() method use it, otherwise use the 
  i2c_smbus_xfer_emulate() method; 
  <LI>i2c_smbus_xfer_emulate(...) emulates the SMBus on the I2C bus. It has an 
  array of two messages (uses 2 for READ, 1 for WRITE). If the size is 
  I2C_SMBUS_QUICK is a zero-length message. Otherwise sets up the message(s) 
  data properly and calls i2c_transfer(adapter, msg, num). In case of read, 
  reads the response back into the data. 
  <LI>i2c_smbus_write_quick(client, value) 
  <LI>i2c_smbus_read_byte(client) 
  <LI>i2c_smbus_write_byte(client, value(; 
  <LI>i2c_smbus_read_byte_data(client, cmd); 
  <LI>i2c_smbus_write_byte_data(client, cmd, value); 
  <LI>i2c_smbus_read_word_data(client, cmd); 
  <LI>i2c_smbus_write_word_data(client, cmd, value); 
  <LI>i2c_smbus_process_call(client, cmd, value); 
  <LI>i2c_smbus_read_block_data(client, cmd, values); 
  <LI>i2c_smbus_write_block_data(client, cmd, len, values); 
  <LI>i2c_smbus_write_i2c_block_data(client, cmd, len, values); </LI></UL></DIV>
<H3>The I2C device functions</H3>
<DIV>The module i2c-dev.c provides a /dev interface of i2c adapters to user 
applications. Each i2c adapter receives a number from the I2C core. This number 
can be seen through the /proc/bus/i2c interface. The I2C adapters are character 
devices with major 89 and minor that number assigned by the I2C core. </DIV>
<DIV>The code i2c-dev.c defines a dummy i2c_driver (named i2cdev_driver) with 
methods i2cdev_attach_adapter, i2cdev_detach_client, and i2cdev_command, and an 
i2c_client template (named i2cdev_client_template) with the i2cdev_driver, no 
adapter, and no private data. </DIV>
<DIV>The I2C device operations are (these oerations act on the client which is 
stored in the file' private_data filed) 
<UL>
  <LI>i2cdev_lseek (from version 2.4.10 only): return -ESPIPE. 
  <LI>i2cdev_read: an i2c_master_recv() on the client. 
  <LI>i2cdev_write: an i2c_master_send() on the client. 
  <LI>i2cdev_ioctl. 
  <LI>i2cdev_open, creates a new client (after the i2cdev_client_template) with 
  adapter the i2cdev_adaps indexed by the inode minor. Possibly calls the 
  adapter' inc_use(). 
  <LI>i2cdev_release: free the file' private_data (the client) and possibly 
  calls the adapter' dec_use(). </LI></UL><BR>The ioctl commands are (arg is the 
ioctl argument) 
<UL>
  <LI>I2C_SLAVE or I2C_SLAVE_FORCE, set the client address to arg; 
  <LI>I2C_TENBIT: set (arg != 0) or clear the flag I2C_M_TEN (ten-bit 
  addresses); 
  <LI>I2C_FUNCS: get the functionality of the client' adapter; 
  <LI>I2C_RDWR: arg should point to an i2c_rdwr_ioctl_data structure. It copies 
  the data from user space, calls i2c_transfer(), and eventually copies the data 
  back to user space. 
  <LI>I2C_SMBUS: arg should point to an i2c_smbus_ioctl_data structure. It calls 
  i2c_smbus_xfer(). The i2c_smbus_ioctl_data struct contains a rw flag, a 
  command, the size of the data and the data pointer (of type i2c_smbus_data). 
  </LI></UL></DIV>
<DIV>The management functions are 
<UL>
  <LI>i2cdev_attach_adapter: inserts the adapter in the i2cdev_adaps[] list. 
  <LI>i2cdev_detach_client: does nothing, returns 0. 
  <LI>i2cdev_command: always returns -1. 
  <LI>i2cdev_init: registers a char device ("i2c") with i2cdev_fops, and adds to 
  it the dummy driver i2cdev_driver. 
  <LI>i2cdev_cleanup: (possibly) unregister the char dev. </LI></UL></DIV>
<DIV>The SMbus I/O functions are defined in terms of i2c_smbus_access(file, rw, 
cmd, size, data), which fills an i2c_smbus_ioctl_data with the arguments and 
calls ioctl(file, I2C_SMBUS, args) which in turns calls i2c_smbus_xfer() to do 
the actual i/o. </DIV>
<H3>The I2C proc functions</H3>
<DIV>The I2C proc interface is defined in the header file 
include/linux/i2c-proc.h. A general callback function type is declared as <PRE>   i2c_real_callback( client, op, ctl_name, nrels_mag, results )
</PRE>where "client" is a pointer to a client device we want to interact with, 
"op" is an operation flag that can be one of SENSORS_PROC_REAL_INFO/READ/WRITE. 
Before using the callback function a ctl_table must be registered; ctl_name -s 
the SYSCTL id of the file being accessed. The function reads or writes real 
numbers; these are coded as an integer ("results") and a magnitude ("nrels_mag") 
which is the power of 10 by which the integer must be divided to get the real 
number (the magnitude can also be negative). For READ/WRITE operations 
"nrels_mag" contains on return the number of elements read or written. </DIV>
<DIV>The structure ctl_table (include/linux/sysctl.h) contains 
<UL>
  <LI>ctl_name: a binary id; 
  <LI>procname: string; 
  <LI>data: private data pointer, and its "maxlen"; 
  <LI>mode: protection rights; 
  <LI>two callbacks, proc_handler(), for text formatting, and ctl_handler(), for 
  all i/o; 
  <LI>a proc_dir_entry pointer; 
  <LI>two extra generic (void *) pointers. </LI></UL>Four control tables are 
defined in drivers/linux/i2c-proc.c (all terminated by a NULL entry), 
<UL>
  <LI>sysctl_table, with CTL_DEV, DEV_SENSORS entries, and a zero entry; 
  <LI>i2c_proc_dev_sensors, with SENSORS_CHIPS entry (callbacks: i2c_proc_chips, 
  i2c_sysctl_chips); 
  <LI>i2c_proc_dev, with DEV_SENSORS entry (callback: i2c_proc_dev_sensors); 
  <LI>i2c_proc, with CTL_DEV entry (callback: i2c_proc_dev). </LI></UL></DIV>
<DIV>i2c_register_entry( client, prefix, ctl_table, module) and 
i2c_deregister_entry( id ) are used to add and remove an entry in the 
/proc/sys/dev/sensors/chips and a directory in /proc/sys/dev/sensors/. 
"ctl_table" should be a template for the newly created directory. A new 
ctl_table is allocated and filled. The second extra field is pointed to 
"client". The controlling "module" should usually be THIS_MODULE The new table 
is registered with sysctl ( register_sysctl_table ) and the etries of the lists 
i2c_entries[] (ctl_table_header), i2c_clients[], i2c_inodes[] are updated. 
Deregistration is the reversed actions. </DIV>
<DIV>i2c_create_name() returns a nice name for a new proc directory. </DIV>
<DIV>i2c_fill_inode(inode, fill) increases/decreases the MOD_USE_COUNT, 
depending on the "fill" parameter. i2c_dir_fill_inode(inode, fill) finds the 
i2c_client with the given inode number (inode-&gt;i_ino), and calls its driver's 
inc/dec_use(). </DIV>
<DIV>i2c_proc_chips( ctl_table, rw, filp, buffer, len ) is the proc interface to 
the chips names. For each non-NULL entry in i2c_entries[] writes the 
ctl_table-&gt;child-&gt;child name and procname to the user buffer. 
<BR>i2c_sysctl_chips(ctl_table, name, len, oldval, oldlen, newval, newlen, 
context) is the sysctl interface. [TO DO] </DIV>
<DIV>i2c_sysctl_real( ctl_table, name, len, oldval, oldlen, newval, newlen, 
context) and i2c_proc_real( ctl_table, rw, filp, buffer, len) are the functions 
that perform the i/o. i2c_proc_real() firts gets the magnitude, next does the 
i/o, which consists of real-long conversion (i2c_parse_reals / i2c_write_reals) 
and i/o on the client (using the function callback()). i2c_sysctl_real() ... [TO 
DO]. i2c_parse_reals() and i2c_write_reals() are not discussed. </DIV>
<DIV>i2c_detect(adapter, addr_data, found_proc) is an inefficient ISA detect 
function, similar to i2c_probe(). [TO DO]. </DIV>
<H3>More reading</H3>
<DIV><A 
href="http://www.geocities.com/marco_corvi/games/lkpe/i2c/i2c-proto.htm">I2C 
protocol</A><BR></DIV>
<H3>Example</H3>
<DIV>Here are some instructions to write a sample adapter and driver for the I2C 
layer: <A 
href="http://www.geocities.com/marco_corvi/games/lkpe/i2c/example.htm">example</A> 
</DIV><BR clear=all><BR clear=all><FONT size=-1>Marco Corvi - 2003</FONT> <!-- text below generated by server. PLEASE REMOVE --></OBJECT></LAYER></DIV></SPAN></STYLE></NOSCRIPT></TABLE></SCRIPT></APPLET>
<SCRIPT 
language=JavaScript>var PUpage="76001084"; var PUprop="geocities"; </SCRIPT>

<SCRIPT language=JavaScript src="The I2C layer_file/pu5geo.js"></SCRIPT>

<SCRIPT language=JavaScript src="The I2C layer_file/ygIELib9.js"></SCRIPT>

<SCRIPT language=JavaScript>var yviContents='http://us.toto.geo.yahoo.com/toto?s=76001084&l=NE&b=1&t=1057746741';yviR='us';yfiEA(0);</SCRIPT>

<SCRIPT language=JavaScript src="The I2C layer_file/mc.js"></SCRIPT>

<SCRIPT language=JavaScript src="The I2C layer_file/geov2.js"></SCRIPT>

<SCRIPT language=javascript>geovisit();</SCRIPT>
<NOSCRIPT><IMG height=1 alt=setstats src="The I2C layer_file/visit.gif" width=1 
border=0></NOSCRIPT> <IMG height=1 alt=1 src="The I2C layer_file/serv.gif" 
width=1> <!-- w16.geo.scd.yahoo.com compressed/chunked Wed Jul  9 03:32:21 PDT 2003 --></DIV></BODY></HTML>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲免费高清视频在线| 国产精品一二三区| 欧美变态tickle挠乳网站| 91小视频在线| 粗大黑人巨茎大战欧美成人| 精品影视av免费| 麻豆精品视频在线观看免费| 狠狠色狠狠色综合| 国产精品一二三区在线| 欧美日韩亚洲不卡| 69av一区二区三区| 日韩欧美一级二级三级| 亚洲精品一区二区三区四区高清 | 精品久久人人做人人爱| 亚洲精品乱码久久久久| 亚洲私人影院在线观看| 一区二区三区欧美在线观看| 亚洲成人av免费| 人人超碰91尤物精品国产| 久久精品国产网站| zzijzzij亚洲日本少妇熟睡| 日本精品视频一区二区三区| 欧美日韩激情一区| 久久午夜羞羞影院免费观看| 国产精品毛片久久久久久久| 亚洲人亚洲人成电影网站色| 国产盗摄女厕一区二区三区| 欧美性猛交一区二区三区精品| 欧美福利视频导航| 久久蜜桃av一区精品变态类天堂| 国产精品成人网| 亚洲成人中文在线| 欧美日韩在线播放| 一区二区三区**美女毛片| 色综合天天综合网天天看片| 7777精品伊人久久久大香线蕉| 亚洲成人综合在线| 91麻豆精品国产91久久久久久久久 | 日韩中文字幕不卡| 国产白丝网站精品污在线入口| 在线免费精品视频| 日韩女优制服丝袜电影| 美女网站色91| 久久久国际精品| 成人成人成人在线视频| 日韩欧美国产成人一区二区| 另类小说图片综合网| 精品播放一区二区| 成人做爰69片免费看网站| 亚洲欧洲精品一区二区精品久久久 | 97精品久久久午夜一区二区三区 | 亚洲精品美国一| 欧美亚洲综合在线| 日韩电影免费在线看| 日本韩国一区二区| 亚洲va韩国va欧美va精品| 日韩视频免费直播| 一区二区三区在线视频免费观看| 色www精品视频在线观看| 亚洲午夜av在线| 91蝌蚪porny成人天涯| 亚洲一区二区三区精品在线| 成人精品国产一区二区4080| 一区二区三区在线视频观看58| 欧美日韩精品电影| 国产一区二区女| 国产日韩欧美精品在线| 久久国产精品一区二区| 中文字幕日本乱码精品影院| 91.麻豆视频| 高清不卡一区二区| 日韩福利电影在线| 中文字幕免费一区| 99久久久免费精品国产一区二区| 亚洲成人免费看| 欧美激情一区二区三区全黄| 在线播放一区二区三区| av色综合久久天堂av综合| 视频一区在线视频| 亚洲视频一二三| www一区二区| 欧美精品日韩综合在线| 成人高清伦理免费影院在线观看| 日本欧美加勒比视频| 亚洲欧美日韩综合aⅴ视频| 欧美xxxxx牲另类人与| 欧洲av一区二区嗯嗯嗯啊| 国产米奇在线777精品观看| 亚洲国产日韩精品| 国产精品国产a级| 久久久久国产一区二区三区四区| 欧美视频中文一区二区三区在线观看| 国产精品伊人色| 秋霞影院一区二区| 亚洲国产视频一区| 亚洲一区二区三区四区中文字幕| 国产视频一区在线观看| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 日韩精品电影一区亚洲| 亚洲欧美中日韩| 久久久久久久久久久99999| 91精品国产综合久久久蜜臀图片| 欧洲视频一区二区| hitomi一区二区三区精品| 国产一区二区三区久久悠悠色av| 日韩av在线发布| 视频一区视频二区中文字幕| 亚洲综合一区二区精品导航| 亚洲激情自拍视频| 亚洲欧美日韩中文播放| 日韩码欧中文字| 亚洲欧洲精品一区二区三区| 国产精品美女久久久久久| 国产亚洲自拍一区| 国产精品视频yy9299一区| 国产日韩高清在线| 26uuu精品一区二区三区四区在线| 67194成人在线观看| 欧美巨大另类极品videosbest | 亚洲三级在线观看| 亚洲欧美日韩国产中文在线| 亚洲少妇30p| 亚洲精品视频免费观看| 一区二区三区电影在线播| 亚洲综合免费观看高清完整版在线 | 成人免费视频播放| 成人禁用看黄a在线| 99在线精品观看| 欧洲国内综合视频| 91精品国产一区二区| 成人性生交大合| av电影一区二区| 91久久国产最好的精华液| 欧美日韩亚洲综合一区| 日韩免费一区二区| 日本一区二区免费在线观看视频 | 亚洲少妇最新在线视频| 一区二区不卡在线播放| 亚洲观看高清完整版在线观看| 午夜私人影院久久久久| 悠悠色在线精品| 亚洲成人av福利| 精品在线你懂的| av中文字幕在线不卡| 欧美日韩中文字幕一区| 欧美成人一级视频| 亚洲丝袜制服诱惑| 日本在线不卡视频| 成人av电影在线播放| 欧洲精品在线观看| 26uuu成人网一区二区三区| 国产精品视频在线看| 一区二区三区精品在线| 美女爽到高潮91| 99久久精品情趣| 欧美一区二区三区小说| 国产精品女主播在线观看| 日韩成人av影视| 97se亚洲国产综合自在线不卡| 777欧美精品| 亚洲欧美色图小说| 狠狠色丁香婷婷综合| 色94色欧美sute亚洲线路一久| 欧美成人三级在线| 一区二区三区不卡在线观看| 加勒比av一区二区| 欧美三区在线观看| 国产精品久久久久久久久晋中| 天天综合色天天综合色h| 成人亚洲一区二区一| 日韩欧美一区电影| 一区二区三区在线播放| 成人精品一区二区三区四区 | 99视频在线精品| 日本一区二区三区电影| 美女爽到高潮91| 欧美最猛黑人xxxxx猛交| 国产精品天美传媒| 麻豆中文一区二区| 欧美日韩视频专区在线播放| 中文字幕一区二区三区在线播放| 精品中文av资源站在线观看| 欧美精选午夜久久久乱码6080| 国产精品久久久久久久久快鸭| 国产一区二区中文字幕| 91精品国产免费| 亚洲成人精品影院| 色综合久久九月婷婷色综合| 国产精品嫩草99a| 国产精品99久久不卡二区| 91精品在线一区二区| 亚洲第一电影网| 欧美专区亚洲专区| 亚洲图片欧美激情| 91视频观看免费| 中文字幕中文字幕中文字幕亚洲无线| 国产精品一区二区在线看| 欧美成人高清电影在线| 青青青爽久久午夜综合久久午夜| 欧美日韩亚洲综合在线|