i2c_check_functionality函数的实现
来源:互联网 发布:淘大象软件下载 编辑:程序博客网 时间:2024/06/16 01:03
下面再来讨论下前面一章中i2c_probe函数中调用的i2c_check_functionality函数的实现。
I2c_probe函数中有这样一段:
/* Stop here if we can't use SMBUS_QUICK */
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK)) {
if (address_data->probe[0] == I2C_CLIENT_END
&& address_data->normal_i2c[0] == I2C_CLIENT_END)
return 0;
dev_warn(&adapter->dev, "SMBus Quick command not supported, "
"can't probe for chips\n");
return -1;
}
追踪i2c_check_functionality:
static inline int i2c_check_functionality(struct i2c_adapter *adap, u32 func)
{
return (func & i2c_get_functionality(adap)) == func;
}
static inline u32 i2c_get_functionality(struct i2c_adapter *adap)
{
return adap->algo->functionality(adap);
}
可见还是调用了algothm的functionlity函数。
我们来看看该驱动中这个函数的实现:
static struct i2c_algorithm mxc_i2c_algorithm = {
.master_xfer = mxc_i2c_xfer,
.functionality = mxc_i2c_func
};
static u32 mxc_i2c_func(struct i2c_adapter *adap)
{
return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
}
可见就是要该适配器支持I2C_FUNC_SMBUS_QUICK的功能。
头文件中I2C_FUNC_I2C和I2C_FUNC_SMBUS_QUICK的定义
I2C_FUNC_I2C Plain i2c-level commands (Pure SMBus adapters typically can not do these)
I2C_FUNC_SMBUS_QUICK Handles the SMBus write_quick command
- i2c_check_functionality函数的实现
- 虚函数的实现
- memcpy函数的实现
- strcpy函数的实现
- strcmp函数的实现
- strtok函数的实现
- atoi函数的实现
- memmove函数的实现
- 函数OMX_MasterInit()的实现
- OmxComponentFactoryDynamicCreate()函数的实现
- INTC_ActivateInterrupt函数的实现
- strtok函数的实现
- strcpy函数的实现
- strcmp函数的实现
- strlen函数的实现
- strcmp函数的实现
- strcpy函数的实现
- strlen函数的实现
- 【学习笔记】宏定义基础
- iOS开发-使用UIImagePickerController遇到的问题
- 进程的三种状态详解
- C#数据结构回顾之单链表
- CAShapeLayer和CAGradientLayer:圆形进度条和动画
- i2c_check_functionality函数的实现
- C++ string 类 学习笔记
- 1037. 在霍格沃茨找零钱(20)
- 和差值最小的数组划分问题
- Interleaving String
- 数据库-删除表中重复记录实现方法分析
- Count Primes
- UML用例图
- nmake编译QWT产生的几个错误