Inp32

Early in my code I have this:

 
#define Inp32 inb 


Then I have this:

1
2
3
4
5
/*trap the clock line*/
do {
	e=Inp32(PORT);
} while( (e & 32) !=0);
/*store the value*/


My questions are these. Is Inp32 being replaced by inb here:

 
e=Inp32(PORT);


Also here:

 
while( (e & 32) !=0


What is the purpose of the "e & 32"? What would could it possibly be calculating?

Thanks!



P.S. The entire function I am working with looks like this:

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*** readInterface() ***/
char * readInterface() {

char *cardRaw; /* keep this abstract*/
int e, i;

if( (cardRaw = (char *) malloc(240)) == NULL) {
printf("Error: goParse(): Cannot malloc space for cardRaw\n");
exit(1);
}

for(i=0;i<240;i++)
cardRaw[i]=0;

printf("Waiting for Card\n");

for(i=0;i<240;i++) {

/*trap the clock line*/
do {
	e=Inp32(PORT);
} while( (e & 32) !=0);

/*store the value*/
cardRaw[i]=e;

do {
	e=Inp32(PORT);
} while( (e & 32) != 32);
/*done trapping the clock line*/

}

/* stripe it to a bitstream*/
for(i = 0;i<240;i++) {
	cardRaw[i] = (cardRaw[i] & 16);
	if(cardRaw[i]==0) {
		cardRaw[i]=1;
	} else {
		cardRaw[i]=0;
	}
}

/* return the bitstream */
return cardRaw;
}//readinterface 
Last edited on
the binary value of decimal 32 is b'100000'. Now whatever value e contains will be And with b'100000'. If the and operation value return 32 then process will stop right away, continue otherwise
Topic archived. No new replies allowed.