NNP STM Generic Remote Module git-main
Loading...
Searching...
No Matches
objacces.c File Reference
#include "data.h"

Go to the source code of this file.

Macros

#define accessDictionaryError(index, subIndex, sizeDataDict, sizeDataGiven, code)
 Print MSG_WAR (s) if error to the access to the object dictionary occurs.
 

Functions

UNS32 _getODentry (CO_Data *d, UNS16 wIndex, UNS8 bSubindex, void *pDestData, UNS32 *pExpectedSize, UNS8 *pDataType, UNS8 checkAccess, UNS8 endianize)
 _getODentry() Reads an entry from the object dictionary.

 
UNS32 _setODentry (CO_Data *d, UNS16 wIndex, UNS8 bSubindex, void *pSourceData, UNS32 *pExpectedSize, UNS8 checkAccess, UNS8 endianize)
 By this function you can write an entry into the object dictionary.
 
const indextablescanIndexOD (CO_Data *d, UNS16 wIndex, UNS32 *errorCode, ODCallback_t **Callback)
 Scan the index of object dictionary. Used only by setODentry and getODentry.
 
UNS32 RegisterSetODentryCallBack (CO_Data *d, UNS16 wIndex, UNS8 bSubindex, ODCallback_t Callback)
 <BRIEF>
 
void _storeODSubIndex (CO_Data *d, UNS16 wIndex, UNS8 bSubindex)
 <BRIEF>
 

Detailed Description

Date
Created on: Oct 10, 2024
Author
Jerry Ukwela (jeu6@.nosp@m.case.nosp@m..edu)

Definition in file objacces.c.

Macro Definition Documentation

◆ accessDictionaryError

#define accessDictionaryError ( index,
subIndex,
sizeDataDict,
sizeDataGiven,
code )

Print MSG_WAR (s) if error to the access to the object dictionary occurs.

You must uncomment the lines in the file objaccess.c :
//#define DEBUG_CAN
//#define DEBUG_WAR_CONSOLE_ON
//#define DEBUG_ERR_CONSOLE_ON

Beware that sometimes, we force the sizeDataDict or sizeDataGiven to 0, when we wants to use this function but we do not have the access to the right value. One example is getSDOerror(). So do not take attention to these variables if they are null.

Parameters
index
subIndex
sizeDataDictSize of the data defined in the dictionary
sizeDataGivenSize data given by the user.
codeerror code to print. (SDO abort code. See file def.h)
Returns

Definition at line 68 of file objacces.c.

Referenced by _getODentry(), and _setODentry().

Function Documentation

◆ _getODentry()

UNS32 _getODentry ( CO_Data * d,
UNS16 wIndex,
UNS8 bSubindex,
void * pDestData,
UNS32 * pExpectedSize,
UNS8 * pDataType,
UNS8 checkAccess,
UNS8 endianize )

_getODentry() Reads an entry from the object dictionary.

use getODentry() macro to read from object and endianize use readLocalDict() macro to read from object and not endianize

// Example usage:
UNS8 *pbData;
UNS8 length;
UNS32 returnValue;
returnValue = getODentry( (UNS16)0x100B, (UNS8)1,
(void * *)&pbData, (UNS8 *)&length );
if( returnValue != SUCCESSFUL )
{
// error handling
}
#define UNS8
Unsigned int8 representation in CANFest.
Definition applicfg.h:25
#define UNS16
Unsigned int16 representation in CANFest.
Definition applicfg.h:26
#define UNS32
Unsigned int32 representation in CANFest.
Definition applicfg.h:27
Parameters
*dPointer to a CAN object data structure
wIndexThe index in the object dictionary where you want to read an entry
bSubindexThe subindex of the Index. e.g. mostly subindex 0 is used to tell you how many valid entries you can find in this index. Look at the canopen standard for further information
*pDestDataPointer to the pointer which points to the variable where the value of this object dictionary entry should be copied
*pExpectedSizeThis function writes the size of the copied value (in Byte) into this variable.
*pDataTypePointer to the type of the data. See objdictdef.h
CheckAccessif other than 0, do not read if the data is Write Only [Not used today. Put always 0].
EndianizeWhen not 0, data is endianized into network byte order when 0, data is not endianized and copied in machine native endianness
Returns
  • OD_SUCCESSFUL is returned upon success.
  • SDO abort code is returned if error occurs . (See file def.h)

Definition at line 111 of file objacces.c.

◆ _setODentry()

UNS32 _setODentry ( CO_Data * d,
UNS16 wIndex,
UNS8 bSubindex,
void * pSourceData,
UNS32 * pExpectedSize,
UNS8 checkAccess,
UNS8 endianize )

By this function you can write an entry into the object dictionary.

Parameters
*dPointer to a CAN object data structure
wIndexThe index in the object dictionary where you want to write an entry
bSubindexThe subindex of the Index. e.g. mostly subindex 0 is used to tell you how many valid entries you can find in this index. Look at the canopen standard for further information
*pSourceDataPointer to the variable that holds the value that should be copied into the object dictionary
*pExpectedSizeThe size of the value (in Byte).
checkAccessFlag that indicate if a check rights must be perfomed (0 : no , other than 0 : yes)
endianizeWhen not 0, data is endianized into network byte order when 0, data is not endianized and copied in machine native endianness
Returns
  • OD_SUCCESSFUL is returned upon success.
  • SDO abort code is returned if error occurs . (See file def.h)

Definition at line 235 of file objacces.c.

◆ scanIndexOD()

const indextable * scanIndexOD ( CO_Data * d,
UNS16 wIndex,
UNS32 * errorCode,
ODCallback_t ** Callback )

Scan the index of object dictionary. Used only by setODentry and getODentry.

Parameters
*dPointer to a CAN object data structure
wIndex
*errorCode: OD_SUCCESSFUL if index foundor SDO abort code. (See file def.h)
**Callback
Returns
NULL if index not found. Else : return the table part of the object dictionary.

Definition at line 343 of file objacces.c.

Referenced by PDOInit(), and RegisterSetODentryCallBack().

Here is the caller graph for this function: