Uploaded by 张某人

xPCTargetFunctionLibraryQuickReference

advertisement
xPC Target Function Library Quick Reference Sheet
Note: Header file xpctarget.h contains function prototypes for all xPC Target functions
Data Structures
Type
Structure
Structure Description
Members
xpcPCIDevice
Defines PCI configuration space
BaseAddress[6]
VirtAddress[6]
Length[6]
AddressSpaceIndicator[6]
MemoryType[6]
Prefetchable[6]
InterruptLine
VendorId
DeviceId
SubDeviceId
SubVendorId
uint32_T
uint32_T
uint32_T
uint16_T
uint16_T
uint16_T
uint16_T
uint16_T
uint16_T
uint16_T
uint16_T
Physical base address assigned by PCI BIOS
Virtual address (see xpcReserveMemoryRegion)
Length of region in bytes
0: Memory-mapped, 1: I/O port mapped
0: 32-bit, 1: Locate below 1MB, 2: 64-bit
Indicates if memory is prefetchable
Contains the assigned interrupt line, 0-15
Vendor ID
Device ID
Sub-device ID
Sub-vendor ID
Member Description
xpcTime
Holds time value in nanoseconds
U64.NanoSecondsLo
U64.NanoSecondsHi
uint32_T
uint32_T
Bottom 32 bits of 64-bit value in nanoseconds
Top 32 bits of 64-bit value in nanoseconds
Functions
Function Name
xpcInpB
xpcInpW
xpcInpDW
xpcOutpB
xpcOutpW
xpcOutpDW
xpcGetPCIDeviceInfo
Description
Returns value of byte input port
Returns value of word input port
Returns value of double word input port
Writes to byte output port
Writes to word output port
Writes to double word output port
Get PCI device information
Returns
uint8_T value
uint16_T value
uint32_T value
void
void
void
0: pass
int32_T
1: fail
xpcShowPCIDeviceInfo
xpcAllocPhysicalMemory
xpcFreePhysicalMemory
xpcReserveMemoryRegion
xpcGetElapsedTime
xpcSubtractTime
xpcBusyWait
xpcIsModelInit
Display PCI device information
Allocate physical memory
Free physical memory
Map physical memory to virtual
Returns time since system boot
Returns difference between two times
Wait for specified length of time
Returns target model load state;
true: while application loads,
false: start application execution
void
void * physical
void
void * virtual
real_T seconds
real_T seconds
void
boolean_T load
Arguments
uint16_T port
uint16_T port
uint16_T port
uint16_T port, uint8_T value
uint16_T port, uint16_T value
uint16_T port, uint32_T value
uint16_T vendorId, uint16_T deviceId,
uint16_T subVendorId, uint16_T subDeviceId,
uint16_T bus, uint16_T slot, xpcPCIDevice *pciInfo
xpcPCIDevice *pciInfo
uint32_T numBytes
const void *physical
const void *physical, uint32_T numBytes, uint32_T access
xpcTime *upTime
xpcTime *time, const xpcTime *time2, const xpcTime *time1
real_T seconds
void
Interrupt Hook Functions
Function Name
Description
Returns
Arguments
PCI
ISA
PreHookFunction
ISR function to be called when board issues interrupt request
xpcPCIDevice *pciInfo
PostHookFunction
StartFunction
StopFunction
Runs after return from function call on interrupt, before model execution
Called before model begins execution to enable interrupts
Called after model termination to disable interrupts
int XPC_RUN_ISR
XPC_DROP_ISR
void
void
void
All members of
xpcPCIDevice
except VirtAddress
are provided.
Only
BaseAddress[0] of
xpcPCIDevice is
provided.
Macros
#define
Description
XPC_NO_VEND_DEV
XPC_NO_BUS_SLOT
XPC_RT_PG_USERREADWRITE
XPC_RUN_ISR
XPC_DROP_ISR
Use when no VendorId, DeviceId, subVendorId or subDeviceId is required
Use when not specifying PCI bus or slot
Read/write access to memory region
Hook function return if interrupt occurred
Hook function return if no interrupt occurred
xPC Target Version 4.0 (R2008b)
© 2008 The MathWorks, Inc.
xpcPCIDevice *pciInfo
xpcPCIDevice *pciInfo
xpcPCIDevice *pciInfo
Download