Fix red_test build with gcc 9

This commit is contained in:
Alex Kalmuk 2021-04-02 23:11:36 +03:00
parent b5f58d2130
commit 61ef8e3198
1 changed files with 7 additions and 3 deletions

View File

@ -20,6 +20,7 @@
#include <time.h> #include <time.h>
#include <pthread.h> #include <pthread.h>
#include <math.h> #include <math.h>
#include <inttypes.h>
#include "ethercat.h" #include "ethercat.h"
@ -52,6 +53,7 @@ void redtest(char *ifname, char *ifname2)
printf("Starting Redundant test\n"); printf("Starting Redundant test\n");
/* initialise SOEM, bind socket to ifname */ /* initialise SOEM, bind socket to ifname */
(void) ifname2;
// if (ec_init_redundant(ifname, ifname2)) // if (ec_init_redundant(ifname, ifname2))
if (ec_init(ifname)) if (ec_init(ifname))
{ {
@ -73,8 +75,8 @@ void redtest(char *ifname, char *ifname2)
printf("Slave:%d Name:%s Output size:%3dbits Input size:%3dbits State:%2d delay:%d.%d\n", printf("Slave:%d Name:%s Output size:%3dbits Input size:%3dbits State:%2d delay:%d.%d\n",
cnt, ec_slave[cnt].name, ec_slave[cnt].Obits, ec_slave[cnt].Ibits, cnt, ec_slave[cnt].name, ec_slave[cnt].Obits, ec_slave[cnt].Ibits,
ec_slave[cnt].state, (int)ec_slave[cnt].pdelay, ec_slave[cnt].hasdc); ec_slave[cnt].state, (int)ec_slave[cnt].pdelay, ec_slave[cnt].hasdc);
printf(" Out:%8.8x,%4d In:%8.8x,%4d\n", printf(" Out:%p,%4d In:%p,%4d\n",
(int)ec_slave[cnt].outputs, ec_slave[cnt].Obytes, (int)ec_slave[cnt].inputs, ec_slave[cnt].Ibytes); ec_slave[cnt].outputs, ec_slave[cnt].Obytes, ec_slave[cnt].inputs, ec_slave[cnt].Ibytes);
/* check for EL2004 or EL2008 */ /* check for EL2004 or EL2008 */
if( !digout && ((ec_slave[cnt].eep_id == 0x0af83052) || (ec_slave[cnt].eep_id == 0x07d83052))) if( !digout && ((ec_slave[cnt].eep_id == 0x0af83052) || (ec_slave[cnt].eep_id == 0x07d83052)))
{ {
@ -105,7 +107,7 @@ void redtest(char *ifname, char *ifname2)
/* acyclic loop 5000 x 20ms = 10s */ /* acyclic loop 5000 x 20ms = 10s */
for(i = 1; i <= 5000; i++) for(i = 1; i <= 5000; i++)
{ {
printf("Processdata cycle %5d , Wck %3d, DCtime %12lld, dt %12lld, O:", printf("Processdata cycle %5d , Wck %3d, DCtime %12"PRId64", dt %12"PRId64", O:",
dorun, wkc , ec_DCtime, gl_delta); dorun, wkc , ec_DCtime, gl_delta);
for(j = 0 ; j < oloop; j++) for(j = 0 ; j < oloop; j++)
{ {
@ -228,6 +230,8 @@ OSAL_THREAD_FUNC ecatcheck( void *ptr )
{ {
int slave; int slave;
(void) ptr;
while(1) while(1)
{ {
if( inOP && ((wkc < expectedWKC) || ec_group[currentgroup].docheckstate)) if( inOP && ((wkc < expectedWKC) || ec_group[currentgroup].docheckstate))