How to access hardware on Linux in C?

Asked

Viewed 235 times

3

I am aware of the existence of the Microsoft Win32 API, which allows the programmer to manipulate low-level resources such as serial ports, memories, CPU, GPU, etc. However I work with Linux environments and I want to access the hardware on Linux using the C language.

  • I’ve read a lot on the web about syscall, and I can’t understand anything :/ I just see people talking about functions like Fork(), and I don’t even know the basics.

  • People who worked with parallel ports, who used parallel pins to control hardware directly, needed to access only I/O ports, and there are ways to do this right on Linux and Windows, without needing a device driver. To this end, document http://tldp.org/HOWTO/IO-Port-Programming-2.html may help. But I believe it is a totally obsolete solution. Using an Arduino to control hardware I/O, and communicate with the PC via USB serial, is best in every respect.

1 answer

6


You don’t access the hardware, you call the API of the operating system. By chance some of them access the hardware for you.

Windows and Linux have different philosophies of how to do this. What can be considered equivalent to Win32 are the syscalls.

Book usually recommended to learn "all".

Browser other questions tagged

You are not signed in. Login or sign up in order to post.