The Samsung Development Board comes with a buzzer, so we can control the buzzer by writing a specific value to the register. When developing a driver, an error may occur in functions such as Init, exit, and so on, which is the possibility that the driver will fail to install, and, worse, the inability to use the Rmmod driver, which can cause an inability to install again. There are many ways to reuse Linux-driven code. Standard C program mode can be used. Put the code you want to reuse in a different file. If you try some features, the appropriate header file for the include is OK. Compilation is a Linux driver composed of multiple files, code reuse is divided into static and dynamic two, static reuse is a low-level reuse, in this section will introduce another way of diamante sharing: module dependency, also known as the export symbol. Forcibly unloading the driver, that is, when the driver is abnormal, the Linux driver may not uninstall properly. For example, initializing the data crash, the initialization function of the driver module crashes, which causes the initialization to not return normally. The performance of this situation is that the current Linux driver module does not have any other modules to use, we can use the Rmmod bad_driver command to uninstall. The buzzer driver is also called the PWN pulse width modulation, the basic principle is the pulse to control the buzzer opening and stopping. The PWN drive is similar to the LED driver implementation process and may be simpler.
8th Chapter Buzzer