project disk driver
Download
Skip this Video
Download Presentation
Project: Disk Driver

Loading in 2 Seconds...

play fullscreen
1 / 14

Project: Disk Driver - PowerPoint PPT Presentation


  • 539 Views
  • Uploaded on

Project: Disk Driver ICS 145B L. Bic file system disk driver disk controller disk 1 2 emulation software Assignment implement a driver for a simulated disk fs requests reading/writing of logical disk blocks (0:L-1)

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Project: Disk Driver' - bernad


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
project disk driver

Project: Disk Driver

ICS 145B

L. Bic

assignment
file

system

disk

driver

disk

controller

disk

1

2

emulation software

Assignment
  • implement a driver for a simulated disk
  • fs requests reading/writing of logical disk blocks (0:L-1)
  • disk driver interacts with HW controller via register interface to read/write blocks
organization of the disk pg 369
Organization of the Disk (pg 369)
  • each surface consist of tracks
  • each track consist of sectors (blocks)
  • each sector consist of bytes
  • tracks with same diameter is a cylinder
  • thus a cylinder also consist of tracks
  • sector is the smallest unit of transfer
fs driver interface 1
FS/Driver Interface (1)
  • read_block(int i, char *p)
  • write_block(int i, char *p)

copy block i to/from main memory (ptr)

  • init_disk(…)
  • save_disk(…)

file

system

disk

driver

disk

controller

disk

1

2

emulation software

disk driver
Disk Driver
  • principles of operation (see Section 11.4.3, page 379)

driver SW

disk driver6
Disk Driver
  • valid opcodes
    • SEEK
    • READ
    • WRITE
    • REPORT
  • writing opcode (OP reg) starts operation
  • controller becomes busy (BUSY reg)
  • driver must await completion
    • await_intrpt() for SEEK/READ/WRITE
    • busy-wait for REPORT (test BUSY reg)
disk driver7
Disk Driver
  • SEEK/READ/WRITE operation may fail
    • permanent failure (e.g., invalid parameter)
    • transient failure (generated at random)
  • driver must check status after every operation
    • write REPORT opcode
    • busy-wait until report operation completes
    • test STAT register
    • repeat operation if error is transient; report is permanent
controller registers 2
Controller Registers (2)
  • writable registers
    • OP: SEEK, READ, WRITE, REPORT
    • CYL: 0..CYL_NO-1 (used by SEEK)
    • SURF: 0..NO_SURF-1 (used by READ/WRITE)
    • SECT: 0..NO_SECT-1 (used by READ/WRITE)
    • MEM: pointer (used by READ/WRITE)
  • read-only registers
    • BUSY: TRUE/FALSE
    • STAT: OK, ILL_OP, ILL_CYL, ILL_SURF, ILL_SECT, ERROR (transient error)

file

system

disk

driver

disk

controller

disk

1

2

emulation software

controller interface functions
Controller Interface Functions
  • int read_reg(int reg_no)
    • read value of BUSY or STAT
  • int write_int_reg(int reg_no, int v)
    • write v into OP, CYL, SURF, SECT register
    • writing OP also starts operation (if not busy)
  • int write_mem_reg(char* v)
    • write starting location in memory (v) into MEM
  • int await_intrpt()
    • block process until completion interrupt
controller interface functions10
Controller Interface Functions
  • int init_disk(int no_cyl, int no_surf, int no_sect, int sect_len, char disk_cont[])
    • create/initialized disk
    • disk_cont[] is the initialization file; if nonexistent, disk is filled with blanks
  • int save_disk(char disk_cont[])
    • save the current disk contents in the file disk_cont[]
driver protocol
Driver Protocol
  • translate logical block number into a disk address (cylinder #, surface #, sector #)
  • if read/write head is already at desired cylinder, skip to step 3; else perform seek:
    • write cylinder # into the CYL register
    • write opcode SEEK into OP register
    • wait for interrupt (by calling await_intrpt() )
    • write opcode REPORT into OP register
    • busy-wait until BUSY register becomes FALSE
    • read STAT register
    • if operation ok, go to step 3; else retry SEEK
driver protocol cont
Driver Protocol -- cont

3. Perform READ or WRITE operation:

  • write parameters into controller registers (SURF, SECT, MEM)
  • write opcode READ or WRITE into OP register
  • wait for interrupt (by calling await_intrpt() )
  • write opcode REPORT into OP register
  • busy-wait until BUSY register becomes FALSE
  • read STAT register
  • if operation ok, go to step 1; else retry READ/WRITE
using simulation software
Using Simulation Software
  • the following files are on the web page
    • controller.c
    • internal.h
    • interface.h
  • DO NOT MODIFY THESE IN ANY WAY
  • compile these into controller.o
  • compile/link your program with controller.o
  • your program must include interface.h, i.e.:
    • #include ”interface.h”
  • your program uses the disk by invoking the controller interface functions (see protocol)
summary of tasks
Summary of tasks
  • design/implement driver
  • test driver (handling transient errors)
  • develop presentation/test shell (optional)
  • turn in design documentation
    • hard copy of high-level documentation to Distribution Center
    • commented code to Masterhit
  • code will be tested as part of FS project
ad