Hi Eduard…
ed1k wrote:
Y.LEROUX <> y.leroux@nospam.actris.com> > wrote in article <a33rsm$b35$> 1@inn.qnx.com> >…
snip
My Board use IRQ11.
Also I’m puzzled a bit what have you done in order to use IRQ11? I maybe wrong, PCI bus is quite
new stuff for me >
AFAIK, PCI bus uses INT #A, INT #B, INT #C and INT #D. Some of these lines should be translated to
physical interrupt line, for example IRQ11. Could anybody explain me how to do it?
It is my understanding that these are hard-wired lines, and the BIOS
will assign an IRQ to them. I am not aware that you have a choice on
which IRQ the line gets connected to, whence you MUST always check which
IRQ the board is connected to by looking in the PCI register space.
Also, if you do a pci -v | more, do you see your board via vendor and
device ID? If so, then you may be able to use the pci_* set of
functions. Down bellow you’ll find a portion of how I get this
information from a cPCI board. Notice that I use mmap_device_memory()
to map the pci register base to local memory, and from then on you just
read/set information at will, including the IRQ and family.
Finally, the book “PCI System Architecture” is a good source.
Regards…
Miguel.
P.S. I use the VMIC 7755 cPCI cpu board.
Thanks.
Eduard.
////////////////////////////////////////////////////////////////////////
template
int vmic::init_vmic7755( void )
{
////////////////////////////////////////////////////////////////////////
// PCI portion
////////////////////////////////////////////////////////////////////////
//… attach a handle to the PCI device
if( pci_handle = pci_attach( 0 ) < 0 )
{
perror( “Error attaching to the PCI server” );
return ( EXIT_FAILURE );
}
//… Locate the embedded PCI functions resources
memset( &vmic7755info, 0, sizeof( vmic7755info ) );
vmic7755info.VendorId = 0x114A;
vmic7755info.DeviceId = 0x6504;
//… get the information
bridgeHandle = pci_attach_device( NULL, PCI_SEARCH_VENDEV |
PCI_SHARE, 0, &vmic7755info );
//… did we do this right?
if( NULL == bridgeHandle )
{
perror( “pci_attach_device” );
return ( -1 );
}
printf( “Bridge device found\n”
" Vendor Id = 0x%x\n"
" Device Id = 0x%x\n"
" Subsystem Id = 0x%x\n"
" Subsystem Vendor Id = 0x%x\n"
" Bus Number = 0x%x\n"
" Device Function Number = 0x%x\n"
" Revision = 0x%x\n"
" Class = 0x%x\n"
" IRQ = 0x%x\n"
" PciBaseAddress[0] = 0x%llx\n"
" PciBaseAddress[1] = 0x%llx\n"
" CpuBaseAddress[0] = 0x%llx\n"
" CpuBaseAddress[1] = 0x%llx\n"
" BaseAddressSize[0] = %d \n"
" BaseAddressSize[1] = %d \n"
" CpuIoTranslation = 0x%llx\n"
" CpuMemTranslation = 0x%llx\n"
" CpuBmstrTranslation = 0x%llx\n"
" RomSize = 0x%x\n",
vmic7755info.VendorId, vmic7755info.DeviceId,
vmic7755info.SubsystemId,
vmic7755info.SubsystemVendorId,
vmic7755info.BusNumber, vmic7755info.DevFunc,
vmic7755info.Revision, vmic7755info.Class,
vmic7755info.Irq,
vmic7755info.PciBaseAddress[0],
vmic7755info.PciBaseAddress[1],
vmic7755info.CpuBaseAddress[0],
vmic7755info.CpuBaseAddress[1],
vmic7755info.BaseAddressSize[0],
vmic7755info.BaseAddressSize[1],
vmic7755info.CpuIoTranslation,
vmic7755info.CpuMemTranslation,
vmic7755info.CpuBmstrTranslation, vmic7755info.RomSize );
if( PCI_IS_MEM( vmic7755info.CpuBaseAddress[0] ) )
{ printf("\n vmic7755info.CpuBaseAddress[0] = 0x%llx is a memory
address\n", vmic7755info.CpuBaseAddress[0]);
}
if( PCI_IS_MEM( vmic7755info.CpuBaseAddress[1] ) )
{ printf("\n vmic7755info.CpuBaseAddress[1] = 0x%llx is a memory
address\n", vmic7755info.CpuBaseAddress[1]);
}
if( PCI_IS_IO( vmic7755info.CpuBaseAddress[0] ) )
{ printf("\n vmic7755info.CpuBaseAddress[0] = 0x%llx is a IO
address\n", vmic7755info.CpuBaseAddress[0]);
}
if( PCI_IS_IO( vmic7755info.CpuBaseAddress[1] ) )
{ printf("\n vmic7755info.CpuBaseAddress[1] = 0x%llx is a IO
address\n", vmic7755info.CpuBaseAddress[1]);
}
//… Get the base address of the CSR’s
if( pci_read_config( bridgeHandle,
0x10,
1,
sizeof( BaseAddr_ram ),
&BaseAddr_ram ) != PCI_SUCCESS )
{
perror( “pci_read_config” );
return ( -1 );
}
if( pci_read_config( bridgeHandle,
0x14,
1,
sizeof( BaseAddr_timer ),
&BaseAddr_timer ) != PCI_SUCCESS )
{
perror( “pci_read_config” );
return ( -1 );
}
////////////////////////////////////////////////////////////////////////
// END PCI portion
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// Memory and Register mapping
////////////////////////////////////////////////////////////////////////
//… this is the register base memory
regBase = (volatile uint8_t *) mmap_device_memory( NULL,
vmic7755info.BaseAddressSize[1],
PROT_READ|PROT_WRITE|PROT_NOCACHE,
0,
vmic7755info.CpuBaseAddress[1]);
if( regBase == MAP_FAILED )
{ perror( “mmap_device_memory” );
//return ( -1 );
exit( EXIT_FAILURE );
}
//… this is the pointer to a map of the reg base…
vmicRegB = (vmic_timer_t *) regBase;
//… this is the presistant ram memory (will survive shutdown)
ramBase = (volatile uint8_t *) mmap_device_memory( NULL,
vmic7755info.BaseAddressSize[0],
PROT_READ|PROT_WRITE|PROT_NOCACHE,
0,
vmic7755info.CpuBaseAddress[0]);
if( regBase == MAP_FAILED )
{ perror( “mmap_device_memory” );
//return ( -1 );
exit( EXIT_FAILURE );
}
////////////////////////////////////////////////////////////////////////
// END Memory and Register mapping
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// Hardware set up
////////////////////////////////////////////////////////////////////////
//… clear any intterrupt
//regBase[0x30] = 0; //… value written does not matter
vmicRegB->t1ic = 0;
////////////////////////////////////////////////////////////////////////
// END hardware set up
////////////////////////////////////////////////////////////////////////
//… success…
return ( 1 );
}
////////////////////////////////////////////////////////////////////////
\
my opinions are mine, only mine, solely mine, and they are not related
in any possible way to the institution(s) in which I study and work.
Miguel Simon
Research Engineer
School of Aerospace and Mechanical Engineering
University of Oklahoma
http://www.amerobotics.ou.edu/
http://www.saic.com