I have a QPMC-1553 in a VxWorks system. The API call, BusTools_API_InitExtended, keeps returning a error code of 203 (Bad Card Number). If I use its PCI base address for argument 2 of the API call, I get a dual port ram error, and then it does a...

Installing the QPMC-1553 in a VxWorks system is a two part process:

  1. Modify the VxWorks image to configure the QPMC-1553.
  2. Install and run the API and application programs.

To modify the VxWorks image you need to change sysLib.c, config.h, and the board-specific include file that config.h includes. There is full description of these steps in the VxWorks chapter of the "BusTools/1553-API User's Manual and Hardware Installation Guide". Briefly, you need to find an unused region of memory. It needs to be at least 8 megabytes. Typically, you can use the High regions of the A32 address range on a VME SBC. Define your memory regions in config.h and the board-specific include file and add that to the sysPhysMemDesc table. You then need to add configuration code to sysHwInit in sysLib.c

Config.h
#define INCLUDE_CONDOR_QPMC
Board specific include (like vm2600.h)
#if defined (INCLUDE_CONDOR_QPMC) 
#define CONDOR_PMC_MEM_ADRS    0xf0000000      /* base of Condor PMC space */
#define CONDOR_PMC_MEM_SIZE    0x1000000       /* 16 Mbytes for 2 Condor QPMC boards */
#define CONDOR_DEV0_SPACE      0x0
#define CONDOR_DEV1_SPACE      0x800000
#define CONDOR_PCI0_ADRS       (CONDOR_PMC_MEM_ADRS + CONDOR_DEV0_SPACE)
#endif 

You may need to change macros like these two.

#if defined (INCLUDE_CONDOR_PMC) || defined (INCLUDE_CONDOR_820) || defined (INCLUDE_CONDOR_MMSI) 
#define IS_VME_ADDRESS(adrs)  ( ((UINT32)(adrs) >= (UINT32)(VME_A32_MSTR_LOCAL) && 
                                 (UINT32)(adrs) = (UINT32)(VME_A24_MSTR_LOCAL) && 
                                 (UINT32)(adrs) = (UINT32)(VME_A16_MSTR_LOCAL) && 
                                 (UINT32)(adrs) = (UINT32)(VME_A32_REG_BASE)   && 
                                 (UINT32)(adrs) = (UINT32)VME_MSTR_LO_ADRS) && 
((UINT32)(adrs) = (UINT32)(PCI_MSTR_LO_ADRS)    && 
                                (UINT32)(adrs) = (UINT32)(CONDOR_PMC_MEM_ADRS) && 
                                (UINT32)(adrs) = (UINT32)PCI_MSTR_LO_ADRS) && 
((UINT32)(adrs) 

sysLib.c (sysPysMemDesc)
#if defined( INCLUDE_CONDOR_QPMC )
    {
    (void *) CONDOR_PMC_MEM_ADRS,
    (void *) CONDOR_PMC_MEM_ADRS,
    CONDOR_PMC_MEM_SIZE,
    VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE |
    VM_STATE_MASK_GUARDED,
    VM_STATE_VALID      | VM_STATE_WRITABLE      | VM_STATE_CACHEABLE_NOT |
    VM_STATE_GUARDED
    },
#endif
sysLib.c (sysHwInit)
#if defined(INCLUDE_CONDOR_QPMC)
        {
           int num_pmc_boards = 0;
           int index;
           static int MAX_BOARDS=2;
           static unsigned PMC_OFFSET = 0x2000000;
           UINT32 base_addr;

           int span_count = 0;
           for(index = 0;index 

Now, rebuild the VxWorks image and download it to your target. It is helpful to have the show routines included in your image. If you have these show routines, type:

pciDeviceShow

You see something like the following. The QPMC-15553 is vendorID 13c6, deviceID 1553.

pciDeviceShow
Scanning function 0 of each PCI device on bus 0
Using configuration mechanism 1
bus       device    function  vendorID  deviceID  class
00000000  00000000  00000000  00001057  00004801  00060000 
00000000  0000000b  00000000  000010ad  00000565  00060100 
00000000  0000000d  00000000  000010e3  00000000  00068000 
00000000  0000000e  00000000  00001011  00000009  00020000 
00000000  00000010  00000000  000013c6  00001553  00ff0000 
00000000  00000011  00000000  000013c6  00001001  00ff0000 
value = 0 = 0x0

Now type: pciHeaderShow 0,0x10,0 to display the QPMC-1553 configuration registers.

pciHeaderShow 0,0x10,0
vendor ID =                   0x13c6
device ID =                   0x1553
command register =            0x0002
status register =             0x0400
revision ID =                 0x01
class code =                  0xff
sub class code =              0x00
programming interface =       0x00
cache line =                  0x00
latency time =                0x00
header type =                 0x00
BIST =                        0x00
base address 0 =              0xf0000000
base address 1 =              0x00000000
base address 2 =              0x00000000
base address 3 =              0x00000000
base address 4 =              0x00000000
base address 5 =              0x00000000
cardBus CIS pointer =         0x00000000
sub system vendor ID =        0x13c6
sub system ID =               0x0000
expansion ROM base address =  0x00000000
interrupt line =              0x00
interrupt pin =               0x01
min Grant =                   0x00
max Latency =                 0x00
value = 0 = 0x0

This verifies that you have configured the QPMC-1553 with the desired base address, 0xf0000000 in this case. The exact settings depend on your system so they may vary from what is shown here. You need to consider the memory map for the specific PowerPC and any other PCI or VME boards you have installed.

Once this process is completed and verified, you are ready to download the BusTools/1553-API. You can find the pre-compiled version under the VxWorks folder in the library directory on you host platform. If you are running Tornado, you can download VXW-PMC-1553-PPC603.out or VXW-PMC-1553-PPC604.out depending on your processor type (G3 or G4).

Now, download you application software. There is a demo program, VxW_Demo the tests the installation. You can download it and see if the board initializes and runs. You'll find it under the VxWorks folder in the Examples directory. You download VxW_demo and run it by typing:

 Demo 0,"qpmc1553"