News ID

The Application of Embedded System in Touch Screen Driver

Graperain

Windows CE.NET is a preemptive multi-tasking and powerful communications capabilities of the Windows 32-bit embedded operating system, Microsoft is specifically for information devices, mobile applications, consumer electronics, embedded applications and other non-PC areas designed from scratch Strategic operating system products. You can see that Windows CE is not part of the Windows desktop operating system or reduced version. The CE system, like other operating systems, also provides device drivers. To drive internal or peripheral hardware devices. The driver links the operating system and the device so that the operating system can identify the device and provide the appropriate service for the application. To really understand the driver must be combined with the actual development of some drivers. In this paper, based on ARM9 core hardware platform for the touch-screen driver, for example, on how to different hardware devices to achieve Windows CE-driven development.

1. Windows CE architecture

Windows CE is composed of many discrete modules. Each module provides specific functionality. Some of these modules are divided into components. Components make the Win-dows CE very compact, only less than 200KB of RAM, it only takes up the minimum equipment required to run the ROM, RAM and other hardware resources.

Windows CE includes four modules that provide the most critical functionality of the operating system: kernel modules; object storage modules; graphics, window and event subsystem (GWES) modules, and communication modules. Windows CE also includes additional optional modules. These modules can support the task of managing the flow of device drivers, support COM and so on.

Core is the core of 0S. Through the Core DII module. It provides basic operating system functions that are present in all devices. The kernel is responsible for memory management, process management, and specific file management functions. It also manages virtual memory, scheduling, multitasking, and exception handling.

Object Storage You can store user data and application data in a file or reg- ister. During the course of the operating system construction process, these different object storage components can be selected or ignored.

GWES is the graphical user interface between the user, the application, and the OS.

GWES accepts user input by manipulating the keyboard and stylus movements. And select the information to be transferred to the application and 0S. GWES handles output by creating and managing the windows, graphics, and text displayed on the display device and the printer.

The communication component provides support for the following communications hardware and data protocols: Serial I / O support, Remote Access Service (RAS), Transmission Control Protocol / Internet Protocol (TCP / IP), Local Area Network (LAN) Of wireless services.

2. device-driven interrupt handling

Interrupt is an important method of dealing with hardware and software, so most of the drivers are related to interrupt handling. To understand the driver development process. You must first understand the Windows CE interrupt mechanism. In the CE interrupt handling. Part of the work is done by the CE Kernel, part of the completed by the OEM. The interrupt service routines for Windows CE are implemented by the OAL (Object Abstraction Layer). The hardware interrupt is sent to the kernel's exception handler. The kernel's interrupt support handler calls the OAL function OEMInterruptDisable to disable this hardware-specific interrupt. The kernel then invokes the ISR for a physical interrupt to return a logical interrupt to the system's task scheduler in the form of an interrupt identifier. After the system obtains the interrupt number, it will find the interrupt number and wake up the thread waiting for the corresponding event (IsD, then IST can interrupt the user mode.) After processing.

The IST needs to call InterruptDONe to notify the OS that the interrupt handling is complete.

3. WinCE under the driver model

To write the driver also determine which driver it belongs to. The Windows CE driver is divided into a native device driver and a streaming device driver. Native device drivers are statically linked to GWES, and they do not exist as a separate DLL. There are some types of devices, such as keyboard, display and Pc card slot on the operating system has a certain interface, is designed for Windows CE.NET. So they are the native device driver. If in accordance with the structure points, can be divided into hierarchical drivers and non-hierarchical drivers. Hierarchical drivers consist of two set layers: the upper layer is the model device driver (MDD), and the lower is the platform-dependent driver (PDD). Stream interface driver is a dynamic link library in the form of a unified management by the device manager to load, manage and uninstall. This paper uses a layered driver to complete the $ 3C2410-based touch screen driver.

4. Windows CE touch screen driver under the implementation

4.1 Configuring the Hardware

For a layered driver, you only need to write the PDD layer code that corresponds to a specific hardware platform. The first is to configure the controller hardware, which is the first thing to complete the driver.

That is, the hardware initialization of the touch screen. That is, the touch screen controller is set to a certain state by writing data to a register mapped to the memory. Configure the hardware

Before, we need to decide in advance whether to use interrupt-driven.

Here we use interrupt-driven approach. To be clear. Not using interrupts is always the best design. The process of configuring the hardware is by

TouchPanalPowerOn0 function completed.

4.2 Setting Interrupts Judge the condition of being touched

The basic hardware for the touch screen is set correctly. The next step is to use a reliable method to determine whether the screen has been touched. Two logical interrupts are used in its driver:

1.SYSINTR TOUCH, for the touch pen when you click the touch screen to generate the corresponding interrupt:

2.SYSINTR TOUCH_CHANGE, for the touch pen to leave the corresponding interrupt.

The process has several judgments: check whether the screen is touched; acquire multiple raw data on each axis for subsequent filtering; check whether the screen is still being touched.

4.3 Read the data and shake

When the screen is touched. We first read the x-axis and Y-axis of the original data and defibrillation processing, and then determine whether the data is stable, if unstable, continue to read the data and to shake, until the stable data so far. Reading the coordinates of the touch point is done by the DdsiTouchPanalGetPoint ().

4.4 Touch Screen Calibration

Complete the previous tedious work, the driver of the various functions are already ready. Now you can actually touch the screen. The resistive touch screen needs to be calibrated before operation. This requires some reference values. So that we can convert the raw raw analog-to-digital conversion value to the screen pixel coordinates required by higher-level software. Because many resistive touch screens are significantly non-linear, simply inserting several position values ​​between the maximum and minimum values ​​can cause the driver to be very imprecise. Often the touch driver runs the calibration program at start-up. But remember that these reference values ​​must be saved. So as not to be calibrated at a later start-up time.

The only way to make accurate judgments is to do a lot of iterative testing. After a large number of experiments show that the more calibration points selected, interpolated window spacing is smaller, the higher the accuracy of the calibration. After calibration is complete. You can begin normal operation, and began to send software to higher levels of touch events. The final step, we use the Platform Builder to compile a good driver loaded into the WinCE kernel, and then burn to the target device. After the start we will get a friendly touch-screen interface. You can verify that the driver is successful.

5. Conclusion

When designing the Windows CE driver. First select the type of driver. This paper selects a layered native device driver. Development efficiency is relatively high, other drivers can choose the appropriate driving model according to the actual situation. In addition. Windows CE drivers can be ported to different hardware platforms. As long as the master of the above ideas can be successfully achieved transplantation.

Source: Graperain