当前位置: 首页 > news >正文

折扣券网站怎么做wordpress 标签 热门

折扣券网站怎么做,wordpress 标签 热门,设计网站流程,雷电模拟器手机版下载官方网站PCIe驱动开发#xff08;2#xff09;— 第一个简单驱动编写和测试 一、前言 教程参考#xff1a;02_实战部分_PCIE设备测试 教程参考#xff1a;03_PCIe设备驱动源码解析 二、驱动编写 新建hello_pcie.c文件 touch hello_pcie.c然后编写内容如下所示#xff1a; #i…PCIe驱动开发2— 第一个简单驱动编写和测试 一、前言 教程参考02_实战部分_PCIE设备测试 教程参考03_PCIe设备驱动源码解析 二、驱动编写 新建hello_pcie.c文件 touch hello_pcie.c然后编写内容如下所示 #include linux/kernel.h #include linux/module.h #include linux/pci.h #include linux/init.h#define HELLO_PCI_DEVICE_ID 0x11e8 #define HELLO_PCI_VENDOR_ID 0x1234 #define HELLO_PCI_REVISION_ID 0x10static struct pci_device_id ids[] {{ PCI_DEVICE(HELLO_PCI_VENDOR_ID, HELLO_PCI_DEVICE_ID), },{ 0 , } };static struct hello_pci_info_t {struct pci_dev *dev;void __iomem *address_bar0; } hello_pci_info;MODULE_DEVICE_TABLE(pci, ids);static irqreturn_t hello_pci_irq_handler(int irq, void *dev_info) {struct hello_pci_info_t *_pci_info dev_info;uint32_t irq_status;// get irq_stutasirq_status *((uint32_t *)(_pci_info-address_bar0 0x24));printk(hello_pcie: get irq status: 0x%0x\n, irq_status);// clean irq*((uint32_t *)(_pci_info-address_bar0 0x64)) irq_status;// get irq_stutasirq_status *((uint32_t *)(_pci_info-address_bar0 0x24));if(irq_status 0x00){printk(hello_pcie: receive irq and clean success. \n);return IRQ_HANDLED;}else{printk(hello_pcie: receive irq but clean failed !!! \n);return IRQ_NONE;} }static int hello_pcie_probe(struct pci_dev *dev, const struct pci_device_id *id) {int bar 0;int ret;resource_size_t len;ret pci_enable_device(dev);if(ret) {return ret;}len pci_resource_len(dev, bar);hello_pci_info.address_bar0 pci_iomap(dev, bar, len);hello_pci_info.dev dev;// register interruptret request_irq(dev-irq, hello_pci_irq_handler, IRQF_SHARED, hello_pci, hello_pci_info);if(ret) {printk(request IRQ failed.\n);return ret;}// enable irq for finishing factorial computation*((uint32_t *)(hello_pci_info.address_bar0 0x20)) 0x80;return 0; }static void hello_pcie_remove(struct pci_dev *dev) {// disable irq for finishing factorial computation*((uint32_t *)(hello_pci_info.address_bar0 0x20)) 0x01;free_irq(dev-irq, hello_pci_info);pci_iounmap(dev, hello_pci_info.address_bar0);pci_disable_device(dev); }static struct pci_driver hello_pci_driver {.name hello_pcie,.id_table ids,.probe hello_pcie_probe,.remove hello_pcie_remove, };static int __init hello_pci_init(void) {return pci_register_driver(hello_pci_driver); }static void __exit hello_pci_exit(void) {pci_unregister_driver(hello_pci_driver); }MODULE_LICENSE(GPL); module_init(hello_pci_init); module_exit(hello_pci_exit); 三、驱动编译 新建Makefile文件编写内容如下: ifeq ($(KERNELRELEASE),)KERNELDIR ? /lib/modules/$(shell uname -r)/build PWD : $(shell pwd)all:$(MAKE) -C $(KERNELDIR) M$(PWD) modules clean:rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions Module* modules*.PHONY: all cleanelseobj-m : hello_pcie.o endif 然后执行 make命令进行编译 编译完成后可以得到驱动对应的 .ko文件 四、驱动加载及测试 驱动编译完成后使用如下命令加载即可 sudo insmod hello_pcie.ko然后使用lspci查看该pcie设备可以看到驱动加载成功 同时我们也可以看到其BAR0基地址为0xfea00000我们使用devmem向其0x08编译地址写入数据进行阶乘运算 使用详细说明可以查看查看qemu源码的docs/specs/edu.txt文件 然后我们使用dmesg命令可以查看驱动的相关打印
http://www.hkea.cn/news/14589995/

相关文章:

  • 青海 网站开发 app gis学生个人网页制作素材
  • 家用电器网站建设公司网站 域名 cn com
  • 做网站会很忙吗网站支付怎么做的
  • 潍坊网站定制模板建站学院网站开发网站定位
  • iis网站没有属性府网站建设先进个人
  • 哈尔滨网站免费制作wordpress 同步es
  • 在谷歌上网站推广邢台经济开发区网站
  • 平台关键词排名优化在线看seo网站
  • 工业网站素材网站开发项目实战
  • 章丘建网站网站在当地做宣传
  • 旅游 网站建设目标搜索网络如何制造
  • 网站建设工作内容太原网站制作企业
  • 装修公司手机网站模板个人成立公司怎么做企业网站
  • 内蒙古住房与城乡建设部网站百度网址大全下载到桌面
  • 旅游网站开发分析报告网页界面设计是什么
  • 彩票网站有人做吗定制小程序制作平台
  • 网站建设名片设计服装织梦网站源码
  • 龙岗做网站的外贸是做什么的经营范围
  • 长沙电商网站重庆市建设工程信息网怎么查询不到安全管理证书
  • 为国外客户做网站建设dw做网站实例
  • 网站建设个人主要事迹专业网站建设科技公司
  • 学生网站模板中国互联网网站性能
  • 推销网站建设恒佳企划网站建设
  • 网站建设提供书面资料清单高级网络工程师证书
  • 想在公司局域网做建网站微商城分销平台上线
  • 怎么制作网站表白网站建设栏目提纲
  • 微网站开发素材下载 网站样板
  • 南昌市网站建设公司制作做的网站如何上传网上
  • 广州10打网站服务商北京建设工程造价信息网
  • 用vs2010做的网站的源码济南网络营销服务公司