diff --git a/TODO.tasks b/TODO.tasks deleted file mode 100644 index d1fa282..0000000 --- a/TODO.tasks +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/osal/osal.h b/osal/osal.h index 0510403..fd20817 100644 --- a/osal/osal.h +++ b/osal/osal.h @@ -42,7 +42,7 @@ typedef double float64; typedef struct { uint32 sec; /*< Seconds elapsed since the Epoch (Jan 1, 1970) */ - int32 usec; /*< Microseconds elapsed since last second boundary */ + uint32 usec; /*< Microseconds elapsed since last second boundary */ } ec_timet; typedef struct osal_timer diff --git a/test/linux/eepromtool/eepromtool.c b/test/linux/eepromtool/eepromtool.c index 19c2bbf..33696c0 100644 --- a/test/linux/eepromtool/eepromtool.c +++ b/test/linux/eepromtool/eepromtool.c @@ -17,9 +17,6 @@ #include #include #include -#include -#include -#include #include "ethercattype.h" #include "nicdrv.h" @@ -51,7 +48,7 @@ uint16 ow; int os; int slave; int alias; -struct timeval tstart,tend, tdif; +ec_timet tstart,tend, tdif; int wkc; int mode; char sline[MAXSLENGTH]; @@ -341,7 +338,7 @@ void eepromtool(char *ifname, int slave, int mode, char *fname) { if ((mode == MODE_INFO) || (mode == MODE_READBIN) || (mode == MODE_READINTEL)) { - rc = gettimeofday(&tstart, NULL); + tstart = osal_current_time(); eeprom_read(slave, 0x0000, MINBUF); // read first 128 bytes wbuf = (uint16 *)&ebuf[0]; @@ -366,12 +363,12 @@ void eepromtool(char *ifname, int slave, int mode, char *fname) if (esize > MINBUF) eeprom_read(slave, MINBUF, esize - MINBUF); // read reminder - rc = gettimeofday(&tend, NULL); - timersub(&tend, &tstart, &tdif); + tend = osal_current_time(); + osal_time_diff(&tstart, &tend, &tdif); if (mode == MODE_READINTEL) output_intelhex(fname, esize); if (mode == MODE_READBIN) output_bin(fname, esize); - printf("\nTotal EEPROM read time :%ldms\n", (tdif.tv_usec+(tdif.tv_sec*1000000L)) / 1000); + printf("\nTotal EEPROM read time :%ldms\n", (tdif.usec+(tdif.sec*1000000L)) / 1000); } if ((mode == MODE_WRITEBIN) || (mode == MODE_WRITEINTEL)) { @@ -390,12 +387,12 @@ void eepromtool(char *ifname, int slave, int mode, char *fname) printf("Busy"); fflush(stdout); - rc = gettimeofday(&tstart, NULL); + tstart = osal_current_time(); eeprom_write(slave, estart, esize); - rc = gettimeofday(&tend, NULL); - timersub(&tend, &tstart, &tdif); + tend = osal_current_time(); + osal_time_diff(&tstart, &tend, &tdif); - printf("\nTotal EEPROM write time :%ldms\n", (tdif.tv_usec+(tdif.tv_sec*1000000L)) / 1000); + printf("\nTotal EEPROM write time :%ldms\n", (tdif.usec+(tdif.sec*1000000L)) / 1000); } else printf("Error reading file, abort.\n"); diff --git a/test/linux/simple_test/simple_test.c b/test/linux/simple_test/simple_test.c index 6e8aa63..970fb88 100644 --- a/test/linux/simple_test/simple_test.c +++ b/test/linux/simple_test/simple_test.c @@ -11,9 +11,6 @@ #include #include -#include -#include -#include #include "ethercattype.h" #include "nicdrv.h" @@ -116,7 +113,7 @@ void simpletest(char *ifname) printf(" T:%lld\r",ec_DCtime); needlf = TRUE; } - usleep(5000); + osal_usleep(5000); } inOP = FALSE; @@ -225,7 +222,7 @@ OSAL_THREAD_FUNC ecatcheck( void *ptr ) if(!ec_group[currentgroup].docheckstate) printf("OK : all slaves resumed OPERATIONAL.\n"); } - usleep(10000); + osal_usleep(10000); } } diff --git a/test/linux/slaveinfo/slaveinfo.c b/test/linux/slaveinfo/slaveinfo.c index b74f00c..1eefd9b 100644 --- a/test/linux/slaveinfo/slaveinfo.c +++ b/test/linux/slaveinfo/slaveinfo.c @@ -420,12 +420,16 @@ int si_siiPDO(uint16 slave, uint8 t, int mapoffset, int bitoffset) PDO->BitSize[PDO->nPDO] += bitlen; a += 2; - str_name[0] = 0; - if(obj_name) - ec_siistring(str_name, slave, obj_name); + /* skip entry if filler (0x0000:0x00) */ + if(obj_idx || obj_subidx) + { + str_name[0] = 0; + if(obj_name) + ec_siistring(str_name, slave, obj_name); - printf(" [0x%4.4X.%1d] 0x%4.4X:0x%2.2X 0x%2.2X", abs_offset, abs_bit, obj_idx, obj_subidx, bitlen); - printf(" %-12s %s\n", dtype2string(obj_datatype), str_name); + printf(" [0x%4.4X.%1d] 0x%4.4X:0x%2.2X 0x%2.2X", abs_offset, abs_bit, obj_idx, obj_subidx, bitlen); + printf(" %-12s %s\n", dtype2string(obj_datatype), str_name); + } bitoffset += bitlen; totalsize += bitlen; } @@ -619,22 +623,34 @@ void slaveinfo(char *ifname) } } +char ifbuf[1024]; + int main(int argc, char *argv[]) { + ec_adaptert * adapter = NULL; printf("SOEM (Simple Open EtherCAT Master)\nSlaveinfo\n"); - + if (argc > 1) - { + { if ((argc > 2) && (strncmp(argv[2], "-sdo", sizeof("-sdo")) == 0)) printSDO = TRUE; if ((argc > 2) && (strncmp(argv[2], "-map", sizeof("-map")) == 0)) printMAP = TRUE; /* start slaveinfo */ - slaveinfo(argv[1]); + strcpy(ifbuf, argv[1]); + slaveinfo(ifbuf); } else { - printf("Usage: slaveinfo ifname [options]\nifname = eth0 for example\nOptions :\n -sdo : print SDO info\n -map : print mapping\n"); - } - + printf("Usage: slaveinfo ifname [options]\nifname = eth0 for example\nOptions :\n -sdo : print SDO info\n -map : print mapping\n"); + + printf ("Available adapters\n"); + adapter = ec_find_adapters (); + while (adapter != NULL) + { + printf ("Description : %s, Device to use for wpcap: %s\n", adapter->desc,adapter->name); + adapter = adapter->next; + } + } + printf("End program\n"); return (0); }