Chapter 7 ---- pwm buzzer and ---- pwm buzzer

Source: Internet
Author: User

Chapter 7 ---- pwm buzzer and ---- pwm buzzer

Linux code reuse:

You can load the header file to use all the original functions. The dynamic mode is that one driver uses the resources of another driver.

For an experiment like a buzzer, there are many internal files, and all the source code must have a lot for proper management.

If there are multiple files, module-y specifies all the files, and then a build. sh script is generated, executed using sh, and the log information is viewed using dmesg.

Code reuse is divided into static and dynamic. Static reuse is to generate the. ko kernel, and dynamic reuse is a module dependency. One driver uses the exported symbol from the other driver module.

Restart the Development Board or the simulator. ko file to automatically disappear. Unmount when an exception occurs: 1. initialize the function. 2. The unmount function is blocked.

To uninstall a driver, enter a bunch of commands to query the first address of the module structure, and install and download the force_kill_driver driver.

The implementation principle of the buzzer driver is basically the same as that of the LED, but the implementation method is different, because the PWM is composed of multiple files.

The basic principle of PWM is to control the opening and stopping of the buzzer through the pulse. GPFCON only uses the highest two to control PWM.

Static function struct, the open function of the PWM device file, which can only open the PWM device file at the same time using the semaphore control, and then close the function to release the semaphore, ioctl () function to process the I/O command, set the file_operation device of the file device, initialize the semaphore at the beginning, and remove the semaphore. Open PWM_IOTCL_START In the pwm. h file and stop PWM_IOTCL_STOP. Here we will explain in detail in the underlying Linux driver, generate the. ko file, and compile it successfully.

The test buzzer generally uses the parameters of the I/O command and can be voiced normally.

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.