In previous chapters, we learned several useful things that can be handy in device driver development; however, a final step is needed. We must see how to add advanced functionalities to our character device and fully understand how we can synchronize user space processes with the peripheral I/O activity.
In this chapter, we'll see how to implement system calls for the lseek(), ioctl(), and mmap() functions, and we'll also get to know several techniques to put a process to sleep, just in case our peripheral does not yet have data to return to it; therefore, in this chapter, we will cover the following recipes:
- Going up and down within a file with lseek()
- Using ioctl() for custom commands
- Accessing I/O memory with mmap()
- Locking with the process context
- Locking (and syncing) with the interrupt context
- Waiting for I/O operations with poll...