mpiControlObjectPtr

Declaration

mpiControlObjectPtr(MPIControl                  control,
                    MPIControlObjectType        objectType,
                    int32_t                        objectIndex,
                    MPI_BOOL                    host,
                    MFWObjectPtr                *objectPtr);

 

Required Header: stdmpi.h

Change History: Added in 04.00.

Description

mpiControlObjectPtr gets a pointer to an object, specified by the objectType and objectIndex. The objectPtr can be a host address or a controller address, depending on the host flag. If the objectIndex is 0, mpiControlObjectPtr sets the objectPtr to the base of the object array, even if the number of objects in the array is zero.

WARNING! Bypassing the MPI to access the controller’s memory directly is not guaranteed to be binary compatible with future MPI libraries. The controller’s memory map is firmware version dependent. If your application directly accesses the controller’s memory, you must re-compile your application when upgrading to newer MPI versions.

control A handle to a control object.
objectType The type of object;
objectIndex An index into an array of objects.
host TRUE or FALSE. When TRUE, objectPtr is a host address based pointer. When FALSE, objectPtr is a controller address based pointer.
*objectPtr A pointer to an object address
Return Values
MPIMessageOK
MPIControlMessageOBJECT_INVALID
MPIControlMessageOBJECT_INDEX_INVALID

Sample Code

Configure a set of addresses to contain pointers to axis memory on the controller.  
This would be useful for configuring the data recorder.

MFWAxisData *axisDataPtr; void *addr[2];
returnValue = mpiControlObjectPtr(control, MPIControlObjectTypeAXIS_DATA, 0, TRUE, /* host address */ &axisDataPtr);
if (returnValue == MPIMessageOK) { addr[0] = &axisDataPtr->Status; addr[1] = &axisDataPtr->TC.Velocity; }

See Also

mpiControlObjectCount