This chapter is mainly about the buzzer driver, the buzzer iss3cc6410Development Board with a hardware device, this section will introduce the principle of the buzzer, and achieve a complete buzzer driver. This section describes theLinuxthe way the drive is divided 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. In theLinuxDrive code reuse, for exampleCThe language source code
modulation), the basic principle is to control the buzzer by pulse to open and stop. Implement buzzer driver Test buzzer driverThe PWM driver is similar to the principle of the LED driver, as long as an experiment is made, and the other one will understand. But the code needs to be carefully written to understand the steps involved in runningWith the I/o command to open and stop the PWM, thePWM Drive consists of 3 files: pwm.c, Pwm_fun.h,pwm_fun.c. PWM.C is the driver main program.Pwm_fun.h ref
function, and it is convenient to implement, the best way is undoubtedly to use the C language compiler instructions (#if, #else, #endif, etc.). Print Kernel debug information: PRINTKThe PRINTK function is prototyped as follows:asmlinkage int PRINTK (const char * fmt, ...)The PRINTK file is a simple 4-digit text file that is the default for that file.6 4 1 7If you want to modify the contents of the PRINTK file, require that any information be output to the console, you can execute the followin
cross-compilation tool chainSecond, build the file system image production environment1. Create the root file system directory Rootfs and its subdirectories bin,sbin,boot,root,sys,srv,proc,usr, etc.2. Compile busybox1.7.0: (Required source Bundle: BUSYBOX-1.7.0.TAR.BZ2)2.1 Decompression Source Package, enter the source directory;2.2 Configuration BusyBox: Do make menuconfig in the source directory, if you use the default configuration to exit, save, if you need to configure your own then change
The seventh chapter outlines another driver: LED light control1. Create an LED-driven device file:1th Step: Initialize the Cdev with the Cdev_init function;2nd step: Specify the number of the device, divided into two specified methods3rd Step: Use the Cdev_add function to add the character device to the character device array in the kernel;4th Step: Use Class_create macro to create struct class;5th step: Create a device file using the Device_create function.2. Uninstalling the LED-driven device
The tenth chapter describes the complex Linux drivers and HAL and other libraries, need to use a variety of methods to test it. Examples include setting breakpoints, stepping through code output debugging information, and so on. InLinuxin the system,/proc is often used as a tool for data interaction between the kernel space and the user space, and the/proc file system behaves like a device file system. /proc is a virtual file system, which means that/proc is not a real file system, but a memory
user-space program kgdb.
Debugging a user-space program with GDB
Remote debugging of user space programs with Gdbserver
debugging kernel programs remotely with KGDB
Linux kernel debugging has been considered by many people to be very difficult. Most people prefer to use the PRINTK function directly to output debugging information and not to use various commands. (GDB, Gdbserver, KGDB, etc.) for debugging. Because doing so does not necessarily make for more benefits.Althoug
,Gdbserverand debugging kernel space programs.Kgdb. gdbDebugging a user-space program that tracks the program that is debugging user space, but it can only bePCon the test. GdbserverRemote Debug User space program, withGdbservercan test run on board, phone orAndroidthe program on the emulator. Gdbserveris one that can run onARMserver-side programs on the architecture, used on the Development BoardGdbserverOpen the program that you want to test, and then use the serial, Wired, or wireless network
either case, the calling program does not need to know the specifics of the hardware design, only the parameters required by the abstraction layer. Writing SupportHALof theLinuxDriver steps:1.WriteLinuxDrive;2.WriteHAL Library;3.WriteService Library. InAndroidused in the systemLinuxThere are two ways of driving:1.through the traditional way directly withLinuxDrive interactions. 2.androidpeculiar to, by theHALmodule. is essentially throughLinuxShared Libraries(. So)with theLinuxthe driver intera
for data interaction between kernel space and user space. /proc is a virtual file system, so reading and writing/proc file systems is much 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. In Linux drivers, you can use kernel functions to create and delete virtual files in the/proc directory, as well as to establish and delete virtual directories. The/proc file system, like the/dev file system
In the previous article we analyzed the Android HAL layer of the main two structural body hw_module_t (Hardware module) and hw_device_t (Hardware Device) members, let us specifically see how the upper-level app is how to implement the operating hardware?We know that some hardware vendors are reluctant to open up some of their core code, so put the code on the HAL layer, but how do you make sure it's not open? Hal layer code is not also let everyone kn
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.