A device driver is a special code that interfaces a physical device into the system and exports it to the user-space processes using a well-defined API. In an Unix-like OS, where everything is a file (see the following section), the physical device is represented as a file, and then the device driver implements all the system calls a process can do on a file.
The difference between a normal function and a system call is just the fact that the latter is mainly executed in the kernel while a function executes in the user space only.
printf() is a function while
write() is a system call. The latter (except for a prologue and an epilogue) executes in the kernel space while the former executes in the user space (even if it calls the
write() function to actually write its data to the output stream).
The system calls are used to communicate with the peripherals and other processes and to get access to the kernel internals data. This is why a system call triggers...