2.5.2 Keyboard and Mouse Drivers’ Device Objects
Figure 2.20 illustrates the device objects that represent the keyboard and mouse devices shown previously in Figure 2.7. The keyboard and mouse drivers shown in Figure 2.8 create these device objects by calling an I/O support routine.
Figure 2.20 Keyboard and Mouse Device Objects
For the keyboard and mouse devices, both their respective port and class drivers create device objects. The port driver creates a device object to represent the physical port. Each class driver creates its own device object to represent the keyboard or mouse device as a target for I/O requests.
Each class driver calls an I/O support routine to get a pointer to the next-lower-level driver’s device object, so the class driver can chain itself above the port driver, and so each class driver can send I/O requests down to the port driver for the target device object representing its physical device.
As shown previously in Figure 2.8, each port driver is a lowest-level driver, so every port driver of a device that generates interrupts must set up interrupt object(s) and register an ISR.
Note that a dual-device port driver, like the (i8042) driver for the keyboard and auxiliary device controller shown in Figure 2.7, must set up device-specific interrupt objects when each device uses a different interrupt vector. The writer of such a driver can either implement separate ISRs for each device or implement a single ISR for both devices.