In the Linux device driver first: Introduction to the device driver briefly describes the character driver, this article briefly describes how to write a simple character device driver. This article draws on the source code in the LDD, realizes a hardware device-independent character
In the Linux device driver first: Introduction to the device driver briefly describes the character driver, this article briefly describes how to write a simple character device driver. This article draws on the source code in the LDD, realizes a hardware device-independent character
first, the Linux system divides the device into 3 categories: Character device, block device, network device. Using drivers:1, character device : Refers to a byte can only one byte read and write devices, can not randomly read the device
stored files (API)> View Path (API)Properties of the > file (API)> Read (API)Almost all of the operations are done through the API, and are read in the same way as the file package.The reason why you don't write a specific API name is that you have to read it yourself, and here's just a brief introduction to it. But you know a little English, it is estimated not to read the specific introduction can read, use.Will basically deal with the following nouns.1,handle. This can be interpreted directl
Linux Device Driver Article 3: How to Write a simple character device driver ?, Linux Article 3
In the first article on linux Device Drivers: the device drivers briefly introduce character drivers. This article briefly introduces how to write a simple character device driver
Linux Device Driver category, character device driver, how to add cdev to the kernel ?, Driver category cdev
1. Linux Device Driver category
By hardware of Managed Devices
Character Device
Access by byte streams, which can be accessed sequentially or at specified locations
Touch screen LCD for serial port terminals
Bl
#include "standard_i2c.h"#include #include #include #include #include #include #include #include #include #include
#if 0#include #include
#else#define I2C_M_WT 0x0000/* Write data from master to slave */#define I2C_M_RD 0x0001/* read data, from slave to master */#define I2C_ADDR (0x48>>1)
#define I2C_ADDR_16BIT 1//1:16bit i2c_addr 0:8bit i2c_addr
#define I2C_RETRIES 0x0701/* Sets the number of retries when an ACK is not received */#define I2C_TIMEOUT 0x0702/* Set time-out time-out jiffies
In the Linux device driver first: Introduction to the device driver briefly describes the character driver, this article briefly describes how to write a simple character device driver. This article draws on the source code in the LDD, realizes a hardware device-independent character
This article was reproduced from: http://blog.csdn.net/ymangu666/article/details/39292651Primary, secondary device numberThe application can access the actual device by reading and writing to the device files in the/dev directory.1) Each device file corresponds to two device
The complex device drivers mentioned here involve PCI, USB, network devices, block devices, and so on (strictly speaking, these devices are conceptually not parallel, for example, a character device is tied to a block device, and a PCI, USB device, etc. may be part of a character d
Linux character device-simple character device model
Linux character Devices
I. Use the character Device Driver
1. Compile/install the driverIn Linux, drivers generally use the program structure of the kernel module for encoding. Therefore, the essence of compiling/installing a driver is to compile/install a kernel module.
2. Character
PCI device creation process
This part is divided into two parts for learning. One is to refer to the previous articles, analyze the source code of ld1_and sculld, and the other is to refer to ldd3 to learn PCI.
Part 1Ldd_bus declares the ldd_bus_type of a bus_type structure:
Struct bus_type ldd_bus_type = {
. Name = "LDD ",
. Match = ldd_match,
. Uevent = ldd_uevent,
};
The code for adding ldd_bus_type to and detaching from the kernel is as follows:
As there are too many notes in Chapter 10, I will post the previous notes first.
1. functions used to open various devices
Device
Function used to open a device
File
Createfile (pszname is the path name or UNC path name)
Directory
Createfile (pszname is the path name or UNC path name ). if you specify the file_flag_backup_semantics flag when calling createfile, Windows al
1. The setup steps are very easy in "application ".2. Click "set", as shown in the following figure.3. Find the "device" in the "Enable settings" and enter the details.4. Click "call" to enter.5. Click other settings ].6. Then you can set [call transfer] here ].7. Select [voice call ].8. Select the transfer method
A new device driver model-platform (platform) device driver, platform device driver (platform_device) and platform driver (Platform_driver) is introduced into the Linux2.6 kernel, The introduction of platform devices makes Linux device drivers more portable.First, platform equipmentPlatform
A Linux device model can be better understood through various stages of a device's life cycle in the kernel. I will analyze the source code of ldquo and sculld to understand the integration of each link in the Linux device model. The integration of the (PCI Bus) in ldd3 serves as a reference, because embedded Linux uses less PCI bus. First, you must familiarize yourself with the source code of ldquo and scu
Loaded from http://blog.csdn.net/sjwangjinbao/article/details/6077225When writing a bus device driver, it was found that the struct device in the 2.6.33.2 kernel had no members of BUS_ID, and the const char *init_name member was found. However, this member cannot be used directly to set and read the device name.The method for kernel operation is dev_name and Dev_
2.1Network Driver StructureThe architecture 1 of the Linux Network Driver is shown in.It can be divided into four layers:(1) Protocol Interface Layer
(2) network device interface layer
(3) Device Driver Function Layer
(4) network device and media layer.
Network Driver Focus: completes the device driver Function Layer
I
How to use the device tree of linux drivers and how to use the device tree of linux drivers
The Device Tree describes the hardware from the software perspective, and DTS is the Device Tree source file. DTC is responsible for converting DTS to DTB, and DTB is the binary form of DTS for machine use.
The
1, after the system plugged into the USB device, from the console interface has the following prompt:From the console information, you can see the inserted USB device name.As you can see, the plugged-in USB device is sde4.However, if the CRT tool is remotely connected to the past, you can use the following command to view the USB
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.