This article is suitable for those who have no contact with the driver or novice driver. To run this program and the source code, please read the ReadMe.txt file first.
The drivers described in this article are made with WindRiver, do not use DDK or driverstudio, may not look like a "very formal" driver, and the drivers in this article cannot be used for DirectShow interfaces. For DDK and DriverStudio I also understand some content, at the beginning of the time I was full of passion to use DDK or driverstudio, and soon my fire of passion was mercilessly extinguished, for an end People who have not been exposed to driver development (I don't know how the system found a device driver before), I personally think DDK or driverstudio is a bit difficult, when you have some understanding of DDK or DriverStudio, when you have the desire to make a little code, You'll see how brutal the results are, either run an error, or black screen restart, and finally you have nowhere to start, especially the preparation of a hardware device is not their own, for some production orders are unfamiliar, for starters, DDK or driverstudio seems particularly difficult, at first I was like this. But in my personal view after understanding some of the driving knowledge, in the use of DDK or driverstudio encounter difficulties, you may wish to try WindRiver, you will be excited to find that the tool can not do what the work will be able to communicate with your hardware, At this time you will have a better grasp of the windriver, because the object is always the same device, the common place or some.
While using WindRiver, you've just developed a software that looks like it's just developing an application layer, which is equivalent to putting some of the driver features into the application (note: Just a part), of course, which requires WindRiver API support (so it affects speed), In fact, I think this is the development of windriver ideas. And I think if you do it under the WindRiver, then use DDK or DriverStudio difficulty will also drop a lot of it, especially for the USB drive, to find out URB should be easier after. Well, don't say much, let's get down to business.
1. Preparation--knowing and knowing, win
For a driver like me, it is necessary to know something about driving knowledge. We should have a conceptual grasp of the drive, such as what the driver is, what the driver is, how the hardware is driven, how the application communicates with the hardware, what the driver ultimately produces, and what the development drivers are. In the process, we can find some of the driving development of the book to see, accumulate some conceptual knowledge.
2, tools-to first attack the matter, its prerequisite
Speaking of development, of course, need a development tool, where VC is inseparable from, but the development drive, there must be another tool to choose. In fact, what is the way to generate the driving framework, like VC under the application can automatically generate an initial framework. Here we have three ways to choose:
From the DDK example (at this time Xu contains DDK compiler tools), such as the Usbintel to write, this way to compile the driving quality should be the best, but at the same time difficulty is the largest;
With DriverStudio (at this time Xu contains DDK compiler tool), in fact, DriverStudio is the DDK of the package, its difficulty although a decline, but for me such a beginner is still difficult, there is a metaphor for a good, driverstudio and DDK relationship , just like the VC and SDK relationship;
With WindRiver, as mentioned earlier, WindRiver actually has a drive of its own (normal mode), so it can directly communicate with your hardware, of course, you need to make some settings for your hardware, such as the delivery of some production orders, that is, some register settings. However, hardware tends to have a lot of registers, so it is cumbersome to manually set yourself, if your hardware already has a ready-made driver (such as a camera), we can use like Bushound tools to track the entire process of driving load, and then write a program to convert the results to code, and then add On the special settings you need, I do it, but this style of code may look very bad. Because in this process you need to understand the production orders, so look at the hardware datasheet is necessary, which is the reason I choose ov511+ chip camera, its datasheet is open.
3, look at the Linux source code-Shanzhi, can attack jade
Because Linux is an open source project, so there is no source code in Windows, Linux can often find the corresponding source code, the camera driver is such a situation. Camera image data is very difficult to analyze, even if the ov511+ camera uncompressed data is not easy to analyze, but through the Linux source code we can find (320*240, yuv420): It is through the block to deal with a 384 bytes,256 bytes Bytes u,64 bytes V, it can be found that one frame of data is not a standard yuv420 format. So the basic process of image processing should be ov511+ yuv420-> standard yuv420->rgb24. If it is to compress the data, that also must carry on a decoding work first, this is also more tedious, has the patience to continue to look at the Linux source code, but I did not do.
Summary--the wind and waves will sometimes, straight Hang Yun-fan Ji Sea
In this learning process, I came up with an experience is: knowledge needs a process of accumulation, the mentality should be balanced, do not be anxious. Since the starting point was too high (to start with a generic driver), difficult to grasp the degree of certainty, and there is no basis for their own, so very depressed, but slowly, with the camera-driven understanding, realize that GM is actually very difficult, you need to the various camera chips are programmed, and then integrated into a generation Code Li (Personal understanding), but some manufacturers are not public datasheet, such as zc301, which makes the development of the driver is particularly difficult, so now just select a chip: ov511, but also only its uncompressed data processing, but finally can see the camera image, Although this is far from the original goal.
Download source code: http://www.vckbase.com/code/downcode.asp?id=2909