2002-07-05 04:48:36

by Gabor Kerenyi

[permalink] [raw]
Subject: PCI bus access method

Hi!

I'm curious about which one of the following code
segments is executed faster. They are in an interrupt
handler, the readings and writings are done on the PCI bus.

__u32 tmp;
int i;
for (i=0;i<128;i++) {
tmp=readb(dev->dpmem+i);
if (!tmp) continue;
writeb(0,dev->dpmem+i);
some_code;
}

256 PCI bus access in the worst case, but fewer code

or

__u32 tmp;
int i,j;
char *p=&tmp;
for (i=0;i<128;i+=4) {
tmp=readl(dev->dpmem+i);
if (!tmp) continue;
writel(0, dev->dpmem+i);
for (j=0;j<4;j++)
if (*(p+j)) {
some_code;
}
}

64 PCI bus access in the worst case but more code

Thanks,

Gabor