The function of counting the number of words is encapsulated in the Linux driver. The Linux system maps each driver into a single file. These files are called device files or drive files and are stored in the/dev directory. The steps for writing a Linux driver are as follows:
1. Build Linux drive skeleton (load and unload Linux drivers);
2, registration and cancellation of equipment documents;
3, specify the information related to the drive;
4, specify the function of the back-off;
5, write business logic;
6, the preparation of makefile documents;
7, compiling Linux driver;
8, install and uninstall Linux driver;
Count the number of words this driver does not have access to the hardware and interacts with the application using the device files as media. The application passes a space-delimited string to the file device (each substring separated by a space is called a word), and then reads from the device file the number of words that the string contains.
For a Linux driver, initial development and testing can be done on ubuntulinux at the outset. The part that accesses the hardware can be simulated with software in Ubuntulinux. When the basic development is finished, it is necessary to test the actual hardware on the Development Board or the engineering prototype. We can test Linux drivers in a variety of ways, primarily with ubuntulinux testing, testing Linux drives with native (native) C programs on the Android emulator, using ANDROIDNDK to test Linux drives, Use Java source code to directly manipulate the device files to test Linux drivers, test Linux drivers using the S3C6410 board, and compile the drivers into the Linux kernel for testing.
Linux drivers: Count the number of words