Android Driver Development Sixth chapter

Source: Internet
Author: User

First Linux driver: Count the numbers of words

The Linux system maps each driver into a single file. These files become device driver files and are saved in the/dev directory. This design concept makes interacting with Linux drivers as easy as the common file interaction of a fish. Exchanging data with the Linux driver becomes the exchange of data with the device file.

Writing a Linux driver requires these steps:

1. Build the Linux driver skeleton.

2. Register and unregister the device files.

3. Specify driver-related information.

4. Specify the callback function.

5. Write the business logic.

6. Write the makefile file.

7. Compile the Linux driver.

8. Install and uninstall Linux drivers.

Then the preparation of the Linux driver has to first establish the directory to store the Linux driver, then build the driver source code files, and finally write a makefile file. The second is to write the skeleton of the Linux driver, mainly initialize and exit the program. The next step is to specify the driver-related information: module author, module alias, module description, open source protocol. Then register and unregister the device files. Specifies the callback function. Finally, the algorithm of counting the number of words is realized.

There are different ways to test Linux drivers:

1. Test Linux drivers with Ubuntu Linux.

2. Test the Linux driver with the native C program on the Android emulator.

3. Test Linux drivers with the Android NDK.

4. Use Java code to directly manipulate device files to test Linux drivers.

5. Use the s3c6410 Development Board to test the Linux driver.

6. Compile the driver into the Linux kernel for testing.

Android Driver Development Sixth chapter

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.