This article is done original, reproduced please specify the source, respect for the original.Writing this article, I refer to some blogs on the Internet:Http://bbs.chinaunix.net/thread-3634524-1-1.htmlHttp://www.bkjia.com/gjrj/800182.htmlAlso refer to the "Linux driver development in detail" 3.4 chapters, to achieve the establishment of their own drive directory.The driving example in this article is: Linux
Poll for linux drivers and poll for linux driversPOLL operations
1. POLL execution process:
Poll is a system call. Its kernel entry function is sys_poll. sys_poll calls do_sys_poll directly without any processing. The execution process of do_sys_poll can be divided into three parts:
1. Copy the input pollfd array to the kernel space. Because the copy operation is
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 Device Tree is a
Control program.In addition, routing and address resolution are handled by the kernel.
Loadable Modules
The features provided by the Linux kernel can be extended at run time, that is, when the system is up and running, we can add or remove functionality from the kernel to the kernel.Code that can be added to the kernel at run time is called a "module."The Linux kernel supports several types o
/** * Author:hasen * Reference: Linux device Driver Development Details * Introduction: Android small Novice Linux * device driver Development Learning Journey * Topic: Concurrency and race in Linux device drivers * date:2014-11- 04 */1, concurrency, and race concurrency (concurrency) refers to multiple execution units
Linux is a variant of the UNIX operating system, and the principle and idea of writing a driver in Linux is similar to that of other Unix systems, but it is very different for drivers in DOS or window environments. Design the driver in the Linux environment, the thought is concise, the operation is convenient, the func
Distory function*/
int Cleanup_module ()
{
PRINTK ("I'll shut down myself in Kernerl mod/n)";
RETUTN 0;
}Such an example is done. We also write a makefile example to fit our application in large program heavy applications. This is the content of the Makfile file.
# A Makefile for a module
cc=gcc
modcflags:=-wall _dmodule-d_kernel_-dlinux
HELLO.O Hello.c/usr/inculde? Linux/version.h
CC $ (modcflags) 0c hello.c
echo the module is Complie completely
The
transaction.The following is a method of using the struct with the C99 syntax, and the struct member that does not show the declaration is initialized to null by GCCstatic const struct File_operations Globalmem_fops = {. Owner = This_module,. Llseek = Globalmem_llseek,. Read = Globalmem_read,. write = Globalmem_write,. Unlocked_ioctl = globalmem_ioctl,/* in the kernel version of 2.6.x, in the file operation structure,Will have the IOCTL field, use Unlocked_ioctl in the higher version */. open =
int Dma_map_device (struct device *dev,struct scatterlist *sg, int nents,enum dma_data_directiondirection);
There can be a relatively simple way to pre-allocate buffers in a Linux system, which is to synchronize the "mem=" parameter to reserve memory. For example, for a system with a memory of 64MB, passing the MEM=62MB command-line argument to it allowsThe top 2MB memory is reserved for use as IO memory, this 2MB memory can be statica
Linux driver module parameters-Linux Device DriversModule Parameters
In many cases, we expect to control our drive behavior through parameters. For example, because of different systems, to ensure good portability of our drivers, sometimes we want to control our driven behavior by passing parameters. In this way, drivers
(i) Reuse of Linux codereuse = static reuse (the code that will be reused is declared in the header file of other files) + dynamic reuse (using resources from another Linux driver, such as functions, variables, macros, etc.)1. Compilation is a Linux driver composed of multiple files (static reuse)For complex Linux
1. Linux Power Management Global architectureLinux power management is very complex, involving system-level standby, frequency-voltage transformation, System idle processing, and each device driver support for system standby and runtime power management for each device, which can be say and every device driver in the system.Power management is very important for consumer electronics products. Therefore, this part of the work often occupies a considera
the Linux structure for continued use.Overall analysis-ReconstructionIf your project does not have a tight schedule, and you can use the portability code repeatedly for future projects, you will analyze the current RTOS application structure based on the time, and how to map them to the Linux structure. For RTOS application code, you need to consider ing RTOS tasks one by one to the viability of
Knowledge of Linux DriversOperating system through a variety of drivers rely on home and hardware devices, it has shielded a variety of devices for users, drive hardware is the most basic function of the operating system, and provide a unified operation. Device drivers are one of the most basic components of the operating system and are more than 60% in the
directory based on the name of the driver and the associated bus
Get the lock inside the bus, then traverse all the devices registered with the bus and call the match function for those devices
Remove Driver
Call the Pci_unregister_driver function
The function uses the DEVICE_DRIVER structure contained in the PCI_DRIVER structure as a parameter to invoke the driver core function Driver_unregister
The Driver_unregister function clear
knowledge involved in the chapter, but this is my idea during the review.I learned about arm-Linux. Except for the first chapter, other code is run on ARM9, the kernel version I used is the 2.6.29 kernel I used during learning.
If there is any infringement in the following articles, please contact me immediately and I will delete them immediately.
· Linux Device Driver Summary (1): basic concepts related
One, interrupt handler functionThe interrupt handler function runs in the interrupt context and cannot be preempted or dispatched.There are a few things to note about interrupt context programming:Cannot sleep or call schedule to abandon CPUYou cannot call any function that may sleep, for example: to get the semaphoreThe user spatial data cannot be accessed, for example: Copy_from_user, because it is not executed in the context of the process.Execution time as short as possibleint REQUEST_IRQ (u
blocking and non-blocking IO in Linux device drivers:Blocking and non-blocking in 1.Linux device drivers Summary: http://m.blog.csdn.net/blog/dongteen/17264501Blocking and non-blocking io:http://m.blog.csdn.net/blog/dongteen/17264501 in 2.Linux device driversBlocking and non-blocking I/O in 3.
Tags: important contex ICA mod options map kernel variable EALLinux network devices are different from character devices and block devices, and no files correspond to network devices. The application operates the network device through the socket.The network device driver belongs to the data link layer, communicates with the IP/ARP protocol, and directly operates the physical layer chip (NIC Chip). The three-layer protocol sends data through DEV_QUEUE_XMIT (), receives data through NETIF_RX (),
describes how an Ethernet transceiver is connected to a network controller
Int (*mdio_read) (struct net_device *dev, int phy_id, int location);
void (*mdio_write) (struct net_device *dev, int phy_id, int location, int val);
Drivers/net/mii.c
Ethtool Support
Ethtool is a tool for system administrators to control network interfaces
Use Ethtool to control many interface parameters inc
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.