Chpt2 How Software and Hardware Work Together

Embed Size (px)

Citation preview

  • 8/9/2019 Chpt2 How Software and Hardware Work Together

    1/15

    Lesson 2Lesson 2

    How Software and Hardware Work Together

  • 8/9/2019 Chpt2 How Software and Hardware Work Together

    2/15

    Slide 2Ver 1.0 10 April 2001

    ObjectivesObjectives

    Understand how the devices communicates

    Introduction to system resources

  • 8/9/2019 Chpt2 How Software and Hardware Work Together

    3/15

  • 8/9/2019 Chpt2 How Software and Hardware Work Together

    4/15

    Slide 4Ver 1.0 10 April 2001

    Interrupt RequestInterrupt Request

    Device interruptCPU when it need CPU services usingINT wire

    Eg When keyboard is pressed, INT wire is charged. The CPUstops what it is doing and run a BIOS routine (program) toquery the keyboard

    To regulates data traffic on the I/O busThe adapter or unit on the I/O bus uses the interrupt to signalrequest to the CPU that it wants to send or receive data

    Most IRQ wires are assigned to certain devices

    16 IRQsOnly 15 IRQ can be used

    IRQ 2 is wired to IRQ 9 (they are the same)

    2 IRQ controllers, joined by IRQ 2 and IRQ 9

  • 8/9/2019 Chpt2 How Software and Hardware Work Together

    5/15

    Slide 5Ver 1.0 10 April 2001

    IRQ ControllersIRQ Controllers

    IRQ 8

    IRQ 9 (dont exist)IRQ 10IRQ 11IRQ 12IRQ 13

    IRQ 14

    IRQ 15

    IRQ 0IRQ 1

    IRQ 2/9IRQ 3IRQ 4IRQ 5

    IRQ 6

    IRQ 7

    IRQ2 join to IRQ9

    Int

    Intel CPU

    IRQ Controller IRQ Controller

  • 8/9/2019 Chpt2 How Software and Hardware Work Together

    6/15

    Slide 6Ver 1.0 10 April 2001

    Interrupt RequestInterrupt Request

    Physically implemented as wiresIRQ 0, 1 and 8 are hard wired

    IRQ is assigned to a device when the PC starts

    Sharing of IRQ

    PCI devices are able to shareConflict of IRQ

    2 or more devices using the same IRQ

    Devices with resources conflict will not work

    Adjust resources to enable each device to have their

    own resources

  • 8/9/2019 Chpt2 How Software and Hardware Work Together

    7/15

    Slide 7Ver 1.0 10 April 2001

    IRQ TableIRQ Table

    IRQ Devices

    0 System timer

    1 Keyboard controller

    2 Open for use

    3 COM 2, COM 4

    4 COM 1, COM 3

    5 LPT2 (printer)

    6 Floppy drive controller

    7 LPT1 (printer)

    8 Real-time clock

    9 Wired to IRQ 2

    10 Open for use

    11 Open for use

    12 Open for use

    13 Math coprocessor

    14 Primary hard drive controller

    15 Secondary hard drive controller

  • 8/9/2019 Chpt2 How Software and Hardware Work Together

    8/15

    Slide 8Ver 1.0 10 April 2001

    I/O AddressI/O Address

    CPU talks to devices using their I/O addressPhysically, it use a wire call IO/MEM

    When voltage is placed on the wire, all devices listen. Thedevice will response if the I/O address matches

    All devices have more than 1 I/O addressEg hard disk has preset I/O address 01F0-01FF

    Sound card configures its own

    2 devices cannot have the same I/O address

    Once a device has an I/O address, no other device can

    use itTwo ways communication: CPU and a device

  • 8/9/2019 Chpt2 How Software and Hardware Work Together

    9/15

    Slide 9Ver 1.0 10 April 2001

    Physical wiring & HEXPhysical wiring & HEX

    I/O address using 16 wiresDivided into 4 group of 4 wires (4groups x 4 wires)

    Using 4 wires to representHexadecimal numbers (seetable)

    Eg 01F0 is represented physicallyas:

    0000 0001 1111 0000

    Binary number Hex0000 All wire off 0

    0001 Only 4th wire off 1

    0010 Only 3rd wire off 2

    0011 3th and 4th on 3

    0100 Only 2nd wire on 4

    0101 2nd and 4th wire on 5

    0110 2nd and 3rd wire on 6

    0111 Only 1stwire off 7

    1000 Only 1stwire on 8

    1001 1stand 4th wire on 9

    1010 1st

    and 3rd

    wire on A1011 2nd wire off B

    1100 1stand 2nd wire on C

    1101 3rd wire off D

    1110 4th wire off E

    1111 All wires on F

  • 8/9/2019 Chpt2 How Software and Hardware Work Together

    10/15

    Slide 10Ver 1.0 10 April 2001

    I/O Address TableI/O Address Table

    IRQ I/O Address Device

    0 040-05F System timer

    1 060-06F Keyboard controller

    2 0A0-0AF Access to IRQs above 7

    4 3F8-3FFCOM1

    3 2F8-2FF COM2

    4 3E8-3EF COM3

    3 2E8-2EF COM4

    6 03F-3F7 Floppy

    7 378-37F Parallel Port (LPT1)

    14 1F0-1F7 Primary IDE

    15 170-177 Secondary IDE

  • 8/9/2019 Chpt2 How Software and Hardware Work Together

    11/15

    Slide 11Ver 1.0 10 April 2001

    Direct Memory AccessDirect Memory Access

    Enables system to run background applicationwithout interfering the CPU

    Creating background sounds in games

    Access floppy disk drive

    To increase system performanceFreed the CPU from handling data transfer tasks

    PC has 2 DMA controllers, giving 8 channels0 to 7

    Channel 0, 2, and 4 cannot be usedChannel 2 is used by Floppy disk drive

    Device activate its assigned DMA channel if it wants to performa DMA data transfer

  • 8/9/2019 Chpt2 How Software and Hardware Work Together

    12/15

    Slide 12Ver 1.0 10 April 2001

    Direct Memory AccessDirect Memory Access

    Use by ISA devicesDMA is Slow

    Not suitable for newer devices eg hard disk

    Used by slow devices eg floppy drive, tape drive, sound card

    Bus Master devicesSkip DMA totally

    Popular in Hard disk, known as Ultra DMA

  • 8/9/2019 Chpt2 How Software and Hardware Work Together

    13/15

    Slide 13Ver 1.0 10 April 2001

    Enabling DMA in Hard Disk (older HDD)Enabling DMA in Hard Disk (older HDD)

    Steps:Control Panel

    Double-Click System applet

    Click Device Manager

    Double-click on Disk Drive

    Click on selected hard disk

    Click on Properties

    Click on the Setting tab

    Check the DMA box

    Note: If problem is encounteredafter enabling DMA, remove thesetting in SAFE MODE

  • 8/9/2019 Chpt2 How Software and Hardware Work Together

    14/15

    Slide 14Ver 1.0 10 April 2001

    DMA ChannelsDMA Channels

    DMA Channels Function Other Users

    0 Memory Refresh None

    1 Open for Use SCSI, ECP port

    2 Floppy drive controller Tape

    3 Open for Use ECP port SCSI card,Network Card

    4 Not Available Cascade to 0-3

    5 Sound Card SCSI

    6 Open for Use Sound Card, NIC

    7 Open for Use Sound Card, NIC

  • 8/9/2019 Chpt2 How Software and Hardware Work Together

    15/15

    Slide 15Ver 1.0 10 April 2001

    Device Manager to Find Resources AllocationDevice Manager to Find Resources Allocation

    The steps are:Control Panel

    System Applet

    Device Manager tab

    Double-click on Computer