Writing Device Driving ISRs in a System
- A device has three sets of device registers
- Data Register
- Control Register
- Status register
- Data Register
- A device initializes by setting the control register bit and the device closes b y resetting the control register bits.
- There may be more than one device register at a device address.
- Control register bits controls all the action of the device.
- Status register bits reflects flags for the status of the device at an instant and changes after performing the actions as per device driver
- ISRs can be called either by setting the status flag or a hardware call by a signal to initiate.
- The status and control registers should be available at the same address, since the processor reads the status from the address during read operation and writes at the same address during the write operation.
Parallel Port Device driver in a System
Step A – Device Initialisation Program
Step B – Device Driver Program
Step 0, 1, 2, 3, 4, 5 – Interrupt Service Routine for PORTA.
Serial Device driver in a System
It uses UART 8250 with Intel 80x86 Processor
Steps for Serial Port Device Driver Program
- Device initialization codes for UART 8250. Define input and output port Addresses (0x2F8 for serial port address in x86 processors)
- Set control bits for interrupt mask and allocate interrupt vector address for device interrupts. (Interrupt vector is a memory address where the driver ISR is located).
- Enable all Interrupts in the system.
- Enable serial line interrupt.
- Set Baud Rate.
- Initialize normal serial data output.
- Enable interrupt controller as initialization of device is finished in the above steps
Transfer character to serial line device by writing it to port at 0x2F8.
Comments
Post a Comment