Eighth chapter, buzzer driver--study notes
The buzzer is a hardware device on the s3c6410 Development Board. You can control the buzzer by writing a specific value to the register. This section will introduce the buzzer to achieve the original plow, and achieve a complete buzzer drive (can be turned on and off buzzer). PWM drives are implemented differently than led drivers, and the PWM driver consists of multiple files. This is also the standard implementation of most I-N u-X drives. That is to say--a complex driver is unlikely to put all the code in the ... Files in a single file. It is a good idea to put the relevant code in the appropriate file. These files are co-compiled when you compile the L-N U-x driver. This section describes how to divide the li n u x 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.
Code reuse is divided into static and dynamic. Static reuse is when you use certain features, include the corresponding header file. Dynamic reuse is a Linux driver that can use resources from another Linux driver. When compiling multiple source code files in the C or C + + language, if A.C uses the functions in the B.C file, you need to use extern to pre-define the B.C in the a.c file, and extern is to tell the compiler the function name, the number of arguments, the parameter type, and the return value type. extern only works in the compile phase.
The Linux driver cannot be uninstalled using the Rmmod command when the Linux driver exception fails to unload properly. There are several situations:
1. Initialization function crashes.
2. The Unload function is blocked.
When this happens, the machine can be restarted, but it is cumbersome to reboot each time, so you can remove the Linux driver by modifying the corresponding memory address of the Linux driver.
Eight, buzzer driver--learning notes