Reading notes (vi)

Source: Internet
Author: User

First Linux driver:

Linux-driven work and access is one of the highlights of Linux, and has been widely praised by the industry. The Linux system maps each driver into a single file. These files are called device files or drive files and are saved in the/dev directory. This design concept makes interacting with Linux drivers as easy as interacting with ordinary files. Of course, it's easier than visiting Linuxapi. Since most Linux drivers have their corresponding device files, exchanging data with the Linux driver becomes the exchange of data with the device files. For example, to send a print command to a Linux printer driver, you can open the device file directly using the C function open and have the function ioctl send a print command to the drive's device file.

To write a Linux driver: Step one: Build Linux driver skeleton load and unload Linu drivers. Step two: Register and unregister the device files. Step three: Specify information related to the driver. Fourth step: Specify the callback function. Fifth step: Write the callback function. Fifth step: Write the makefile file. Seventh: compiling Linux drivers. Eighth Step: Install and uninstall the Linux driver.

Test Linux drivers in a variety of ways: for a Linux driver, you can start with pre-development and testing on Ubuntu Linux, and then use software on Ubuntu Linux to simulate the part of the hardware that comes in. When the basic development is completed, it is necessary to transport the Development Board or the main process prototype, using real hardware for testing. Of course, the final test will need to be done on the final sales Hing, and the Linux driver will be the real development. One of the most important steps in developing a Linux driver is testing.

This chapter not only introduces an example, but also describes how to test Linux drivers using different methods. These methods are mainly differentiated by platform. For example, you can test Linux drivers directly using Ubuntu inux. There are a number of drivers that can be installed directly on Android, embedded systems, or even on the Android emulator board or on the phone, as long as the Linux kernel is compiled on one side.

http://home.cnblogs.com/u/lkm-6398/

Reading notes (vi)

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.