src/pdo.c
changeset 380 fe47568b8281
parent 379 193558036df4
child 425 4bc4706528ae
equal deleted inserted replaced
379:193558036df4 380:fe47568b8281
    66 		UNS8 tmp[]= {0,0,0,0,0,0,0,0}; /* temporary space to hold bits */
    66 		UNS8 tmp[]= {0,0,0,0,0,0,0,0}; /* temporary space to hold bits */
    67 
    67 
    68 		/* pointer fo the var which holds the mapping parameter of an mapping entry  */
    68 		/* pointer fo the var which holds the mapping parameter of an mapping entry  */
    69 		UNS32* pMappingParameter = (UNS32*) TPDO_map->pSubindex[prp_j + 1].pObject;
    69 		UNS32* pMappingParameter = (UNS32*) TPDO_map->pSubindex[prp_j + 1].pObject;
    70 		UNS16 index = (UNS16)((*pMappingParameter) >> 16);
    70 		UNS16 index = (UNS16)((*pMappingParameter) >> 16);
    71 		UNS8 Size = (UNS8)(*pMappingParameter) & (UNS32)0x000000FF); /* Size in bits */
    71 		UNS8 Size = (UNS8)(*pMappingParameter & (UNS32)0x000000FF); /* Size in bits */
    72 		
    72 		
    73 		/* get variable only if Size != 0 and Size is lower than remaining bits in the PDO */
    73 		/* get variable only if Size != 0 and Size is lower than remaining bits in the PDO */
    74 		if(Size && ((offset + Size) <= 64)) {
    74 		if(Size && ((offset + Size) <= 64)) {
    75 			UNS8 ByteSize = 1 + ((Size - 1) >> 3); /*1->8 => 1 ; 9->16 => 2, ... */
    75 			UNS8 ByteSize = 1 + ((Size - 1) >> 3); /*1->8 => 1 ; 9->16 => 2, ... */
    76 			UNS8 subIndex = (UNS8)(( (*pMappingParameter) >> (UNS8)8 ) & (UNS32)0x000000FF);
    76 			UNS8 subIndex = (UNS8)(( (*pMappingParameter) >> (UNS8)8 ) & (UNS32)0x000000FF);
   227                /* The 16 hight bits contains the index, the medium 8 bits
   227                /* The 16 hight bits contains the index, the medium 8 bits
   228                  contains the subindex, */
   228                  contains the subindex, */
   229                /* and the lower 8 bits contains the size of the mapped
   229                /* and the lower 8 bits contains the size of the mapped
   230                  variable. */
   230                  variable. */
   231 
   231 
   232                Size = (UNS8)(*pMappingParameter) & (UNS32)0x000000FF);
   232                Size = (UNS8)(*pMappingParameter & (UNS32)0x000000FF);
   233 					
   233 					
   234 					/* set variable only if Size != 0 and Size is lower than remaining bits in the PDO */
   234 					/* set variable only if Size != 0 and Size is lower than remaining bits in the PDO */
   235                if(Size && ((offset + Size) <= (m->len << 3))) {
   235                if(Size && ((offset + Size) <= (m->len << 3))) {
   236                  /* copy bit per bit in little endian */
   236                  /* copy bit per bit in little endian */
   237                  CopyBits(Size, (UNS8*)&m->data[offset>>3], offset%8, 0, ((UNS8*)tmp), 0, 0);
   237                  CopyBits(Size, (UNS8*)&m->data[offset>>3], offset%8, 0, ((UNS8*)tmp), 0, 0);