The eighth chapter, let the Development Board sound: Buzzer driver

Source: Internet
Author: User

Through the study of this chapter I learned the following knowledge:

First, the knowledge of buzzer: Buzzer is also known as PWM (pulse width modulation), the basic principle is to control the buzzer by pulse to open and close, the output pin of the timer and the transistor of the buzzer connected, this circuit transistor is PNP, when the pin is high, the transistor is in saturation, circuit conduction,       Current flow through the buzzer, at this time the buzzer audible, conversely, when the pin is high, the transistor is in the cut-off state, circuit shutdown, buzzer stop sound. The buzzer driver consists of three files: Pwm_c.pwm_fun.h, pwm_fun.c. Where PWM.C is the driver main program. Pwm_fun.h refers to the corresponding header file and defines some macros. The Pwm_fun.c file contains two functions for opening and stopping the PWM.

The buzzer is a hardware device on the S3C6410 Development Board that can control the buzzer by writing a specific value to the register.

Study of the Experiment: Compile 3. c files into 3.0 files, and deliver the 3.0 file chains to the. ko file. 1. Write main.c files, as well as FUN.C, product.c, and product.h files. 2. Write Makefile file obj-m: = main.o multi_file_driver-y: = FUN.O PRODUCT.O

Second, code reuse: 1, static reuse: The code to be reused in other files, if you want to use some features, include the corresponding header file can be 2, dynamic reuse: A Linux driver can use another Linux driver resources in the third, Uninstall the Linux driver module due to abnormal conditions can not be uninstalled in the following two scenarios:

1, initialization function crash: The current Linux driver module to clear the reference counter 0 can

2. The Unload function is blocked: Replace the original unload function with an empty unload function

The eighth chapter, let the Development Board sound: Buzzer driver

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.