Page 119 - DCAP210_INTRODUCTION__TO_MICROPROCESSORS
P. 119
Unit 8: Interfacing I/O Devices
Generally, polling is inefficient and should be avoided, particularly in time-sharing systems. Notes
In sampling, value of an input device is read and then the program proceeds.
• No tight loop
• Typically used to track sequence of actions (the mouse)
8.2.4 Device Association
To obtain device independence:
• Design an application in terms of virtual (abstract) devices.
• Implement virtual devices using physical devices
There are certain natural associations:
e.g. Valuator—Mouse-X
But if the naturally associated device does not exist on a platform, one can make do with other
possibilities:
e.g. Valuator—number entered on keyboard
8.2.5 Device Input Modes
Return values from devices may be provided in:
Request Mode:
Alternating application and device execution
• application requests a return and then suspends execution;
• device wakes up, provides input and then suspends execution;
• application resumes execution.
Sample Mode:
Concurrent application and device execution
• device continually updates register(s) or memory location(s);
• application may read at any time.
Event Mode:
Concurrent application and device execution together with a concurrent queue management
service
• device continually offers input to the queue
• application may request selections and services from the queue (or the queue may interrupt
the application).
8.2.6 Application Structure
With respect to device input modes, applications may be structured to engage in
• requesting
• polling or sampling
• event processing
LOVELY PROFESSIONAL UNIVERSITY 113