00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "objacces.h"
00024 #include "sdo.h"
00025 #include "dcf.h"
00026 #include "sysdep.h"
00027
00028
00029
00030 extern UNS8 _writeNetworkDict (CO_Data* d, UNS8 nodeId, UNS16 index,
00031 UNS8 subIndex, UNS8 count, UNS8 dataType, void *data, SDOCallback_t Callback, UNS8 endianize);
00032
00033 const indextable *ptrTable;
00034
00035 static void CheckSDOAndContinue(CO_Data* d, UNS8 nodeId)
00036 {
00037 UNS32 abortCode;
00038
00039 if(getWriteResultNetworkDict (d, nodeId, &abortCode) != SDO_FINISHED)
00040 {
00041 MSG_ERR(0x1A01, "SDO error in consise DCF", abortCode);
00042 MSG_WAR(0x2A02, "server node : ", nodeId);
00043 }
00044
00045 closeSDOtransfer(d, nodeId, SDO_CLIENT);
00046 decompo_dcf(d,nodeId);
00047 }
00048
00049 UNS32 decompo_dcf(CO_Data* d,UNS8 nodeId)
00050 {
00051 UNS32 errorCode;
00052 UNS16 target_Index;
00053 UNS8 target_Subindex;
00054 UNS32 target_Size;
00055 UNS32 res;
00056 ODCallback_t *Callback;
00057
00058 ptrTable = (*d->scanIndexOD)(0x1F22, &errorCode, &Callback);
00059 if (errorCode != OD_SUCCESSFUL)
00060 {
00061 return errorCode;
00062 }
00063
00064
00065 while (nodeId < ptrTable->bSubCount){
00066 UNS32 nb_targets;
00067
00068 UNS8 szData = ptrTable->pSubindex[nodeId].size;
00069 UNS8* dcfend;
00070
00071 {
00072 UNS8* dcf = *((UNS8**)ptrTable->pSubindex[nodeId].pObject);
00073 dcfend = dcf + szData;
00074 if (!d->dcf_cursor) {
00075 d->dcf_cursor = (UNS8*)dcf + 4;
00076 d->dcf_count_targets = 0;
00077 }
00078 nb_targets = UNS32_LE(*((UNS32*)dcf));
00079 }
00080
00081
00082 if((UNS8*)d->dcf_cursor + 7 < (UNS8*)dcfend && d->dcf_count_targets < nb_targets)
00083 {
00084
00085 target_Index = UNS16_LE(*((UNS16*)(d->dcf_cursor))); d->dcf_cursor += 2;
00086 target_Subindex = *((UNS8*)(((UNS8*)d->dcf_cursor)++));
00087 target_Size = UNS32_LE(*((UNS32*)(d->dcf_cursor))); d->dcf_cursor += 4;
00088
00089
00090 res = _writeNetworkDict(d,
00091 nodeId,
00092 target_Index,
00093 target_Subindex,
00094 target_Size,
00095 0,
00096 d->dcf_cursor,
00097 CheckSDOAndContinue,
00098 0);
00099
00100
00101 d->dcf_cursor += target_Size;
00102 d->dcf_count_targets++;
00103
00104 return ;
00105 }
00106 nodeId++;
00107 d->dcf_cursor = NULL;
00108 }
00109
00110 (*d->preOperational)();
00111
00112 }