Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework FoE Busy handling and enables in global test of win32 #627

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ install(FILES

if(BUILD_TESTS)
add_subdirectory(test/simple_ng)
add_subdirectory(test/linux/slaveinfo)
add_subdirectory(test/linux/eepromtool)
add_subdirectory(test/linux/simple_test)
add_subdirectory(test/win32/slaveinfo)
add_subdirectory(test/win32/eepromtool)
add_subdirectory(test/win32/simple_test)
add_subdirectory(test/win32/firm_update)
add_subdirectory(test/win32/eoe_test)
endif()
30 changes: 29 additions & 1 deletion soem/ethercatfoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,35 @@ int ecx_FOEwrite(ecx_contextt *context, uint16 slave, char *filename, uint32 pas
}
psize += segmentdata;
p = (uint8 *)p - segmentdata;
--sendpacket;
sendpacket--;
worktodo = TRUE;
dofinalzero = FALSE;
segmentdata = tsize;
psize -= segmentdata;
/* if last packet was full size, add a zero size packet as final */
/* EOF is defined as packetsize < full packetsize */
if (!psize && (segmentdata == maxdata))
{
dofinalzero = TRUE;
}
FOEp->MbxHeader.length = htoes((uint16)(0x0006 + segmentdata));
FOEp->MbxHeader.address = htoes(0x0000);
FOEp->MbxHeader.priority = 0x00;
/* get new mailbox count value */
cnt = ec_nextmbxcnt(context->slavelist[slave].mbx_cnt);
context->slavelist[slave].mbx_cnt = cnt;
FOEp->MbxHeader.mbxtype = ECT_MBXT_FOE + MBX_HDR_SET_CNT(cnt); /* FoE */
FOEp->OpCode = ECT_FOE_DATA;
sendpacket++;
FOEp->PacketNumber = htoel(sendpacket);
memcpy(&FOEp->Data[0], p, segmentdata);
p = (uint8 *)p + segmentdata;
/* send FoE data to slave */
wkc = ecx_mbxsend(context, slave, (ec_mbxbuft *)&MbxOut, EC_TIMEOUTTXM);
if (wkc <= 0)
{
worktodo = FALSE;
}
}
break;
}
Expand Down
5 changes: 5 additions & 0 deletions test/win32/eepromtool/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

set(SOURCES eepromtool.c)
add_executable(eepromtool ${SOURCES})
target_link_libraries(eepromtool soem)
install(TARGETS eepromtool DESTINATION bin)
5 changes: 5 additions & 0 deletions test/win32/eoe_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

set(SOURCES eoe_test.c)
add_executable(eoe_test ${SOURCES})
target_link_libraries(eoe_test soem)
install(TARGETS eoe_test DESTINATION bin)
Loading