DEVICE DRIVER

VINOD KAMATH CS691X PROJECT WORK

Introduction ‡ How to write/install device drivers ‡ Systems. Block and Network devices . Kernel Programming ‡ Character.

Tasks involved ‡ Building and Running modules ‡ Character device drivers .

block/network devs . Applications Building device driver module ± Appln .rmmod ± Global var-Symtab ‡ Do in Kernel space (not User space) ± response time.single task ± Module .‡ Module vs. MODULE ± insmod.register for future ‡ Compiling and Loading ± ___KERNEL__.

Util.. areas ‡ Major/Minor no.Simple Char.(un)register chr_dev . for Loading Localities ± Acts on mem.Character device drivers ‡ Scull . Kernel and Char drivers ± n devices for n mem. Area as though it is a device ± Demonstrate interface betn.

To access driver¶s functions ‡ Open and Close ± Initialize device. By file structure ± Kenerl uses file ops. usage count. ‡ Memory ± Device-memory Link List ‡ Read and Write .‡ File operations/structure Design and implementation of Scull ± Device id.

} .h> ‡ int init_module (void) {printk(³<1>Hello. cruel World\n´).Examples-Hello World ‡ #define MODULE ‡ #include <linux/module. World\n´). return 0} ‡ void cleanup_module {printk(³<1>Goodbye.

).c } int init_module (void) {malloc.h>«.w. reg do_fops} ‡ void cleanup_module (unreg.l ‡ ‡ ‡ ‡ . __KERNEL__ #include <linux/module. Struct file_operations d0_fops = {r... free.o.Examples-Scull #define MODULE.

Conclusions ‡ Writing device drivers is not for faint heart/Adventure ‡ Very careful with Kernel codes .

Scheduling ‡ Understand principle for multi user .Future work ‡ Try Advanced drivers.