Download MicroCANopen Plus User Manual

Transcript
THE MICROCANOPEN PLUS PROTCOL STACK
Passed
level indicates a priority level for the access, is set to PIACC_APP,
PIACC_PDO or PIACC_SDO depending on if the access is made from the
application, PDO processing or SDO processing.
offset is the offset into the process image to the location to which the write is
executed.
psrc is a memory pointer to the source from which data is copied.
len is the length of the data to be copied in bytes.
Returned
Nothing or length of data copied.
2.3.8 Process Image Access Macros: The PI_COMP macro
This macro is defined in procimg.h and used to compare data with data in the
process image. This can be customized or provided as a function if the application
wants to have a direct call-back for any compare access made to the process
image.
Declaration
PI_COMP(level,offset,psrc,len)
Passed
level indicates a priority level for the access, is set to PIACC_APP,
PIACC_PDO or PIACC_SDO depending on if the access is made from the
application, PDO processing or SDO processing.
offset is the offset into the process image to the location that is to be compared.
psrc is a memory pointer to the data that is to be compared.
len is the length of the data to be compared in bytes.
Returned
0 if the data is identical and unequal 0 otherwise.
2.3.9 Default Process Image Access Macros
The code is delivered with default macros that use plain calls to memcpy resp.
memcmp from the ANSI-C string library:
#define PI_READ(level,offset,pdst,len)
#define PI_WRITE(level,offset,psrc,len)
#define PI_COMP(level,offset,psrc,len)
memcpy(pdst,&(gProcImg[offset]),len)
memcpy(&(gProcImg[offset]),psrc,len)
memcmp(&(gProcImg[offset]),psrc,len)
In environments where the following is true, these will work fine:
21