OSINITSetinterruptvectors: Time-sliceclockSCHEDULER SoftwareinterruptOSSERVICES KeyboardinterruptsIOData... OSSERVICESExaminestacktodeterminerequestedoperation. Callappropriateroutine. SCHEDULERSaveprogramstate. Selectarunnableprocess. Restoresavedcontextofnewprocess. PushnewvaluesforPSandPConstack. Returnfrominterrupt. (a) OS initialization, services, and scheduler IOINITSetprocessstatustoBlocked. Initializememorybufferaddresspointerandcounter. Calldevicedrivertoinitializedevice andenableinterruptsinthedeviceinterface. Returnfromsubroutine. IODATAPolldevicestodeterminesourceofinterrupt. Callappropriatedriver. IfEND=1,thensetprocessstatustoRunnable. Returnfrominterrupt. (b) I/O routines KBDINITEnableinterrupts. Returnfromsubroutine. KBDDATACheckdevicestatus. Ifready,thentransfercharacter. Ifcharacter=CR,then{setEND=1;Disableinterrupts } elsesetEND=0. Returnfromsubroutine. (c) Keyboard driver Figure A few operating system routines.
Mainprogram MOVR0,#0 STRR0,EOLClearEOLflag. ADRR1,DATAINLoadaddressofRegisterDATAIN. LDRBR0,[R1,#3]Get contentsofCONTROLregister. ORRR0,R0,#4SetbitKENinregisterCONTROL STRBR0,[R1,#3]toenablekeyboardinterrupts. MOVR0,#&50EnableIRQinterruptsinprocessor MSRCPSR,R0andswitchtousermode.... IR Q Interrupt-serviceroutine READSTMFDR13!,{ R0 R2,R14 irq}SaveR0,R1,andR14irqonthestack. ADRR1,DATAINLoadaddressof register DATAIN. LDRBR0,[R1]Getinputcharacter. LDRR2,PNTRLoadpointervalue. STRBR0,[R2],#1Storecharacterandincrementpointer. STRR2,PNTRUpdatepointervalueinthememory. CMPBR0,#&0DCheckifCarriageReturn. LDMNEFDR13!,{ R0 R2,R14 irq}Ifnot,restoreregisters SUBNESPC,R14irq,#4andreturn. LDRB R0,[R1,#3] OtherwisegetCONTROLregister. ANDR0,R0,#&FBClearbitKEN STRBR0,[R1,#3]todisablekeyboardinterrupts. MOVR0,#1SetEOLflag. STRR0,EOL LDMFDR13!,{R0-R2,R14}Restoreregisters SUBSPC,R14irq,#4andreturn. Figure An ARM interrupt-service routine to read an input line from a keyboard based on Figure 4.9.
DATAIN 1 SIN Ready A31 A1 A0 Address decoder D7 D0 R/W Figure Combined input/output interface circuit. A2 DATAOUT Input status Bus PA7 PA0 CA PB7 PB0 CB1 CB2 SOUT D1 RS1 RS0 My-address Handshake control Master- Ready Slave-
Handshake control DATAOUT Printer data Idle Valid Read Load SOUT ready A31 A1 A0 Address decoder D 7 Q 7 D 0 Q 0 D7 D0 Figure 4.35.A parallel point interface for the bus of Figure 4.25, with a state-diagram for the timing logic. statusdata D 1 Q 1 D0 Timing Logic Clock My-address R/W Slave- Idle Respond My-address Go Go=1
memory Processor Bridge Processor bus PCI bus Main memory Additional controller CD-ROM controller Disk Disk 1Disk 2 ROM CD- SCSI controller USB controller Video KeyboardGame disk IDE SCSI bus Figure An example of a computer system using different interface standards. ISA interface Ethernet interface
Host computer Root hub Hub Figure Universal Serial Bus tree structure. I/O device Hub I/O device I/O device Hub I/O device I/O device I/O device
Host computer Root Hub Hub A Device Figure Split bus operation D F/LS HS - High speed F/LS- Full/Low speed Hub B Device C
PID (a) Packet identifier field PIDADDRENDPCRC Bits (b) Token packet, IN or OUT PIDDATACRC16 80 to Bits (c) Data packet Figure USB packet format.
PIDFrame numberCRC5 8115Bits (a) SOF Packet Figure USB frames. ST3DS 1-ms frame T7DT3D S- Start-of-frame packet Tn- Token packet, address = n D- Data packet A- ACK packet (b) Frame example
Table 4.4 The SCSI bus signals. CategoryNameFunction DataDB(0)to DB(7) Datalines:Carryonebyteofinformation duringtheinformationtransferphaseand identifydeviceduringarbitration,selectionand reselectionphases DB(P)Paritybitforthedatabus PhaseBSYBusy:Assertedwhenthebusisnotfree SELSelection:Assertedduringselectionand reselection Information type C/DControl/Data:Assertedduringtransferof controlinformation(command,statusor message) MSGMessage:indicatesthattheinformationbeing transferredisamessage HandshakeREQRequest:Assertedbyatargettorequestadata transfercycle A CKAcknowledge:Assertedbytheinitiatorwhenit hascompletedadatatransferoperation Directionof transfer I/OInput/Output:Assertedtoindicateaninput operation(relativ e totheinitiator) Other A TNAttention:Assertedbyaninitiatorwhenit wishestosendamessagetoatarget RSTReset:Causesalldevicecontrolstodisconnect fromthebusandassumetheirstart-upstate – – – – – – – – – – – –