PCI driver code

I have had to convert an existing QNX 4.25 system that had an ISA board to a
PCI motherboard. I have had to develop a Keithley board driver for the I/O
and A/D processes. I have all the device information for the board from
Keithley.
The VendorID and DeviceID are known and using the QNX
function _CA_PSI_Read_Config_DWord I have determined the base address as
0xe700 from the General Control Register 0 in the configuration space.
What functions does one use to read and write to the PCI memory space?

Does anyone have any sample code?

I would greatly appreciate some guidance if possible.

John Kaye

“John Kaye” <jekaye@total.net> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
news:bijta0$die$1@inn.qnx.com

I have had to convert an existing QNX 4.25 system that had an ISA board to
a
PCI motherboard. I have had to develop a Keithley board driver for the I/O
and A/D processes. I have all the device information for the board from
Keithley.
The VendorID and DeviceID are known and using the QNX
function _CA_PSI_Read_Config_DWord I have determined the base address as
0xe700 from the General Control Register 0 in the configuration space.
What functions does one use to read and write to the PCI memory space?

Does anyone have any sample code?

I would greatly appreciate some guidance if possible.

John Kaye

This is my PCI-program some code samples:

//Find My PCI-units
if(_CA_PCI_BIOS_Present(&lastbus, &version, &hardware) != PCI_SUCCESS)
{
printf(“m_analog: NO BIOS32 found\n”);
exit(0);
}

// All bus and units
for(busnum = 0; busnum <= lastbus; busnum++)
{
for(device = 0; device < 32; device++)
{

// PCI info
_CA_PCI_Read_Config_DWord(busnum, device << 3, 0, 16, (char *)&creg);
sprintf( buf, “%x”, creg.Device_ID );

if( strstr( fl_type_char, buf ) != NULL && // My unit?
device == fl_device_number ) // and My unit number?
{

// My Unit Base Address
pci_base_addr = creg.Base_Address_Regs[2] & 0xFFFFFFFC;

// All info to print
if( fl_debug == ON )
printf(“m_analog: PCI-1713 Vendor %x, DeviceId %x, Base Addr %x,
Device Number %d \n”,
creg.Vendor_ID, creg.Device_ID,
pci_base_addr, device );
break;

}
}
}

// Init My unit
outp( pci_base_addr+6, 0 ); // Trigger Source Clear
outp( pci_base_addr+9, 0 ); // 'lear FIFO

Work With My unit

case TYPE_ADC_PCI_1713:
//----------------
outp( pci_base_addr+6, 1 );

outp( pci_base_addr, 0 );

do
{
code = inp( pci_base_addr + 7 ) & 1;
count++;
} while ( code == 1 && count < MAX_READY_WAIT );

if( count == MAX_READY_WAIT )
printf(“m_analog: PCI-1713 No Ready ERROR\n” );

//Result of sample
code = inpw( pci_base_addr ) & 0xfff;

if( AI.gain_analog_in < 6 ) //
code -= 2048;

break;