Compiling of Linux kernel modules and drivers-general Linux technology-Linux programming and kernel information. For details, refer to the following. The Linux kernel is an integral structure, so it is very difficult to add anything to or delete some features to the kernel.
1, the concept and role of asynchronous notification
Impact: Blocking-The application does not need to poll the device for access
Non-blocking--notification of interrupts
That is, initiated by the driver, actively notifies the application
2. Linux Asynchronous Notification programming
2.1 Linux Signal
Role: In Linux systems, asynchronous notifications use signals
Article reprinted to CSDN community Luo Shenyang's Android tour, original address: http://blog.csdn.net/luoshengyang/article/details/6573809In the Android Hardware Abstraction Layer (HAL) Overview and Learning Plan article, we briefly describe the ways in which Android systems write drivers for hardware. In short, hardware drivers are distributed on the Linux ker
interface for the operating system.★File_operations struct
There are many types of drivers, and their programs will be different. How can drivers provide unified interfaces? The most important thing is this struct, which is defined in the include/linux/fs. h file.
struct file_operations {struct module *owner;loff_t (*llseek) (struct file *, loff_t, int);ssize_t
Brief introduction
The name of the TTY device is abbreviated from the previous telex, originally referred to as a physical or virtual terminal connected to a UNIX system
The core of the Linux TTY driver is immediately below the standard character device driver layer and provides a range of functions that are used as interfaces by terminal type devices
There are three types of TTY drivers
In addition to the ability to read and write devices, most drivers also need the ability to control hardware.
1. In user space, useIOCTL system calls to control devicesThe prototype is as follows:
Int IOCTL (int fd, unsigned long cmd ,...); /* FD: file descriptor cmd: Control Command...: optional parameter: insert * argp. The specific content depends on CMD */
The user program only uses the command code to tell the driver what it wants to do.How to e
The method structure of the device file registration in the Linxu driver is also the body that provides the operation interface to the user layer, my version is 3.1.10Writing is not easy, reprint need to indicate the source: http://blog.csdn.net/jscese/article/details/43408625The prototype is defined in the kernel source/include/linux/fs.h:struct File_operations {struct module *owner; The first file_operations member is not an operation at all; It is
How to pass parameters to a module, Linux kernel provides a simple framework.1. Module_param (name, type, perm);Name is both the parameter name that the user sees and the variable that accepts the parameter within the module;Type represents the data type of the parameter, which is one of the following: Byte, short, ushort, int, uint, long, ulong, CHARP, BOOL, invbool;PERM Specifies the access rights for the corresponding file in the SYSFS. Access righ
Environment: [Linux][ubuntu][14.04.3lts]1. NVIDIA official website Download Graphics driver (is a. Run file)2. It seems that Ubuntu installs nouveau as a driver by default, so turn off nouveau and turn it off in the following way:Create a new/etc/modprobe.d/disable-nouveau.conf (in fact the name is random, because all the. conf files under this directory will load on boot)Additional blacklist nouveau options nouveau modeset=03. The installation proces
critical section cannot be too long; spin----lock can be used in an interrupt contextSignal Volume----need a header file linux/semaphore.h----struct semaphore sem; Define the semaphore----Sema_init (sem,1); Initialize the semaphore----Down_interruptible (SEM); Get the semaphore----......//Critical area code----Up (SEM); Release semaphore----Description: The semaphore differs from the spin lock, which is a sleep lock that cannot be used in an interrup
Memdev.h#ifndef _memdev_h#define _memdev_h#define mem_magic ' m ' #define Mem_restart _io (mem_magic, 0)//Use the kernel-provided macros to generate commands #define MEM _set _iow (mem_magic, 1, int)//change command to pass a shaping parameter to the kernel #endifDriver MEMDEV.C#include Application MEM_READ.C#include The device number is dynamically assigned in the driver and the device number assigned by the system to Memdev is viewed through cat/proc/devices.Use the command Mknod/dev/memde
Linux character device driver programming process 1. first, some version information is useless, but not less # define _ NO_VERSION _ www.2cto.com # include lt; linux/modules. h gt; # include lt; linux/version. h gt; charkern...
Basic process for writing Linux character device
Recently, I have been reading books and learning about Linux device drivers. I am getting started with the simplest character device drivers and can have a macro understanding of the driver framework and functions of various elements. The following is a detailed analysis of the device driver with the first character I have written. I will sort out some basic driv
uses system functions to interview device files.So be sure to have a device file in your filesystem that corresponds to your device driver, so your app has access to your device drivers.Device files are typically placed below the/dev folder. You can view it through the LS command. How do I create a device file node?The ability to use the Mknod command, such as I want to create a master device number of 103. A character device file with a secondary device number of 0. You can enter: Mknod/dev/xx
Learning device driver Programming also has a period of time, also wrote a few drivers, so there are some new understanding and understanding of the device driver, summed up. Learning device driver Programming also has a period of time, also wrote a few drivers, so there are some new understanding and understanding of the device driver, summed up.★ What is a driverWhen I first started learning about device
Using asynchronous notifications in device drivers can make access to the device accessible to the application by the driver when it is accessible. Therefore, applications that use nonblocking I/O do not need to poll the device for access, and blocking access can be superseded by asynchronous notifications like "break". Asynchronous notifications are similar to the concept of "interrupts" on hardware, and the more accurate term is "signal-driven async
Linux driver-LED Drivers _ 1, linuxled_1
Steps:
1. Framework
2. complete hardware operations:
A. view the principle diagram and pins
B. Check the 2440 manual.
C. write code: ioremap is required for the IO port.
My board sub-circuit is as follows:
1,Configure GPBCON registersConfiguration output is configured in the open function.
2,Configure GPBDAT registersConfigure in the write function
#################
Clock management for linux Device Drivers (4) ---- it turns out to be a child
When I was a child, I saw a TV series called "Little Dragon man". You don't have to mention it. It's actually very inspirational. To find my mother, it's a great TV series, what are the children watching? Xuanyuan sword, god of every day, magic, illusion, and flashy stuff. Apart from commercial value, what kind of stuff can be use
# If kernelrelease is defined, we 've been invoked from# Kernel build system and can use its language.Ifneq ($ (kernelrelease ),)OBJ-M: = Hello. o
# Otherwise we were called directly from the command# Line; invoke the kernel build system.
ElseKerneldir? =/Lib/modules/$ (shell uname-R)/buildPWD: = $ (shell PWD)Default:$ (Make)-C $ (kerneldir) M = $ (PWD) ModulesEndif
When we knocked on make, we entered this authoritative makefile twice. The first time she entered makefile and found that ker
1. Module_i2c_driver (adxl34x_driver) expand toStatic int__intAdxl34x_driver_init (void){returnI2c_register_driver ( adxl34x_driver);} Module_init (adxl34x_driver_init);Static void__exitAdxl34x_driver_exit (void){returnI2c_del_driver ( adxl34x_driver);} Module_exit (adxl34x_driver_exit);Function: Instead of registering initialization functions and module_init () and Module_exit (), you can replace them with this if you do nothing in the initialization function. Common macros in
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.