150 likes | 243 Views
Troisième Partie Chapitre 6 Les interfaces D’entrée-sortie. D. I/O. A. D. T. E. A. V. I. C. E. Sy. Polled I/O. Computer bus. CPU. mem. I/O interface. Polling Procedure. public void print(char ch); // Printer polling method { while Sy do { /* wait */ } ; Data = ch;
E N D
Troisième Partie Chapitre 6 Les interfaces D’entrée-sortie
D I/O A D T E A V I C E Sy Polled I/O Computer bus CPU mem I/O interface
Polling Procedure public void print(char ch); // Printer polling method { while Sy do {/* wait */}; Data = ch; Sy = true /* activate printer interface */; };
Normal Program Interrupt Handler Interrupt
Where is the interrupt handler ? Fixed direct addresses (INTEL) Fixed indirect addresses (Motorola) Vectored Interrupts (DEC) How to save the program state ? By programmer Automatically, the entire state. Automatically, a part of the state. By shadow registers Interrupt Issues
Direct Interrupt Addresses Contents of P register when interrupt 1 occurred = xyz RESET JMP 00000 Interrupt handler 01000 0D000 Save context 00004 INT.1 JSB 0D000 00008 INT.2 Restore context RET xyz
Indirect Interrupt Addresses Contents of P register when interrupt 1 occurred = xyz Interrupt handler 0D000 INT.2 INT.1 0D000 FFFFF 00000 RESET At interrupt, the entire context, including P, is saved on stack by the control unit. The RTI instruction restores the entire context, including P RTI xyz
+ 1 - Vectored Interrupt Interrupting device After an interrupt, the interrupting device will normally put a JSB instruction on the data bus for calling the interrupt handler
Fetching the next instruction at a predefined address A JSB at the predefined address and a RET at the end of the interrupt handler take care of the return address. All other context needs to be saved explicitly Very simple from an hardware point of view Fetching the next instruction via a predefined address Context (full or subset) saved by hardware Specific Return from Interrupt instruction to restore context More complex control unit required Fetching the next instruction from the interrupting interface No restrictions on number of interrupting devices Context saving similar to the case of direct interrupt addresses Very simple control unit but rather complex interfaces Interrupt Handling
D I/O A D T E A V I C E Sy Interrupt Driven I/O Computer bus CPU interrupt mem I/O interface
Interrupt Driven Printing (1) public void print(char ch); // Printer function pseudocode { while bufferfull do {/* wait */}; put ch intobuffer; if (buffer was empty){start driver} };
Interrupt driven Printing (2) public void pdriver; // Interrupt driven printer driver { while (true) do { if (BufferEmpty) {Suspend pdriver}; Data = Next Character from Buffer; Sy = true; (* activate printer interface *) Suspend driver until printer interrupt; } };
D I/O bus request/ bus granted A D T E A V I C E Sy Direct Memory Access Computer bus CPU interrupt DMAC ready mem I/O interface
DMA Controller to CPU Bus Request Bus Granted Interrupt Request Configuration BUS Origin Address Destination Address Ready = Transfert Request Byte Count