src/objacces.c
author greg
Mon, 14 May 2007 11:24:32 +0200
changeset 199 48b59c852636
parent 175 e255529b6f7d
child 208 05d95c45b388
permissions -rw-r--r--
fix :

Traceback (most recent call last):
File "../../objdictgen/objdictgen.py", line 69, in ?
result = manager.ExportCurrentToFile(fileOut)
AttributeError: NodeManager instance has no attribute 'ExportCurrentToFile'
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     1
/*
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     2
This file is part of CanFestival, a library implementing CanOpen Stack. 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     3
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     4
Copyright (C): Edouard TISSERANT and Francis DUPIN
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     5
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     6
See COPYING file for copyrights details.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     7
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     8
This library is free software; you can redistribute it and/or
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     9
modify it under the terms of the GNU Lesser General Public
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    10
License as published by the Free Software Foundation; either
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    11
version 2.1 of the License, or (at your option) any later version.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    12
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    13
This library is distributed in the hope that it will be useful,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    14
but WITHOUT ANY WARRANTY; without even the implied warranty of
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    16
Lesser General Public License for more details.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    17
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    18
You should have received a copy of the GNU Lesser General Public
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    19
License along with this library; if not, write to the Free Software
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    21
*/
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    22
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 55
diff changeset
    23
/* #define DEBUG_WAR_CONSOLE_ON */
95cd3376cc9f compilator compatitibility
frdupin
parents: 55
diff changeset
    24
/* #define DEBUG_ERR_CONSOLE_ON */
11
64ed038bdc74 Bogue:big endian
dejoigny
parents: 10
diff changeset
    25
1
b3dc740b4b04 Commit some Fix from Francis on sdo.c and abjacces.c. Fix endianisation problems while accessing OD. Also fix SDO abord handling bug.
etisserant
parents: 0
diff changeset
    26
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    27
#include "objacces.h"
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    28
8
eee2b0c89213 correction bogue pour BIG_ENDIAN
dejoigny
parents: 2
diff changeset
    29
75
debc68b124b7 compiler compatibility : accessDictionaryError contains nothing out of debogue mode
frdupin
parents: 71
diff changeset
    30
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    31
UNS8 accessDictionaryError(UNS16 index, UNS8 subIndex, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    32
			     UNS8 sizeDataDict, UNS8 sizeDataGiven, UNS32 code)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    33
{
75
debc68b124b7 compiler compatibility : accessDictionaryError contains nothing out of debogue mode
frdupin
parents: 71
diff changeset
    34
#ifdef DEBUG_WAR_CONSOLE_ON
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    35
  MSG_WAR(0x2B09,"Dictionary index : ", index);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    36
  MSG_WAR(0X2B10,"           subindex : ", subIndex);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    37
  switch (code) {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    38
    case  OD_NO_SUCH_OBJECT: 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    39
      MSG_WAR(0x2B11,"Index not found ", index);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    40
      break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    41
    case OD_NO_SUCH_SUBINDEX :
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    42
      MSG_WAR(0x2B12,"SubIndex not found ", subIndex);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    43
      break;   
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    44
    case OD_WRITE_NOT_ALLOWED :
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    45
      MSG_WAR(0x2B13,"Write not allowed, data is read only ", index);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    46
      break;         
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    47
    case OD_LENGTH_DATA_INVALID :    
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    48
      MSG_WAR(0x2B14,"Conflict size data. Should be (bytes)  : ", sizeDataDict);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    49
      MSG_WAR(0x2B15,"But you have given the size  : ", sizeDataGiven);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    50
      break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    51
    case OD_NOT_MAPPABLE :
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    52
      MSG_WAR(0x2B16,"Not mappable data in a PDO at index    : ", index);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    53
      break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    54
    case OD_VALUE_TOO_LOW :
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    55
      MSG_WAR(0x2B17,"Value range error : value too low. SDOabort : ", code);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    56
      break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    57
    case OD_VALUE_TOO_HIGH :
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    58
      MSG_WAR(0x2B18,"Value range error : value too high. SDOabort : ", code);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    59
      break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    60
  default :
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    61
    MSG_WAR(0x2B20, "Unknown error code : ", code);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    62
  }
75
debc68b124b7 compiler compatibility : accessDictionaryError contains nothing out of debogue mode
frdupin
parents: 71
diff changeset
    63
#endif
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    64
  return 0; 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    65
}	
75
debc68b124b7 compiler compatibility : accessDictionaryError contains nothing out of debogue mode
frdupin
parents: 71
diff changeset
    66
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    67
175
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
    68
