00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00035 #include "objacces.h"
00036 #include "sdo.h"
00037 #include "dcf.h"
00038 #include "sysdep.h"
00039
00040
00054 extern UNS8 _writeNetworkDict (CO_Data* d, UNS8 nodeId, UNS16 index,
00055 UNS8 subIndex, UNS8 count, UNS8 dataType, void *data, SDOCallback_t Callback, UNS8 endianize);
00056
00057 const indextable *ptrTable;
00058
00065 static void CheckSDOAndContinue(CO_Data* d, UNS8 nodeId)
00066 {
00067 UNS32 abortCode;
00068
00069 if(getWriteResultNetworkDict (d, nodeId, &abortCode) != SDO_FINISHED)
00070 {
00071 MSG_ERR(0x1A01, "SDO error in consise DCF", abortCode);
00072 MSG_WAR(0x2A02, "server node : ", nodeId);
00073 }
00074
00075 closeSDOtransfer(d, nodeId, SDO_CLIENT);
00076 decompo_dcf(d,nodeId);
00077 }
00078
00087 UNS32 decompo_dcf(CO_Data* d,UNS8 nodeId)
00088 {
00089 UNS32 errorCode;
00090 UNS16 target_Index;
00091 UNS8 target_Subindex;
00092 UNS32 target_Size;
00093 UNS32 res;
00094 ODCallback_t *Callback;
00095
00096 ptrTable = (*d->scanIndexOD)(0x1F22, &errorCode, &Callback);
00097 if (errorCode != OD_SUCCESSFUL)
00098 {
00099 return errorCode;
00100 }
00101
00103 while (nodeId < ptrTable->bSubCount){
00104 UNS32 nb_targets;
00105
00106 UNS8 szData = ptrTable->pSubindex[nodeId].size;
00107 UNS8* dcfend;
00108
00109 {
00110 UNS8* dcf = *((UNS8**)ptrTable->pSubindex[nodeId].pObject);
00111 dcfend = dcf + szData;
00112 if (!d->dcf_cursor){
00113 d->dcf_cursor = (UNS8*)dcf + 4;
00114 d->dcf_count_targets = 0;
00115 }
00116 nb_targets = UNS32_LE(*((UNS32*)dcf));
00117 }
00118
00120 if((UNS8*)d->dcf_cursor + 7 < (UNS8*)dcfend && d->dcf_count_targets < nb_targets)
00121 {
00123 target_Index = UNS16_LE(*((UNS16*)(d->dcf_cursor))); d->dcf_cursor += 2;
00124 target_Subindex = *((UNS8*)(((UNS8*)d->dcf_cursor)++));
00125 target_Size = UNS32_LE(*((UNS32*)(d->dcf_cursor))); d->dcf_cursor += 4;
00126
00127
00128
00129 res = _writeNetworkDict(d,
00130 nodeId,
00131 target_Index,
00132 target_Subindex,
00133 target_Size,
00134 0,
00135 d->dcf_cursor,
00136 CheckSDOAndContinue,
00138 0);
00141 d->dcf_cursor += target_Size;
00142 d->dcf_count_targets++;
00143
00144 return ;
00145 }
00146 nodeId++;
00147 d->dcf_cursor = NULL;
00148 }
00150 (*d->preOperational)();
00151
00152 }