.

Memory Methods

Introduction | Accessing Memory Methods | Control Object Memory Methods
mpiObjectMemory(...) | mpiObjectMemoryGet(...) / Set(...)

Introduction

You use Memory methods to access a motion controller's RAM. The MPI imposes no structure on motion controller RAM, so the use of memory methods requires implementation-specific knowledge of the motion controller's memory map.

The controller's memory map is version specific. If you use a hard-coded address with a memory method, it may not be compatible with other controller firmware versions. The xmp.h header file defines the controller's memory map and the interface to the MPI. It is intended for internal purposes only. The defines, structures, and ordering will change with each revision. If you use the xmp.h structures directly, be aware that your application code may require changes to be compatible with other xmp.h versions.

For MEI/XMP only The memory map is defined in the xmp.h header file. All accessible memory is defined in the MEIXmpData{} and MEIXmpBufferData{} structures.

Each object has its own memory methods; only the memory directly associated with the specific object can be accessed using that object's Memory methods.

Example An Axis object created with axis number 0 may only access memory associated with Axis 0.

 

Access Memory Methods

Memory access via these methods is thread-safe; only one thread at a time can read or write the portion of memory associated with the object. The Get/Set methods will bounds-check the memory address to be accessed, and return an error if the address is not associated with the object.

 

Control Object Memory Methods

The Control object memory methods are an exception. Using the ControlMemory methods, an application may access all memory on the motion controller at any time, without constraint. The ControlMemory methods are not thread-safe. Memory methods for the other objects are generally implemented by locking the section of memory associated with the object, and then calling a ControlMemory method.

It is possible to write a motion application using only a Control object. After creating and initializing the Control object, the address of motion controller memory can be obtained, and you can use the ControlMemoryGet/Set methods to access that memory.

Depending on the type of Control object created, an application can directly access the motion controller memory without using the ControlMemoryGet/Set methods. Such an application would bypass the rest of the MPI library and must implement its own thread safety, as well as deal with how the motion controller firmware operates.

Method .
mpiObjectMemory(...)
mpiObjectMemoryGet(...)
mpiObjectMemorySet(...)
Return host address of object in memory Read motion controller memory
Write motion controller memory

 

mpiObjectMemory(...)

The mpiObjectMemory(...) method returns a host address that maps to the section of motion controller memory associated with the object. mpiObjectMemory(...) uses 2 arguments: the object handle, and an output argument of type void **. If a call to mpiObjectMemory(...) succeeds, the location pointed to by the output argument is set to the host address.

 

mpiObjectMemoryGet(...) / mpiObjectMemorySet(...)

These methods read (get) and write (set) motion controller memory. They take 4 arguments:

 
  • the object handle
  • a destination address of type void *
  • a source address of type void *
  • and a length in bytes

The Get method's destination address points to host memory, while the source address points to motion controller memory (based on the address returned by the Memory method for the object). The Set method is the opposite. The Set method's destination address points to motion controller memory and the source address points to host memory.


Object Methods | Configuration Methods | Memory Methods | Status Methods
| Event Notification Methods | List Methods | Identity Methods |

 

       Legal Notice  |  Tech Email  |  Feedback
      
Copyright ©
2001-2021 Motion Engineering