Status-register : Why it is not working properly

182 Views Asked by At

A piece of hardware has a one-byte status register. The LSB of the register is a 'busy' bit. The driver must wait for the bit to clear before writing any registers in the device. Consider the following code:

char p = remap(MEM_PCI, REG_BASE_ADDRESS, REG_SIZE); 
while (*p & 1);
/ write to hardware */ 

The code doesn't work. Often the driver hangs waiting for the hardware to be "ready". Please list of the reasons for why that could happen.

0

There are 0 best solutions below