103 UNS32 * pMappingParameter = NULL; |
103 UNS32 * pMappingParameter = NULL; |
104 /* pointer to the transmissiontype...*/ |
104 /* pointer to the transmissiontype...*/ |
105 UNS8 * pTransmissionType = NULL; |
105 UNS8 * pTransmissionType = NULL; |
106 UNS32 * pwCobId = NULL; |
106 UNS32 * pwCobId = NULL; |
107 |
107 |
108 UNS8 dataType; |
108 UNS8 dataType; |
109 UNS16 index; |
109 UNS16 index; |
110 UNS8 subIndex; |
110 UNS8 subIndex; |
111 UNS8 offset; |
111 UNS8 offset; |
112 UNS8 status; |
112 UNS8 status; |
113 UNS8 sizeData; |
113 UNS8 Size; |
114 UNS32 objDict; |
114 UNS32 objDict; |
115 UNS16 offsetObjdict; |
115 UNS16 offsetObjdict; |
116 UNS16 offsetObjdictMap; |
116 UNS16 offsetObjdictMap; |
117 UNS16 lastIndex; |
117 UNS16 lastIndex; |
118 |
118 |
119 status = state3; |
119 status = state3; |
183 status = state9; |
183 status = state9; |
184 |
184 |
185 case state9: /* get data to transmit */ |
185 case state9: /* get data to transmit */ |
186 index = (UNS16)((*pMappingParameter) >> 16); |
186 index = (UNS16)((*pMappingParameter) >> 16); |
187 subIndex = (UNS8)(( (*pMappingParameter) >> (UNS8)8 ) & (UNS32)0x000000FF); |
187 subIndex = (UNS8)(( (*pMappingParameter) >> (UNS8)8 ) & (UNS32)0x000000FF); |
188 /* <<3 because in *pMappingParameter the size is in bits */ |
188 UNS8 ByteSize; |
189 sizeData = (UNS8) ((*pMappingParameter & (UNS32)0x000000FF) >> 3) ; |
189 UNS8 tmp[]= {0,0,0,0,0,0,0,0}; |
190 |
190 Size = (UNS8)(*pMappingParameter); /* Size in bits */ |
191 objDict = getODentry(d, index, subIndex, (void *)&d->process_var.data[offset], &sizeData, &dataType, 0 ); |
191 ByteSize = 1 + ((Size - 1) >> 3); /*1->8 => 1 ; 9->16 => 2, ... */ |
192 |
192 objDict = getODentry(d, index, subIndex, tmp, &ByteSize, &dataType, 0 ); |
|
193 /* copy bit per bit in little endian*/ |
|
194 CopyBits(Size, ((UNS8*)tmp), 0 , 0, (UNS8*)&d->process_var.data[offset>>3], offset%8, 0); |
|
195 |
193 if( objDict != OD_SUCCESSFUL ){ |
196 if( objDict != OD_SUCCESSFUL ){ |
194 MSG_ERR(0x1013, " Couldn't find mapped variable at index-subindex-size : ", (UNS16)(*pMappingParameter)); |
197 MSG_ERR(0x1013, " Couldn't find mapped variable at index-subindex-size : ", (UNS16)(*pMappingParameter)); |
195 return 0xFF; |
198 return 0xFF; |
196 } |
199 } |
197 |
200 |
198 offset += sizeData ; |
201 offset += Size ; |
199 d->process_var.count = offset; |
202 d->process_var.count = 1 + ((offset - 1) >> 3); |
200 prp_j++; |
203 prp_j++; |
201 status = state10; |
204 status = state10; |
202 break; |
205 break; |
203 |
206 |
204 case state10: /* loop to get all the data to transmit */ |
207 case state10: /* loop to get all the data to transmit */ |