Linux Driver Tutorials : Http://pan.baidu.com/s/1c0hljUS
Write a simple application call driver--header file
? Print header File
–include <stdio.h> calling print function printf
? The header file needed to invoke the file in the app
– #include <sys/types.h> basic system data types. The basic data type of the system is compiled in 32
The environment is maintained as a 32-bit value and grows to a 64-bit value in the 64 compilation environment.
– #include <sys/stat.h> system Call function header file. Can call ordinary files, directories, tubes
Tao, socket, character, block properties
– #include <fcntl.h> defines the Open function
– #include <unistd.h> defines the close function
– #include <sys/ioctl.h> defines the IOCTL function
? The header file that was called is the one that was put together with the compiler.
– Using the ARM2009Q3 compiler here, the compiler uses the ARM-NONE-LINUX-GNUEABI-GCC
? Locate the header file by using the Find command in the compiler directory
– e.g. #find./-name Types.h
? Functions that are called
The –open function is a return file descriptor
The –IOCTL function is applied to the drive to pass the value
The –close function is to close open files
? Write code for the application, compile
–arm-none-linux-gnueabi-gcc-o Invoke_hello invoke_hello.c-static
? Load Devicenode_linux_module Drive in the development Board, run the application
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Schindler 4412 Board Linux Driver Tutorial--Write a simple application call driver