summaryrefslogtreecommitdiff
path: root/minix/drivers/audio/es1371/wait.c
blob: 97145abe56d9faf401585cfefd5fb2fb12ead524 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <minix/drivers.h>
#include <sys/types.h>
#include "pci_helper.h"


int WaitBitd (int paddr, int bitno, int state, long tmout)
{
        unsigned long mask;

	mask = 1UL << bitno;
	tmout *= 5000;

	if(state) {
    while(tmout-- > 0) {
	    if(pci_inl(paddr) & mask) {
	      return 0;
	    }
	  }
	}	else {
    while(tmout-- > 0) {
	    if(!(pci_inl(paddr) & mask)) {
	      return 0;
	    }
	  }
	}
	return 0;
}