Sixth. First Linux driver: Count the number of words
The sixth chapter describes how to test Linux drivers on multiple platforms using multiple methods.
This chapter is the implementation technology of the algorithm to count the number of words: Linux driver. The function of counting the number of words is encapsulated in the Linux driver. Drivers do not necessarily have to deal directly with the hardware, but also can drink the ordinary library to provide other program calls to achieve specific functions.
The first section of Linux drive what exactly is a thing
There is no intrinsic difference between Linux drivers and normal Linux APIs, except that the Linux-driven approach differs from the Linux API.
The Linux system maps each driver into a single file, which is called a device file or driver file, and is stored in the/dev directory. This design concept makes interacting with Linux drivers as easy as interacting with normal files, and easier than accessing Linux APIs.
Section II: Procedures for writing Linux drivers
- Build a Linux driver skeleton (load and unload Linux drivers).
- Registering and destroying equipment files.
- Specify driver-related information
- Specifying a callback function
- Writing business logic
- Writing makefile Files
- Compiling Linux Drivers
- Installing and uninstalling Linux drivers
The first five steps on how to write a Linux driver, the next three steps can make the Linux driver work correctly. At the same time these eight steps do not necessarily run sequentially, you can choose according to their own needs.
Section III the first Linux driver: Count the number of words
Preparation before writing a driver
Writing the skeleton of a Linux driver
Develop driver-related information
Registering and destroying equipment files
Make a callback function
An algorithm for implementing statistical word numbers
compiling, installing, and uninstalling Linux drivers
Fourth section testing Linux drivers in several ways
Testing Linux drivers with Ubuntu Linux
Test Linux drivers with native C programs on the Android emulator
Testing Linux drivers with the Android NDK
Use Java code to directly manipulate device files to test Linux drivers
Testing Linux drivers with the S3C6410 board
Compiling the driver into the Linux kernel for testing
Section fifth developing and testing Linux drivers using eclipse
Developing Linux drivers in eclipse
Testing Linux drivers in eclipse
Sixth. First Linux driver: Count the number of words