I have a basic understand of the following:
- How to read hardware device Data Sheets
- How hardware devices work in theory
- What does a device driver do
- General concepts of C programming
- Linux OS
I have always believed that if I can understand all the code of a given device driver and can ultimately write the same code from scratch just with the help of above (without looking at the source code), I will be able to get a very good understand of C language and how device drivers work and interact with OS. For me, this would be like a major milestone in my career.
So, over the last few years, I have always thought to learn how to write device drivers (mostly for Linux OS). I always start (this has happened at least 6-7 times) with great enthusiasm and pick a few good online resources and read them. I then take an existing driver code from the Linux kernel (say an Ethernet driver code), obtain a datasheet and start to read the driver code but after reading few lines I kind of get confused and then ultimately give up because I could not follow the rest of the code.
My Question: I know such a tutorial is too good to be true but I still want to ask - Does anybody know a good resource which explains how a Linux device driver was written from starting with detailed references to data sheet and how the existing line of code related with it and then explaining each function/block of code as to why it exists and what does it do exactly.