20 #define EC_SOE_MAX_DRIVES 8 51 memset(&Ec, 0,
sizeof(Ec));
81 uint16 totalsize, framedatasize;
97 SoEp->MbxHeader.address =
htoes(0x0000);
98 SoEp->MbxHeader.priority = 0x00;
104 SoEp->incomplete = 0;
108 SoEp->idn =
htoes(idn);
126 if (((aSoEp->MbxHeader.mbxtype & 0x0f) ==
ECT_MBXT_SOE) &&
128 (aSoEp->error == 0) &&
129 (aSoEp->driveNo == driveNo) &&
130 (aSoEp->elementflags == elementflags))
133 totalsize += framedatasize;
135 if (totalsize <= *psize)
138 memcpy(bp, mp, framedatasize);
144 framedatasize -= totalsize - *psize;
147 if (framedatasize > 0) memcpy(bp, mp, framedatasize);
150 if (!aSoEp->incomplete)
160 if (((aSoEp->MbxHeader.mbxtype & 0x0f) ==
ECT_MBXT_SOE) &&
203 uint16 framedatasize, maxdata;
218 SoEp->MbxHeader.address =
htoes(0x0000);
219 SoEp->MbxHeader.priority = 0x00;
230 framedatasize = psize;
232 SoEp->idn =
htoes(idn);
233 SoEp->incomplete = 0;
234 if (framedatasize > maxdata)
236 framedatasize = maxdata;
238 SoEp->incomplete = 1;
239 SoEp->fragmentsleft = psize / maxdata;
247 memcpy(mp, hp, framedatasize);
249 psize -= framedatasize;
264 if (((aSoEp->MbxHeader.mbxtype & 0x0f) ==
ECT_MBXT_SOE) &&
266 (aSoEp->error == 0) &&
267 (aSoEp->driveNo == driveNo) &&
268 (aSoEp->elementflags == elementflags))
275 if (((aSoEp->MbxHeader.mbxtype & 0x0f) ==
ECT_MBXT_SOE) &&
318 uint16 entries, itemcount;
326 psize =
sizeof(SoEmapping);
329 if ((wkc > 0) && (psize >= 4) && ((entries =
etohs(SoEmapping.currentlength) / 2) > 0) && (entries <=
EC_SOE_MAXMAPPING))
333 for (itemcount = 0 ; itemcount < entries ; itemcount++)
335 psize =
sizeof(SoEattribute);
338 if ((wkc > 0) && (!SoEattribute.list))
341 *Osize += (int)8 << SoEattribute.length;
345 psize =
sizeof(SoEmapping);
348 if ((wkc > 0) && (psize >= 4) && ((entries =
etohs(SoEmapping.currentlength) / 2) > 0) && (entries <=
EC_SOE_MAXMAPPING))
352 for (itemcount = 0 ; itemcount < entries ; itemcount++)
354 psize =
sizeof(SoEattribute);
357 if ((wkc > 0) && (!SoEattribute.list))
360 *Isize += (int)8 << SoEattribute.length;
367 if ((*Isize > 0) || (*Osize > 0))
int ecx_mbxempty(ecx_contextt *context, uint16 slave, int timeout)
#define EC_SOE_MAXMAPPING
int ecx_readIDNmap(ecx_contextt *context, uint16 slave, int *Osize, int *Isize)
void ecx_pusherror(ecx_contextt *context, const ec_errort *Ec)
PACKED_BEGIN struct PACKED ec_SoEattributet
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.
void ec_clearmbx(ec_mbxbuft *Mbx)
#define EC_SOE_ATTRIBUTE_B
int ecx_mbxsend(ecx_contextt *context, uint16 slave, ec_mbxbuft *mbx, int timeout)
int ec_SoEwrite(uint16 slave, uint8 driveNo, uint8 elementflags, uint16 idn, int psize, void *p, int timeout)
int ec_SoEread(uint16 slave, uint8 driveNo, uint8 elementflags, uint16 idn, int *psize, void *p, int timeout)
ec_timet osal_current_time(void)
int ecx_mbxreceive(ecx_contextt *context, uint16 slave, ec_mbxbuft *mbx, int timeout)
Headerfile for ethercatsoe.c.
int ec_readIDNmap(uint16 slave, int *Osize, int *Isize)
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.
PACKED_BEGIN struct PACKED ec_mbxheader ec_mbxheadert
Headerfile for ethercatmain.c.
int ecx_SoEwrite(ecx_contextt *context, uint16 slave, uint8 driveNo, uint8 elementflags, uint16 idn, int psize, void *p, int timeout)
#define EC_SOE_MAX_DRIVES
uint8 ec_mbxbuft[EC_MAXMBX+1]
uint8 ec_nextmbxcnt(uint8 cnt)