This digest from my my book fixing "embedded Linux driver template explaining and project practice"
Initially it seems that Linux device driver development involves a lot of content, and the need to achieve a wide range of drivers, in fact, after a period of time to drive back looks like the main points are:
(1) Classification of the drive, first summed up as which type of drive, the collation of the correct reuse of the kernel provided by the subsystem for development, often found that in fact, a lot of common things the kernel has helped us to do, a good driver engineers should maximize the use of kernel resources. After all, the kernel has been implemented with strong stability and high portability.
(2) to find the subsystem provided by the kernel, the next step is to make the subsystem for the device to provide the characterization, that is, describe the class-driven structure, and then define the structure to initialize the necessary data, and finally call the kernel subsystem provided by the interface function submitted to the kernel management. This is a strategic process for most driver development.
(3) clarify what the subsystem has done and what it needs to implement in its own drive, usually by looking for a close driver to make changes rather than writing a line of code. Finding a close drive routine in the kernel is a good and quick way. These routines basically provide how the interface is used, the invocation process, and so on.
(4) The above is basically related to the kernel interface, the second driver relates to the chip manual, which is consistent with other embedded software, so from the SCM software development or other operating system software development turned to do Linux This is part of the strength of the people who drive development.
(5) Another content driver is the protocol, various embedded bus protocols from simple SPI to complex PCI or USB and so on. The basic knowledge of the protocol needs to be mastered, fortunately, the kernel to a variety of common protocols are provided in the form of subsystems, in the subsystem to do the majority of common work, greatly reducing the workload of driving development.
so learn to drive development, an important aspect is to learn the core, familiar with the core organization and thinking mode, so it is very necessary to make a summary of its ideas.