
Embedded linux device drivers - keeplight
Hi guys,<p>I have a dillema about device drivers written for an embedded linux.
So, as far as I know, a device driver lies in kernel space and it creates a node under the &#x2F;dev file system, through which the user can access a physical device ( theoretically).
Now, what exactly defines a device driver?
I see this like layered structure.
Starting from bottom, we have a physical device (GPS,GSM,or any kind of device connected to a board).An upper layer we have the core (those interfaces which implements the protocols like I2C,UART,and so on).An upper layer is so called the device driver which uses the sub-layer (core) to communicate with the physical device.Both the newly created device driver and the I2C, UART, SPI and so on, creates a node under &#x2F;dev.
Now, do we need to create a device driver which uses the core library as long as it exposes its data to user space ?I mean, in this case we can use an user space application which plays the role of the driver reading&#x2F;writing to &#x2F;dev&#x2F;Ttyxx ?<p>Please give me a clear picture about device driver.<p>Thank you,
Best Regards,
======
devnonymous
HN is possibly not the best place to ask questions such as these. You'd
probably get better answers and also be able to have a follow up discussion by
posting this question to a osdev or Linux kernel related mailing list (search
for osdev or kernel newbies or even the dev mailing list for the distro of
choice).

All that said, to answer your question in brief, you have the right idea -
even within the device driver layer you have various levels of abstraction.
Whether you ultimately choose a certain level of abstraction is really
specific to what you would like to do. If you find that an existing kernel
module that provides a easy to work with interface via a device node, just
make a userspace tool or library to suit your needs, if not, create your own
kernel module.

