3.4.2内核下的I2C驱动框架解析
at24cxx_drv.c源码:
#include "linux/kernel.h"
#include "linux/module.h"
#include "linux/platform_device.h"
#include "linux/i2c.h"
#include "linux/err.h"
#include "linux/regmap.h"
#include "linux/slab.h"
static int __devinit at24cxx_probe(struct i2c_client *client,
{
}
static int __devexit at24cxx_remove(struct i2c_client *client)
{
}
static const struct i2c_device_id at24cxx_id_table[] = {
};
// 1. 分配/设置i2c_driver //
static struct i2c_driver at24cxx_driver = {
};
static int at24cxx_drv_init(void)
{
}
static void at24cxx_drv_exit(void)
{
}
module_init(at24cxx_drv_init);
module_exit(at24cxx_drv_exit);
MODULE_LICENSE("GPL");
at24cxx_dev.c源码:
#include "linux/kernel.h"
#include "linux/module.h"
#include "linux/platform_device.h"
#include "linux/i2c.h"
#include "linux/err.h"
#include "linux/regmap.h"
#include "linux/slab.h"
static struct i2c_board_info at24cxx_info = {
};
static struct i2c_client *at24cxx_client;
static int at24cxx_dev_init(void)
{
}
static void at24cxx_dev_exit(void)
{
}
module_init(at24cxx_dev_init);
module_exit(at24cxx_dev_exit);
MODULE_LICENSE("GPL");
===============================================================
第二种方法:
at24cxx_drv.c源码:
#include "linux/kernel.h"
#include "linux/module.h"
#include "linux/platform_device.h"
#include "linux/i2c.h"
#include "linux/err.h"
#include "linux/regmap.h"
#include "linux/slab.h"
static int __devinit at24cxx_probe(struct i2c_client *client,
{
}
static int __devexit at24cxx_remove(struct i2c_client *client)
{
}
static const struct i2c_device_id at24cxx_id_table[] = {
};
// 1. 分配/设置i2c_driver //
static struct i2c_driver at24cxx_driver = {
};
static int at24cxx_drv_init(void)
{
}
static void at24cxx_drv_exit(void)
{
}
module_init(at24cxx_drv_init);
module_exit(at24cxx_drv_exit);
MODULE_LICENSE("GPL");
at24cxx_dev.c源码:
#include "linux/kernel.h"
#include "linux/module.h"
#include "linux/platform_device.h"
#include "linux/i2c.h"
#include "linux/err.h"
#include "linux/regmap.h"
#include "linux/slab.h"
static struct i2c_client *at24cxx_client;
static const unsigned short addr_list[] = { 0x60, 0x50, I2C_CLIENT_END };
static int at24cxx_dev_init(void)
{
}
static void at24cxx_dev_exit
3 4 2内核I2C驱动框架解 相关文章:
- 在Linux系统中批量建立用户的shell (04-08)
- 达芬奇数字媒体片上系统的架构和Linux启动过程(06-02)
- 3DES算法的FPGA高速实现(06-21)
- linux下Intel 3945ABG 安装无线网卡驱动(06-25)
- 基于s3c2410的CramFS根文件系统的移植(07-13)
- AD7888与S3C2410的SPI接口及Linux下嵌入式驱动的实现(11-06)