powerpc+linux2.6.25平台下的i2c驱动架构分析

上传人:子 文档编号:42513186 上传时间:2018-06-02 格式:DOC 页数:17 大小:23.15KB
返回 下载 相关 举报
powerpc+linux2.6.25平台下的i2c驱动架构分析_第1页
第1页 / 共17页
powerpc+linux2.6.25平台下的i2c驱动架构分析_第2页
第2页 / 共17页
powerpc+linux2.6.25平台下的i2c驱动架构分析_第3页
第3页 / 共17页
powerpc+linux2.6.25平台下的i2c驱动架构分析_第4页
第4页 / 共17页
powerpc+linux2.6.25平台下的i2c驱动架构分析_第5页
第5页 / 共17页
点击查看更多>>
资源描述

《powerpc+linux2.6.25平台下的i2c驱动架构分析》由会员分享,可在线阅读,更多相关《powerpc+linux2.6.25平台下的i2c驱动架构分析(17页珍藏版)》请在金锄头文库上搜索。

1、PowerPC+Linux2.6.25PowerPC+Linux2.6.25 平台下的平台下的 I2CI2C 驱动架构分析驱动架构分析(鏈師鍒涙枃绔犲彂琛簬 Sailor_forever 鐨勪釜浜篵 log 锛屾湭缁忔湰浜鸿鍙紝涓嶅緱鐢簬鍟嗕笟鐢斻備换浣曚釜浜恒佸獟浣撱佸叾浠栫綉绔欎笉寰楃鑷妱琚紱缃戠粶濯掍綋杞浇璇锋敞鏄庡嚭澶勶紝澧炲姞鍘熸枃閾炬帴锛屽惁鍒欏睘浜庝镜鏉冭涓恒傚 鏈変换浣曢棶棰橈紝璇风暀瑷鎴栬呭彂閭欢缁檚 ailing_9806 锛?)http:/ PowerPC+Linux 2.6.25 骞冲彴涓轰緥锛岃缁嗗垎鏋愪簡 I2C 鎬荤嚎鐨勯鍔灦鏋勩傞鍏堜粙缁嶄簡 I2C 鐨勬讳綋鏋

2、舵瀯锛屼粠鐢埛鐨勮搴皢鍏跺垎涓轰笁涓眰闈紝涓嶅悓鐨勫紑鍙戣呭彧闇瑕佸叧娉浉搴旂殑灞傞潰鍗冲彲銆傜劧鍚庡垎鏋愪簡涓昏鏁版嵁缁撴瀯鍙婂叾涔嬮棿鐨勭浉浜掑叧绯伙紝鎺潃鍒嗘瀽浜嗕笉鍚屽眰鐨勫叿浣撳疄鐜帮紝鏈鍚庝互涓娆綞 EPEOM 涓轰緥璁茶堪浜嗗浣曞湪鐢埛绌洪棿璁块棶 I2C 椹卞姩銆傚浜嶢 RM + Linux 骞冲彴锛屽彧鏈夊钩鍙颁緷璧栧眰鍗虫荤嚎閫傞厤鍣鍔湁宸紓銆?銆愬叧閿瓧銆慞 owerPC, I2C, i2c-core, adapter , i2c_algorithm, RTC, EEPROM鐩綍1 I2C 姒傝堪 32 I2C 鎬讳綋鏋舵瀯 32.1 纭欢鎶借薄灞? 32.2 骞冲彴渚濊

3、禆灞? 32.3 鐢埛鎺彛灞? 33 涓昏鐨勬暟鎹粨鏋? 43.1 Adapter 43.2 I2c_algorithm 53.3 i2c_driver 53.4 Client 64 骞冲彴渚濊禆灞?鎬荤嚎閫傞厤鍣鍔? 74.1 platform device 74.2 platform driver 94.3 Adapter 鍙奱 lgorithm 125 纭欢鎶借薄灞?I2C core 135.1 鎬荤嚎鍒濆鍖? 135.2 Adapter 娉唽 155.3 椹卞姩娉唽 165.4 鏁版嵁浼犺緭 176 鐢埛鎺彛灞?I2C 璁惧椹卞姩 186.1 缁熶竴鐨勮澶囨 鍨? 186.1.1 鍏抽

