src/objacces.c
author etisserant
Wed, 10 May 2006 16:59:40 +0200
changeset 0 4472ee7c6c3e
child 1 b3dc740b4b04
permissions -rw-r--r--
Commit a new cvs repo.
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
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    23
#include "objacces.h"
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    24
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    25
#ifdef DEBUG_WAR_CONSOLE_ON
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    26
UNS8 accessDictionaryError(UNS16 index, UNS8 subIndex, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    27
			     UNS8 sizeDataDict, UNS8 sizeDataGiven, UNS32 code)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    28
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    29
  MSG_WAR(0x2B09,"Dictionary index : ", index);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    30
  MSG_WAR(0X2B10,"           subindex : ", subIndex);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    31
  switch (code) {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    32
    case  OD_NO_SUCH_OBJECT: 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    33
      MSG_WAR(0x2B11,"Index not found ", index);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    34
      break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    35
    case OD_NO_SUCH_SUBINDEX :
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    36
      MSG_WAR(0x2B12,"SubIndex not found ", subIndex);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    37
      break;   
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    38
    case OD_WRITE_NOT_ALLOWED :
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    39
      MSG_WAR(0x2B13,"Write not allowed, data is read only ", 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_LENGTH_DATA_INVALID :    
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    42
      MSG_WAR(0x2B14,"Conflict size data. Should be (bytes)  : ", sizeDataDict);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    43
      MSG_WAR(0x2B15,"But you have given the size  : ", sizeDataGiven);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    44
      break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    45
    case OD_NOT_MAPPABLE :
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    46
      MSG_WAR(0x2B16,"Not mappable data in a PDO at index    : ", index);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    47
      break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    48
    case OD_VALUE_TOO_LOW :
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    49
      MSG_WAR(0x2B17,"Value range error : value too low. SDOabort : ", code);
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_VALUE_TOO_HIGH :
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    52
      MSG_WAR(0x2B18,"Value range error : value too high. SDOabort : ", code);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    53
      break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    54
  default :
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    55
    MSG_WAR(0x2B20, "Unknown error code : ", code);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    56
  }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    57
  return 0; 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    58
}	
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    59
#endif
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    60
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    61
UNS32 getODentry( CO_Data* d, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    62
                  UNS16 wIndex,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    63
		  UNS8 bSubindex,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    64
		  void * pDestData,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    65
		  UNS8 * pExpectedSize,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    66
		  UNS8 * pDataType,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    67
		  UNS8 checkAccess)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    68
{ // DO NOT USE MSG_ERR because the macro may send a PDO -> infinite loop if it fails.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    69
  UNS32 errorCode;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    70
  UNS8 szData;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    71
  const indextable *ptrTable;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    72
  ODCallback_t *Callback;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    73
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    74
  ptrTable = (*d->scanIndexOD)(wIndex, &errorCode, &Callback);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    75
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    76
  if (errorCode != OD_SUCCESSFUL)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    77
    return errorCode;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    78
  if( ptrTable->bSubCount <= bSubindex ) {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    79
    // Subindex not found
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    80
    accessDictionaryError(wIndex, bSubindex, 0, 0, OD_NO_SUCH_SUBINDEX);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    81
    return OD_NO_SUCH_SUBINDEX;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    82
  }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    83
  
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    84
  if (checkAccess && !(ptrTable->pSubindex[bSubindex].bAccessType & WO)) {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    85
    accessDictionaryError(wIndex, bSubindex, 0, 0, OD_WRITE_NOT_ALLOWED);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    86
    return OD_READ_NOT_ALLOWED;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    87
  }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    88
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    89
  *pDataType = ptrTable->pSubindex[bSubindex].bDataType;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    90
   szData = ptrTable->pSubindex[bSubindex].size;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    91
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    92
  if(	*pExpectedSize == 0 ||
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    93
  	*pExpectedSize == szData ||
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    94
  	(*pDataType == visible_string && *pExpectedSize > szData)) // We allow to fetch a shorter string than expected
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    95
  {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    96
	#ifdef CANOPEN_BIG_ENDIAN
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    97
	      {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    98
		// data must be transmited with low byte first
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    99
		UNS8 i, j = 0;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   100
		for ( i = ptrTable->pSubindex[bSubindex].size - 1 ; i >= 0 ; i--) {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   101
			((char*)pDestData)[j++] = ((char*)ptrTable->pSubindex[bSubindex].pObject)[i];
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   102
		}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   103
	      }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   104
	#else  	
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   105
  	      memcpy(pDestData, ptrTable->pSubindex[bSubindex].pObject,*pExpectedSize);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   106
	#endif
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   107
      *pExpectedSize = szData;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   108
      return OD_SUCCESSFUL;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   109
  }else{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   110
      *pExpectedSize = szData;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   111
      accessDictionaryError(wIndex, bSubindex, szData, *pExpectedSize, OD_LENGTH_DATA_INVALID);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   112
      return OD_LENGTH_DATA_INVALID;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   113
  }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   114
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   115
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   116
UNS32 setODentry( CO_Data* d, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   117
                  UNS16 wIndex,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   118
		  UNS8 bSubindex, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   119
		  void * pSourceData, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   120
		  UNS8 * pExpectedSize, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   121
		  UNS8 checkAccess)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   122
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   123
  UNS8 szData;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   124
  UNS8 dataType;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   125
  UNS32 errorCode;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   126
  const indextable *ptrTable;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   127
  ODCallback_t *Callback;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   128
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   129
  ptrTable =(*d->scanIndexOD)(wIndex, &errorCode, &Callback);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   130
  if (errorCode != OD_SUCCESSFUL)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   131
    return errorCode;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   132
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   133
  if( ptrTable->bSubCount <= bSubindex ) {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   134
    // Subindex not found
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   135
    accessDictionaryError(wIndex, bSubindex, 0, *pExpectedSize, OD_NO_SUCH_SUBINDEX);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   136
    return OD_NO_SUCH_SUBINDEX;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   137
  }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   138
  if (checkAccess && !(ptrTable->pSubindex[bSubindex].bAccessType & RO)) {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   139
    accessDictionaryError(wIndex, bSubindex, 0, *pExpectedSize, OD_WRITE_NOT_ALLOWED);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   140
    return OD_WRITE_NOT_ALLOWED;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   141
  }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   142
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   143
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   144
   dataType = ptrTable->pSubindex[bSubindex].bDataType;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   145
   szData = ptrTable->pSubindex[bSubindex].size;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   146
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   147
  if( *pExpectedSize == 0 ||
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   148
  	*pExpectedSize == szData ||
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   149
  	(dataType == visible_string && *pExpectedSize < szData)) // We allow to store a shorter string than entry size
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   150
  {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   151
      errorCode = (*d->valueRangeTest)(dataType, pSourceData);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   152
      if (errorCode) {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   153
	accessDictionaryError(wIndex, bSubindex, szData, *pExpectedSize, errorCode);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   154
	return errorCode;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   155
      }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   156
      #ifdef CANOPEN_BIG_ENDIAN
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   157
	      {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   158
		// data must be transmited with low byte first
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   159
		UNS8 i, j = 0;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   160
		for ( i = ptrTable->pSubindex[bSubindex].size - 1 ; i >= 0 ; i--) {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   161
			((char*)ptrTable->pSubindex[bSubindex].pObject)[i] = ((char*)pSourceData)[j++];
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   162
		}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   163
	      }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   164
      #else  	
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   165
  	      memcpy(ptrTable->pSubindex[bSubindex].pObject,pSourceData, *pExpectedSize);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   166
      #endif
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   167
      *pExpectedSize = szData;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   168
      
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   169
      // Callbacks
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   170
      if(Callback && Callback[bSubindex]){
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   171
      	 (*Callback[bSubindex])(d, ptrTable, bSubindex);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   172
      }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   173
      
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   174
      // TODO : Store dans NVRAM      
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   175
      // if (ptrTable->pSubindex[bSubindex].bAccessType & TO_BE_SAVED)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   176
      return OD_SUCCESSFUL;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   177
  }else{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   178
      *pExpectedSize = szData;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   179
      accessDictionaryError(wIndex, bSubindex, szData, *pExpectedSize, OD_LENGTH_DATA_INVALID);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   180
      return OD_LENGTH_DATA_INVALID;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   181
  }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   182
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   183
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   184
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   185
const indextable * scanIndexOD (CO_Data* d, UNS16 wIndex, UNS32 *errorCode, ODCallback_t **Callback)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   186
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   187
  return (*d->scanIndexOD)(wIndex, errorCode, Callback);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   188
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   189
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   190
UNS32 RegisterSetODentryCallBack(CO_Data* d, UNS16 wIndex, UNS8 bSubindex, ODCallback_t Callback)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   191
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   192
	UNS32 errorCode;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   193
	ODCallback_t *CallbackList;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   194
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   195
	scanIndexOD (d, wIndex, &errorCode, &CallbackList);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   196
	if(errorCode == OD_SUCCESSFUL && CallbackList) 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   197
		CallbackList[bSubindex] = Callback;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   198
	return errorCode;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   199
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   200