mirror of
https://github.com/OpenEtherCATsociety/SOEM.git
synced 2026-10-02 12:24:03 +08:00
Add more samples
Change-Id: I6bf219887efd88a69a257815f1974759d56fd3c3
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
add_executable(coetest coetest.c)
|
||||
target_link_libraries(coetest soem)
|
||||
install(TARGETS coetest DESTINATION bin)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,3 @@
|
||||
|
||||
set(SOURCES eepromtool.c)
|
||||
add_executable(eepromtool ${SOURCES})
|
||||
add_executable(eepromtool eepromtool.c)
|
||||
target_link_libraries(eepromtool soem)
|
||||
install(TARGETS eepromtool DESTINATION bin)
|
||||
|
||||
@@ -360,7 +360,7 @@ void eepromtool(char *ifname, int slave, int mode, char *fname)
|
||||
/* initialise SOEM, bind socket to ifname */
|
||||
if (ecx_init(&ctx, ifname))
|
||||
{
|
||||
printf("ec_init on %s succeeded.\n", ifname);
|
||||
printf("ecx_init on %s succeeded.\n", ifname);
|
||||
|
||||
w = 0x0000;
|
||||
wkc = ecx_BRD(&ctx.port[0], 0x0000, ECT_REG_TYPE, sizeof(w), &w, EC_TIMEOUTSAFE); /* detect number of slaves */
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
add_executable(eoe_test eoe_test.c)
|
||||
target_link_libraries(eoe_test soem)
|
||||
install(TARGETS eoe_test DESTINATION bin)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
add_executable(firm_update firm_update.c)
|
||||
target_link_libraries(firm_update soem)
|
||||
install(TARGETS firm_update DESTINATION bin)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
add_executable(red_test red_test.c)
|
||||
target_link_libraries(red_test soem)
|
||||
install(TARGETS red_test DESTINATION bin)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,3 @@
|
||||
set(SOURCES simple_ng.c)
|
||||
add_executable(simple_ng ${SOURCES})
|
||||
add_executable(simple_ng simple_ng.c)
|
||||
target_link_libraries(simple_ng soem)
|
||||
install(TARGETS simple_ng DESTINATION bin)
|
||||
|
||||
@@ -36,6 +36,7 @@ typedef struct
|
||||
ec_PDOdesct PDOdesc[EC_MAX_MAPT];
|
||||
ec_eepromSMt eepSM;
|
||||
ec_eepromFMMUt eepFMMU;
|
||||
ec_mbxpoolt mbxpool;
|
||||
} Fieldbus;
|
||||
|
||||
static void
|
||||
@@ -71,6 +72,7 @@ fieldbus_initialize(Fieldbus *fieldbus, char *iface)
|
||||
context->PDOdesc = fieldbus->PDOdesc;
|
||||
context->eepSM = &fieldbus->eepSM;
|
||||
context->eepFMMU = &fieldbus->eepFMMU;
|
||||
context->mbxpool = &fieldbus->mbxpool;
|
||||
context->FOEhook = NULL;
|
||||
context->EOEhook = NULL;
|
||||
context->manualstatechange = 0;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
set(SOURCES simple_test.c)
|
||||
add_executable(simple_test ${SOURCES})
|
||||
add_executable(simple_test simple_test.c)
|
||||
target_link_libraries(simple_test soem)
|
||||
install(TARGETS simple_test DESTINATION bin)
|
||||
|
||||
@@ -80,13 +80,11 @@ void simpletest(char *ifname)
|
||||
/* initialise SOEM, bind socket to ifname */
|
||||
if (ecx_init(&ctx, ifname))
|
||||
{
|
||||
printf("ec_init on %s succeeded.\n", ifname);
|
||||
printf("ecx_init on %s succeeded.\n", ifname);
|
||||
|
||||
/* find and auto-config slaves */
|
||||
if (ecx_config_init(&ctx, FALSE) > 0)
|
||||
{
|
||||
printf("%d slaves found and configured.\n", ec_slavecount);
|
||||
|
||||
if (forceByteAlignment)
|
||||
{
|
||||
ecx_config_map_group_aligned(&ctx, &IOmap, 0);
|
||||
@@ -98,7 +96,8 @@ void simpletest(char *ifname)
|
||||
|
||||
ecx_configdc(&ctx);
|
||||
|
||||
printf("Slaves mapped, state to SAFE_OP.\n");
|
||||
printf("%d slaves found and configured.\n", ec_slavecount);
|
||||
|
||||
/* wait for all slaves to reach SAFE_OP state */
|
||||
ecx_statecheck(&ctx, 0, EC_STATE_SAFE_OP, EC_TIMEOUTSTATE * 4);
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
set(SOURCES slaveinfo.c)
|
||||
add_executable(slaveinfo ${SOURCES})
|
||||
add_executable(slaveinfo slaveinfo.c)
|
||||
target_link_libraries(slaveinfo soem)
|
||||
install(TARGETS slaveinfo DESTINATION bin)
|
||||
|
||||
@@ -646,13 +646,11 @@ void slaveinfo(char *ifname)
|
||||
/* initialise SOEM, bind socket to ifname */
|
||||
if (ecx_init(&ctx, ifname))
|
||||
{
|
||||
printf("ec_init on %s succeeded.\n", ifname);
|
||||
printf("ecx_init on %s succeeded.\n", ifname);
|
||||
|
||||
/* find and auto-config slaves */
|
||||
if (ecx_config_init(&ctx, FALSE) > 0)
|
||||
{
|
||||
printf("%d slaves found and configured.\n",ec_slavecount);
|
||||
|
||||
if (forceByteAlignment)
|
||||
{
|
||||
ecx_config_map_group_aligned(&ctx, &IOmap, 0);
|
||||
@@ -779,11 +777,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
printf("Usage: slaveinfo ifname [options]\nifname = eth0 for example\nOptions :\n -sdo : print SDO info\n -map : print mapping\n");
|
||||
|
||||
printf("Available adapters\n");
|
||||
printf("\nAvailable adapters:\n");
|
||||
head = adapter = ec_find_adapters();
|
||||
while (adapter != NULL)
|
||||
{
|
||||
printf("Description : %s, Device to use for wpcap: %s\n", adapter->desc, adapter->name);
|
||||
printf(" - %s (%s)\n", adapter->name, adapter->desc);
|
||||
adapter = adapter->next;
|
||||
}
|
||||
ec_free_adapters(head);
|
||||
|
||||
Reference in New Issue
Block a user