Move to RTEMS 5 and don't build tests for RTEMS
parent
0398b6ba72
commit
94217505df
|
@ -9,6 +9,7 @@ endif()
|
|||
|
||||
set(SOEM_INCLUDE_INSTALL_DIR include/soem)
|
||||
set(SOEM_LIB_INSTALL_DIR lib)
|
||||
set(BUILD_TESTS TRUE)
|
||||
|
||||
if(WIN32)
|
||||
set(OS "win32")
|
||||
|
@ -41,6 +42,7 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "rtems")
|
|||
message("Building for RTEMS")
|
||||
set(OS "rtems")
|
||||
set(SOEM_LIB_INSTALL_DIR ${LIB_DIR})
|
||||
set(BUILD_TESTS FALSE)
|
||||
endif()
|
||||
|
||||
message("OS is ${OS}")
|
||||
|
@ -74,6 +76,8 @@ install(FILES
|
|||
${OSHW_HEADERS}
|
||||
DESTINATION ${SOEM_INCLUDE_INSTALL_DIR})
|
||||
|
||||
add_subdirectory(test/linux/slaveinfo)
|
||||
add_subdirectory(test/linux/eepromtool)
|
||||
add_subdirectory(test/linux/simple_test)
|
||||
if(BUILD_TESTS)
|
||||
add_subdirectory(test/linux/slaveinfo)
|
||||
add_subdirectory(test/linux/eepromtool)
|
||||
add_subdirectory(test/linux/simple_test)
|
||||
endif()
|
||||
|
|
|
@ -151,10 +151,11 @@ int ecx_setupnic(ecx_portt *port, const char *ifname, int secondary)
|
|||
sprintf(fname, "/dev/bpf%i", i);
|
||||
*bpf = open(fname, O_RDWR);
|
||||
}
|
||||
|
||||
|
||||
if(*bpf == -1)
|
||||
{
|
||||
/* Failed to open bpf */
|
||||
perror("Could not open bpf\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -164,40 +165,52 @@ int ecx_setupnic(ecx_portt *port, const char *ifname, int secondary)
|
|||
if (ioctl(*bpf, BIOCSBLEN, &buffer_len) == -1) {
|
||||
perror("BIOCGBLEN");
|
||||
}
|
||||
assert(buffer_len >= 1518);
|
||||
|
||||
if (buffer_len < 1518) {
|
||||
printf("buffer_len %d < 1518\n", buffer_len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* connect bpf to NIC by name */
|
||||
strcpy(ifr.ifr_name, ifname);
|
||||
assert(ioctl(*bpf, BIOCSETIF, &ifr) == 0);
|
||||
if(ioctl(*bpf, BIOCSETIF, &ifr) == -1) {
|
||||
perror("BIOCSETIF");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Set required bpf options */
|
||||
|
||||
/* Activate immediate mode */
|
||||
if (ioctl(*bpf, BIOCIMMEDIATE, &true_val) == -1) {
|
||||
perror("BIOCIMMEDIATE");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Set interface in promiscuous mode */
|
||||
if (ioctl(*bpf, BIOCPROMISC, &true_val) == -1) {
|
||||
perror("BIOCPROMISC");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Allow to have custom source address */
|
||||
if (ioctl(*bpf, BIOCSHDRCMPLT, &true_val) == -1) {
|
||||
perror("BIOCSHDRCMPLT");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Listen only to incomming messages */
|
||||
uint direction = BPF_D_IN;
|
||||
if (ioctl(*bpf, BIOCSDIRECTION, &direction) == -1) {
|
||||
perror("BIOCSDIRECTION");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Set read timeout */
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 1;
|
||||
timeout.tv_usec = 11000;
|
||||
if (ioctl(*bpf, BIOCSRTIMEOUT, &timeout) == -1) {
|
||||
perror("BIOCSRTIMEOUT");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* setup ethernet headers in tx buffers so we don't have to repeat it */
|
||||
|
@ -207,9 +220,8 @@ int ecx_setupnic(ecx_portt *port, const char *ifname, int secondary)
|
|||
port->rxbufstat[i] = EC_BUF_EMPTY;
|
||||
}
|
||||
ec_setupheader(&(port->txbuf2));
|
||||
if (r == 0) rval = 1;
|
||||
|
||||
return rval;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** Close sockets used
|
||||
|
|
Loading…
Reference in New Issue