HELP!!!如何提高PCI的访问速度

现在我用PCI总线访问数据,首先我通过MMAP()函数将DSP中的一片数据区映射到我程序区的一个数据区指针A,每次接到硬件发来的中断时,我通过MEMCPY(B,A,SIZE)将数据拷贝到存储的数据缓冲,数据量为9600字节,可是这条语句竟然花了2ms,而我的硬件中断间隔只有0.1ms,这可怎么办呀?据说PCI总线的访问速度可达每秒3M,唐先生有办法解决吗?

This looks like a hardware limitation. 9600/0.002=4.8M > 3M.
The only way is to check your H/W to see if it supports bus master or DMA.

Wait, if the limitation IS 3M, nothing can help you.
What kind of DSP card are you using?

可能是听错了,今天又了解了一下,PCI总线的访问速度最大可以达到几十兆,听有人说通过DMA方式可以快速的访问数据,你知道怎么做吗?

For 33MHz 32 bit PCI bus, it should be 33Mx4=132M.
Most of PCI card for example Ethernet card support bus master, this is the best way. But your PCI host controller and PCI card have to support this feature.
If bus master is unavailable, you can check if your hardware support DMA.

For DMA and bus master, it really depends on the hardware design.
Key word: source address register, destination address register, control register, descriptor.

Got to sleep.

pci总线支持的突发从模式读取,在QNX下是怎么实现的?谁知道

Bus master transaction? This has nothing to do with the OS.

Are you running on x86 with a BIOS? If so, BIOS should configured the PCI host as bus master enabled. The problem is if your DSP card support bus master transaction or not which you have to check the hardware manual.
If your hardware support bus master, you have to set the bus master bit
in the PCI command register.
You can do it like this:
pci_read_config( handle, offsetof (struct _pci_config_regs, Command), 1, sizeof( cmd ), &cmd );
cmd |= PCI_COMMAND_MASTER_ENABLE;
pci_write_config( handle, offsetof (struct _pci_config_regs, Command), 1, sizeof( cmd ), &cmd );
handle is the value you get by pci_attach_device() and cmd is unsigned short variable.

You can also use pci utility to check if your bus master is enabled (pci -vvv).

按照您的方法作了,可是存取速度并没有什么变化,CPU的占用率没有下降,是不是还要做什么操作?

Bus mster is kind of DMA, your hardware has to support this feature.
In this case, you don’t need memcpy to copy the data, the PCI card
will put the data in your main memory directly.
Basically you have to pre-allocate a chunk of memory, and tell the
your PCI card the memory address, length. PCI card will put the data
into the memory which you pre-allocated, and then generate an interrupt.
That means, when you get the interrupt, the data is already in your
memory.
Most of the network driver use bus master, If you have network DDK,
there are many sample, epic, speedo, el900 etc.

能不能告诉我那里有这些例子?

If there is network DDK in your system, it should be under /usr/src/ddk-6.x.1 directory.
speedo driver is a good example.
I think you have to check your PCI card support bus master first.
What kind DSP card are you using?

我用的是TI的TMS320C6000系列的DSP

Seem this chip support bus master transfer.
Do you have <<TMS320C6000 DSP Peripheral Component Interconnection(PCI) Reference Guid>> (spru581a.pdf)? It will give you some hint.