2010-03-22 22:25:22 +01:00
|
|
|
#include <minix/drivers.h>
|
2007-11-23 12:30:50 +01:00
|
|
|
#include <sys/types.h>
|
2007-11-23 12:40:33 +01:00
|
|
|
#include "pci_helper.h"
|
|
|
|
|
2007-11-23 12:30:50 +01:00
|
|
|
|
|
|
|
int WaitBitd (int paddr, int bitno, int state, long tmout)
|
|
|
|
{
|
2010-01-15 22:45:30 +01:00
|
|
|
unsigned long mask;
|
2007-11-23 12:30:50 +01:00
|
|
|
|
|
|
|
mask = 1UL << bitno;
|
|
|
|
tmout *= 5000;
|
|
|
|
|
|
|
|
if(state) {
|
|
|
|
while(tmout-- > 0) {
|
2010-01-15 22:45:30 +01:00
|
|
|
if(pci_inl(paddr) & mask) {
|
2007-11-23 12:30:50 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
while(tmout-- > 0) {
|
2010-01-15 22:45:30 +01:00
|
|
|
if(!(pci_inl(paddr) & mask)) {
|
2007-11-23 12:30:50 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|