| 27 | |
| 28 | When HelenOS runs the driver is an executable stored in {{{/drv}}} (e.g. {{{/drv/foo}}}). The driver is normally started automatically by the Device Manager. When the driver is needed, the Device Manager will start it and the driver connects to the Device Manager. |
| 29 | |
| 30 | In HelenOS source tree drivers are located under {{{uspace/drv}}}. To add a new driver ''foo'', you need to: |
| 31 | * create a directory {{{uspace/drv/a/b/foo}}} |
| 32 | * create a makefile {{{uspace/drv/a/b/foo/Makefile}}} |
| 33 | * create at least one source file {{{uspace/drv/a/b/foo/foo.c}}} |
| 34 | * add directory {{{uspace/drv/a/b/foo}}} to the DIRS definition in {{{uspace/Makefile}}} |
| 35 | |
| 36 | You can use an existing driver as a starting point, for example {{{uspace/drv/test/test1}}}. A driver is a C program similar to a HelenOS server or application. It is linked with {{{libdrv}}} (and the makefile should add libdrv's include path to the header search paths). The most basic DDF interfaces are defined in the header {{{ddf/driver.h}}}. |