For complex Linux drivers and libraries such as HAL, you need to debug them in a variety of ways. For example, setting breakpoints, stepping through code, outputting debugging information, and so on.
PrintkThe use of functions andPrintffunction is similar, exceptPrintkfunction runs in kernel space,PrintfThe function runs in user space. In other words, likeLinuxDrive such aThe Linux kernel program can only output debug information using the PRINTK function. The PRINTK function is implemented in the printk.c file.
While usingPrintkThe function can easily write messages to the log file or to the console. But a lot of usePrintkThe function frequently operates log files or console device files (/dev/console) can seriously affectLinuxDrive performance (so the write disk is much faster than reading and writing memory), so this requireslinuxprintklinuxprintk
InLinuxFile System,/procIt is often used as a tool for data interaction between kernel space and user space./procThe file system behaves in the same way as the device file system (/devSimilar/procis a virtual file system, which means that/procis not a real file system, but a memory map. All read and write/procOperations are both read and write to memory. So read and write The/proc file system is far faster than reading/writing/ dev file systems. As a result, the/proc file system can also serve as a tool for Linux to interact with user-space programs.
my Blog Park address is: http://www.cnblogs.com/zzp036/p/5449784.html
Andriod Deep Exploration (Vol. 1) HAL and Driver Development Tenth chapter reading experience