UNS32 _getODentry( CO_Data* d, 
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    69
                  UNS16 wIndex,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    70
		  UNS8 bSubindex,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    71
		  void * pDestData,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    72
		  UNS8 * pExpectedSize,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    73
		  UNS8 * pDataType,
175
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
    74
		  UNS8 checkAccess,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
    75
		  UNS8 endianize)
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 55
diff changeset
    76
{ /* DO NOT USE MSG_ERR because the macro may send a PDO -> infinite loop if it fails. */
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    77
  UNS32 errorCode;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    78
  UNS8 szData;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    79
  const indextable *ptrTable;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    80
  ODCallback_t *Callback;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    81
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    82
  ptrTable = (*d->scanIndexOD)(wIndex, &errorCode, &Callback);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    83
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    84
  if (errorCode != OD_SUCCESSFUL)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    85
    return errorCode;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    86
  if( ptrTable->bSubCount <= bSubindex ) {
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 55
diff changeset
    87
    /* Subindex not found */
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    88
    accessDictionaryError(wIndex, bSubindex, 0, 0, OD_NO_SUCH_SUBINDEX);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    89
    return OD_NO_SUCH_SUBINDEX;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    90
  }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    91
  
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    92
  if (checkAccess && !(ptrTable->pSubindex[bSubindex].bAccessType & WO)) {
1
b3dc740b4b04 Commit some Fix from Francis on sdo.c and abjacces.c. Fix endianisation problems while accessing OD. Also fix SDO abord handling bug.
etisserant
parents: 0
diff changeset
    93
  	MSG_WAR(0x2B30, "Access Type : ", ptrTable->pSubindex[bSubindex].bAccessType);
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    94
    accessDictionaryError(wIndex, bSubindex, 0, 0, OD_WRITE_NOT_ALLOWED);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    95
    return OD_READ_NOT_ALLOWED;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    96
  }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    97
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    98
  *pDataType = ptrTable->pSubindex[bSubindex].bDataType;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    99
   szData = ptrTable->pSubindex[bSubindex].size;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   100
12
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   101
   if(	*pExpectedSize == 0 ||
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   102
  	*pExpectedSize == szData ||
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 55
diff changeset
   103
  	(*pDataType == visible_string && *pExpectedSize < szData)) {/* We allow to fetch a shorter string than expected */
12
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   104
     
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   105
#  ifdef CANOPEN_BIG_ENDIAN
175
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   106
     if(endianize && *pDataType > boolean && *pDataType < visible_string) {
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 55
diff changeset
   107
       /* data must be transmited with low byte first */
12
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   108
       UNS8 i, j = 0;
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   109
       MSG_WAR(boolean, "data type ", *pDataType);
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   110
       MSG_WAR(visible_string, "data type ", *pDataType);
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   111
       for ( i = szData ; i > 0 ; i--) {
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   112
         MSG_WAR(i," ", j);
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   113
	 ((UNS8*)pDestData)[j++] = 
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   114
	   ((UNS8*)ptrTable->pSubindex[bSubindex].pObject)[i-1];
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   115
       }
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   116
     }
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 55
diff changeset
   117
     else /* It it is a visible string no endianisation to perform */
12
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   118
       memcpy(pDestData, ptrTable->pSubindex[bSubindex].pObject,szData);
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   119
#  else
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   120
     memcpy(pDestData, ptrTable->pSubindex[bSubindex].pObject,szData);
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   121
#  endif
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   122
     
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   123
     *pExpectedSize = szData;
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   124
#if 0
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 55
diff changeset
   125
     /* Me laisser ça, please ! (FD) */
12
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   126
     {
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   127
       UNS8 i;
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   128
       for (i = 0 ; i < 10 ; i++) {
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   129
	 MSG_WAR(*pExpectedSize, "dic data= ",
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   130
		 *(UNS8 *)(ptrTable->pSubindex[bSubindex].pObject + i));
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   131
       }
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   132
      
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   133
     }
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   134
#endif
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   135
     return OD_SUCCESSFUL;
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   136
   }
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 55
diff changeset
   137
   else { /* Error ! */
12
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   138
     *pExpectedSize = szData;
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   139
     accessDictionaryError(wIndex, bSubindex, szData, 
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   140
			   *pExpectedSize, OD_LENGTH_DATA_INVALID);
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   141
     return OD_LENGTH_DATA_INVALID;
1d3b9ad366c8 CANOPEN_BIG_ENDIAN :
dejoigny
parents: 11
diff changeset
   142
   }
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   143
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   144
175
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   145
UNS32 getODentry( CO_Data* d, 
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   146
                  UNS16 wIndex,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   147
		  UNS8 bSubindex,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   148
		  void * pDestData,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   149
		  UNS8 * pExpectedSize,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   150
		  UNS8 * pDataType,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   151
		  UNS8 checkAccess)
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   152
{
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   153
	return _getODentry( d, 
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   154
                  wIndex,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   155
		  bSubindex,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   156
		  pDestData,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   157
		  pExpectedSize,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   158
		  pDataType,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   159
		  checkAccess,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   160
		  1);//endianize
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   161
}
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   162
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   163
UNS32 readLocalDict( CO_Data* d, 
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   164
                  UNS16 wIndex,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   165
		  UNS8 bSubindex,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   166
		  void * pDestData,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   167
		  UNS8 * pExpectedSize,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   168
		  UNS8 * pDataType,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   169
		  UNS8 checkAccess)
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   170
{
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   171
		return _getODentry( d, 
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   172
                  wIndex,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   173
		  bSubindex,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   174
		  pDestData,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   175
		  pExpectedSize,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   176
		  pDataType,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   177
		  checkAccess,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   178
		  0);//do not endianize
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   179
}
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   180
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   181
UNS32 _setODentry( CO_Data* d, 
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   182
                  UNS16 wIndex,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   183
		  UNS8 bSubindex, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   184
		  void * pSourceData, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   185
		  UNS8 * pExpectedSize, 
175
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   186
		  UNS8 checkAccess,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   187
		  UNS8 endianize)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   188
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   189
  UNS8 szData;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   190
  UNS8 dataType;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   191
  UNS32 errorCode;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   192
  const indextable *ptrTable;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   193
  ODCallback_t *Callback;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   194
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   195
  ptrTable =(*d->scanIndexOD)(wIndex, &errorCode, &Callback);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   196
  if (errorCode != OD_SUCCESSFUL)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   197
    return errorCode;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   198
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   199
  if( ptrTable->bSubCount <= bSubindex ) {
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 55
diff changeset
   200
    /* Subindex not found */
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   201
    accessDictionaryError(wIndex, bSubindex, 0, *pExpectedSize, OD_NO_SUCH_SUBINDEX);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   202
    return OD_NO_SUCH_SUBINDEX;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   203
  }
1
b3dc740b4b04 Commit some Fix from Francis on sdo.c and abjacces.c. Fix endianisation problems while accessing OD. Also fix SDO abord handling bug.
etisserant
parents: 0
diff changeset
   204
  if (checkAccess && (ptrTable->pSubindex[bSubindex].bAccessType == RO)) {
b3dc740b4b04 Commit some Fix from Francis on sdo.c and abjacces.c. Fix endianisation problems while accessing OD. Also fix SDO abord handling bug.
etisserant
parents: 0
diff changeset
   205
  	MSG_WAR(0x2B25, "Access Type : ", ptrTable->pSubindex[bSubindex].bAccessType);
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   206
    accessDictionaryError(wIndex, bSubindex, 0, *pExpectedSize, OD_WRITE_NOT_ALLOWED);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   207
    return OD_WRITE_NOT_ALLOWED;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   208
  }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   209
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   210
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   211
   dataType = ptrTable->pSubindex[bSubindex].bDataType;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   212
   szData = ptrTable->pSubindex[bSubindex].size;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   213
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   214
  if( *pExpectedSize == 0 ||
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   215
  	*pExpectedSize == szData ||
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 55
diff changeset
   216
  	(dataType == visible_string && *pExpectedSize < szData)) /* We allow to store a shorter string than entry size */
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   217
  {
2
8d4a822f95e4 Fixed Endianisation/ValueRange order in SetODentry
etisserant
parents: 1
diff changeset
   218
      #ifdef CANOPEN_BIG_ENDIAN
175
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   219
	      if(endianize && dataType > boolean && dataType < visible_string)
11
64ed038bdc74 Bogue:big endian
dejoigny
parents: 10
diff changeset
   220
	      {
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 55
diff changeset
   221
			/* we invert the data source directly. This let us do range testing without */
95cd3376cc9f compilator compatitibility
frdupin
parents: 55
diff changeset
   222
			/* additional temp variable */
55
96173dd44f2c unused variable deleted
frdupin
parents: 12
diff changeset
   223
		 	UNS8 i;
11
64ed038bdc74 Bogue:big endian
dejoigny
parents: 10
diff changeset
   224
	  		for ( i = 0 ; i < ( ptrTable->pSubindex[bSubindex].size >> 1)  ; i++) 
64ed038bdc74 Bogue:big endian
dejoigny
parents: 10
diff changeset
   225
	  		{
64ed038bdc74 Bogue:big endian
dejoigny
parents: 10
diff changeset
   226
	    		UNS8 tmp =((UNS8 *)pSourceData) [(ptrTable->pSubindex[bSubindex].size - 1) - i];
64ed038bdc74 Bogue:big endian
dejoigny
parents: 10
diff changeset
   227
	    		((UNS8 *)pSourceData) [(ptrTable->pSubindex[bSubindex].size - 1) - i] = ((UNS8 *)pSourceData)[i];
64ed038bdc74 Bogue:big endian
dejoigny
parents: 10
diff changeset
   228
	    		((UNS8 *)pSourceData)[i] = tmp;
64ed038bdc74 Bogue:big endian
dejoigny
parents: 10
diff changeset
   229
	    	}
64ed038bdc74 Bogue:big endian
dejoigny
parents: 10
diff changeset
   230
		}  
2
8d4a822f95e4 Fixed Endianisation/ValueRange order in SetODentry
etisserant
parents: 1
diff changeset
   231
      #endif
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   232
      errorCode = (*d->valueRangeTest)(dataType, pSourceData);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   233
      if (errorCode) {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   234
	accessDictionaryError(wIndex, bSubindex, szData, *pExpectedSize, errorCode);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   235
	return errorCode;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   236
      }
2
8d4a822f95e4 Fixed Endianisation/ValueRange order in SetODentry
etisserant
parents: 1
diff changeset
   237
      memcpy(ptrTable->pSubindex[bSubindex].pObject,pSourceData, *pExpectedSize);
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   238
      *pExpectedSize = szData;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   239
      
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 55
diff changeset
   240
      /* Callbacks */
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   241
      if(Callback && Callback[bSubindex]){
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   242
      	 (*Callback[bSubindex])(d, ptrTable, bSubindex);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   243
      }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   244
      
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 55
diff changeset
   245
      /* TODO : Store dans NVRAM */     
161
c4908cc776a9 SetODEntry now call CO_data->storeODSubEntry(Index,SubIndex) for variables to be Stored (when column Save==True in GUI)
etisserant
parents: 75
diff changeset
   246
      if (ptrTable->pSubindex[bSubindex].bAccessType & TO_BE_SAVE){
c4908cc776a9 SetODEntry now call CO_data->storeODSubEntry(Index,SubIndex) for variables to be Stored (when column Save==True in GUI)
etisserant
parents: 75
diff changeset
   247
      	(*d->storeODSubIndex)(wIndex, bSubindex);
c4908cc776a9 SetODEntry now call CO_data->storeODSubEntry(Index,SubIndex) for variables to be Stored (when column Save==True in GUI)
etisserant
parents: 75
diff changeset
   248
      }
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   249
      return OD_SUCCESSFUL;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   250
  }else{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   251
      *pExpectedSize = szData;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   252
      accessDictionaryError(wIndex, bSubindex, szData, *pExpectedSize, OD_LENGTH_DATA_INVALID);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   253
      return OD_LENGTH_DATA_INVALID;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   254
  }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   255
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   256
175
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   257
UNS32 setODentry( CO_Data* d, 
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   258
                  UNS16 wIndex,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   259
		  UNS8 bSubindex, 
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   260
		  void * pSourceData, 
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   261
		  UNS8 * pExpectedSize, 
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   262
		  UNS8 checkAccess)
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   263
{
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   264
	return _setODentry( d, 
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   265
                  wIndex,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   266
		  bSubindex, 
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   267
		  pSourceData, 
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   268
		  pExpectedSize, 
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   269
		  checkAccess,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   270
		  1);//endianize
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   271
}
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   272
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   273
UNS32 writeLocalDict( CO_Data* d, 
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   274
                  UNS16 wIndex,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   275
		  UNS8 bSubindex, 
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   276
		  void * pSourceData, 
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   277
		  UNS8 * pExpectedSize, 
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   278
		  UNS8 checkAccess)
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   279
{
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   280
	return _setODentry( d, 
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   281
                  wIndex,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   282
		  bSubindex, 
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   283
		  pSourceData, 
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   284
		  pExpectedSize, 
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   285
		  checkAccess,
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   286
		  0);//do not endianize
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   287
}
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   288
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   289
e255529b6f7d Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents: 161
diff changeset
   290
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   291
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   292
const indextable * scanIndexOD (CO_Data* d, UNS16 wIndex, UNS32 *errorCode, ODCallback_t **Callback)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   293
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   294
  return (*d->scanIndexOD)(wIndex, errorCode, Callback);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   295
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   296
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   297
UNS32 RegisterSetODentryCallBack(CO_Data* d, UNS16 wIndex, UNS8 bSubindex, ODCallback_t Callback)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   298
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   299
	UNS32 errorCode;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   300
	ODCallback_t *CallbackList;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   301
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   302
	scanIndexOD (d, wIndex, &errorCode, &CallbackList);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   303
	if(errorCode == OD_SUCCESSFUL && CallbackList) 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   304
		CallbackList[bSubindex] = Callback;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   305
	return errorCode;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   306
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   307
161
c4908cc776a9 SetODEntry now call CO_data->storeODSubEntry(Index,SubIndex) for variables to be Stored (when column Save==True in GUI)
etisserant
parents: 75
diff changeset
   308
void _storeODSubIndex (UNS16 wIndex, UNS8 bSubindex){}