LDT (Linux Driver Template) is a template for writing a new driver for the Linux kernel. While it is very useful for beginners, it can also work as a starting point for writing a new kernel driver.
The following Linux kernel driver features are used in the driver:
module, platform driver, file operations (read/write, mmap, ioctl, blocking and nonblocking mode, polling), kfifo, completion, interrupt, tasklet, work, kthread, timer, simple misc device, multiple char devices, Device Model, configfs, UART 0x3f8, HW loopback, SW loopback, ftracer.
In order to explore the source code clone the repository from GitHub:
$ git clone git://github.com/makelinux/ldt.git $ cd ldt $ make $ ./ldt-test $ sudo ./misc_loop_drv_test
Inportant files are:
- Main source file of LDT: ldt.c
- Test script, run it: ldt-test
- Generic testing utility for Device I/O: dio.c
- Simple misc driver with read, write, fifo, tasklet and IRQ: misc_loop_drv.c
- More files with accessory functions
On GitHub: LDT