摘要: linux container_of(ptr,struct B, member)1. ptr: struct B 一个对象,ptr 指向它的一个成员 例如 struct B { int a; char b;};struct B b_obj;ptr = &b_obj.b;2. struct B, 包含... 阅读全文
posted @ 2013-03-04 16:08 lcnewstart 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 一、怎么写I2C设备驱动程序?1. 分配一个i2c_driver结构体。2. 设置attach_adapte函数和detach_client函数。 attach_adapter直接调用 i2c_probe(adap, 设备地址, 发现这个设备后要调用的函数); detach_client 表示卸载这... 阅读全文
posted @ 2013-03-04 15:09 lcnewstart 阅读(337) 评论(0) 推荐(0) 编辑