Hello, Hugh!
You wrote on Tue, 6 Aug 2002 09:46:11 -0400:
??>> flag PCI_INIT_ALL doesn’t includes the above flags, so is that defines
??>> for future use or worked but undocumented ?
HB> No, it is not defined for future use. You can or in the flag when you
HB> do your pci_attach_device() and it will enable bus mastering.
Thank You !!! But I have another question (more complexity) I wrote question
in the qdn.public.ddk.audio about enabling bus master feature for audio
device, but no got answer till this time. ado_* function set in the Audio
DDK doesn’t allow to pass flags while attaching to PCI audio device. So I
can’t enable bus master …
I wrote the next source but it is doesn’t work for me: if you know, please
help me !
P.S. In FreeBSD kernel they do read COMMAND register after set MASTER flag,
but I don’t … maybe this is my problem ? (The below source from linux
kernel, adopted for QNX)
#define PCI_COMMAND_REG 0x04 /* offset in pci config space
/
#define PCI_COMMAND_REG_SIZE 0x02 / register size in bytes
/
#define PCI_COMMAND_REG_TYPE uint16_t / register in C type
/
#define PCI_LATENCYTIMER_REG 0x0D / offset in pci config space
/
#define PCI_LATENCYTIMER_REG_SIZE 0x01 / register size in bytes
/
#define PCI_LATENCYTIMER_REG_TYPE uint8_t / register in C type
/
#define PCI_LATENCYTIMER_MAX 255 / maximum value for latency
timer /
/ Setup Bus Master to device */
ado_debug(DB_LVL_DRIVER, “ctrl_init(): VT8233: Setting up BusMaster to
device …\n”);
pci_read_config(vt8233->pci->handle, PCI_COMMAND_REG, 0x01,
PCI_COMMAND_REG_SIZE, &PCICommandReg);
if (PCICommandReg & PCI_COMMAND_MASTER_ENABLE == 0)
{
PCI_LATENCYTIMER_REG_TYPE PCILatencyTimerReg;
uint8_t needupdate=1;
/* if BM flag isn’t already setted, we set it up manually. */
PCICommandReg|=PCI_COMMAND_MASTER_ENABLE;
pci_write_config(vt8233->pci->handle, PCI_COMMAND_REG, 0x01,
PCI_COMMAND_REG_SIZE, &PCICommandReg);
/* initializing PCI latency timer for this device manually. */
ado_debug(DB_LVL_DRIVER, “ctrl_init(): VT8233: initalizing PCI device
latency timer …\n”);
pci_read_config(vt8233->pci->handle, PCI_LATENCYTIMER_REG, 0x01,
PCI_LATENCYTIMER_REG, &PCILatencyTimerReg);
if (PCILatencyTimerReg < 16)
{
PCILatencyTimerReg = (64 <= PCI_LATENCYTIMER_MAX) ? 64 :
PCI_LATENCYTIMER_MAX;
}
else
{
if (PCILatencyTimerReg > PCI_LATENCYTIMER_MAX)
{
PCILatencyTimerReg = PCI_LATENCYTIMER_MAX;
}
else
{
needupdate=0;
}
}
if (needupdate)
{
pci_write_config(vt8233->pci->handle, PCI_LATENCYTIMER_REG, 0x01,
PCI_LATENCYTIMER_REG, &PCILatencyTimerReg);
}
}
With best regards, Mike Gorchak.