This chapter will be an example of learning the first Linux driver: Counting the number of words. The purpose of this example is not to explain how to count the number of words, but rather the implementation of the algorithm:Linux driver. the Linux system maps each driver into a single file, which is called a device file or driver file, and is stored in the/ dev directory. More advanced functionality is required to write the driver, which is the Linux -driven event, which is the callback function.
Learn the steps to write a linux driver. The first step: Build the Linux driver skeleton; Step two: Register and unregister the device files; step three: Specify the information related to the driver; Fourth: Specify the callback function, step Fifth: Write the business logic, and sixth: write the Makefile Seventh Step: Compiling Linux drivers; step eighth: Install and uninstall Linux drivers.
The following is a simple study of the instance, which does not have access to the hardware, but instead uses the device files as media to interact with the application. The application passes a space-delimited string to the device file, and then reads from the device file the number of words that the string contains.
Finally, there are a number of ways to test Linux drivers. For a linux driver, you can start Early development and testing on Ubuntu Linux, and when basic development is complete, you need to test on the development Board with real hardware This chapter describes testing Linux drivers on different platforms , including Ubuntu Linux,android Simulator and s3c6410 Development Board.
http://www.cnblogs.com/SJ-0325/
First Linux Driver