Code Chu is divided into two types: static and dynamic. The method described in the previous section is static reuse of code, which is code-level reuse, which is to put code that needs to be reused and the consumer who uses the code to compile it, eventually generating an executable file or program C. Ko. so etc) 8-1 Test mu ti fi iver driver in this section you will describe another way of code sharing: module dependencies, also known as export symbols. If you can only use a sentence to explain how to use the export symbols to implement the code, this sentence is "in a driver module using another driver module in the exported symbols (Tsuneaki, variables, functions, etc."
Since the Ymbol_ consumer Drive uses the exported symbols in the Symbo i_producer driver, the installation
Before Ψnbol_ consumer, you need to install Symbol_producer, otherwise the error message will be output.
Insmod:eπor inserting ' Symbol_consumer.ko ':-1 Unknown symbol in module
Depmod is used to analyze the dependency between inux chopsticks blocks, which is useful for having complex dependencies between multiple Linux modules. Using Depmod to analyze the dependencies of a Linux module, you can use the modprobe command to load the Lin dish module. The MoD probe command loads the Linux modules based on the Linux module dependencies of the Depmod command, and does not need to load the Inux module as you would with the INS mod command.
If you test the Linux driver in a way that dynamically loads. ko files on the emulator or on the board, even if the Linux driver cannot be uninstalled properly, the dynamic Linux die will be unloaded from the storage if the emulator or Development Board is restarted.
Scenario 1 initialization function crashes
Due to the initialization function of the Linux driver module (the function that the MODULE_ init macro specifies) crashes, which causes the initialization function to fail to return to field two, the performance is that the current Nux driver module is not used by any other Linux driver module, But it shows that it has been quoted once.
Using the Rmmo D Bad driver command will output the following information, but cannot find other Linux modules that use Ad_ Driverl
Scenario 2 The Unload function is blocked
When uninstalling the Linux driver using the Rmmod command, the system invokes the Unload function (the function specified by running the Modu LE_ exit Macro), and only the Unload function is successfully returned to the elbow, the Linux move will be flipped. If the Unload function is blocked (possibly caused by a dead loop, concurrency, and so on), the Rmmod command will also be blocked, which means that the code to unload the Linux driver module will never be executed.
First of all, look at the situation. The key to this situation is that the value of the reference counter and the referrer do not. In fact, the reference does not exist, so you only need to clear the reference counter of the current Inux driver module to 0.
The problem with the 2nd case is the Unload function, so just replace the original unload function with an empty unload function.
In either case, it is necessary to solve an unavoidable problem, that is, to get the Linux driver module that represents the Modu le struct pointer to be unloaded. Because the struct module represents information about the Linux driver.
PWM Drive
The buzzer is also called PWM (pulse width modulation), and the basic principle is to control the buzzer's opening and stopping by means of pulses. For convenience, this book will be a bee, collectively known as PWM PWM connected to the TOUT 1 port
The PWM is controlled using the port Gpfcon register. The macro corresponding to the register in the Lin dish kernel is s3c64xx PF CON, which represents the virtual address of the Gpfcon Register register. The Gpfcon only uses up to two bits (3,031 bits) to control the PWM. When the maximum two bits are last, turn on the PWM. Last Stop PWM. So you just need to set a different value for the Gpfcon register by using the Owrite3 function.
Android Deep Exploration (Volume I) eighth chapter