Linux Device Drivers Development Год издания: 2017 Автор: Madieu J. Жанр или тематика: linux programming Издательство: Packt Publishing ISBN: 978-1-78528-000-9 Язык: Английский Формат: PDF Качество: Издательский макет или текст (eBook) Интерактивное оглавление: Да Количество страниц: 570 Описание: Linux kernel is a complex, portable, modular and widely used piece of software, running on around 80% of servers and embedded systems in more than half of devices throughout the World. Device drivers play a critical role in how well a Linux system performs. As Linux has turned out to be one of the most popular operating systems used, the interest in developing proprietary device drivers is also increasing steadily. This book will initially help you understand the basics of drivers as well as prepare for the long journey through the Linux Kernel. This book then covers drivers development based on various Linux subsystems such as memory management, PWM, RTC, IIO, IRQ management, and so on. The book also offers a practical approach on direct memory access and network device drivers. By the end of this book, you will be comfortable with the concept of device driver development and will be in a position to write any device driver from scratch using the latest kernel version (v4.13 at the time of writing this book).
Примеры страниц
Оглавление
Preface Chapter 1: Introduction to Kernel Development Environment setup Getting the sources Source organization Kernel configuration Build your kernel Kernel habits Coding style Kernel structures allocation/initialization Classes, objects, and OOP Summary Chapter 2: Device Driver Basis User space and kernel space The concept of modules Module dependencies depmod utility Module loading and unloading Manual loading modprobe and insmod /etc/modules-load.d/.conf Auto-loading Module unload Driver skeletons Module entry and exit point __init and __exit attributes Module information Licensing Module author(s) Module description Errors and message printing Error handling Handling null pointer errors Message printing printk() Module parameters Building your first module The module's makefile In the kernel tree Out of the tree Building the module Summary Chapter 3: Kernel Facilities and Helper Functions Understanding container_of macro Linked lists Creating and initializing the list Dynamic method Static method Creating a list node Adding a list node Deleting a node from the list Linked list traversal Kernel sleeping mechanism Wait queue Delay and timer management Standard timers Jiffies and HZ Timers API Timer setup initialization Standard timer example High resolution timers (HRTs) HRT API HRT setup initialization Dynamic tick/tickless kernel Delays and sleep in the kernel Atomic context Nonatomic context Kernel locking mechanism Mutex Mutex API Declare Acquire and release Spinlock Spinlock versus mutexes Work deferring mechanism Softirqs and ksoftirqd ksoftirqd Tasklets Declaring a tasklet Enabling and disabling a tasklet Tasklet scheduling Work queues Kernel-global workqueue the shared queue Dedicated work queue Programming syntax Predefined (shared) workqueue and standard workqueue functions Kernel threads Kernel interruption mechanism Registering an interrupt handler Interrupt handler and lock Concept of bottom halves The problem interrupt handler design limitations The solution bottom halves Tasklets as bottom halves Workqueue as bottom halves Softirqs as bottom half Threaded IRQs Threaded bottom half Invoking user-space applications from the kernel Summary Chapter 4: Character Device Drivers The concept behind major and minor Device number allocation and freeing Introduction to device file operations File representation in the kernel Allocating and registering a character device Writing file operations Exchanging data between kernel space and user space A single value copy The open method Per-device data The release method The write method Steps to write The read method Steps to read The llseek method Steps to llseek The poll method Steps to poll The ioctl method Generating ioctl numbers (command) Steps for ioctl Filling the file_operations structure Summary Chapter 5: Platform Device Drivers Platform drivers Platform devices Resources and platform data Device provisioning - the old and depreciated way Resources Platform data Where to declare platform devices? Device provisioning - the new and recommended way Devices, drivers, and bus matching How can platform devices and platform drivers match? Kernel devices and drivers-matching function OF style and ACPI match ID table matching Name matching - platform device name matching Summary Chapter 6: The Concept of Device Tree Device tree mechanism Naming convention Aliases, labels, and phandle DT compiler Representing and addressing devices SPI and I2C addressing Platform device addressing Handling resources Concept of named resources Accessing registers Handling interrupts The interrupt handler Interrupt controller code Extract application-specific data Text string Cells and unsigned 32-bit integers Boolean Extract and parse sub-nodes Platform drivers and DT OF match style Dealing with non-device tree platforms Support multiple hardware with per device-specific data Match style mixing Platform resources and DT Platform data versus DT Summary Chapter 7: I2C Client Drivers The driver architecture The i2c_driver structure The probe() function Per-device data The remove() function Driver initialization and registration Driver and device provisioning Accessing the client Plain I2C communication System Management Bus (SMBus) compatible functions Instantiating I2C devices in the board configuration file (old and depreciated way) I2C and the device tree Defining and registering the I2C driver Remark Instantiating I2C devices in the device tree - the new way Putting it all together Summary Chapter 8: SPI Device Drivers The driver architecture The device structure spi_driver structure The probe() function Per-device data The remove() function Driver initialization and registration Driver and devices provisioning Instantiate SPI devices in board configuration file old and depreciated way SPI and device tree Instantiate SPI devices in device tree - the new way Define and register SPI driver Accessing and talking to the client Putting it all together SPI user mode driver With IOCTL Summary Chapter 9: Regmap API 201 A Register Map Abstraction Programming with the regmap API regmap_config structure regmap initialization 202 regmap and cache Putting it all together A regmap example Summary Chapter 10: IIO Framework SPI initialization I2C initialization Device access functions regmap_update_bits function Special regmap_multi_reg_write function Other device access functions IIO data structures iio_dev structure iio_info structure IIO channels Channel attribute naming conventions Distinguishing channels Putting it all together Triggered buffer support IIO trigger and sysfs (user space) Sysfs trigger interface add_trigger file remove_trigger file Tying a device with a trigger The interrupt trigger interface The hrtimer trigger interface IIO buffers IIO buffer sysfs interface IIO buffer setup Putting it all together IIO data access One-shot capture Buffer data access Capturing using the sysfs trigger Capturing using the hrtimer trigger IIO tools Summary Chapter 11: Kernel Memory Management System memory layout - kernel space and user space Kernel addresses concept of low and high memory Low memory High memory User space addresses Virtual Memory Area (VMA) Address translation and MMU Page look up and TLB How does TLB work Memory allocation mechanism Page allocator Page allocation API Conversion functions Slab allocator The buddy algorithm A journey into the slab allocator kmalloc family allocation vmalloc allocator Process memory allocation under the hood The copy-on-write (CoW) case Work with I/O memory to talk with hardware PIO devices access MMIO devices access __iomem cookie Memory (re)mapping kmap Mapping kernel memory to user space Using remap_pfn_range Using io_remap_pfn_range The mmap file operation Implementing mmap in the kernel Linux caching system What is a cache? CPU cache memory caching The Linux page cache disk caching Specialized caches (user space caching) Why delay writing data to disk? Write caching strategies The flusher threads Device-managed resources Devres Summary Chapter 12: DMA Direct Memory Access Setting up DMA mappings Cache coherency and DMA DMA mappings Coherent mapping Streaming DMA mapping Single buffer mapping Scatter/gather mapping Concept of completion DMA engine API Allocate a DMA slave channel Set slave and controller specific parameters Get a descriptor for transaction Submit the transaction Issue pending DMA requests and wait for callback notification Putting it all together NXP SDMA (i.MX6) DMA DT binding Consumer binding Summary Chapter 13: Linux Device Model LDM data structures The bus Bus registration Device driver Device driver registration Device Device registration Deep inside LDM kobject structure kobj_type ksets Attribute Attributes group Device model and sysfs Sysfs files and attributes Current interfaces Device attributes Bus attributes Device drivers attributes Class attributes Allow sysfs attribute files to be pollable Summary Chapter 14: Pin Control and GPIO Subsystem Pin control subsystem Pinctrl and the device tree The GPIO subsystem The integer-based GPIO interface: legacy Claiming and configuring the GPIO Accessing the GPIO getting/setting the value In atomic context In a non-atomic context (that may sleep) GPIOs mapped to IRQ Putting it all together The descriptor-based GPIO interface: the new and recommended way GPIO descriptor mapping - the device tree Allocating and using GPIO Putting it all together The GPIO interface and the device tree The legacy integer-based interface and device tree GPIO mapping to IRQ in the device tree GPIO and sysfs Exporting a GPIO from kernel code Summary Chapter 15: GPIO Controller Drivers gpio_chip Driver architecture and data structures Pin controller guideline Sysfs interface for GPIO controller GPIO controllers and DT Summary Chapter 16: Advanced IRQ Management Multiplexing interrupts and interrupt controllers Advanced peripheral IRQs management Interrupt request and propagation Chaining IRQ Chained interrupts Nested interrupts Case study GPIO and IRQ chip Legacy GPIO and IRQ chip New gpiolib irqchip API Interrupt controller and DT Summary Chapter 17: Input Devices Drivers Input device structures Allocating and registering an input device Polled input device sub-class Generating and reporting an input event User space interface Putting it all together Driver examples Summary Chapter 18: RTC Drivers RTC framework data structures RTC API Reading and setting time Driver example Playing with alarms RTCs and user space The sysfs interface The hwclock utility Summary Chapter 19: PWM Drivers PWM controller driver Driver example PWM controller binding PWM consumer interface PWM clients binding Using PWMs with the sysfs interface Summary Chapter 20: Regulator Framework PMIC/producer driver interface Driver data structures Description structure Constraints structure init data structure Feeding init data into a board file Feeding init data into the DT Configuration structure Device operation structure Driver methods Probe function Remove function Case study: Intersil ISL6271A voltage regulator Driver example Regulators consumer interface Regulator device requesting Controlling the regulator device Regulator output enable and disable Voltage control and status Current limit control and status Operating mode control and status Regulator binding Summary Chapter 21: Framebuffer Drivers Driver data structures Device methods Driver methods Detailed fb_ops Checking information Set controller's parameters Screen blanking Accelerated methods Putting it all together Framebuffer from user space Summary Chapter 22: Network Interface Card Drivers Driver data structures The socket buffer structure Socket buffer allocation Network interface structure The device methods Opening and closing Packet handling Packet reception Packet transmission Driver example Status and control The interrupt handler Ethtool support Driver methods The probe function Module unloading Summary Index
[only-soft.org].t89886.torrent
Торрент:
Зарегистрирован
[ 2018-10-21 02:05 ]
2 KB
Статус:
√проверено
Скачан:
0 раз
Размер:
3 MB
Оценка:
(Голосов: 0)
Поблагодарили:
0
Madieu J. - Linux Device Drivers Development [2017, PDF, ENG] скачать торрент бесплатно и без регистрации
Вы не можете начинать темы Вы не можете отвечать на сообщения Вы не можете редактировать свои сообщения Вы не можете удалять свои сообщения Вы не можете голосовать в опросах Вы не можете прикреплять файлы к сообщениям Вы можете скачивать файлы