src/pdo.c
changeset 539 187058b4a4b8
parent 524 b94067330319
child 587 c175351a6994
equal deleted inserted replaced
538:49f6d796b692 539:187058b4a4b8
    69 
    69 
    70       /* pointer fo the var which holds the mapping parameter of an mapping entry  */
    70       /* pointer fo the var which holds the mapping parameter of an mapping entry  */
    71       UNS32 *pMappingParameter =
    71       UNS32 *pMappingParameter =
    72         (UNS32 *) TPDO_map->pSubindex[prp_j + 1].pObject;
    72         (UNS32 *) TPDO_map->pSubindex[prp_j + 1].pObject;
    73       UNS16 index = (UNS16) ((*pMappingParameter) >> 16);
    73       UNS16 index = (UNS16) ((*pMappingParameter) >> 16);
    74       UNS8 Size = (UNS8) (*pMappingParameter & (UNS32) 0x000000FF);     /* Size in bits */
    74       UNS32 Size = (UNS32) (*pMappingParameter & (UNS32) 0x000000FF);     /* Size in bits */
    75 
    75 
    76       /* get variable only if Size != 0 and Size is lower than remaining bits in the PDO */
    76       /* get variable only if Size != 0 and Size is lower than remaining bits in the PDO */
    77       if (Size && ((offset + Size) <= 64))
    77       if (Size && ((offset + Size) <= 64))
    78         {
    78         {
    79           UNS8 ByteSize = 1 + ((Size - 1) >> 3);        /*1->8 => 1 ; 9->16 => 2, ... */
    79           UNS32 ByteSize = 1 + ((Size - 1) >> 3);        /*1->8 => 1 ; 9->16 => 2, ... */
    80           UNS8 subIndex =
    80           UNS8 subIndex =
    81             (UNS8) (((*pMappingParameter) >> (UNS8) 8) & (UNS32) 0x000000FF);
    81             (UNS8) (((*pMappingParameter) >> (UNS8) 8) & (UNS32) 0x000000FF);
    82 
    82 
    83           MSG_WAR (0x300F, "  got mapping parameter : ", *pMappingParameter);
    83           MSG_WAR (0x300F, "  got mapping parameter : ", *pMappingParameter);
    84           MSG_WAR (0x3050, "    at index : ", TPDO_map->index);
    84           MSG_WAR (0x3050, "    at index : ", TPDO_map->index);
   239                             numPdo)->pSubindex[0].pObject;
   239                             numPdo)->pSubindex[0].pObject;
   240                 numMap = 0;
   240                 numMap = 0;
   241                 while (numMap < *pMappingCount)
   241                 while (numMap < *pMappingCount)
   242                   {
   242                   {
   243                     UNS8 tmp[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
   243                     UNS8 tmp[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
   244                     UNS8 ByteSize;
   244                     UNS32 ByteSize;
   245                     pMappingParameter =
   245                     pMappingParameter =
   246                       (UNS32 *) (d->objdict + offsetObjdict +
   246                       (UNS32 *) (d->objdict + offsetObjdict +
   247                                  numPdo)->pSubindex[numMap + 1].pObject;
   247                                  numPdo)->pSubindex[numMap + 1].pObject;
   248                     if (pMappingParameter == NULL)
   248                     if (pMappingParameter == NULL)
   249                       {
   249                       {
   266                       {
   266                       {
   267                         /* copy bit per bit in little endian */
   267                         /* copy bit per bit in little endian */
   268                         CopyBits (Size, (UNS8 *) & m->data[offset >> 3],
   268                         CopyBits (Size, (UNS8 *) & m->data[offset >> 3],
   269                                   offset % 8, 0, ((UNS8 *) tmp), 0, 0);
   269                                   offset % 8, 0, ((UNS8 *) tmp), 0, 0);
   270                         /*1->8 => 1 ; 9->16 =>2, ... */
   270                         /*1->8 => 1 ; 9->16 =>2, ... */
   271                         ByteSize = 1 + ((Size - 1) >> 3);
   271                         ByteSize = (UNS32)(1 + ((Size - 1) >> 3));
   272 
   272 
   273                         objDict =
   273                         objDict =
   274                           setODentry (d, (UNS16) ((*pMappingParameter) >> 16),
   274                           setODentry (d, (UNS16) ((*pMappingParameter) >> 16),
   275                                       (UNS8) (((*pMappingParameter) >> 8) &
   275                                       (UNS8) (((*pMappingParameter) >> 8) &
   276                                               0xFF), tmp, &ByteSize, 0);
   276                                               0xFF), tmp, &ByteSize, 0);