4、敭鏁版嵁缁撴瀯 186.1.2 鍒濆鍖? 196.1.3 Open 鍙妑 elease 216.1.4 鏁版嵁鏀跺彂 226.2 鐗瑰畾鐨勮澶囬鍔? 266.2.1 鍏抽敭鏁版嵁缁撴瀯 266.2.2 鍒濆鍖? 276.2.3 鏁版嵁鏀跺彂 297 椹卞姩璁块棶绀轰緥 297.1.1 鍐欐搷浣? 297.1.2 璇绘搷浣? 318 鍙傝冮福璋? 331 I2C 姒傝堪I2C 鍙湁涓潯绾匡紝涓鏉覆琛屾暟鎹嚎锛歋 DA 锛屼竴鏉槸鏃堕挓绾縎 CL 銆侷 2C 鏄竴绉嶅涓绘満鎺 埗鎬荤嚎锛屽悓涓鎬荤嚎涓婂彲鍏佽澶氫釜 master 锛屽嵆鎬荤嚎涓婄殑璁惧閮芥湁涓诲姩鍙戣捣鏁版嵁浼犺緭鐨勫彲鑳斤紝渚濋

5、潬绾夸笌閫昏緫鏉疄鐜版棤鎹熶徊瑁併備絾閫氬父鎯呭喌鏄荤嚎涓婃湁涓甫 CPU 鐨刴 aster 锛屽叾浠栬澶囪master 璁块棶銆?2 I2C 鎬讳綋鏋舵瀯鍦?.6 鐨凩 inux 鍐呮牳涓紝 I2C 鐨勯鍔灦鏋勫垎涓哄涓嬩笁涓眰娆細纭欢鎶借薄灞傘佸钩鍙颁緷璧栧眰鍜岀敤鎴锋帴鍙眰銆?2.1 纭欢鎶借薄灞?i2c-core.h 鍜宨 2c-core.c涓哄叾涓讳綋妗嗘灦浠爜锛屾彁渚涗簡鏍稿績鏁版嵁缁撴瀯鐨勫畾涔夈乮 2c 閫傞厤鍣鍔拰璁惧椹卞姩鐨勬敞鍐屻佹敞閿绠悊绛堿 PI 銆傚叾涓虹浠跺钩鍙版棤鍏冲眰锛屽悜涓嬪睆钄戒簡鐗悊鎬荤嚎閫傞厤鍣殑宸紓锛屽畾涔変簡缁熶竴鐨勮闂瓥鐣拰鎺彛锛涘叾鍚戜笂鎻愪緵

6、浜嗙粺涓鐨勬帴鍙紝浠究 I2C 璁惧椹卞姩閫氳繃鎬荤嚎閫傞厤鍣繘琛屾暟鎹敹鍙戙?2.2 骞冲彴渚濊禆灞?i2c 鎬荤嚎閫傞厤鍣紙adapter 锛夊氨鏄竴鏉2c 鎬荤嚎鐨勬帶鍒跺櫒锛堟墍璋撴帶鍒舵槸鐩稿浜庢湰 CPU 鏉鐨勶級锛屽湪鐗悊涓婅繛鎺嫢骞瞚 2c 璁惧銆傚湪 Linux 椹卞姩涓紝姣忕澶勭悊鍣钩鍙版湁鑷繁鐨勯傞厤鍣鍔紝灞炰簬骞冲彴绉绘鐩稿叧灞傘傛瘡涓涓壒瀹氱殑纭欢骞冲彴鍦2c/busses/鐩綍涓嬮兘鏈変竴涓猘 dapter 鐨勫疄鐜帮紝瀵逛簬 PowerPC 骞冲彴鏉锛屽叾鏄痠 2c-mpc.c 銆傚叾鎸夌収鏍稿績灞傚畾涔夌殑鎺彛瀹炵幇浜唅 2c_adapter 锛屾彁渚涗簡鍏蜂綋

