资源简介
LDD3的源码,由于其他人的资源要下载积分,发扬开源精神,下载并0积分分享~
代码片段和文件信息
/*
* A virtual bus for LDD sample code devices to plug into. This
* code is heavily borrowed from drivers/base/sys.c
*
* Copyright (C) 2001 Alessandro Rubini and Jonathan Corbet
* Copyright (C) 2001 O‘Reilly & Associates
*
* The source code in this file can be freely used adapted
* and redistributed in source or binary form so long as an
* acknowledgment appears in derived source files. The citation
* should list that the code comes from the book “Linux Device
* Drivers“ by Alessandro Rubini and Jonathan Corbet published
* by O‘Reilly & Associates. No warranty is attached;
* we cannot take responsibility for errors or fitness for use.
*
*/
/* $Id: lddbus.cv 1.9 2004/09/26 08:12:27 gregkh Exp $ */
#include
#include
#include
#include
#include
#include “lddbus.h“
MODULE_AUTHOR(“Jonathan Corbet“);
MODULE_LICENSE(“Dual BSD/GPL“);
static char *Version = “$Revision: 1.9 $“;
/*
* Respond to hotplug events.
*/
static int ldd_hotplug(struct device *dev char **envp int num_envp
char *buffer int buffer_size)
{
envp[0] = buffer;
if (snprintf(buffer buffer_size “LDDBUS_VERSION=%s“
Version) >= buffer_size)
return -ENOMEM;
envp[1] = NULL;
return 0;
}
/*
* Match LDD devices to drivers. Just do a simple name test.
*/
static int ldd_match(struct device *dev struct device_driver *driver)
{
return !strncmp(dev->bus_id driver->name strlen(driver->name));
}
/*
* The LDD bus device.
*/
static void ldd_bus_release(struct device *dev)
{
printk(KERN_DEBUG “lddbus release\n“);
}
struct device ldd_bus = {
.bus_id = “ldd0“
.release = ldd_bus_release
};
/*
* And the bus type.
*/
struct bus_type ldd_bus_type = {
.name = “ldd“
.match = ldd_match
.hotplug = ldd_hotplug
};
/*
* Export a simple attribute.
*/
static ssize_t show_bus_version(struct bus_type *bus char *buf)
{
return snprintf(buf PAGE_SIZE “%s\n“ Version);
}
static BUS_ATTR(version S_IRUGO show_bus_version NULL);
/*
* LDD devices.
*/
/*
* For now no references to LDDbus devices go out which are not
* tracked via the module reference count so we use a no-op
* release function.
*/
static void ldd_dev_release(struct device *dev)
{ }
int register_ldd_device(struct ldd_device *ldddev)
{
ldddev->dev.bus = &ldd_bus_type;
ldddev->dev.parent = &ldd_bus;
ldddev->dev.release = ldd_dev_release;
strncpy(ldddev->dev.bus_id ldddev->name BUS_ID_SIZE);
return device_register(&ldddev->dev);
}
EXPORT_SYMBOL(register_ldd_device);
void unregister_ldd_device(struct ldd_device *ldddev)
{
device_unregister(&ldddev->dev);
}
EXPORT_SYMBOL(unregister_ldd_device);
/*
* Crude driver interface.
*/
static ssize_t show_version(struct device_driver *driver char *buf)
{
struct ldd_driver *ldriver = to_ldd_driver(driver);
sprintf(buf “%s\n“ ldriver->version);
return strlen(buf);
}
int register_ldd_driver(struct ldd_driver *driver)
{
int ret
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 855 2005-02-01 04:31 ldd3_examples\include\lddbus.h
文件 4058 2005-02-01 04:31 ldd3_examples\lddbus\lddbus.c
文件 710 2005-02-01 04:31 ldd3_examples\lddbus\Makefile
文件 1091 2005-02-01 04:31 ldd3_examples\LICENSE
文件 289 2005-02-01 04:31 ldd3_examples\Makefile
文件 2128 2005-02-01 04:31 ldd3_examples\misc-modules\complete.c
文件 2000 2005-02-01 04:31 ldd3_examples\misc-modules\faulty.c
文件 463 2005-02-01 04:31 ldd3_examples\misc-modules\hello.c
文件 1130 2005-02-01 04:31 ldd3_examples\misc-modules\hellop.c
文件 6194 2005-02-01 04:31 ldd3_examples\misc-modules\jiq.c
文件 7571 2005-02-01 04:31 ldd3_examples\misc-modules\jit.c
文件 2293 2005-02-01 04:31 ldd3_examples\misc-modules\kdataalign.c
文件 1489 2005-02-01 04:31 ldd3_examples\misc-modules\kdatasize.c
文件 987 2005-02-01 04:31 ldd3_examples\misc-modules\Makefile
文件 2044 2005-02-01 04:31 ldd3_examples\misc-modules\seq.c
文件 6200 2005-02-01 04:31 ldd3_examples\misc-modules\silly.c
文件 2161 2005-02-01 04:31 ldd3_examples\misc-modules\sleepy.c
文件 1483 2005-02-01 04:31 ldd3_examples\misc-progs\asynctest.c
文件 2088 2005-02-01 04:31 ldd3_examples\misc-progs\dataalign.c
文件 1287 2005-02-01 04:31 ldd3_examples\misc-progs\datasize.c
文件 417 2005-02-01 04:31 ldd3_examples\misc-progs\gdbline
文件 3372 2005-02-01 04:31 ldd3_examples\misc-progs\inp.c
文件 925 2005-02-01 04:31 ldd3_examples\misc-progs\load50.c
文件 297 2005-02-01 04:31 ldd3_examples\misc-progs\Makefile
文件 1975 2005-02-01 04:31 ldd3_examples\misc-progs\mapcmp.c
文件 2170 2005-02-01 04:31 ldd3_examples\misc-progs\mapper.c
文件 1186 2005-02-01 04:31 ldd3_examples\misc-progs\nbtest.c
文件 2286 2005-02-01 04:31 ldd3_examples\misc-progs\netifdebug.c
文件 3593 2005-02-01 04:31 ldd3_examples\misc-progs\outp.c
文件 1218 2005-02-01 04:31 ldd3_examples\misc-progs\polltest.c
............此处省略89个文件信息
- 上一篇:基于FPGA的AES加密算法的高速实现
- 下一篇:51STC单片机开发板驱动
相关资源
- 物业管理系统源码+数据库
- 超级玛丽游戏C源码 完整源程序
- 微信小程序商城网站源码(不带后台
- as3.0超级玛丽源码
- pcsc-lite-1.7.4 源码包
- VerilogHDL设计与实战视频教程源码.tx
- IEEE32位浮点数转换工具含源码
- E4A免签支付源码 支付宝 微信 QQ 第三
- Unity开发的斗地主,自带AI,直接编译
- 安全删除(断开)U盘获取其他移动储
- qt5串口程序
- cuda实现md5的源码
- 计算几何常用算法源码——多边形基
- 图像处理源码 opencv图像处理源码
- 编译原理算符优先文法实验源码
- 嵌入式linux下截图工具gsnap移植源码
- [网盘]OpenSceneGraph三维渲染引擎编程指
- lz4压缩算法源码
- 103规约源代码非常好的电力系统103规
- 易语言,BCB6,DELPHI7TCCMingW的速度测试
- 文件校验工具MD5SHA1SHA210.2TOKYOHOT含源码
- GPS串口数据接收源码
- 基于相位选择法的QPSK调制的源码
- 7个安卓源码小程序很适合初学者
- pefile源码库
- 天猫淘宝秒杀抢购插件源码
- 四轴飞控源码
- HDB3解码Verilog程序源码,hdb3_decode.v
- cocos-js小游戏2048游戏源码以及素材
- 大富豪游戏源码
评论
共有 条评论