*BSD News Article 15161


Return to BSD News archive

Newsgroups: comp.os.386bsd.development
Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!osuunx.ucc.okstate.edu!moe.ksu.ksu.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!uunet!decwrl!netcomsv!netcom.com!jmonroy
From: jmonroy@netcom.com (Jesus Monroy Jr)
Subject: FDC flow chart #2
Message-ID: <jmonroyC62GqE.67I@netcom.com>
Keywords: FDC flow chart logic 
Organization: NETCOM On-line Communication Services (408 241-9760 guest)
Date: Mon, 26 Apr 1993 01:13:26 GMT
Lines: 266

mail julian@jules.dialix.oz.au
flow chart #1
        This posting is for the FDC & QIC-40/80 group.
 
        What follows is the logic for the FDC through the function
        calls and Macros.  "Decision" logic is not included except
        where a Macro or Function was called.
 
 
        Logic for What?
        ---------------
                This is the logic for a FDC request for data
        transfer, wheter it is a read or write to the floppy drive.
 
___________________________________________________________________________
Jesus Monroy Jr                                          jmonroy@netcom.com
/386BSD/device-drivers /fd /qic /clock /documentation
___________________________________________________________________________
 
 
           +-------------
           |*  request - funtions in order run
     ~~~~~~|             logical and physical
           |
           +-------------
 
 
 
    +-----------------+               +---------------
    | | fdstrategy()| |               |* all request start here
    | |             | |               |  (should start in open)
    | |             | |~~~~~~~~~~~~~~~|
    | |             | |               |
    | |             | |               |
    +-----------------+               +---------------
            !
            !
            V
    +-----------------+               +---------------
    | | FD-UNIT()   | |               |* extract unit number from
    | |             | |               |  request packet
    | | C-MACRO     | |~~~~~~~~~~~~~~~|
    | |             | |               |
    | |             | |               |
    +-----------------+               +---------------
     !          !
     !          !
     !          !
     !          !
     !          !
     !          !                    +---------------
     !          V                    |* fatal errors
     !     +-------------+           |  abort process
     !    ( fdterminate() )~~~~~~~~~~|                +---------------
     !    (               )          |                |* error on
     !     +-------------+           |                |  invalid parameters
     !                               +------------~~~~|* bad transfer
     !                                                |  request
     !                                                |
     V                                                +---------------
    +----------------+           +---------------
    | | splbio()   | |           |*  Lock out
    | |            | |           |   other (competing)
    | |            | |~~~~~~~~~~~|   processes
    | |            | |           |
    | |            | |           |
    +----------------+           +---------------
            !
            !
            V
           /\
          /  \
         /    \
        / disk \
       /--------\
       \        /
        \ sort /
         \    /
          \  /
           \/
            !
    +----------------+       +---------------
    | | untimeout()| |       |* I don't know
    | |            | |       |  why this is
    | |            | |~~~~~~~|  here
    | |            | |       |
    | |            | |       |
    +----------------+       +---------------
            !
            !
            !
            !
            V
    +----------------+           +---------------
    | | splx()     | |           |* return priority
    | |            | |           |  to others
    | |            | |~~~~~~~~~~~|
    | |            | |           |
    | |            | |           |
    +----------------+           +---------------
           !
           !
           +~~~~~~~~~~+
           !          !
           !          !                 +---------------
           !          V                 |* drive is busy
           !     +-------------+        |  no need to fdstart.
           !    (               )~~~~~~~|  request is on que.
           !    (  RETURN       )       |
           !     +-------------+        |
           !                            +---------------
           !
           !
           V
    +-----------------+           +---------------
    | | fdstart()   | |           |* start any processes
    | |             | |           |  needed
    | |             | |~~~~~~~~~~~|
    | |             | |           |
    | |             | |           |
    +-----------------+           +---------------
            !
            !
            V
    +--------------------+        +---------------
    | | GET-PARM-PTRS()| |        |* get the parameter
    | |                | |        |  pointers
    | | C-MACRO        | |~~~~~~~~|
    | |                | |        |
    | |                | |        |
    +--------------------+        +---------------
            !
            !
            V
    +-----------------+                     +---------------
    | | splbio()    | |                     |* Lock Out other
    | |             | |                     |  processes
    | |             | |~~~~~~~~~~~~~~~~~~~~~|
    | |             | |                     |
    | |             | |                     |
    +-----------------+                     +---------------
            !
            +~~~~~~~~~~~~~~~~~~~+~~~~+
            !                   !    !
            V                   !    !
    +-----------------+         !    !    +---------------
    | | fdturnon()  | |         |    !    |* turn on the FD motor
    | |             | |         !    !    |
    | |             | |~~~~~~~~~!~~~~!~~~~|
    | |             | |         !    !    |
    | |             | |         !    !    |
    +-----------------+         !    !    +---------------
     !                          !    !
     !                          !    !
     !                          V    !
     ! +-------------------------+   !      +---------------
     ! | | fd_prep_reset_drv() | |   !      |* calculate the
     ! | |                     | |   !      !  fd track to
     ! | |                     | |~~~!~~~~~~|  seek
     ! | |                     | |   !      |
     ! | |                     | |   !      |
     ! +-------------------------+   !      +---------------
     !  !                            !
     !  !                            !
     !  !                            V
     !  ! +----------------------------+       +---------------
     !  ! | | fd_prep()              | |       |* calculate the
     !  ! | |                        | |       |  neede parameters
     !  ! | |                        | |~~~~~~~|  for data transfer
     !  ! | |                        | |       |
     !  ! | |                        | |       |
     !  ! +----------------------------+       +---------------
     !  !  !
     !  !  !
     !  !  !
     V  V  V
    +-----------------+                     +---------------
    | | splx()      | |                     |* return priority
    | |             | |                     |  to others
    | |             | |~~~~~~~~~~~~~~~~~~~~~|
    | |             | |                     |
    | |             | |                     |
    +-----------------+                     +---------------
            !
            +~~~~~~~~~~~+~~+~~+~~+~~~~~+
            !           !  !  !  !     !
            V           !  !  !  !     !
    +-----------------+ !  !  !  !     !  +---------------
    | | fdterminate | | !  !  !  !     !  |* Write-check
    | |             | | !  !  !  !     !  |  if failed fdterminate()
    | |             | |~!~~!~~!~~!~~~~~!~~|
    | |             | | !  !  !  !     !  |
    | |             | | !  !  !  !     !  |
    +-----------------+ !  !  !  !     !  +---------------
     !                  !  !  !  !     !
     ! +-----------------+ !  !  !     !  +---------------
     ! | | timeout()   | | !  !  !     !  |* allow the moter
     ! | |             | | !  !  !     !  |  time to spin up
     ! | |             | |~!~~!~~!~~~~~!~~|
     ! | |             | | !  !  !     !  |
     ! | |             | | !  !  !     !  |
     ! +-----------------+ !  !  !     !  +---------------
     !  !                  !  !  !     !
     !  !                  !  !  !     !
     !  !                  V  !  !     !
     !  ! +-----------------+ !  !     !    +---------------
     !  ! | | fd-reset()  | | !  !     !    |* issue a reset
     !  ! | |             | | !  !     !    |  command to
     !  ! | |             | |~!~~!~~~~~!~~~~|  the FDC
     !  ! | |             | | !  !     !    |
     !  ! | |             | | !  !     !    |
     !  ! +-----------------+ !  !     !    +---------------
     !  !  !                  !  !     !
     !  !  !                  !  !     !
     !  !  !                  V  !     !
     !  !  ! +-----------------+ !     !       +---------------
     !  !  ! | | fd-seek()   | | !     !       |* issue a seek
     !  !  ! | |             | | |     !       |  command to
     !  !  ! | |             | |~!~~~~~!~~~~~~~|  the FDC
     !  !  ! | |             | | !     !       |
     !  !  ! | |             | | !     !       |
     !  !  ! +-----------------+ !     !       +---------------
     !  !  !  !                  !     !
     !  !  !  !                  !     !
     !  !  !  !                  !     !
     !  !  !  !                  V     !
     !  !  !  ! +--------------------+ !       +---------------
     !  !  !  ! | | fd-read-write()| | !       |* issue a read/write
     !  !  !  ! | |                | | !       |  command to
     !  !  !  ! | |                | |~!~~~~~~~|  the FDC
     !  !  !  ! | |                | | !       |
     !  !  !  ! | |                | | !       |
     !  !  !  ! +--------------------+ !       +---------------
     !  !  !  !  !                     !
     !  !  !  !  !                     !
     !  !  !  !  !                     V
     !  !  !  !  !       +--------------+
     !  !  !  !  !       | Error        |     +---------------
     !  !  !  !  !       |              |     |* Something wierd
     !  !  !  !  !       | stdout(err)  |     |  has happened
     !  !  !  !  !       |              |~~~~~|
     !  !  !  !  !       |        - --  |     |
     !  !  !  !  !       -       -    ---     |
     !  !  !  !  !        -     -             +---------------
     !  !  !  !  !         -   -
     !  !  !  !  !          - -
     !  !  !  !  !           !
     +~~+~~+~~+~~+~~~~~~~~~~~+
                      !
                      !                  +---------------
                      V                  |* This is the normal
                  +-------------+        |  completion point
                 (               )~~~~~~~|  for most transactions.
                 (  RETURN       )       |  NOTE: if error on startup
                  +-------------+        |         there is no-recover, yet
                                         +---------------
 
 
 
 
___________________________________________________________________________
Jesus Monroy Jr                                          jmonroy@netcom.com
/386BSD/device-drivers /fd /qic /clock /documentation
___________________________________________________________________________