linux I2CÇý¶¯·ÖÎö
I2CÊÇPhillips¿ª·¢µÄ2ÏߵĴ®ÐÐ×ÜÏßÐÒ顣ͨ³£Ó¦ÓÃÔÚǶÈëʽϵͳÖÐÈò»Í¬µÄ×é¼þͨÐÅ£¬PCÖ÷°å¿ÉÒÔͨ¹ýI2CÀ´Ó벻ͬµÄ´«¸ÐÆ÷ͨÐÅ¡£ÕâЩ´«¸ÐÆ÷ͨ³£±¨¸æ·çÉÈËٶȣ¬´¦ÀíÆ÷ζȺÍÕû¸öÓ²¼þϵͳµÄÐÅÏ¢£¬Õâ¸öÐÒéÒ²¿ÉÒÔÓÃÔÚRAM chipsÉÏ£¬Ïò²Ù×÷ϵͳÌṩDIMMµÄÐÅÏ¢¡£
ÔÚ2.0ʱI2CµÄkernelÔ´Âë²»ÔÚÄÚºËÀïµÄ£¬2.4Äں˰üÀ¨ÁËÒ»µã¶ÔI2CµÄÖ§³Ö£¬Ö÷ÒªÊÇÊÓƵÇý¶¯¡£
ÔÚ2.6ÄÚºËÀ´óÁ¿µÄI2C´úÂë¼ÓÈëµ½ÁËÄÚºËÀï¡£¸ÐлºÜ¶àÄں˿ª·¢ÕßµÄŬÁ¦£¬ËûÃÇÈýӿڸüÈÝÒ×±»ÄÚºËÉçÇø½ÓÊÜ¡£ÓÐЩÇý¶¯ÈÔÔÚÍⲿµÄCVSÊ÷ÀûÓзÅÈëkernel.orgÀµ«ÊÇËûÃDZ»ÒÆÖ²Ö»ÊÇʱ¼äµÄÎÊÌâ¡£
I2CµÄkernelÔ´Âë±»·Ö³É¼¸¸ö²¿·Ö£ºthe I2C core, I2C bus drivers£¬I2C algorithm drivers and I2C chip drivers¡£ÎÒÃǽ«ºöÂÔI2C core²¿·Ö£¬¶øÊǹØ×¢ÈçºÎ±àдa bus and algorithm Çý¶¯¡£
I2C Bus Drivers ×ÜÏßÇý¶¯
I2C×ÜÏßÇý¶¯ÓÃÒ»¸ö½á¹¹i2c_adapterÀ´ÃèÊö£¬¸Ã½á¹¹ÔÚÎļþinclude/linux/i2c.hÀﶨÒå¡£
ÒÔϵÄ×Ö¶ÎÐèÒªÔÚ×ÜÏßÇý¶¯ÀïÉèÖãº
struct module *owner; -set to the value (THIS_MODULE) that allows the proper module reference counting.
unsigned int class; -the type of I2C class devices that this driver supports. Usually this is set to the value I2C_ADAP_CLASS_SMBUS.
struct i2c_algorithm *algo; -a pointer to the struct i2c_algorithm structure that describes the way data is transferred through this I2C bus controller. More information on this structure is provided below.
char name[I2C_NAME_SIZE]; -set to a descriptive name of the I2C bus driver. This value shows up in the sysfs filename associated with this I2C adapter.
ÒÔϵĴúÂëÀ´×ÔÒ»¸öI2C adapterÇý¶¯µÄÀý×Ótiny_i2c_adap.c£¬
¿ÉÒÔÔÚthe Linux Journal FTP site [ftp.ssc.com/pub/lj/listings/issue116/7136.tgz [1]] »ñµÃ¡£
À´¿´¿´struct i2c_adapter ÈçºÎ±»ÉèÖãº
static struct i2c_adapter tiny_adapter = {
.owner = THIS_MODULE,
.class = I2C_ADAP_CLASS_SMBUS,
.algo = &tiny_algorithm,
.name = "tiny adapter",
};
Ҫע²áI2C adapter£¬Çý¶¯µ
Ïà¹ØÎĵµ£º
ÌýÆðÀ´£¬ÓÐ×ÔÐÅ£¬ÓиãЦ¡£ÓÖ×ÔÐÅ£¬ÓÖ¸ãЦ¡£
Á½ÄêÇ°£¬¿¼ÈëÁËÒ»¸ö¶þÁ÷´óѧ£¬·Ç¼ÆËã»úרҵ¡£µ±³õ»³×ÅÎÞ±ÈÃÀºÃµÄÐÄÇ飬ֻÊÇÏ£ÍûÔÚѧУ¹ýµÄ¿ìÀÖЩ£¬Ñ§µÄºÃЩ£¬µ«ÊÇÓÐЩÊÂÇé×ÜÊÇÄÑÒÔÔ¤ÁÏ£¬ÎÒ×ÜÊÇÎÞ·¨ÍüÈ´ÄÇ·Ý»³ÄÔÚÕâ¸öÄ°ÉúµÄ³ÇÊУ¬ÎÒ×ÜÊÇÃÔʧÁË×Ô¼º¡£Ä¬Ä¬µÄ¶ãÔÚ×Ô¼ºµÄÊÀ½çÀïÌòóÂÉË¿Ú£¬ÔÒÔΪµ½Á˸öеĻ·¾³ÄÜÍüµôÒ»ÇеÄÉËÐÄ¹Ê ......
×î½ü¸Ð½Ó´¥perl£¬¸Ð¾õºÜ²»´í£¬´¦ÀíÎı¾·Ç³£·½±ã¡£Ç°½×¶ÎÓÃcȥͳ¼ÆһЩÎı¾£¬ÀÛµÄÒªËÀ£¬¶øÇÒ³ÌÐòÖл¹¾³£³öbug£»¶øÓÃperlÔò²»Í¬£¬Ëü±ÜÃâµÄ¸´ÔÓµÄÊý¾Ý½á¹¹£¬ÕâÑù³ö´íµÄ¸ÅÂʾͺÜСÁË£¬¶øÇÒ±àд´úÂë¶ÌС¾«º·¡£Ç°Á½Ì콫perlÄõ½linuxÉÏÔËÐУ¬ËäÈ»Ìí¼ÓÁË#!/usr/local/bin/perl£¬µ«»¹ÊÇÌáʾÕÒ²»µ½½âÊÍÆ÷£ºbad interpreter¡£ÓôÃÆѽ¡ ......
ÆäʵÕâ²ÅÓ¦¸ÃÊÇÕâһϵÁÐÎÄÕµĵÚÒ»½Ú£¬ÒòΪÕâƪÎÄÕ½²µÄÊÇÅ̹ſªÌìµØµÄÊ¡£»°ËµMr.
ProcessÊÇÒ»¸öÏÖ´úÈË£¬µ«ÊÇ£¬Ö»ÒªÊÇÈË£¬×ܸÃÓиö×æÏÈ¡£ÈËÃÇ×ÜÏëÖªµÀ×Ô¼º´ÓÄÄÀ´£¬È»ºó²Å¿ÉÒÔ¹ÀÃþËãÒ»ÏÂ×Ô¼º½«È¥ÏòºÎ·½¡£ËùÒÔÔÛÒ²ÒªÁ˽âÒ»ÏÂ
LinuxµÄÊÀ½çÀïÈËÀàµÄÆðÔ´¡£
ͼ1£º´ÓÉϵ絽BIOS
°´ÏµçÔ´¿ª¹ØµÄÄǸöÕæʵµÄÈ˾ÍÊÇLinuxÊÀ½çÀïµÄ ......
LinuxϵͳϵĶàÏß³Ì×ñÑPOSIXÏ߳̽ӿڣ¬³ÆΪ pthread¡£±àдLinuxϵĶàÏ̳߳ÌÐò£¬ÐèҪʹÓÃÍ·Îļþpthread.h£¬Á¬½ÓʱÐèҪʹÓÿâlibpthread.a¡£Ë³±ã˵һÏ£¬Linux ÏÂpthreadµÄʵÏÖÊÇͨ¹ýϵͳµ÷ÓÃclone£¨£©À´ÊµÏֵġ£clone£¨£©ÊÇ LinuxËùÌØÓеÄϵͳµ÷Óã¬ËüµÄʹÓ÷½Ê½ÀàËÆfork£¬¹ØÓÚclone£¨£©µÄÏêϸÇé¿ö£¬ÓÐÐËȤµÄ¶ÁÕß¿ÉÒÔÈ¥²é ......