mpiControlCreate

Declaration

MPI_RESULT mpiControlCreate(MPIControl          *control,
                            MPIControlType      type,
                            MPIControlAddress    *address);

 

Required Header: stdmpi.h

Change History: Modified in 04.00.

Description

mpiControlCreate creates a Control object of the specified type and type-specific address. ControlCreate is the equivalent of a C++ constructor. mpiControlCreate establishes communication with the motion controller hardware and initializes any SynqNet networks connected to the controller. Controller communication can occur through direct memory access, device driver, or remote by using client/server.

*control A pointer to a control object handle.
type The type of communication to access the controller hardware. Specifying MPIControlTypeDEFAULT applies MPIControlTypeDEVICE.
*address A pointer to a controller address structure. The address structure identifies the controller.  A controller can be local, remote, or a file containing a controller’s memory snapshot.

The type parameter determines the form of the address parameter:

If the "type" parameter is
Then the form of the "address" parameter is
MPIControlTypeDEFAULT MPIControlAddress.number
MPIControlTypeMAPPED MPIControlAddress.number
MPIControlTypeDEVICE MPIControlAddress.number
MPIControlTypeCLIENT MPIControlAddress.client
MPIControlTypeFILE MPIControlAddress.type.file

 

Type *address Controller Number "address" used
MPIControlTypeDEFAULT
or
NULL 0 None
     
MPIControlTypeDEVICE address address.number address.number
MPIControlTypeCLIENT address specified by server address.type.client->server
address.type.file.type
MPIControlTypeFILE address NA address.type.file->name
address.type.file.type

 

Return Values
MPIMessageOK
MPIControlMessageLIBRARY_VERSION
MPIControlMessageCONTROL_INVALID
MPIControlMessageTYPE_INVALID
MPIControlMessageCONTROL_NUMBER_INVALID
MPIControlMessageFIRMWARE_INVALID
MPIControlMessagePACK_ALIGNMENT
MPIControlMessageSYNQNET_STATE
MPIPacketMessageADDRESS_INVALID
MPIPlatformMessageDEVICE_INVALID
MPIPlatformMessageDEVICE_MAP_ERROR
MPISynqNetMessageSTATE_ERROR
MPISynqNetMessageTOPOLOGY_MISMATCH
MPISynqNetMessageTOPOLOGY_MISMATCH_FLASH
MPISynqNetMessageNODE_LATENCY_EXCEEDED
MPISynqNetMessageNODE_FPGA_VERSION
MPISynqNetMessageNODE_MAC_VERSION
MPISynqNetMessageNODE_INIT_FAIL

Sample Code

Create and initialize a control for local controller #0

      MPIControl     control;
      
      returnValue =
         mpiControlCreate(&control,
                          MPIControlTypeDEFAULT,
                          NULL);
                          
Create and initialize a control for local controller #1

      MPIControl         control;
      MPIControlAddress  address;
      
      address.number = 1;
      
      returnValue =
         mpiControlCreate(&control,
                          MPIControlTypeDEFAULT,
                          &address);
                       
Create and initialize a client control for a remote controller

      MPIControl         control;
      MPIControlAddress  address;
      
      address.type.client.server = 192.168.1.74;
      address.type.client.port = MPIControlDEFAULT_PORT;
      
      returnValue =
         mpiControlCreate(&control,
                          MPIControlTypeCLIENT,
                          &address);

See Also

MPIControl | MPIControlAddress | MPIControlType | mpiControlValidate | mpiControlDelete