Share this

Design of WDM Driver for PCI Bus Motion Control Card

2026-04-06 07:21:25 · · #1
Abstract: This paper presents a method for designing a WDM driver using DriverStudio to enable CNC system applications to access the motion control card. Taking a PCI bus-based motion control card as the object, the paper elaborates on the main steps of designing a WDM driver based on its hardware structure. The WDM driver was developed and tested in a Windows environment, achieving the expected results. Keywords: WDM; PCI; DriverStudio 0 Introduction Currently, open CNC systems are being used more and more widely. Among them, open CNC systems based on Windows and PCs are becoming a trend in CNC technology development. The CNC system studied in this paper adopts an open architecture of NC embedded in a PC, using the Windows 2000 operating system as the platform. An NC embedded in a PC-type CNC system refers to inserting the motion control card into the computer's expansion slot, where the PC performs non-real-time processing tasks, while real-time control is handled by the motion control card. Since user-mode applications cannot directly access hardware in the Windows environment, but must indirectly access hardware resources by calling device drivers running in kernel mode, applications must develop device drivers for the motion control card in this CNC system to access it. This paper takes the DSP motion control card based on PCI bus in the CNC system as the research object, and mainly discusses the design of the WDM driver of the motion control card in the Windows 2000 environment. 1 Introduction to the structure and development tools of WDM driver 1.1 Structure of WDM driver Windows Driver Model (WDM) driver is a PnP (Plug and Play) driver that also follows the power management protocol and can achieve source code-level compatibility between Windows 98, Windows 2000 and Windows XP. In the WDM driver model, each hardware device has at least two drivers. One driver is called the function driver, which is responsible for initializing I/O operations, handling interrupt events brought about by the completion of I/O operations, and providing users with a control method for connecting devices; the other driver is called the bus driver, which is responsible for managing the connection between hardware and computer [1]. The WDM driver adopts a layered structure model, as shown in Figure 1 [2]. On the left of Figure 1 is a device object stack. Device objects are data structures created by the operating system to help software manage hardware. The device object at the bottom of the stack is called the physical device object, or PDO for short. In the middle of the device object stack is an object called the function device object, or FDO for short. There are also some filter device objects above and below the FDO, referred to as FiDO. The filter device object above the FDO is called the upper-level filter, and the filter device object below the FDO is called the lower-level filter. In the driver stack of a single hardware, the bus driver manages the connection between the computer and the device represented by the PDO. The function driver manages the device represented by the FDO. The filter driver is used to monitor and modify the I/O request packet (IRP) stream. [align=center] Figure 1 Hierarchical structure of WDM device objects and drivers[/align] 1.2 Introduction to development tools There are many software programs for developing drivers, such as NuMega's DriverStudio, Jungo's WinDriver, and Microsoft's DDK. In use, although the driver code developed using DDK is very concise, has a clear structure, and is efficient, it is difficult to develop [3]. Using third-party development tools such as DriverStudio and WinDriver is simple to use and faster to develop. Therefore, NuMega's DriverStudio is selected as the development tool. NuMega's DriverStudio is a toolkit used to simplify the development, debugging, and testing of device drivers under the Microsoft Windows platform. DriverStudio includes tool modules such as DriverWorks, DriverNetworks, SoftICE, and VToolsD. DriverWorks contains a comprehensive source code generation tool (DriverWizard) along with corresponding class libraries and driver samples, providing support for device driver development in C++. 2. Hardware Structure of the Motion Control Card The designed motion control card uses the TI TMS320LF2407 DSP chip as its core processor. The hardware system of this motion control card includes a PCI interface submodule, a digital signal processor (DSP) submodule, and an axis control interface submodule. The PCI interface of this motion control card uses the PLX PCI9052 interface chip, which is an interface chip launched by PLX Technologies for expansion adapters that provides a hybrid high-performance PCI bus target mode. It can connect to various local buses and features asynchronous operation, interrupt generators, and FIFOs. The motion control card connects to the host PC via the PCI bus, and the PCI interface submodule connects to the DSP submodule through the dual-port RAM device IDT7026. The dual-port memory (RAM) is a bidirectional FIFO data memory that serves as a data buffer. The axis control interface submodule is connected to the DSP submodule through the CPLD (Complex Programmable Logic Device). The hardware structure diagram of the motion control card is shown in Figure 2 [4]. [align=center] Figure 2 Hardware structure diagram of the motion control card[/align] 3 Design of the motion control card driver There are three main steps to develop the WDM driver for the motion control card using DriverWorks: creating the WDM driver framework; implementing the specific functions of the driver; and generating the WDM driver. The following is the specific method for designing the motion control card WDM driver using DriverWorks. 3.1 Generating the WDM driver framework using DriverWizard DriverWizard is the tool for DriverWorks to create the WDM framework program. There are eleven steps in creating a WDM driver framework for a PCI device. The following points should be noted: (1) Step 4: Select the bus type supported by the hardware device. Here, PCI is selected. Fill in the PCI Vendor ID, PCI Device ID, PCI Subsystem ID and PCI Revision ID according to the specific hardware. These parameters can be obtained from the hardware manufacturer. If the parameters entered are inconsistent with those in the target PCI device register, the system will not be able to install this driver. (2) Step 6: Select the functions supported by the driver and check the four checkboxes: Read, Write, Device IO Control and Clean up. (3) Step 7: Select the I/O request IRP processing method. Select DriverManaged, which will be managed by the StartIO queue managed by the driver. Select to process read and write requests separately. (4) Step 9: Select the class name and interface type in the device file. The class name is usually taken as the default value. Select the GUID interface method as the way the application opens the device. In the resource bar, click Add IO Port(s), Add Memory Range, and Add IRQ to declare the required resources. (5) Step 11: In order to facilitate debugging and better understand the operation process of the WDM driver, select to let the system generate a console test program and a trace code for debugging with SoftICE. At this point, the driver framework has been formed. DriverWizard generates two classes: one in the driver file, mainly implementing the DriverEntry and AddDevice routines for WDM; the other in the device file, mainly implementing the routines for hardware interaction. 3.2 Implementation of Driver Functionality The WDM driver framework created by DriverWizard contains many routines. These routines can be divided into two types: required basic routines and optional extended routines. Modifying the corresponding routines as needed will implement the specific functions of the motion control card driver. 3.2.1 Initializing the Driver – DriverEntry Routine The DriverEntry routine is responsible for driver initialization; all drivers must include the DriverEntry routine. When a driver is loaded, the PnP manager calls the DriverEntry routine once for each driver. DriverEntry is used to initialize driver-wide data structures and resources. The DriverEntry routine has the following three main functions: (1) Set the entry pointers for AddDevice, Unload, Dispatch and other routines. (2) Obtain some necessary information from the registry to initialize the driver. (3) Initialize other data structures and resources within the driver scope. 3.2.2 Serial Read Routine - SerialRead Routine In this driver, serial processing of IRPs is performed using an IRP queue managed by the driver. When the hardware device is busy, the IRPs are queued; when the hardware device is idle, the queued IRPs are retrieved and processed. The SerialRead routine is an extended routine. Adding functional code to the SerialRead routine can realize the serial read operation of the PC to the motion control card. The application can read the data and parameters in the dual-port RAM through this WDM driver. 3.2.4 Serial Write Routine - SerialWrite Routine In this driver, to realize the serial write operation of the PC to the motion control card, the SerialWrite routine needs to be used. The serial write operation is mainly responsible for processing the interpretation of the motion function prototype and writing the interpreted instructions into the dual-port RAM. 3.3 Generating the WDM Driver After the WDM driver design is complete, a workspace and two projects will be generated. The workspace includes the driver project and the application project. Select both projects and set them as the currently active projects, then compile them using Visual C++ 6.0. For driver compilation, no settings are required; simply click the Build icon to generate a driver file with the .sys extension. 4. Installation and Application of the Motion Control Card Driver After generating the driver with the .sys extension, before installation, you must first modify the INF file and then copy it to the ". .\sys\objchk\i386" directory. Modifying the INF file simply involves changing the prompt within the double quotes to the corresponding content to generate the device information file. The INF file of the driver is modified as follows: [Strings] ProviderName = "CNC Research Center" // Company Name MfgName = "South China University of Technology School of Mechanical Engineering" // Hardware Manufacturer Name DeviceDesc = "Advanced Motion Control Card V3.2" // Device Description DeviceClassName = "Advanced Motion Control" // Device Class Description SvcDesc = "Motion Control" // Service Description Use the Add New Hardware in the Control Panel to search for new hardware. Specify the INF file and the .sys driver file generated after compilation according to the prompts, and the system can automatically install the driver for the new hardware. After the driver is installed, the motion control card and its device driver are tested in the Windows 2000 environment [4]. The test results show that this device driver can enable the motion control card to work stably in the Windows 2000 environment and can accurately control the motion position and speed of multi-axis motion. At the same time, the driver can also drive the motion control card to work normally when it is ported to the Windows 98/XP system. 5 Conclusion Traditional drivers are developed using DDK, which is not efficient. This paper takes a PCI bus-based motion control card as the research object and DriverWorks as the tool to design a device driver conveniently and quickly. The motion control card and its driver were tested in a Windows environment, and the results show that the driver enables the motion control card to work stably in the Windows environment. Essentially, the driver still meets the DDK's requirements for WDM and calls the basic functions provided by the DDK. Developing a driver for a motion control card in a CNC system using DriverStudio is of great significance for realizing an open software architecture and human-machine interface in CNC systems. The author's innovation lies in using DriverStudio to design a WDM driver for the motion control card, achieving normal communication between the host computer and the motion control card in a Windows 2000 environment, and enabling accurate control of multi-axis motion position and speed through the motion control card according to the host computer's instructions. References: [1] Si Yumei, Zou Rongshi, Guo Lihong. Design and implementation of WDM driver for PCI serial communication card [J]. Microcomputer Information, 2005, 22, p. 145 [2] Wu Anhe, Tai Ming, Yu Hongtao. Development of Windows 2000/XP WDM device driver [M]. Electronic Industry Press, 2003 [3] Wu Anhe, Zhou Lili. Windows device driver (VxD and WDM) development practice [M]. Electronic Industry Press, 2001 [4] Zhu Jinhua. Research and development of DSP motion control card based on PCI bus [D]. Guangzhou: School of Mechanical Engineering, South China University of Technology, 2004 Design of WDM driver for motion control card based on PCI bus
Read next

CATDOLL Dodo 109CM TPE

Height: 109cm Weight: 15.6kg Shoulder Width: 26cm Bust/Waist/Hip: 52/50/57cm Oral Depth: 3-5cm Vaginal Depth: 3-13cm An...

Articles 2026-02-22
CATDOLL 146CM Mila TPE

CATDOLL 146CM Mila TPE

Articles
2026-02-22
CATDOLL 140CM Qing TPE

CATDOLL 140CM Qing TPE

Articles
2026-02-22