DEVICE DRIVER - PowerPoint PPT Presentation

About This Presentation
Title:

DEVICE DRIVER

Description:

DEVICE DRIVER VINOD KAMATH CS691X PROJECT WORK Introduction How to write/install device drivers Systems, Kernel Programming Character, Block and Network devices Tasks ... – PowerPoint PPT presentation

Number of Views:145
Avg rating:3.0/5.0
Slides: 11
Provided by: Vino151
Category:
Tags: device | driver | scsi

less

Transcript and Presenter's Notes

Title: DEVICE DRIVER


1
DEVICE DRIVER
  • VINOD KAMATH
  • CS691X PROJECT WORK

2
Introduction
  • How to write/install device drivers
  • Systems, Kernel Programming
  • Character, Block and Network devices

3
Tasks involved
  • Building and Running modules
  • Character device drivers

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

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

6
Design and implementation of Scull
  • File operations/structure
  • Device id. By file structure
  • Kenerl uses file ops. To access drivers
    functions
  • Open and Close
  • Initialize device, usage count,
  • Memory
  • Device-memory Link List
  • Read and Write
  • Transfer data from Kernel-User
  • Testing/Debugging
  • cp, cat, dd wls-l gt dev/scull0

7
Examples-Hello World
  • define MODULE
  • include ltlinux/module.hgt
  • int init_module (void) printk(lt1gtHello,
    World\n) return 0
  • void cleanup_module printk(lt1gtGoodbye, cruel
    World\n)

8
Examples-Scull
  • define MODULE, __KERNEL__
  • include ltlinux/module.hgt.
  • Struct file_operations d0_fops r,w,o,c
  • int init_module (void) malloc, reg do_fops
  • void cleanup_module (unreg, free...)l

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

10
Future work
  • Try Advanced drivers, Scheduling
  • Understand principle for multi user
Write a Comment
User Comments (0)
About PowerShow.com