From the course: Linux Device Drivers: Reading, Writing, and Debugging
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Kernel modules for user space drivers - Linux Tutorial
From the course: Linux Device Drivers: Reading, Writing, and Debugging
Kernel modules for user space drivers
- [Instructor] Let's talk briefly about the kernel module you need to write so that you can get that UIO device that you can map from user space. The key function in your module is going to be the uio_register_device. So, you got to set up this device object and the info object, and when you call this function, then the uio device file will get created. First time this happens, it's uio0, second time it happens, it's uio1, and so forth, so. You have to be a little bit careful in user space that you open up the right file. And in your info, you're specifying what memory is available so that when user space does the nmap, its mappin' the memory on your device. So, your kernel module code can look something like this. A name and a version for your info, so your driver could check that. And then, for the memory, we're saying where the memory starts, so we got to get the address from our device of where that is. And then, we're setting a size, so that's how much we can map. And then a…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
(Locked)
Introduction to user space device drivers3m 34s
-
(Locked)
UIO, mapping device memory, and interrupts2m 43s
-
(Locked)
Kernel modules for user space drivers1m 31s
-
(Locked)
User space Ethernet driver1m 56s
-
(Locked)
I2C from user space1m 37s
-
(Locked)
Challenge: Modify and test a user space driver1m 51s
-
(Locked)
Solution: Modify and test a user space driver1m 41s
-
(Locked)
-