src/dcf.c
changeset 200 930be51ddc24
parent 191 1e6e3d261b8f
child 202 9cfd9211616c
equal deleted inserted replaced
199:48b59c852636 200:930be51ddc24
    21 */
    21 */
    22 
    22 
    23 #include "objacces.h"
    23 #include "objacces.h"
    24 #include "sdo.h"
    24 #include "sdo.h"
    25 #include "dcf.h"
    25 #include "dcf.h"
       
    26 #include "sysdep.h"
    26 
    27 
    27 const indextable *ptrTable;
    28 const indextable *ptrTable;
    28 
    29 
    29 static void CheckSDOAndContinue(CO_Data* d, UNS8 nodeId)
    30 static void CheckSDOAndContinue(CO_Data* d, UNS8 nodeId)
    30 {
    31 {
    67 		  		dcfend = dcf + szData;
    68 		  		dcfend = dcf + szData;
    68 				if (!d->dcf_cursor)	{
    69 				if (!d->dcf_cursor)	{
    69 					d->dcf_cursor = dcf + 4;
    70 					d->dcf_cursor = dcf + 4;
    70 					d->dcf_count_targets = 0;
    71 					d->dcf_count_targets = 0;
    71 				}
    72 				}
    72 	#ifdef CANOPEN_BIG_ENDIAN
    73 				nb_targets = UNS32_LE(*((UNS32*)dcf));
    73 				nb_targets = ((UNS8*)d->dcf++) | ((UNS8*)d->dcf++) << 8 | ((UNS8*)d->dcf++) << 16 | ((UNS8*)d->dcf++) << 24;
       
    74 	#else
       
    75 				nb_targets = *((UNS32*)dcf);
       
    76 	#endif
       
    77 		  	}
    74 		  	}
    78 			
    75 			
    79 			// condition on consise DCF string for NodeID, if big enough
    76 			// condition on consise DCF string for NodeID, if big enough
    80 			if(d->dcf_cursor + 7 < dcfend && d->dcf_count_targets < nb_targets)
    77 			if(d->dcf_cursor + 7 < dcfend && d->dcf_count_targets < nb_targets)
    81 			{
    78 			{
    82 				// pointer to the DCF string for NodeID
    79 				// pointer to the DCF string for NodeID
    83 	#ifdef CANOPEN_BIG_ENDIAN
    80 				target_Index = UNS16_LE(*((UNS16*)(d->dcf_cursor))); d->dcf_cursor += 2;
    84 				target_Index = ((UNS8*)d->dcf_cursor++) | ((UNS8*)d->dcf_cursor++) << 8;
       
    85 				target_Subindex = ((UNS8*)d->dcf_cursor++);
       
    86 				target_Size = ((UNS8*)d->dcf_cursor++) | ((UNS8*)d->dcf_cursor++) << 8 | ((UNS8*)d->dcf_cursor++) << 16 | ((UNS8*)d->dcf_cursor++) << 24;
       
    87 	#else
       
    88 				target_Index = *((UNS16*)(d->dcf_cursor)); d->dcf_cursor += 2;
       
    89 				target_Subindex = *((UNS8*)(d->dcf_cursor++));
    81 				target_Subindex = *((UNS8*)(d->dcf_cursor++));
    90 				target_Size = *((UNS32*)(d->dcf_cursor)); d->dcf_cursor += 4;
    82 				target_Size = UNS32_LE(*((UNS32*)(d->dcf_cursor))); d->dcf_cursor += 4;
    91 	#endif
       
    92 				
    83 				
    93 					/*printf("Master : ConfigureSlaveNode %2.2x (Concise DCF)\n",nodeId);*/
    84 					/*printf("Master : ConfigureSlaveNode %2.2x (Concise DCF)\n",nodeId);*/
    94 					res = writeNetworkDictCallBack(d, /*CO_Data* d*/
    85 					res = writeNetworkDictCallBack(d, /*CO_Data* d*/
    95 							nodeId, /*UNS8 nodeId*/
    86 							nodeId, /*UNS8 nodeId*/
    96 							target_Index, /*UNS16 index*/
    87 							target_Index, /*UNS16 index*/