Compile the wince driver

Source: Internet
Author: User

Generally, we need localalloc in the driver to reserve a bucket, and then map the I/O port to the address using localcopy. Then we can access the reserved address.
The handling of interruptions varies with various devices. If it is a built-in device (built in), a new interrupt is generally defined in the oalintr. h file, and the oal layer is added to handle the interrupt. Create an event with createevent in the driver's init function, call interruptinitialize to associate the defined interrupt with the created event, and create a thread, in this thread, waitforsingleobject is called to wait for this event. when the device is interrupted, this event is triggered. waitforsingleojbect returns and the thread is running, so that we can handle this interruption.
The newly added processing of the interrupt in oal is the so-called ISR content, and this thread is called ist.

Others

1. The number of devices with the same name under CE cannot exceed 10

This problem is no longer found in ce5.0,
Previous versions can do this:
Only one device is output to the upper layer,
Then, use IOCTL to open physical devices.
In this way, no restrictions are imposed.

2. MDD and PDD

A driver is usually divided into two parts: hardware-related (PDD) and hardware-independent (MDD) layers.
Of course, this layering is not necessary, but you can write much less code after adopting this hierarchy, because Microsoft provides a lot of driver mdd. Even if CE does not have an example of the driver we have written, after adopting this structure, when you need to write a second program, you can reuse its code to improve development efficiency.

MDD provides functions that can be used by devices of the same type (such as serial ports), so that PDD only supports register operations.
For example, most of the code of the serial port interrupt processing and read/write functions is implemented in mdd,
In implementation of different serial ports, you only need to provide some functions of the actual operation register.

The MDD and PDD interfaces of different drivers are different,
Therefore, when we face a specific driver, we need to find out which functions need to be provided.

3 xxx_init function return handle

Generally, this handle is a pointer for the driver to save data,
We will tell the upper-layer program when init returns, and when other upper-layer functions (such as open) are called later,
This value is passed in, so that we can access some of our own private data.

Of course, an arbitrary non-0 value can also be returned.

For a device driver, the layers not used by the system have different handles.
The handle returned in xxx_init is saved in the Device Manager, which cannot be seen in other programs,
Using createfile will also get a file handle, which I don't know where to save,
But it is different from the former.

That is to say, the handles of software at different layers will be different.

4. Differences between debugmsg and retailmsg

They are used to output debugging information,
The difference is:
Debugmsg is valid only in the debug version. In the release version, it is defined as null.
Retailmsg can be output in both Debug and release versions,
In addition, debugmsg can be used to control whether to output information at runtime.

During ship build, both retailmsg and debugmsg are invalid.

5. Two desktops are displayed on the video screen, which should be:

The screen size is set to only half of the actual size (height ).

That is to say, the screen height is 600, and the height set in your driver is 300.

Of course, you can also modify the program to make the lower half of it output black.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.