Linux Driver Development with Raspberry Pi: Practical Labs Год издания: 2021 Автор: Alberto Liberal Жанр или тематика: Linux programming Издательство: Individually published Язык: Английский Формат: PDF Качество: Издательский макет или текст (eBook) Интерактивное оглавление: Да Количество страниц: 648 Описание: From Preface: You will learn how to develop Linux drivers for the Raspberry Pi boards. You will start with the simplest ones that do not interact with any external hardware, then you will develop Linux drivers that manage different kind of devices: Accelerometer, DAC, ADC, RGB LED, Buttons, Joystick controller, Multi-Display LED controller and I/O expanders controlled via I2C and SPI buses. You will also develop DMA drivers, USB device drivers, drivers that manage interrupts and drivers that write and read on the internal registers of the SoC to control its GPIOs. To ease the development of some of these drivers, you will use different types of Linux kernel subsystems: Miscellaneous, LED, UIO, USB, Input and Industrial I/O. More than 30 kernel modules have been written (besides several user applications), which can be downloaded from the book's GitHub repository.
Примеры страниц
Оглавление
Table of Contents Preface Chapter 1: Building the System Bootloader Linux kernel System call interface and C runtime library System shared libraries Root filesystem Linux boot process Building an embedded Linux system for the Raspberry Pi Raspberry Pi OS Connect and set up hardware Setting up an ethernet communication Copying files to your Raspberry Pi Building the Linux kernel Chapter 2: The Linux Device and Driver Model Bus core drivers Bus controller drivers Device drivers Devices The sysfs filesystem The kobject infrastructure Introduction to the Device Tree Chapter 3: The Simplest Drivers Licensing LAB 3.1: "helloworld" module Listing 3-1: helloworld_rpi3.c Listing 3-2: Makefile helloworld_rpi3.ko demonstration LAB 3.2: "helloworld with parameters" module Listing 3-3: helloworld_rpi3_with_parameters.c Listing 3-4: Makefile helloworld_rpi3_with_parameters.ko demonstration Chapter 4: Character Drivers LAB 4.1: "helloworld character" module Registration and unregistration of character devices Listing 4-1: helloworld_rpi3_char_driver.c Listing 4-2: Makefile Listing 4-3: ioctl_test.c helloworld_rpi3_char_driver.ko demonstration Creating device files with devtmpfs LAB 4.2: "class character" module Listing 4-4: helloworld_rpi3_class_driver.c helloworld_rpi3_class_driver.ko demonstration Miscellaneous character driver Registering a minor number LAB 4.3: "miscellaneous character" module Listing 4-5: misc_rpi3_driver.c misc_rpi3_driver.ko demonstration Chapter 5: Platform Drivers LAB 5.1: "platform device" module Listing 5-1: hellokeys_rpi3.c hellokeys_rpi3.ko demonstration Documentation to interact with the hardware Hardware naming convention Pin control subsystem GPIO controller driver GPIO descriptor consumer interface Obtaining and disposing GPIOs Using GPIOs GPIOs mapped to IRQs GPIOs in the Device Tree Exchanging data between kernel and user spaces MMIO (Memory-Mapped I/O) device access LAB 5.2: "RGB LED platform device" module LAB 5.2 hardware description LAB 5.2 Device Tree description LAB 5.2 code description of the "RGB LED platform device" module Listing 5-2: ledRGB_rpi3_platform.c ledRGB_rpi3_platform.ko demonstration Platform driver resources Linux LED class LAB 5.3: "RGB LED class" module LAB 5.3 Device Tree description LAB 5.3 code description of the "RGB LED class" module Listing 5-3: ledRGB_rpi3_class_platform.c ledRGB_rpi3_class_platform.ko demonstration Platform device drivers in user space User defined I/O: UIO How UIO works Kernel UIO API LAB 5.4: "LED UIO platform" module LAB 5.4 Device Tree description LAB 5.4 code description of the "LED UIO platform" module Listing 5-4: led_rpi3_UIO_platform.c Listing 5-5: UIO_app.c led_rpi3_UIO_platform.ko with UIO_app demonstration Chapter 6: I2C Client Drivers The Linux I2C subsystem Writing I2C client drivers I2C client driver registration Declaration of I2C devices in the Device Tree LAB 6.1: "I2C I/O expander device" module LAB 6.1 hardware description LAB 6.1 Device Tree description LAB 6.1 code description of the "I2C I/O expander device" module Listing 6-1: io_rpi3_expander.c io_rpi3_expander.ko demonstration LAB 6.2: "I2C multidisplay LED" module LAB 6.2 hardware description LAB 6.2 Device Tree description Unified device properties interface for ACPI and Device Tree LAB 6.2 code description of the "I2C multidisplay LED" module Listing 6-2: ltc3206_rpi3_led_class.c ltc3206_rpi3_led_class.ko demonstration Chapter 7: Handling Interrupts in Device Drivers Linux kernel IRQ domain for GPIO controllers Device Tree interrupt handling Requesting interrupts in Linux device drivers LAB 7.1: "button interrupt device" module LAB 7.1 hardware description LAB 7.1 Device Tree description LAB 7.1 code description of the "button interrupt device" module Listing 7-1: int_rpi3_key.c int_rpi3_key.ko demonstration Deferred work Softirqs Tasklets Timers Threaded interrupts Workqueues Locking in the kernel Locks and uniprocessor kernels Sharing spinlocks between interrupt and process context Locking in user context Sleeping in the kernel LAB 7.2: "sleeping device" module LAB 7.2 Device Tree description LAB 7.2 code description of the "sleeping device" module Listing 7-2: int_rpi3_key_wait.c int_rpi3_key_wait.ko demonstration Kernel threads LAB 7.3: "keyled class" module LAB 7.3 hardware description LAB 7.3 Device Tree description LAB 7.3 code description of the "keyled class" module Listing 7-3: keyled_rpi3_class.c keyled_rpi3_class.ko demonstration LAB 7.4: "GPIO expander device" module LAB 7.4 hardware description LAB 7.4 Device Tree description LAB 7.4 GPIO controller driver description Listing 7-4: CY8C9520A_rpi3.c LAB 7.4 GPIO child driver description Listing 7-5: int_rpi3_gpio.c LAB 7.4 GPIO based IRQ application Listing 7-6: gpio_int.c LAB 7.4 driver demonstration LAB 7.5: "GPIO-PWM-PINCTRL expander device" module LAB 7.5 GPIO irqchip description LAB 7.5 pin controller driver description LAB 7.5 PWM controller driver description Listing 7-7: CY8C9520A_pwm_pinctrl.c LAB 7.5 driver demonstration LAB 7.6: CY8C9520A Device Tree overlay LAB 7.6 driver demonstration Chapter 8: Allocating Kernel Memory Linux address types User process virtual to physical memory mapping Kernel virtual to physical memory mapping Kernel memory allocators Page allocator Page allocator API SLAB allocator SLAB allocator API Kmalloc allocator LAB 8.1: "linked list memory allocation" module Listing 8-1: linkedlist_rpi3_platform.c linkedlist_rpi3_platform.ko demonstration Chapter 9: DMA in Device Drivers Cache coherency Linux DMA Engine API Types of DMA mappings LAB 9.1: "streaming DMA" module Listing 9-1: sdma_rpi3_m2m.c sdma_rpi3_m2m.ko demonstration Chapter 10: Input Subsystem Input subsystem drivers LAB 10.1: "input subsystem accelerometer" module Device Tree Input framework as an I2C interaction Input framework as an input device Listing 10-1: i2c_rpi3_accel.c i2c_rpi3_accel.ko demonstration LAB 10.2: “Nunchuk input subsystem” module LAB 10.2 hardware description LAB 10.2 Device Tree description LAB 10.2 Nunchuk controller driver description Listing 10-2: nunchuk.c nunchuk.ko demonstration LAB 10.3: Nunchuk applications joystick_led.py application Listing 10-3: joystick_led.py joystick_led.py demonstration joystick_pwm.py application Listing 10-4: joystick_pwm.py joystick_pwm.py demonstration joystick_pygame.py application Listing 10-5: joystick_pygame.py joystick_pygame.py demonstration Using SPI with Linux The Linux SPI subsystem Writing SPI client drivers SPI client driver registration Declaration of SPI devices in the Device Tree LAB 10.4: "SPI accel input device" module LAB 10.4 hardware description LAB 10.4 Device Tree description LAB 10.4 code description of the "SPI accel input device" module Listing 10-6: adxl345_rpi3.c adxl345_rpi3.ko demonstration Chapter 11: Industrial I/O Subsystem IIO device sysfs interface IIO device channels The iio_info structure Buffers IIO buffer sysfs interface IIO buffer setup Triggers Triggered buffers Industrial I/O events Delivering IIO events to user space IIO utils LAB 11.1: "IIO Mixed-Signal I/O Device" module LAB 11.1 hardware description LAB 11.1 Device Tree description LAB 11.1 driver description Listing 11-1: max11300-base.h Listing 11-2: maxim,max11300.h Listing 11-3: max11300.c Listing 11-4: max11300-base.c LAB 11.1 driver demonstration GPIO control through a character device Listing 11-5: gpio_device_app.c GPIO control through the gpiolibd library Listing 11-6: libgpiod_max11300_app.c LAB 11.2: “Nunchuk provider and consumer” modules Nunchuck provider module Listing 11-7: nunchuk_accel.c Nunchuck consumer module Listing 11-8: nunchuk_consumer.c LAB 11.2 Device Tree description LAB 11.2 driver demonstration Chapter 12: Using the Regmap API in Device Drivers LAB 12.1: "SPI regmap IIO device" module Listing 12-1: adxl345_rpi3_iio.c adxl345_rpi3_iio.ko demonstration Chapter 13: USB Device Drivers USB 2.0 bus topology USB bus enumeration and device layout USB data transfers USB device classes Human interface device class USB descriptors USB device descriptors USB configuration descriptor USB interface descriptor USB endpoint descriptor USB string descriptors USB HID descriptor The Linux USB subsystem Writing Linux USB device drivers USB device driver registration Linux host-side data types USB request block (URB) LAB 13.1: USB HID Device Application STEP 1: Create a new project STEP 2: Configure Harmony STEP 3: Modify the generated code STEP 4: Declare the USB State Machine states STEP 5: Add new members to APP_DATA type STEP 6: Declare the reception and transmission buffers STEP 7: Initialize the new members STEP 8: Handle the detach STEP 9: Handle the HID events STEP 10: Create the USB State Machine STEP 11: Schedule a new report receive request STEP 12: Receive, prepare and send reports STEP 13: Program the application LAB 13.2: "USB LED" module LAB 13.2 code description of the "USB LED" module Listing 13-1: usb_led.c usb_led.ko demonstration LAB 13.3: "USB LED and Switch" module LAB 13.3 code description of the "USB LED and Switch" module Listing 13-2: usb_urb_int_led.c usb_urb_int_led.ko demonstration LAB 13.4: "I2C to USB Multidisplay LED" module LAB 13.4 code description of the "I2C to USB Multidisplay LED" module Listing 13-3: usb_ltc3206.c usb_ltc3206.ko demonstration References Index
Доп. информация: Примеры кода к книге можно скачать здесь
[only-soft.org].t172074.torrent
Торрент:
Зарегистрирован
[ 2022-10-21 01:25 ]
4 KB
Статус:
√проверено
Скачан:
1 раз
Размер:
6 MB
Оценка:
(Голосов: 0)
Поблагодарили:
0
Alberto Liberal - Linux Driver Development with Raspberry Pi: Practical Labs [2021, PDF, ENG] скачать торрент бесплатно и без регистрации
Вы не можете начинать темы Вы не можете отвечать на сообщения Вы не можете редактировать свои сообщения Вы не можете удалять свои сообщения Вы не можете голосовать в опросах Вы не можете прикреплять файлы к сообщениям Вы можете скачивать файлы