数学专业英语论文 - 范文中心

数学专业英语论文

09/23

数学专业英语论文

班级:信计C122 名字:王陈 学号:126515 英语论文内容:

The device driver notifies the application of several methods

Papers Category:Computer Papers - Computer Application Papers Post Time:2013-2-6 9:48:00

In the current popular Windows operating system, device drivers is the lowest level of manipulation of hardware software interface. To share the device driver design process experience, given the device driver notifies the application of the five kinds of ways, each method specifically described the principle and implementation process, hoping to give the designer of the device driver to provide some help.

Operating system in order to ensure peace and stability, and application portability, Windows operating system does not allow applications direct access to the system's hardware resources, but must resort to the appropriate device driver. Device drivers can directly manipulate the hardware, if applications and device drivers to achieve a two-way communication between, also reached the underlying hardware device application control purposes. Communication between them, including two aspects Abstract: On the one hand is the application sent to the device driver data; hand is the device driver sends a message to the application. The former to achieve more easily through CreateFile () function to obtain a handle to the device driver, you can use the Win32 functions such as DeviceIoControl (), ReadFile () or WriteFile (), etc. to achieve application and device driver communication. Implementation of the latter than the former complex and the article describes the situation in this respect less. This does not mean that it is not important, on the contrary, it is in some applications play an important function. Device drivers complete the data collection work, the need to immediately notify the application so that the application can be promptly removed and the data is processed. In cases like these, and so forth.

In view of the device driver notifies the application of the importance, I combined some experience, it was summarized summarized five methods Abstract:

asynchronous procedure call (APC), event mode (VxD), messaging, asynchronous I / O modes and event mode (WDM). Below were the principles of this in several ways, and given of some of the source code.

An asynchronous procedure call (APC)

Win32 applications using CreateFile () function to dynamically load the device driver, and then define a callback function backFunc (), and the address of the callback function% 26amp; backFunc () as a parameter, through DeviceIoControl

() sent to the device driver. Device drivers to get the address of a callback function, it will save it in a global variable (eg callback), the simultaneous calls

Get_Cur_Thread_Handle () function to get its application thread handle, and the handle is stored in a global variable (eg appthread ) in. When conditions are ripe, the device driver calls _VWIN32_QueueUserApc () function to send messages to the Win32 application. This function takes three arguments Abstract: The first parameter is the address of the callback function (already registered); second parameter is passed to the callback message; third parameter to the caller's thread handle (already registered). Win32 application receives a message, the automatic callback function (actually called by the device driver). Callback

function of the input parameters are populated by the device driver, the callback function here is mainly to handle the message.

2 Event mode (VxD)

First, Win32 applications to create an event handler, called Ring3

handle. Because the virtual device driver using events Ring0 handle, so you need to create Ring0 handle. Using LoadLibrary () function to load the dynamic link library undisclosed Kernel32.dll, get dynamic link library handle. Then, call GetProcAddress (), find the function OpenVxDHandle () in the dynamic link

library location. Then, OpenVxDHandle () function will Ring3 event handlers into Ring0 event handler. Win32 applications using CreateFile () function to load the device driver. If the load is successful, call the DeviceIoControl () function will be

passed to the event handler Ring0 VxD; while waiting for the signal to create a worker thread becomes signaled state itself can shop and other things. When conditions are ripe, VxD set Ring0 event to signaled state (called

_VWIN32_SetWin32Event () function), which corresponds to Ring3 immediately trigger event to signaled state. Once Ring3 event handler for the signaled state, Win32 application's worker thread on this news be handled accordingly. 3 message mode

Win32 application calls CreateFile () function to dynamically load the virtual device driver. Loaded successfully, by calling DeviceIoControl () function handles the form sent to VxD, VxD use this handle to form a message. When the conditions are met, VxD calls SHELL_PostMessage () function to send messages to Win32 applications. To make use of this function successfully, you must use # define to customize a message, and even so it is defined in the application; also used in the message loop ON_MESSAGE () to define the

message processing function corresponding to the message so that the message is generated , can call the message handler. SHELL_PostMessage () function's first argument for Win32 window handle, the second parameter is the message ID number, and the third, four parameters are sent to the message processing

function parameters, fifth, six parameters for the callback function and pass to its parameters. Win32 application receives a message, the message is processed. 4 asynchronous I / O mode

Win32 application first calls the CreateFile () function to load the

device driver. Before calling this function, the penultimate two parameter is set to FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, saying that he can file overlapped I / O operations. When the device driver file is successfully created, create an initial state is no signal, you need to manually reset the event, and will pass this event type is OVERLAPPED data structure (eg Overlapped). Then, Overlapped as a parameter passed to DeviceIoControl () function. Device driver put the I / O request packet (IRP) is set to pending status, and set a cancel routine. If the current IRP queue is empty, then the IRP sent to StartIo () routine;

