Android Deep Explore--hal and Driver Development eighth chapter

Source: Internet
Author: User

This chapter introduces the realization of the original plow of the buzzer, and realizes a complete buzzer drive (can open and close the buzzer), the buzzer is also called PWM pulse width modulation, the basic principle is to control the buzzer by the pulse to open and stop. A buzzer is a hardware device on a development Board that can control the sound emitted by a buzzer by writing a specific value to the register.

In the process of completion, the first is to complete the Linux driver code reuse, the first is to compile the Linux driver composed of multiple files, and generate the Ko file, the last makefile file. It then relies on the driver module, which uses symbols from the back of another driver module in one drive module.

With the I/O command can open and stop the rank PWM,PWM drive consists of three files, PWM.C driver main program, pwm_fun.h the corresponding header file, PWM_FUN.C contains two functions to open and stop the PWM. First enter/root/drivers/ioctl execute build.h script file to compile and upload the IOCTL, before testing to compile and install the PWM driver, and then into the Development Board terminal/data/local Open and stop PWM.

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. This section 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.

PWM driver similar to the LED, it may be simpler, this chapter uses the PWM driver mainly for a more simple to divide a Linux driver into multiple implementation files, learn through this chapter, but also further grasp the code reuse method and forcibly uninstall the Linux drive method, you can not constantly restart the machine.

Android Deep Explore--hal and Driver Development 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.