Linux Device Driver NCTU OS Lab Chi-Wei Yang. Outline b Overall Architecture b Character Driver b Block Driver b Network Driver b Support Functions.

Slides:



Advertisements
Similar presentations
Principles of I/O Hardware I/O Devices Block devices, Character devices, Others Speed Device Controllers Separation of electronic from mechanical components.
Advertisements

Device Drivers. Linux Device Drivers Linux supports three types of hardware device: character, block and network –character devices: R/W without buffering.
User-Mode Linux Ken C.K. Lee
XEN AND THE ART OF VIRTUALIZATION Paul Barham, Boris Dragovic, Keir Fraser, Steven Hand, Tim Harris, Alex Ho, Rolf Neugebauer, lan Pratt, Andrew Warfield.
04/14/2008CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem.
Operating Systems Input/Output Devices (Ch , 12.7; , 13.7)
I/O Devices and Drivers
I/O Hardware n Incredible variety of I/O devices n Common concepts: – Port – connection point to the computer – Bus (daisy chain or shared direct access)
Embedded Real-time Systems The Linux kernel. The Operating System Kernel Resident in memory, privileged mode System calls offer general purpose services.
Chapter 7 Interupts DMA Channels Context Switching.
Figure 1.1 Interaction between applications and the operating system.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Chapter 7 Input/Output. Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats.
1 Today I/O Systems Storage. 2 I/O Devices Many different kinds of I/O devices Software that controls them: device drivers.
Chapter 5 Input/Output I/O Hardware I/O Software Software Layers Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights.
Operating Systems Input/Output Devices (Ch 5: )
I/O Systems CSCI 444/544 Operating Systems Fall 2008.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
Module I Overview of Computer Architecture and Organization.
Device Management. Serial Port Serial Device Serial Device Memory CPU Printer Terminal Modem Mouse etc.
Chapter 8 Input/Output. Busses l Group of electrical conductors suitable for carrying computer signals from one location to another l Each conductor in.
hardware and operating systems basics.
1 I/O and Filesystems. 2 How to provide interfaces Rough reading guide (no exam guarantee): Tanenbaum Ch. 5.1 – 5.5 & Silberschatz Ch. 13 & ,
Cpr E 308 Input/Output Recall: OS must abstract out all the details of specific I/O devices Today –Block and Character Devices –Hardware Issues – Programmed.
Raster-scan system In addition to the central processing unit a special purpose processor called the video controller or display controller is used to.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 2, 2005 Chapter 13: I/O Systems I/O Hardware.
Hardware Definitions –Port: Point of connection –Bus: Interface Daisy Chain (A=>B=>…=>X) Shared Direct Device Access –Controller: Device Electronics –Registers:
ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-2: I/O Management (Review) Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
I/O Systems I/O Hardware Application I/O Interface
1 Module 12: I/O Systems n I/O hardware n Application I/O Interface n Kernel I/O Subsystem n Transforming I/O Requests to Hardware Operations n Performance.
Kernel, processes and threads Windows and Linux. Windows Architecture Operating system design Modified microkernel Layered Components HAL Interacts with.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Principles of I/0 hardware.
Chapter 13: I/O Systems. 13.2/34 Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware.
LINUX System : Lecture 7 Bong-Soo Sohn Lecture notes acknowledgement : The design of UNIX Operating System.
OSes: 3. OS Structs 1 Operating Systems v Objectives –summarise OSes from several perspectives Certificate Program in Software Development CSE-TC and CSIM,
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem.
Chapter 13 – I/O Systems (Pgs ). Devices  Two conflicting properties A. Growing uniformity in interfaces (both h/w and s/w): e.g., USB, TWAIN.
Silberschatz, Galvin and Gagne  Operating System Concepts Six Step Process to Perform DMA Transfer.
Embedded System Course Syllabus. Course Outline Instructor: 안 종석 –Office: 컴퓨터 공학과 Q304 – –Home page:
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
Device Driver Concepts Digital UNIX Internals II Device Driver Concepts Chapter 13.
ICOM Noack Linux I/O structure Device special files Device switch tables and fops How the kernel finds a device Parts of a device driver or module.
Security Architecture and Design Chapter 4 Part 2 Pages 319 to 357.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 12: I/O Systems I/O hardwared Application I/O Interface Kernel I/O.
FILE SYSTEM IMPLEMENTATION 1. 2 File-System Structure File structure Logical storage unit Collection of related information File system resides on secondary.
Part IVI/O Systems Chapter 13: I/O Systems. I/O Hardware a typical PCI bus structure 2.
CSCE451/851 Introduction to Operating Systems
Introduction to Operating Systems Concepts
Module 12: I/O Systems I/O hardware Application I/O Interface
Chapter 13: I/O Systems Modified by Dr. Neerja Mhaskar for CS 3SH3.
Interfacing with Hardware
Input/Output Devices ENCE 360
Input/Output.
CS 286 Computer Organization and Architecture
CPSC 457 Operating Systems
I/O Systems I/O Hardware Application I/O Interface
Operating System Concepts
13: I/O Systems I/O hardwared Application I/O Interface
CS703 - Advanced Operating Systems
Direct Memory Access Disk and Network transfers: awkward timing:
Mid Term review CSC345.
LINUX System : Lecture 7 Lecture notes acknowledgement : The design of UNIX Operating System.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Outline Device Management Device Manager Design Buffering
Operating Systems Structure
LINUX System : Lecture 6 Bong-Soo Sohn
Module 12: I/O Systems I/O hardwared Application I/O Interface
Presentation transcript:

Linux Device Driver NCTU OS Lab Chi-Wei Yang

Outline b Overall Architecture b Character Driver b Block Driver b Network Driver b Support Functions

Overall Architecture b VFS b Driver Types charactercharacter blockblock networknetwork

Overall Architecture (cont.)

b Operation Modes pollingpolling interruptinterrupt DMADMA

Character Driver b Device Properties can’t be randomly accessedcan’t be randomly accessed can’t be bufferedcan’t be buffered usually are slow devicesusually are slow devices b Export Interface file_operationsfile_operations b Data Flow in read/write

Character Driver (cont.)

Block Driver b Device Properties can be randomly accessedcan be randomly accessed accessed in units of blocksaccessed in units of blocks to speed up access, buffer cache is usedto speed up access, buffer cache is used b Export Interface file_operationsfile_operations request_fn()request_fn() b Data Flow in read/write

Block Driver (cont.)

Network Driver b Export Interface b Data Flow in read/write

Network Driver (cont.)

Support Functions b I/O ports reservations request_region()request_region() b Memory Allocations kmalloc(), vmalloc(), get_free_page()kmalloc(), vmalloc(), get_free_page() b Interrupt Handler Registration request_irq()request_irq() b Data Transfer between User/Kernel memcpy_fromfs()memcpy_fromfs()

Support Functions (cont.) b Bottom Halves mark_bh()mark_bh() its main purpose is to provide fewer blocking time due to interruptsits main purpose is to provide fewer blocking time due to interrupts top half/bottom halftop half/bottom half priority-basedpriority-based limitions in writing bottom halveslimitions in writing bottom halves –can't call schedule(), can't block