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

Dev #103

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Dev #103

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
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ project(ingenialink LANGUAGES C VERSION 6.3.2)
set(CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/cmake
)
set(CMAKE_BUILD_TYPE Release)

#-------------------------------------------------------------------------------
# Compiler options
Expand All @@ -12,7 +13,7 @@ if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4 /D_CRT_SECURE_NO_WARNINGS")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Zi")
elseif(${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Wextra -pedantic")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -w -O3")
endif()

#-------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/simple_ecat.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ int main(int argc, const char *argv[])
{
il_net_t *net = NULL;
il_servo_t *servo = NULL;
char* ifname = "\\Device\\NPF_{XXX}";
char* ifname = "enp0s25";
char* dict_path = "XXX";
int port = 1061;
int slave = 1;
Expand Down
4 changes: 2 additions & 2 deletions include/ingenialink/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ typedef struct il_net_emcy_subscriber il_net_emcy_subscriber_t;
/** Emergency subcriber callback. */
typedef void (*il_net_emcy_subscriber_cb_t)(void *ctx, uint32_t code);

int il_net_monitoring_mapping_register[16];
int il_net_disturbance_mapping_register[16];
// int il_net_monitoring_mapping_register[16];
// int il_net_disturbance_mapping_register[16];

/**
* Retain a reference of the network.
Expand Down
18 changes: 9 additions & 9 deletions ingenialink/ecat/lwip.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#define UDP_OPEN_PORT (uint16_t)1061U

/* Network instance */
struct netif tNetif;
struct netif tNetifLwip;

/* Global reply data buffer */
uint8_t pReplyData[1024U];
Expand Down Expand Up @@ -137,11 +137,11 @@ void LWIP_Init(void)
DEFAULT_GW_IP_ADDR3, DEFAULT_GW_IP_ADDR4);

/* Add the network interface */
netif_add(&tNetif, &tIpAddr, &tNetmask, &tGwIpAddr, NULL,
netif_add(&tNetifLwip, &tIpAddr, &tNetmask, &tGwIpAddr, NULL,
&LWIP_EthernetifInit, &ethernet_input);
netif_set_default(&tNetif);
netif_set_up(&tNetif);
tNetif.flags |= NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP;
netif_set_default(&tNetifLwip);
netif_set_up(&tNetifLwip);
tNetifLwip.flags |= NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP;

/* Open the Upd port and link receive callback */
ptUdpPcb = udp_new();
Expand Down Expand Up @@ -190,7 +190,7 @@ void LWIP_EthernetifIntput(void* pData, uint16_t u16SizeBy)
memcpy((void*)pBuf->payload, (const void*)pData, u16SizeBy);
pBuf->len = u16SizeBy;

tError = tNetif.input(pBuf, &tNetif);
tError = tNetifLwip.input(pBuf, &tNetifLwip);

if (tError != ERR_OK)
{
Expand All @@ -204,23 +204,23 @@ void LWIP_SetIpAddress(uint8_t* pu8IpAddr)
ip4_addr_t tNewIpAddr;

IP4_ADDR(&tNewIpAddr, pu8IpAddr[0], pu8IpAddr[1], pu8IpAddr[2], pu8IpAddr[3]);
netif_set_ipaddr(&tNetif, &tNewIpAddr);
netif_set_ipaddr(&tNetifLwip, &tNewIpAddr);
}

void LWIP_SetNetmask(uint8_t* pu8Netmask)
{
ip4_addr_t tNewNetmask;

IP4_ADDR(&tNewNetmask, pu8Netmask[0], pu8Netmask[1], pu8Netmask[2], pu8Netmask[3]);
netif_set_netmask(&tNetif, &tNewNetmask);
netif_set_netmask(&tNetifLwip, &tNewNetmask);
}

void LWIP_SetGwAddress(uint8_t* pu8GwAddr)
{
ip4_addr_t tNewGwAddr;

IP4_ADDR(&tNewGwAddr, pu8GwAddr[0], pu8GwAddr[1], pu8GwAddr[2], pu8GwAddr[3]);
netif_set_gw(&tNetif, &tNewGwAddr);
netif_set_gw(&tNetifLwip, &tNewGwAddr);
}

void LWIP_ProcessTimeouts()
Expand Down
Empty file added test.txt
Empty file.