etisserant@0: /* nico@208: This file is part of CanFestival, a library implementing CanOpen nico@208: Stack. nico@208: nico@208: Copyright (C): Edouard TISSERANT and Francis DUPIN nico@208: nico@208: See COPYING file for copyrights details. nico@208: nico@208: This library is free software; you can redistribute it and/or nico@208: modify it under the terms of the GNU Lesser General Public nico@208: License as published by the Free Software Foundation; either nico@208: version 2.1 of the License, or (at your option) any later version. nico@208: nico@208: This library is distributed in the hope that it will be useful, nico@208: but WITHOUT ANY WARRANTY; without even the implied warranty of nico@208: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU nico@208: Lesser General Public License for more details. nico@208: nico@208: You should have received a copy of the GNU Lesser General Public nico@208: License along with this library; if not, write to the Free Software nico@208: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 nico@208: USA etisserant@0: */ etisserant@0: #include "pdo.h" etisserant@0: #include "objacces.h" etisserant@149: #include "canfestival.h" etisserant@0: nico@208: /*! nico@208: ** @file pdo.c nico@208: ** @author Edouard TISSERANT and Francis DUPIN nico@208: ** @date Tue Jun 5 09:32:32 2007 nico@208: ** nico@208: ** @brief nico@208: ** nico@208: ** nico@208: */ etisserant@0: UNS8 sendPDO(CO_Data* d, s_PDO pdo, UNS8 req) etisserant@0: { etisserant@0: UNS8 i; etisserant@0: if( d->nodeState == Operational ) { etisserant@0: Message m; etisserant@0: nico@215: /* Message copy for sending */ nico@215: m.cob_id.w = pdo.cobId & 0x7FF; /* Because the cobId is 11 bytes nico@208: length */ etisserant@0: if ( req == NOT_A_REQUEST ) { etisserant@0: UNS8 i; etisserant@0: m.rtr = NOT_A_REQUEST; etisserant@0: m.len = pdo.len; nico@215: /* memcpy(&m.data, &pdo.data, m.len); */ nico@215: /* This Memcpy depends on packing structure. Avoid */ etisserant@0: for (i = 0 ; i < pdo.len ; i++) nico@208: m.data[i] = pdo.data[i]; etisserant@0: } etisserant@0: else { etisserant@0: m.rtr = REQUEST; etisserant@0: m.len = 0; etisserant@0: } etisserant@0: etisserant@0: MSG_WAR(0x3901, "sendPDO cobId :", m.cob_id.w); etisserant@0: MSG_WAR(0x3902, " Nb octets : ", m.len); etisserant@0: for (i = 0 ; i < m.len ; i++) { etisserant@0: MSG_WAR(0x3903," data : ", m.data[i]); etisserant@0: } nico@208: etisserant@149: return canSend(d->canHandle,&m); nico@215: } /* end if */ etisserant@0: return 0xFF; etisserant@0: } etisserant@0: nico@208: /*! nico@208: ** PDO Manager nico@208: ** nico@208: ** @param d nico@208: ** @param cobId nico@208: ** nico@208: ** @return nico@208: **/ nico@208: UNS8 PDOmGR(CO_Data* d, UNS32 cobId) etisserant@0: { etisserant@0: UNS8 res; etisserant@0: UNS8 i; etisserant@0: s_PDO pdo; etisserant@0: etisserant@0: MSG_WAR(0x3905, "PDOmGR",0); nico@208: nico@215: /* if PDO is waiting for transmission, nico@208: preparation of the message to send */ nico@208: pdo.cobId = cobId; nico@208: pdo.len = d->process_var.count; nico@215: /* memcpy(&(pdo.data), &(process_var.data), pdo.len); */ nico@208: /* Ce memcpy devrait tre portable */ etisserant@0: for ( i = 0 ; i < pdo.len ; i++) etisserant@0: pdo.data[i] = d->process_var.data[i]; etisserant@0: etisserant@0: res = sendPDO(d, pdo, NOT_A_REQUEST); etisserant@0: etisserant@0: return res; etisserant@0: } etisserant@0: greg@201: #if 0 greg@201: /*********************************************************************/ greg@201: /* TODO : implement bit mapping */ greg@201: /*********************************************************************/ greg@201: etisserant@0: UNS8 buildPDO(CO_Data* d, UNS16 index) frdupin@71: { /* DO NOT USE MSG_ERR because the macro may send a PDO -> infinite loop if it fails. */ etisserant@0: UNS16 ind; etisserant@0: UNS8 subInd; etisserant@0: frdupin@71: UNS8 * pMappingCount = NULL; /* count of mapped objects... */ frdupin@71: /* pointer to the var which is mapped to a pdo */ frdupin@71: /* void * pMappedAppObject = NULL; */ frdupin@71: /* pointer fo the var which holds the mapping parameter of an mapping entry */ nico@208: nico@208: UNS32 * pMappingParameter = NULL; etisserant@0: etisserant@0: UNS8 Size; etisserant@0: UNS8 dataType; etisserant@0: UNS8 offset; etisserant@0: UNS16 offsetObjdict; etisserant@0: UNS16 offsetObjdictPrm; etisserant@0: UNS32 objDict; etisserant@0: etisserant@0: subInd=(UNS8)0x00; etisserant@0: offset = 0x00; etisserant@0: ind = index - 0x1800; nico@208: etisserant@0: MSG_WAR(0x3910,"Prepare PDO to send index :", index); etisserant@0: nico@215: /* only operational state allows PDO transmission */ etisserant@0: if( d->nodeState != Operational ) { etisserant@0: MSG_WAR(0x2911, "Unable to send the PDO (node not in OPERATIONAL mode). Node : ", index); etisserant@0: return 0xFF; etisserant@0: } etisserant@0: offsetObjdictPrm = d->firstIndex->PDO_TRS; etisserant@0: offsetObjdict = d->firstIndex->PDO_TRS_MAP; nico@208: etisserant@0: if (offsetObjdictPrm && offsetObjdict) nico@208: { nico@215: /* get mapped objects number to transmit with this PDO */ nico@208: pMappingCount = (d->objdict + offsetObjdict + ind)->pSubindex[0].pObject; nico@208: MSG_WAR(0x3912, "Nb maped objects : ",* pMappingCount); nico@208: MSG_WAR(0x3913, " at index : ", 0x1A00 + ind); nico@215: while (subInd < *pMappingCount) { /* Loop on mapped variables */ nico@215: /* get mapping parameters */ nico@208: pMappingParameter = (d->objdict + offsetObjdict + ind)->pSubindex[subInd + 1].pObject; nico@208: MSG_WAR(0x3914, "Get the mapping at index : ", (UNS16)0x1A00 + ind); nico@208: MSG_WAR(0x3915, " subIndex : ", subInd + 1); nico@208: MSG_WAR(0x3916, " value : ", *(UNS32 *)pMappingParameter); nico@215: /* Get the mapped variable */ nico@208: Size = ((UNS8)(((*pMappingParameter) & 0xFF) >> 3)); nico@208: objDict = getODentry(d, (UNS16)((*pMappingParameter) >> 16), nico@208: (UNS8)(((*pMappingParameter) >> 8 ) & 0x000000FF), nico@208: (void *)&d->process_var.data[offset], &Size, &dataType, 0 ); nico@208: nico@208: if (objDict != OD_SUCCESSFUL) { nico@208: MSG_WAR(0x2919, "error accessing to the mapped var : ", subInd + 1); nico@208: MSG_WAR(0x2920, " Mapped at index : ", (*pMappingParameter) >> 16); nico@208: MSG_WAR(0x2921, " subindex : ", ((*pMappingParameter) >> 8 ) & 0xFF); nico@208: return 0xFF; nico@208: } nico@208: nico@208: offset += Size; nico@208: d->process_var.count = offset; nico@208: subInd++; nico@215: }/* end Loop on mapped variables */ nico@208: } etisserant@0: return 0; etisserant@0: } greg@201: #endif nico@208: nico@208: /*! nico@208: ** nico@208: ** nico@208: ** @param d nico@208: ** @param cobId nico@208: ** nico@208: ** @return nico@208: **/ etisserant@0: UNS8 sendPDOrequest( CO_Data* d, UNS32 cobId ) nico@208: { nico@208: UNS32 * pwCobId; etisserant@0: UNS16 offset; etisserant@0: UNS16 lastIndex; etisserant@0: UNS8 err; etisserant@0: nico@208: MSG_WAR(0x3930, "sendPDOrequest ",0); nico@215: /* Sending the request only if the cobid have been found on the PDO nico@208: receive */ nico@215: /* part dictionary */ etisserant@0: offset = d->firstIndex->PDO_RCV; etisserant@0: lastIndex = d->lastIndex->PDO_RCV; etisserant@0: if (offset) nico@208: while (offset <= lastIndex) { nico@215: /* get the CobId*/ nico@208: pwCobId = d->objdict[offset].pSubindex[1].pObject; nico@208: nico@208: if ( *pwCobId == cobId ) { nico@208: s_PDO pdo; nico@208: pdo.cobId = *pwCobId; nico@208: pdo.len = 0; nico@208: err = sendPDO(d, pdo, REQUEST); nico@208: return err; nico@208: } nico@208: offset++; nico@208: } nico@208: MSG_WAR(0x1931, "sendPDOrequest : COBID not found : ", cobId); etisserant@0: return 0xFF; etisserant@0: } etisserant@0: etisserant@0: nico@208: /*! nico@208: ** nico@208: ** nico@208: ** @param d nico@208: ** @param m nico@208: ** nico@208: ** @return nico@208: **/ etisserant@0: UNS8 proceedPDO(CO_Data* d, Message *m) nico@208: { etisserant@0: UNS8 numPdo; nico@215: UNS8 numMap; /* Number of the mapped varable */ etisserant@0: UNS8 i; nico@215: UNS8 * pMappingCount = NULL; /* count of mapped objects... */ nico@215: /* pointer to the var which is mapped to a pdo... */ nico@215: /* void * pMappedAppObject = NULL; */ nico@215: /* pointer fo the var which holds the mapping parameter of an nico@208: mapping entry */ nico@208: UNS32 * pMappingParameter = NULL; nico@215: UNS8 * pTransmissionType = NULL; /* pointer to the transmission nico@208: type */ etisserant@0: UNS32 * pwCobId = NULL; etisserant@0: UNS8 Size; etisserant@0: UNS8 dataType; etisserant@0: UNS8 offset; etisserant@0: UNS8 status; etisserant@0: UNS32 objDict; etisserant@0: UNS16 offsetObjdict; etisserant@0: UNS16 lastIndex; etisserant@0: status = state1; nico@208: nico@208: MSG_WAR(0x3935, "proceedPDO, cobID : ", ((*m).cob_id.w & 0x7ff)); etisserant@0: offset = 0x00; etisserant@0: numPdo = 0; etisserant@0: numMap = 0; nico@215: if((*m).rtr == NOT_A_REQUEST ) { /* The PDO received is not a nico@208: request. */ etisserant@0: offsetObjdict = d->firstIndex->PDO_RCV; etisserant@0: lastIndex = d->lastIndex->PDO_RCV; nico@208: nico@215: /* study of all the PDO stored in the dictionary */ etisserant@0: if(offsetObjdict) nico@208: while (offsetObjdict <= lastIndex) { nico@208: nico@208: switch( status ) { nico@208: nico@215: case state1:/* data are stored in process_var array */ nico@215: /* memcpy(&(process_var.data), &m->data, (*m).len); */ nico@215: /* Ce memcpy devrait etre portable */ nico@208: for ( i = 0 ; i < m->len ; i++) nico@208: d->process_var.data[i] = m->data[i]; nico@208: d->process_var.count = (*m).len; nico@208: nico@208: status = state2; nico@208: break; nico@208: nico@208: case state2: nico@215: /* get CobId of the dictionary correspondant to the received nico@208: PDO */ nico@208: pwCobId = d->objdict[offsetObjdict].pSubindex[1].pObject; nico@215: /* check the CobId coherance */ nico@215: /*pwCobId is the cobId read in the dictionary at the state 3 nico@208: */ nico@208: if ( *pwCobId == (*m).cob_id.w ){ nico@215: /* The cobId is recognized */ nico@208: status = state4; nico@208: MSG_WAR(0x3936, "cobId found at index ", 0x1400 + numPdo); nico@208: break; nico@208: } nico@208: else { nico@215: /* cobId received does not match with those write in the nico@208: dictionnary */ nico@208: numPdo++; nico@208: offsetObjdict++; nico@208: status = state2; nico@208: break; nico@208: } nico@208: nico@215: case state4:/* Get Mapped Objects Number */ nico@215: /* The cobId of the message received has been found in the nico@208: dictionnary. */ nico@208: offsetObjdict = d->firstIndex->PDO_RCV_MAP; nico@208: lastIndex = d->lastIndex->PDO_RCV_MAP; nico@208: pMappingCount = (d->objdict + offsetObjdict + numPdo)->pSubindex[0].pObject; nico@208: numMap = 0; nico@208: while (numMap < *pMappingCount) { nico@208: UNS8 tmp[]= {0,0,0,0,0,0,0,0}; nico@208: UNS8 ByteSize; nico@208: pMappingParameter = (d->objdict + offsetObjdict + numPdo)->pSubindex[numMap + 1].pObject; nico@208: if (pMappingParameter == NULL) { nico@208: MSG_ERR(0x1937, "Couldn't get mapping parameter : ", numMap + 1); nico@208: return 0xFF; nico@208: } nico@215: /* Get the addresse of the mapped variable. */ nico@215: /* detail of *pMappingParameter : */ nico@215: /* The 16 hight bits contains the index, the medium 8 bits nico@208: contains the subindex, */ nico@215: /* and the lower 8 bits contains the size of the mapped nico@208: variable. */ nico@208: nico@208: Size = (UNS8)(*pMappingParameter); nico@208: nico@215: /* copy bit per bit in little endian */ nico@208: CopyBits(Size, (UNS8*)&d->process_var.data[offset>>3], offset%8, 0, ((UNS8*)tmp), 0, 0); nico@208: nico@208: ByteSize = 1 + ((Size - 1) >> 3); /*1->8 => 1 ; 9->16 => nico@208: 2, ... */ nico@208: nico@208: objDict = setODentry(d, (UNS16)((*pMappingParameter) >> 16), nico@208: (UNS8)(((*pMappingParameter) >> 8 ) & 0xFF), nico@208: tmp, &ByteSize, 0 ); nico@208: nico@208: if(objDict != OD_SUCCESSFUL) { nico@208: MSG_ERR(0x1938, "error accessing to the mapped var : ", numMap + 1); nico@208: MSG_WAR(0x2939, " Mapped at index : ", (*pMappingParameter) >> 16); nico@208: MSG_WAR(0x2940, " subindex : ", ((*pMappingParameter) >> 8 ) & 0xFF); nico@208: return 0xFF; nico@208: } nico@208: nico@208: MSG_WAR(0x3942, "Variable updated with value received by PDO cobid : ", m->cob_id.w); nico@208: MSG_WAR(0x3943, " Mapped at index : ", (*pMappingParameter) >> 16); nico@208: MSG_WAR(0x3944, " subindex : ", ((*pMappingParameter) >> 8 ) & 0xFF); nico@215: /* MSG_WAR(0x3945, " data : ",*((UNS32*)pMappedAppObject)); */ nico@208: offset += Size; nico@208: numMap++; nico@215: } /* end loop while on mapped variables */ nico@208: nico@208: offset=0x00; nico@208: numMap = 0; nico@208: return 0; nico@208: nico@215: }/* end switch status*/ nico@215: }/* end while*/ nico@215: }/* end if Donnees */ nico@208: else if ((*m).rtr == REQUEST ){ nico@208: MSG_WAR(0x3946, "Receive a PDO request cobId : ", m->cob_id.w); nico@208: status = state1; nico@208: offsetObjdict = d->firstIndex->PDO_TRS; nico@208: lastIndex = d->lastIndex->PDO_TRS; nico@208: if(offsetObjdict) while( offsetObjdict <= lastIndex ){ nico@215: /* study of all PDO stored in the objects dictionary */ nico@208: nico@208: switch( status ){ nico@208: nico@215: case state1:/* check the CobId */ nico@215: /* get CobId of the dictionary which match to the received PDO nico@208: */ nico@208: pwCobId = (d->objdict + offsetObjdict)->pSubindex[1].pObject; nico@208: if ( *pwCobId == (*m).cob_id.w ) { nico@208: status = state4; nico@208: break; nico@208: } nico@208: else { nico@208: numPdo++; nico@208: offsetObjdict++; nico@208: } nico@208: status = state1; nico@208: break; nico@208: nico@208: nico@215: case state4:/* check transmission type (after request?) */ nico@208: pTransmissionType = d->objdict[offsetObjdict].pSubindex[2].pObject; nico@208: if ( (*pTransmissionType == TRANS_RTR) || (*pTransmissionType == TRANS_RTR_SYNC ) || (*pTransmissionType == TRANS_EVENT) ) { nico@208: status = state5; nico@208: break; nico@208: } nico@208: else { nico@215: /* The requested PDO is not to send on request. So, does nico@208: nothing. */ nico@208: MSG_WAR(0x2947, "PDO is not to send on request : ", m->cob_id.w); nico@208: return 0xFF; nico@208: } nico@208: nico@215: case state5:/* get mapped objects number */ nico@208: offsetObjdict = d->firstIndex->PDO_TRS_MAP; nico@208: lastIndex = d->lastIndex->PDO_TRS_MAP; nico@208: pMappingCount = (d->objdict + offsetObjdict + numPdo)->pSubindex[0].pObject; nico@208: numMap = 0; nico@208: while (numMap < *pMappingCount) { nico@208: pMappingParameter = (d->objdict + offsetObjdict + numPdo)->pSubindex[numMap + 1].pObject; nico@215: /* Get the mapped variable */ nico@208: Size = ((UNS8)(((*pMappingParameter) & 0xFF) >> 3)); nico@208: objDict = getODentry( d, (UNS16)((*pMappingParameter) >> (UNS8)16), nico@208: (UNS8)(( (*pMappingParameter) >> (UNS8)8 ) & 0xFF), nico@208: (void *)&d->process_var.data[offset], &Size, &dataType, 0 ); nico@208: if (objDict != OD_SUCCESSFUL) { nico@208: MSG_ERR(0x1948, "error accessing to the mapped var : ", numMap + 1); nico@208: MSG_WAR(0x2949, " Mapped at index : ", (*pMappingParameter) >> 16); nico@208: MSG_WAR(0x2950, " subindex : ", ((*pMappingParameter) >> 8 ) & 0xFF); nico@208: return 0xFF; nico@208: } nico@208: offset += (UNS8) (((*pMappingParameter) & 0xFF) >> 3); nico@208: d->process_var.count = offset; nico@208: numMap++; nico@208: nico@215: } /* end while */ nico@215: PDOmGR( d, *pwCobId ); /* Transmit the PDO */ nico@208: return 0; nico@208: nico@215: }/* end switch status */ nico@215: }/* end while */ nico@215: }/* end if Requete */ nico@208: etisserant@0: return 0; etisserant@0: } etisserant@0: nico@208: /*! nico@208: ** nico@208: ** nico@208: ** @param NbBits nico@208: ** @param SrcByteIndex nico@208: ** @param SrcBitIndex nico@208: ** @param SrcBigEndian nico@208: ** @param DestByteIndex nico@208: ** @param DestBitIndex nico@208: ** @param DestBigEndian nico@208: **/ greg@201: void CopyBits(UNS8 NbBits, UNS8* SrcByteIndex, UNS8 SrcBitIndex, UNS8 SrcBigEndian, UNS8* DestByteIndex, UNS8 DestBitIndex, UNS8 DestBigEndian) greg@201: { nico@215: /* This loop copy as many bits that it can each time, crossing*/ nico@215: /* successively bytes*/ nico@208: // boundaries from LSB to MSB. nico@208: while(NbBits > 0) nico@208: { nico@215: /* Bit missalignement between src and dest*/ nico@208: INTEGER8 Vect = DestBitIndex - SrcBitIndex; nico@208: nico@215: /* We can now get src and align it to dest*/ nico@208: UNS8 Aligned = Vect>0 ? *SrcByteIndex << Vect : *SrcByteIndex >> -Vect; nico@208: nico@215: /* Compute the nb of bit we will be able to copy*/ nico@208: UNS8 BoudaryLimit = (Vect>0 ? 8 - DestBitIndex : 8 - SrcBitIndex ); nico@208: UNS8 BitsToCopy = BoudaryLimit > NbBits ? NbBits : BoudaryLimit; nico@208: nico@215: /* Create a mask that will serve in:*/ nico@208: UNS8 Mask = ((0xff << (DestBitIndex + BitsToCopy)) | (0xff >> (8 - DestBitIndex))); nico@208: nico@215: /* - Filtering src*/ nico@208: UNS8 Filtered = Aligned & ~Mask; nico@208: nico@215: /* - and erase bits where we write, preserve where we don't*/ nico@208: *DestByteIndex &= Mask; nico@208: nico@215: /* Then write.*/ nico@208: *DestByteIndex |= Filtered ; nico@208: nico@215: /*Compute next time cursors for src*/ nico@215: if((SrcBitIndex += BitsToCopy)>7)/* cross boundary ?*/ nico@208: { nico@215: SrcBitIndex = 0;/* First bit*/ nico@215: SrcByteIndex += (SrcBigEndian ? -1 : 1);/* Next byte*/ nico@215: } nico@215: nico@215: nico@215: /*Compute next time cursors for dest*/ nico@208: if((DestBitIndex += BitsToCopy)>7) nico@208: { nico@215: DestBitIndex = 0;/* First bit*/ nico@215: DestByteIndex += (DestBigEndian ? -1 : 1);/* Next byte*/ nico@215: } nico@215: nico@215: /*And decrement counter.*/ nico@208: NbBits -= BitsToCopy; nico@208: } greg@201: greg@201: } etisserant@0: frdupin@71: #if 0 frdupin@71: etisserant@0: /*********************************************************************/ nico@208: /* TODO : reimplement this using CallBacks nico@208: */ etisserant@0: /*********************************************************************/ frdupin@71: nico@208: /*! nico@208: ** nico@208: ** nico@208: ** @param d nico@208: ** @param variable nico@208: ** nico@208: ** @return nico@208: **/ etisserant@0: UNS8 sendPDOevent( CO_Data* d, void * variable ) nico@215: { /* DO NOT USE MSG_ERR because the macro may send a PDO -> infinite nico@208: loop if it fails.*/ etisserant@0: UNS32 objDict = 0; etisserant@0: UNS8 ind, sub_ind; nico@208: UNS8 status; etisserant@0: UNS8 offset; etisserant@0: UNS8 * pMappingCount = NULL; etisserant@0: UNS32 * pMappingParameter = NULL; etisserant@0: void * pMappedAppObject = NULL; nico@215: UNS8 * pTransmissionType = NULL; /* pointer to the transmission nico@208: type */ etisserant@0: UNS32 * pwCobId = NULL; etisserant@0: UNS8 * pSize; etisserant@0: UNS8 size; etisserant@0: UNS8 dataType; etisserant@0: UNS16 offsetObjdict; etisserant@0: UNS16 offsetObjdictPrm; etisserant@0: UNS16 lastIndex; etisserant@0: UNS8 numMap; etisserant@0: ind = 0x00; nico@208: sub_ind = 1; etisserant@0: offset = 0x00; etisserant@0: pSize = &size; etisserant@0: status = state1; etisserant@0: nico@208: nico@215: /* look for the index and subindex where the variable is mapped */ nico@215: /* Then, send the pdo which contains the variable. */ etisserant@0: etisserant@0: MSG_WAR (0x3960, "sendPDOevent", 0); etisserant@0: offsetObjdictPrm = d->firstIndex->PDO_TRS; nico@208: etisserant@0: offsetObjdict = d->firstIndex->PDO_TRS_MAP; etisserant@0: lastIndex = d->lastIndex->PDO_TRS_MAP; etisserant@0: nico@208: if (offsetObjdictPrm && offsetObjdict) nico@215: /* Loop on PDO Transmit */ nico@208: while(offsetObjdict <= lastIndex){ nico@215: /* Check the transmission mode */ nico@208: pTransmissionType = d->objdict[offsetObjdictPrm].pSubindex[2].pObject; nico@208: if (*pTransmissionType != TRANS_EVENT) { nico@208: ind++; nico@208: offsetObjdict++; nico@208: offsetObjdictPrm++; nico@208: continue; nico@208: } nico@208: pMappingCount = d->objdict[offsetObjdict].pSubindex[0].pObject; nico@215: numMap = 1; /* mapped variable */ nico@208: while (numMap <= *pMappingCount) { nico@208: pMappingParameter = d->objdict[offsetObjdict].pSubindex[numMap].pObject; nico@215: /* Get the variable */ nico@208: objDict = getODentry( d, nico@208: (UNS16)((*pMappingParameter) >> 16), nico@208: (UNS8)(( (*pMappingParameter) >> (UNS8)8 ) & (UNS32)0x000000FF), nico@208: (void * *)&pMappedAppObject, pSize, &dataType, 0 ); nico@208: if( objDict != OD_SUCCESSFUL ) { nico@208: MSG_WAR(0x2961, "Error in dict. at index : ", nico@208: (*pMappingParameter) >> (UNS8)16); nico@208: nico@208: MSG_WAR(0x2962, " subindex : ", nico@208: ((*pMappingParameter) >> (UNS8)8 ) & (UNS32)0x000000FF); nico@208: return 0xFF; nico@208: } nico@208: if (pMappedAppObject == variable) { // Variable found ! nico@208: MSG_WAR(0x3963, "Variable to send found at index : ", nico@208: (*pMappingParameter) >> 16); nico@208: MSG_WAR(0x3964, " subIndex : ", nico@208: ((*pMappingParameter) >> 8 ) & 0x000000FF); nico@208: buildPDO(d, 0x1800 + ind); nico@215: /* Get the cobId */ nico@208: pwCobId = d->objdict[offsetObjdictPrm].pSubindex[1].pObject; nico@215: PDOmGR( d, *pwCobId ); /* Send the PDO */ nico@208: return 0; nico@208: } nico@208: numMap++; nico@215: } /* End loop on mapped variable */ nico@208: ind++; nico@208: offsetObjdict++; nico@208: offsetObjdictPrm++; nico@215: } /* End loop while on PDO */ etisserant@0: etisserant@0: MSG_WAR(0x2965, "Variable not found in a PDO to send on event", 0); etisserant@0: return 0xFF; etisserant@0: etisserant@0: } frdupin@71: #endif nico@208: nico@208: nico@208: