Question: A system has two memory-mapped I/O devices. The first device has a 16-bit status register at address OxA000, immediately followed by a 32-bit data
A system has two memory-mapped I/O devices. The first device has a 16-bit status register at address OxA000, immediately followed by a 32-bit data register. The second device has an 8- bit status register at address OxB000, followed by a 32-bit data register. The first device is used to receive data (i.e., input device). The most-significant bit in the status register is a data ready flag, which is set automatically by the device whenever new data is received. For the device to receive more data, the data ready flag must be manually reset by software to indicate that the current data have been processed. The second device is used to send data (i.e., output device). Bit 0 of its status register is a read- only ready to send flag, and bit 7 is a transmit enable command bit that is automatically reset by the device after each transmission. We would like to write software that collects 32-bit words of unsigned values received through the first device, and computes the maximum of received data until the second device becomes ready to send. Once the second device becomes ready to send data, the maximum word is sent using the second device. Once the maximum is sent, the maximum computation is restarted for the next sample of data, ignoring the previously received data samples. a) Construct a C program that implements this behavior using polling only. b) Assuming that each device has its own interrupt handler, develop the handlers for each device in C. The first device generates an interrupt request upon receiving new data. The second device generates an interrupt request upon becoming ready to send new data.
Step by Step Solution
3.54 Rating (151 Votes )
There are 3 Steps involved in it
Below are examples of C code for the specified behavior using polling Part a and with interrupt handlers Part b a C program using polling include include Define memorymapped addresses define FIRSTDEVI... View full answer
Get step-by-step solutions from verified subject matter experts
