Documentation

xpcPCIDevice

Type definition for PCI configuration space structure

Prototype

typedef struct xpcPCIDeviceStruct{
    uint32_T BaseAddress[6];
    uint32_T VirtAddress[6];
    uint32_T Length[6];
    uint16_T AddressSpaceIndicator[6];
    uint16_T MemoryType[6];
    uint16_T Prefetchable[6];
    uint16_T InterruptLine;
    uint16_T VendorId;
    uint16_T DeviceId;
    uint16_T SubDeviceId;
    uint16_T SubVendorId;
} xpcPCIDevice;

Header File

xpctarget.h

Members

BaseAddress

Physical base addresses that are assigned by the PCI BIOS.

VirtAddress

Virtual address of device. You can enter the return value from xpcReserveMemoryRegion. See Description for details.

Length

Length of each region. This value contains the number of bytes that the board segment responds to during the configuration space read. This value might be larger than the space required by the registers as specified in the manufacturer documentation.

AddressSpaceIndicator

Indicates whether the board is I/O port mapped or memory-mapped. Values are one of the following. Verify this value in the manufacturer documentation.

0

Memory-mapped

1

I/O port mapped

MemoryType

Type of memory. This field is relevant only if AddressSpaceIndicator has a value of 0.

0

Located anywhere in the 32-bit address space

1

Located below 1 MB

2

Located anywhere in the 64-bit address space

Prefetchable

Indicates whether or not the memory is prefetchable. Typically, this field is not required.

InterruptLine

Contains the assigned interrupt line, values between 0 and 15. The BIOS assigns this value. You need this value only if you are writing an interrupt driver.

VendorId

Contains vendor ID.

DeviceId

Contains device ID.

SubDeviceId

Contains subdevice ID.

SubVendorId

Contains subvendor ID.

Description

The xpcPCIDevice structure defines the PCI configuration space structure. The following are additional notes on the BaseAddress field:

  • The PCI specification allows the definition of up to six different base addresses (addressable regions). Most boards respond to one or two of these addresses. Base addresses are filled in during the BIOS plug and play initialization, before the Simulink® Real-Time™ kernel starts to execute. The designer of the board decides how many address spaces are defined and what they are used for. Many boards use one address space to contain all of the registers for the board, other boards separate functions into different address spaces. See the board manufacturer documentation for this information.

  • For memory-mapped segments, call the xpcReserveMemoryRegion function to convert the physical address in BaseAddress to a virtual address that is suitable for the CPU to read and write the segment. You can then optionally save this address in the VirtAddress field. You might want to save the address if you have several segments and you want to pass them to a board access library.

Was this topic helpful?