7、鐨勮闂柟寮廼2c_algorithm 銆?2.3 鐢埛鎺彛灞?璁惧椹卞姩灞備负鐢埛鎺彛灞傦紝鍏朵负鐢埛鎻愪緵浜嗛氳繃 I2C 鎬荤嚎璁块棶鍏蜂綋璁惧鐨勬帴鍙?3 涓昏鐨勬暟鎹粨鏋?3.1 AdapterAdapter 鏄鏌愪竴鏉2C 鎬荤嚎鐨勬娊璞紝鏄壒瀹氭荤嚎鐨勭浉鍏冲睘鎬 殑闆嗗悎銆?http:/lxr.linux.no/#linux+v2.6.25/include/linux/i2c.h#L312 312struct i2c_adapter 313 struct module *owner;314 unsigned int id;315 unsigned int class;316 co

8、nst struct i2c_algorithm *algo; /* the algorithm to access the bus */317 void *algo_data;318319 /* - administration stuff. */320 int (*client_register)(struct i2c_client *);321 int (*client_unregister)(struct i2c_client *);322323 /* data fields that are valid for all devices */324 u8 level; /* nesti

9、ng level for lockdep */325 struct mutex bus_lock; /326 struct mutex clist_lock;327328 int timeout;329 int retries;330 struct device dev; /* the adapter device */331332 int nr; /*璇垚鍛樻弿杩颁簡鎬荤嚎鍙?/ 333 struct list_head clients; /* i2c_client缁撴瀯閾捐锛岃缁撴瀯鍖呭惈 device 锛宒 river 鍜?adapter缁撴瀯*/ 334 char name48;335

10、 struct completion dev_released;336; Algo 鏄拰搴曞眰纭欢鐨勬帴鍙紝鏍囪瘑浜嗗叿浣撶殑鐗悊鎬荤嚎浼犺緭鐨勫疄鐜般?Clients 涓轰娇鐢鎬荤嚎鐨刢lient 閾捐銆?Nr 涓鸿閫傞厤鍣篃灏辨槸鏌愭潯 I2C 鎬荤嚎鍗犳嵁鐨勫叏灞缂栧彿銆?bus_lock 鎬荤嚎鐨勪簰鏂攣锛岄槻姝荤嚎鍐茬獊銆?3.2 I2c_algorithmhttp:/lxr.linux.no/#linux+v2.6.25/include/linux/i2c.h#L291291struct i2c_algorithm 292 /* If an adapter algorithm ca

11、nt do I2C-level access, set master_xfer293 to NULL. If an adapter algorithm can do SMBus access, set294 smbus_xfer. If set to NULL, the SMBus protocol is simulated295 using common I2C messages */296 /* master_xfer should return the number of messages successfully297 processed, or a negative value on

12、 error */298 int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs,299 int num);300 int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr,301 unsigned short flags, char read_write,302 u8 command, int size, union i2c_smbus_data * data);303304 /* To determine what the adapter supports */305

13、 u32 (*functionality) (struct i2c_adapter *);306;涓昏灏辨槸 master_xfer 鏂规硶锛屽叾鍜屽叿浣撶殑鎬荤嚎鎺 埗鍣浉鍏筹紝涓嶅悓鐨凜 PU 鍦疄鐜颁笂鍙兘鏈夊樊寮傘?3.3 i2c_driverhttp:/lxr.linux.no/#linux+v2.6.25/include/linux/i2c.h#L105105struct i2c_driver 106 int id;107 unsigned int class;108109 /* Notifies the driver that a new bus has appeared. This routine110 * can be used by the driver to test if the bus meets its conditions111 * 116 int (*detach_adapter)(struct i2c_adapter *);117118 /* tells the driver that a client is about to be deleted 124125

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 生活休闲 > 科普知识

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号