Otherwise, put it IRP queue. Device drivers after completing such work, ending the DeviceIoControl () processing, so do not wait for Win32 applications may IRP processed, from DeviceIoControl () call to return. By determining the return

value, get the IRP handling. If the current IRP is pending, then the main program do some other work, then call WaitForSingleObject () or WaitForMultipleObject () function waits for the event become Overlapped signal state. Device drivers at the appropriate time to handle the queued IRP, processing is complete, call

IoCompleteRequest () function. This function Overlapped the event is set to the signaled state. Win32 applications to respond to this incident immediately exit the wait state, and no signal will be reset to the state of the event, and then call GetOverlappedResult ()

Function to get the result of the IRP process.

5 Event mode (WDM)

Win32 application first creates an event, and then passed to the event handler device drivers, then create a secondary thread, waiting for an event signaled that he will go on other things. Device drivers access the event handle, can be used to convert it to an event pointer register and put it up for later use. When the conditions are met, the device driver will set the event to signaled state, so that the application of the worker thread immediately know the news, then make the appropriate treatment. When the device driver no longer uses this event, the event should be lifted pointer.

6 Conclusion

In the current popular Windows operating system, device drivers is the lowest level of manipulation of hardware software interface. It offers up a user interface and hardware-independent, down directly I / O, hardware interrupts, DMA and memory access and other operations. It applications and hardware details shields, so do not rely on the hardware and software available in portable between

different platforms. This article describes the five kinds of device driver notifies the application, in which the first three methods are mainly used in VxD, the latter two methods is mainly used for WDM. This 5 ways to have been the actual

test. Test results show that they are able to reach the device driver notifies the application purposes.

References Abstract:

