
Map PCI BARs Into Kernel Space With pci_iomap
Map a PCI BAR on Linux 6.12 with pci_iomap, read and write device registers with ioread32 and iowrite32, check sizes first and avoid the posted-write trap.
Tag
362 posts

Map a PCI BAR on Linux 6.12 with pci_iomap, read and write device registers with ioread32 and iowrite32, check sizes first and avoid the posted-write trap.

Write a minimal Linux 6.12 PCI driver with a pci_device_id table, probe and remove, pci_enable_device, region claiming, bus mastering and the error unwinding.

Start a process that sees itself as PID 1 using clone with CLONE_NEWPID or unshare plus fork on Linux 6.12, and learn why unshare never moves the caller.

Install ESP-IDF v5.4 on Linux or macOS, source export.sh, build the hello_world example with idf.py and flash it to an ESP32 board over USB.

Install Zephyr 4.1 and its SDK with west on Linux or macOS, build the blinky sample for a Nucleo board, flash it, and learn what each command does.

Lower or raise a process's nice value with nice and setpriority on Linux 6.12 and glibc 2.40, handle the -1 return trap, and know when root is required.

Make a Linux 6.12 USB driver survive unplug during reads and writes with kref, an io_mutex, a disconnect flag, usb_poison_urb and anchored URB cancellation.

Use avr-libc set_sleep_mode, sleep_enable and sleep_cpu to power down an ATmega328P and wake on a pin change interrupt, with the race-free sequence.

Move UART bytes from an interrupt to a task with a FreeRTOS stream buffer: trigger level, ISR send, blocking receive and the single-writer rule.

Queue several bulk URBs from a Linux 6.12 driver, limit how many are in flight, and handle completions in atomic context without leaking memory.

Read CPU time, peak memory, page faults and context switches for your own process with getrusage on Linux with glibc 2.40, and know which fields are filled.

Decide between libusb in user space and a Linux 6.12 kernel USB driver by latency, device class, security, deployment and what else needs to see the device.