Android Deep Explore eighth chapter

Source: Internet
Author: User

Eighth Chapter

This chapter will introduce the implementation of the buzzer to the original plow and achieve a complete buzzer drive (can turn the buzzer on and off).

1.Linux Driver code reuse: You can use standard C program methods to put code that will be reused in other files. If you want to use some features, include the corresponding header file, it can also be another way of dynamic reuse, but also a Linux driver can use the resources in another Linux drive. There are two more macros (_init and _exit) found in the Main.c file, which have never been used in previous drivers. The two macros are used to identify the Linux driver initialization function (MAIN_INIT) and the Linux drive unload function (Main_exit).

2. Forcibly uninstall Linux driver: Uninstall Linux driver through the Rmmod command, but sometimes cause the Linux driver module can not unload, such as initialization function crash unload function is blocked

3. Buzzer (PWM) driver: The buzzer is a hardware device on the s3c6410 Development Board. You can control the buzzer by writing a specific value to the register. PWM time-driven implementation is different from the LED driver, the PWM driver will be composed of several files. This is also the standard implementation of most Linux drivers. These files are co-compiled when the Linux driver is compiled.

Summary: This chapter describes how to divide a Linux drive into multiple files. The data structure, function code in these files can also be used by several different drivers, so this is also an important method of code reuse. The PWM drive is similar to the LED driver implementation process and may be simpler. In this chapter it is only to demonstrate how to divide a Linux driver into multiple implementation files before using a relatively simple PWM driver. Through the study of this chapter, we can master the common code reuse mode of Linux driver.

Android Deep Explore eighth 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.