[1 European Youth Li, XU Jian-bo, LI Fang-min, etc. virtual device driver VxD inquiry and development. Computer Engineering, 2003

[2 (America) Chris Cant. Windows WDM Device Driver Development Guide. Sun Yi, Ma Libo, the country Xuefei, M., Beijing Abstract: Mechanical Industry Press, 2000

[3 Li Heping DSP-based image reconstruction system to explore ICT, Beijing Abstract: Beijing University of Aeronautics and Astronautics Mechanical Engineering and Automation, 2002

汉语翻译内容:

设备驱动程序通知应用程序的几种方法

文件类别:计算机论文-------计算机应用论文

发表时间:2013-2-6 9:48:00

在目前流行的Windows 操作系统中,设备驱动程序是操纵硬件的最底层软件接口。为了共享在设备驱动程序设计过程中的经验,给出设备驱动程序通知应用程序的5种方法,具体说明每种方法的原理和实现过程,希望能够给设备驱动程序的设计者提供一些帮助。

为了保证操作系统的平安性和稳定性以及应用程序的可移植性,Windows 操作系统不答应应用程序直接访问系统的硬件资源,而是必须借助于相应的设备驱动程序。设备驱动程序可以直接操作硬件,假如应用程序和设备驱动程序之间实现了双向通信,也就达到了应用程序控制底层硬件设备的目的。它们之间的通信包括两个方面摘要:一方面是应用程序传送给设备驱动程序的数据;另一方面是设备驱动程序发送给应用程序的消息。前者的实现较轻易,通过CreateFile()函数获取设备驱动程序的句柄后,就可以使用Win32函数,如DeviceIoControl()、ReadFile()或WriteFile()等实现应用程序和设备驱动程序之间的通

信。后者的实现远比前者复杂,同时介绍这方面情况的文章较少。这不等于说它不重要,相反,它在有些应用场合发挥着重要的功能。设备驱动程序完成数据的采集工作后,需要马上通知应用程序,以便应用程序能够及时将数据取走并进行处理。诸如此类情况,不一而足。 鉴于设备驱动程序通知应用程序的重要性,本人结合一些经验,对它进行了总结,归纳出5种方法摘要:异步过程调用(APC)、事件方式(VxD )、消息方式、异步I/O方式和事件方式(WDM)。下面分别说明这几种方式的原理,并给出实现的部分源代码。

1 异步过程调用(APC)

Win32应用程序使用CreateFile()函数动态加载设备驱动程序,然后定义一个回调函数backFunc(),并且将回调函数的地址%26amp;backFunc()作为参数,通过DeviceIoControl()传送给设备驱动程序。设备驱动程序获得回调函数的地址后,将它保存在一个全局变量(如callback )中,同时调用Get_Cur_Thread_Handle()函数获取它的应用程序线程的句柄,并且将该句柄保存在一个全局变量(如appthread )中。当条件成熟时,设备驱动程序调用_VWIN32_QueueUserApc()函数,向Win32应用程序发送消息。这个函数带有三个参数摘要:第一个参数为回调函数的地址(已经注册);第二个参数为传递给回调函数的消息;第三个参数为调用者的线程句柄(已经注册)。Win32应用程序收到消息后,自动调用回调函数(实际是由设备驱动程序调用)。回调函数的输入参数是由设备驱动程序填入的,回调函数在这里主要是对消息进行处理。

2 事件方式(VxD )

首先,Win32应用程序创建一个事件的句柄,称其为Ring3句柄。由于虚拟设备驱动程序使用事件的Ring0句柄,因此,需要创建Ring0句柄。用LoadLibrary()函数加载未公开的动态链接库Kernel32.dll ,获得动态链接库的句柄。然后,调用GetProcAddress(), 找到函数OpenVxDHandle()在动态链接库中的位置。接着,用OpenVxDHandle()函数将Ring3事件句柄转化为Ring0事件句柄。Win32应用程序用CreateFile()函数加载设备驱动程序。假如加载成功,则调用DeviceIoControl()函数将Ring0事件句柄传给VxD ;同时,创建一个辅助线程等待信号变成有信号状态,本身则可去干其它的事情。当条件成熟时,VxD 置

Ring0事件为有信号状态(调用_VWIN32_SetWin32Event()函数),这马上触发对应的Ring3事件为有信号状态。一旦Ring3事件句柄为有信号状态,Win32应用程序的辅助线程就对这个消息进行相应的处理。

3 消息方式

Win32应用程序调用CreateFile()函数动态加载虚拟设备驱动程序。加载成功后,通过调用DeviceIoControl()函数将窗体句柄传送给VxD ,VxD 利用这个句柄向窗体发消息。当条件满足时,VxD 调用SHELL_PostMessage()函数向Win32应用程序发送消息。要让该函数使用成功,必须用#define来自定义一个消息,并且也要照样在应用程序中定义它;还要在消息循环中使用ON_MESSAGE()来定义消息对应的消息处理函数,以便消息产生时,能够调用消息处理函数。SHELL_PostMessage()函数的第一个参数为Win32窗体句柄,第二个参数为消息ID 号,第三、四个参数为发送给消息处理函数的参数,第五、六个参数为回调函数和传给它的参数。Win32应用程序收到消息后,对消息进行处理。

4 异步I/O方式

Win32应用程序首先调用CreateFile()函数加载设备驱动程序。在调用该函数时,将倒数第2个参数设置为FILE_ATTRIBUTE_NORMAL|FILE_FLAG_OVERLAPPED,表示以后可以对文件进行重叠I/O操作。当设备驱动程序文件创建成功后,创建一个初始态为无信号、需要手动复位的事件,并且将这个事件传给类型为OVERLAPPED 的数据结构(如Overlapped )。然后,将Overlapped 作为一个参数,传给DeviceIoControl()函数。设备驱动程序把这个I/O请求包(IRP )设置为挂起状态,并且设置一个取消例程。假如当前IRP 队列为空,则将这个IRP 传送给StartIo()例程;否则,将它放到IRP 队列中。设备驱动程序做完这些工作后,结束这个DeviceIoControl()的处理,于是Win32应用程序可能不等待IRP 处理完,就从DeviceIoControl()的调用中返回。通过判定返回值,得到IRP 的处理情况。假如当前IRP 处于挂起状态,则主程序先做一些其它的工作,然后调用WaitForSingleObject()或WaitForMultipleObject()函数等待Overlapped 中的事件成为有信号状态。设备驱动程序在适当的时候处理排队的IRP ,处理完成后,调用IoCompleteRequest()函数。该函数将

Overlapped 中的事件设置为有信号状态。Win32应用程序对这个事件马上进行响应,退出等待状态,并且将事件复位为无信号状态,然后调用GetOverlappedResult()

函数获取IRP 的处理结果。

5 事件方式(WDM )

Win32应用程序首先创建一个事件,然后将该事件句柄传给设备驱动程序,接着创建一个辅助线程,等待事件的有信号状态,自己则接着干其它事情。设备驱动程序获得该事件的句柄后,将它转换成能够使用的事件指针,并且把它寄存起来,以便后面使用。当条件具备后,设备驱动程序将事件设置为有信号状态,这样应用程序的辅助线程马上知道这个消息,于是进行相应的处理。当设备驱动程序不再使用这个事件时,应该解除该事件的指针。

6 结语

在目前流行的Windows 操作系统中,设备驱动程序是操纵硬件的最底层软件接口。它向上提供和硬件无关的用户接口,向下直接进行I/O、硬件中断、DMA 和内存访问等操作。它将应用程序和硬件细节屏蔽开来,使软件不依靠于硬件并且可在多个不同的平台之间移植。本文介绍了5种设备驱动程序通知应用程序的方法,其中前3种方法主要用于VxD 中,后2种方法主要用于WDM 。这5种方法都经过实际测试。测试结果表明,它们都能够达到设备驱动程序通知应用程序的目的。

参考文献

摘要:

[1欧青立,徐建波,李方敏,等. 虚拟设备驱动程序VxD 的探究和开发. 计算机工程,2003

[2(美)Chris Cant. Windows WDM设备驱动程序开发指南. 孙义, 马莉波, 国雪飞等译. 北京摘要: 机械工业出版社 2000

[3李和平. 基于DSP 的ICT 图像重建系统探究. 北京摘要: 北京航空航天大学机械工程及自动化学院, 2002


相关内容

  • 红河县职称论文发表网-信息技术小学体育论文选题题目
    云发表,专业论文发表网站!http://www.yunfabiao.com/ 面向作者直接收稿,省去中间环节,价格更低,发表更快,收录更快! 红河县职称论文发表网-信息技术|小学体育论文选题题目 红河县职称论文发表网-以下是信息技术|小学体 ...
  • 江苏大学车辆考研历年分数线汇总
    江苏大学汽车与交通学院历年分数线汇总 09年复试线297,英语线42. 10年 车辆工程学科:根据考生成绩情况,按招生总数(含学术型和应用型)的1:1.2确定参加复试人数.最终的总体要求是:总分≥311.数学≥75.英语≥40 11年专业型 ...
  • 大连理工简介
    大连理工大学简介 大连理工大学2011在河南各专业招生录取分数线理科 专业类型 数学类 土建类 建筑学 建筑环境与设备工程 船舶与海洋工程 交通工程 工商管理类 物流工程 新闻传播学类 软件工程 工程力学 金属材料工程 生物医学工程 计算机 ...
  • 中国人民公安大学研究生招生科目
    专业方向 030101 法学理论 考试科目 备注 01 法理学 02 比较 ①101 思想政治理论②201 英语一③620 法理学. 法学 宪法学④820 刑法学.刑事诉讼法学 030103 宪法学与行 政法学 01 宪法学与行政法 ①10 ...
  • 20**年考研心得体会
    2016年中传舆论学考研分数线及心得体会 凯程为大家提供历年中传舆论学考研复试分数线: 凯程老师通过综合考研辅导名师.舆论专业导师,及往届高分学员.职业经理人的意见,为有意向报考中传舆论专业的考研学子提供如下建议. 2015年3月 首先要确 ...
  • 申报副教授业务自传
    申报副教授业务自传 一.专业知识方面 任现职以来,我注重学习数学教育理论,了解我国基础教育改革的最新动向,xxxx 年参加了国家级和自治区级的数学新课程培训,xxxx 年参加教育部数学教育高级研讨班,xxxx 到南京师范大学作为访学学者进行 ...
  • 20**年东北大学机械考研400+经验分享
    合理的坚持就是胜利 --记2014东北大学机械工程考研 政治:70+,英语二:70+ 数学二:125+,专业课:130+,总分:400+ 考上我心中理想的学校与理想的专业,一切都几乎完美的不真实,但自己从来不算个优秀的学生,本科没拿过一次奖 ...
  • 细节决定复试成败考研英语复试着装礼仪攻略
    考研复试自我介绍尽量多展示知识结构 2月份,2017考研初试成绩就会公布,各院校研招复试也会陆续拉开序幕.面试时第一件事就是向老师介绍自己,那么考生该如何利用这短短的几分钟时间最大程度的展现自己呢?小编建议考生面试时要尽量多展现自己的知识结 ...
  • 14岁上成理,34岁破译国际著名数学难题,你造他是谁吗?丨一甲桃李
    CDUT 丨用心做每一条 用心做每一天丨 14岁上大学?他是天才吗?他是学霸吗? 34岁破译Dwork猜想,还蜚声国际?天哪,这不是工作狂嘛?! 错错错!!! 他说:"天分与做出成果并没有特别大的关系,只要差不多就行了." ...
  • 第五届中国教育学会科研成果奖
    第五届"中国教育学会奖"优秀教育科研成 果评审情况介绍 为纪念中国教育学会成立 30 周年,检阅近 5 年来我国群众性教 育科学究和教改实验的成就,推动教育发展与改革,推动教育科学研 究事业的进步与繁荣,中国教育学会决定 ...