115 uint16 totalsize, framedatasize;
131 SoEp->MbxHeader.address =
htoes(0x0000);
132 SoEp->MbxHeader.priority = 0x00;
138 SoEp->incomplete = 0;
142 SoEp->idn =
htoes(idn);
160 if (((aSoEp->MbxHeader.mbxtype & 0x0f) ==
ECT_MBXT_SOE) &&
162 (aSoEp->error == 0) &&
163 (aSoEp->driveNo == driveNo) &&
164 (aSoEp->elementflags == elementflags))
167 totalsize += framedatasize;
169 if (totalsize <= *psize)
172 memcpy(bp, mp, framedatasize);
178 framedatasize -= totalsize - *psize;
181 if (framedatasize > 0) memcpy(bp, mp, framedatasize);
184 if (!aSoEp->incomplete)
194 if (((aSoEp->MbxHeader.mbxtype & 0x0f) ==
ECT_MBXT_SOE) &&
237 uint16 framedatasize, maxdata;
252 SoEp->MbxHeader.address =
htoes(0x0000);
253 SoEp->MbxHeader.priority = 0x00;
264 framedatasize = psize;
266 SoEp->idn =
htoes(idn);
267 SoEp->incomplete = 0;
268 if (framedatasize > maxdata)
270 framedatasize = maxdata;
272 SoEp->incomplete = 1;
273 SoEp->fragmentsleft = psize / maxdata;
281 memcpy(mp, hp, framedatasize);
283 psize -= framedatasize;
298 if (((aSoEp->MbxHeader.mbxtype & 0x0f) ==
ECT_MBXT_SOE) &&
300 (aSoEp->error == 0) &&
301 (aSoEp->driveNo == driveNo) &&
302 (aSoEp->elementflags == elementflags))
309 if (((aSoEp->MbxHeader.mbxtype & 0x0f) ==
ECT_MBXT_SOE) &&
351 uint16 entries, itemcount;
357 psize =
sizeof(SoEmapping);
360 if ((wkc > 0) && (psize >= 4) && ((entries =
etohs(SoEmapping.currentlength) / 2) > 0) && (entries <=
EC_SOE_MAXMAPPING))
364 for (itemcount = 0 ; itemcount < entries ; itemcount++)
366 psize =
sizeof(SoEattribute);
369 if ((wkc > 0) && (!SoEattribute.list))
372 *Osize += (int)8 << SoEattribute.length;
376 psize =
sizeof(SoEmapping);
379 if ((wkc > 0) && (psize >= 4) && ((entries =
etohs(SoEmapping.currentlength) / 2) > 0) && (entries <=
EC_SOE_MAXMAPPING))
383 for (itemcount = 0 ; itemcount < entries ; itemcount++)
385 psize =
sizeof(SoEattribute);
388 if ((wkc > 0) && (!SoEattribute.list))
391 *Isize += (int)8 << SoEattribute.length;
397 if ((*Isize > 0) || (*Osize > 0))
415 int ec_readIDNmap(
uint16 slave,
int *Osize,
int *Isize)
#define EC_SOE_MAXMAPPING
int ecx_readIDNmap(ecx_contextt *context, uint16 slave, int *Osize, int *Isize)
PACKED_BEGIN struct PACKED ec_SoEattributet
void ecx_pusherror(ecx_contextt *context, const ec_errort *Ec)
void ec_clearmbx(ec_mbxbuft *Mbx)
PACKED_BEGIN struct PACKED ec_SoEt
void ecx_packeterror(ecx_contextt *context, uint16 Slave, uint16 Index, uint8 SubIdx, uint16 ErrorCode)
General typedefs and defines for EtherCAT.
#define EC_SOE_ATTRIBUTE_B
ec_timet osal_current_time(void)
int ecx_mbxempty(ecx_contextt *context, uint16 slave, int timeout)
PACKED_BEGIN struct PACKED ec_mbxheadert
Headerfile for ethercatsoe.c.
uint8 ec_nextmbxcnt(uint8 cnt)
int ecx_mbxsend(ecx_contextt *context, uint16 slave, ec_mbxbuft *mbx, int timeout)
int ecx_SoEread(ecx_contextt *context, uint16 slave, uint8 driveNo, uint8 elementflags, uint16 idn, int *psize, void *p, int timeout)
PACKED_END PACKED_BEGIN struct PACKED ec_SoEmappingt
PACKED_END void ecx_SoEerror(ecx_contextt *context, uint16 Slave, uint16 idn, uint16 Error)
Headerfile for ethercatbase.c.
Headerfile for ethercatmain.c.
int ecx_SoEwrite(ecx_contextt *context, uint16 slave, uint8 driveNo, uint8 elementflags, uint16 idn, int psize, void *p, int timeout)
int ecx_mbxreceive(ecx_contextt *context, uint16 slave, ec_mbxbuft *mbx, int timeout)
uint16 idn[EC_SOE_MAXMAPPING]
uint8 ec_mbxbuft[EC_MAXMBX+1]