diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index c2f47d9..980b3c1 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -42,6 +42,9 @@ jobs: - fqbn: arduino:renesas_uno:unor4wifi platforms: | - name: arduino:renesas_uno + - fqbn: arduino:mbed_giga:giga + platforms: | + - name: arduino:mbed_giga steps: - name: Checkout diff --git a/examples/UDP_Client/UDP_Client.ino b/examples/UDP_Client/UDP_Client.ino index 55929ef..a420f5e 100644 --- a/examples/UDP_Client/UDP_Client.ino +++ b/examples/UDP_Client/UDP_Client.ino @@ -34,11 +34,15 @@ static uint16_t const UDP_SERVER_PORT = 8888; * GLOBAL VARIABLES **************************************************************************************/ -auto const tc6_io = new TC6::TC6_Io - ( SPI - , CS_PIN - , RESET_PIN - , IRQ_PIN); +auto const tc6_io = new TC6::TC6_Io( +#ifdef ARDUINO_GIGA + SPI1 +#else + SPI +#endif + , CS_PIN + , RESET_PIN + , IRQ_PIN); auto const tc6_inst = new TC6::TC6_Arduino_10BASE_T1S(tc6_io); Arduino_10BASE_T1S_UDP udp_client; @@ -143,17 +147,15 @@ void loop() if (rx_packet_size) { /* Print some metadata from received UDP packet. */ - Serial.print("Received "); + Serial.print("["); + Serial.print(millis()); + Serial.print("] Received "); Serial.print(rx_packet_size); Serial.print(" bytes from "); Serial.print(udp_client.remoteIP()); Serial.print(" port "); Serial.print(udp_client.remotePort()); - Serial.println(); - - Serial.print("["); - Serial.print(millis()); - Serial.print("] UDP_Client received packet content: \""); + Serial.print(", data = \""); /* Read from received UDP packet. */ size_t const UDP_RX_MSG_BUF_SIZE = 16 + 1; /* Reserve the last byte for the '\0' termination. */ diff --git a/examples/UDP_Server/UDP_Server.ino b/examples/UDP_Server/UDP_Server.ino index a6b446c..d694f4d 100644 --- a/examples/UDP_Server/UDP_Server.ino +++ b/examples/UDP_Server/UDP_Server.ino @@ -38,11 +38,15 @@ static uint16_t const UDP_SERVER_LOCAL_PORT = 8888; * GLOBAL VARIABLES **************************************************************************************/ -auto const tc6_io = new TC6::TC6_Io - ( SPI - , CS_PIN - , RESET_PIN - , IRQ_PIN); +auto const tc6_io = new TC6::TC6_Io( +#ifdef ARDUINO_GIGA + SPI1 +#else + SPI +#endif + , CS_PIN + , RESET_PIN + , IRQ_PIN); auto const tc6_inst = new TC6::TC6_Arduino_10BASE_T1S(tc6_io); Arduino_10BASE_T1S_UDP udp_server; @@ -126,17 +130,15 @@ void loop() uint16_t const destination_port = udp_server.remotePort(); /* Print some metadata from received UDP packet. */ - Serial.print("Received "); + Serial.print("["); + Serial.print(millis()); + Serial.print("] Received "); Serial.print(rx_packet_size); Serial.print(" bytes from "); Serial.print(udp_server.remoteIP()); Serial.print(" port "); Serial.print(udp_server.remotePort()); - Serial.println(); - - Serial.print("["); - Serial.print(millis()); - Serial.print("] UDP_Client received packet content: \""); + Serial.print(", data = \""); /* Read from received UDP packet. */ size_t const UDP_RX_MSG_BUF_SIZE = 16 + 1; /* Reserve the last byte for the '\0' termination. */ @@ -166,7 +168,6 @@ void loop() } } - static void OnPlcaStatus(bool success, bool plcaStatus) { if (!success) diff --git a/examples/iperf-client/iperf-client.ino b/examples/iperf-client/iperf-client.ino index f39e7d3..cb34ee6 100644 --- a/examples/iperf-client/iperf-client.ino +++ b/examples/iperf-client/iperf-client.ino @@ -41,19 +41,15 @@ static T1SMacSettings const t1s_mac_settings{MAC_PROMISCUOUS_MODE, MAC_TX_CUT_TH * GLOBAL VARIABLES **************************************************************************************/ +auto const tc6_io = new TC6::TC6_Io( #ifdef ARDUINO_GIGA -auto const tc6_io = new TC6::TC6_Io - ( SPI1 - , CS_PIN - , RESET_PIN - , IRQ_PIN); + SPI1 #else -auto const tc6_io = new TC6::TC6_Io - ( SPI + SPI +#endif , CS_PIN , RESET_PIN , IRQ_PIN); -#endif auto const tc6_inst = new TC6::TC6_Arduino_10BASE_T1S(tc6_io); /************************************************************************************** diff --git a/examples/tools/Control-DIOx/Control-DIOx.ino b/examples/tools/Control-DIOx/Control-DIOx.ino index 0bf3a40..86662aa 100644 --- a/examples/tools/Control-DIOx/Control-DIOx.ino +++ b/examples/tools/Control-DIOx/Control-DIOx.ino @@ -35,11 +35,15 @@ static auto const DIO_PIN = TC6::DIO::A0; * GLOBAL VARIABLES **************************************************************************************/ -auto const tc6_io = new TC6::TC6_Io - ( SPI - , CS_PIN - , RESET_PIN - , IRQ_PIN); +auto const tc6_io = new TC6::TC6_Io( +#ifdef ARDUINO_GIGA + SPI1 +#else + SPI +#endif + , CS_PIN + , RESET_PIN + , IRQ_PIN); auto const tc6_inst = new TC6::TC6_Arduino_10BASE_T1S(tc6_io); /************************************************************************************** diff --git a/examples/tools/PoDL-Sink-Auto-TurnOff/PoDL-Sink-Auto-TurnOff.ino b/examples/tools/PoDL-Sink-Auto-TurnOff/PoDL-Sink-Auto-TurnOff.ino index 65c461f..0ff5a67 100644 --- a/examples/tools/PoDL-Sink-Auto-TurnOff/PoDL-Sink-Auto-TurnOff.ino +++ b/examples/tools/PoDL-Sink-Auto-TurnOff/PoDL-Sink-Auto-TurnOff.ino @@ -32,11 +32,15 @@ static T1SMacSettings const t1s_default_mac_settings; * GLOBAL VARIABLES **************************************************************************************/ -auto const tc6_io = new TC6::TC6_Io - ( SPI - , CS_PIN - , RESET_PIN - , IRQ_PIN); +auto const tc6_io = new TC6::TC6_Io( +#ifdef ARDUINO_GIGA + SPI1 +#else + SPI +#endif + , CS_PIN + , RESET_PIN + , IRQ_PIN); auto const tc6_inst = new TC6::TC6_Arduino_10BASE_T1S(tc6_io); /************************************************************************************** diff --git a/examples/tools/PoDL-Source/PoDL-Source.ino b/examples/tools/PoDL-Source/PoDL-Source.ino index aacddef..eb866dd 100644 --- a/examples/tools/PoDL-Source/PoDL-Source.ino +++ b/examples/tools/PoDL-Source/PoDL-Source.ino @@ -32,11 +32,15 @@ static T1SMacSettings const t1s_default_mac_settings; * GLOBAL VARIABLES **************************************************************************************/ -auto const tc6_io = new TC6::TC6_Io - ( SPI - , CS_PIN - , RESET_PIN - , IRQ_PIN); +auto const tc6_io = new TC6::TC6_Io( +#ifdef ARDUINO_GIGA + SPI1 +#else + SPI +#endif + , CS_PIN + , RESET_PIN + , IRQ_PIN); auto const tc6_inst = new TC6::TC6_Arduino_10BASE_T1S(tc6_io); /************************************************************************************** diff --git a/src/lib/liblwip/cfg/lwipopts.h b/src/lib/liblwip/cfg/lwipopts.h index c30dd04..e866e8f 100644 --- a/src/lib/liblwip/cfg/lwipopts.h +++ b/src/lib/liblwip/cfg/lwipopts.h @@ -586,4 +586,145 @@ extern unsigned char debug_flags; #define LWIP_DBG_TYPES_ON debug_flags +// Rename APIs / structs to avoid clashes +#define sys_now t1s_sys_now +#define etharp_cleanup_netif t1s_etharp_cleanup_netif +#define etharp_find_addr t1s_etharp_find_addr +#define etharp_get_entry t1s_etharp_get_entry +#define etharp_input t1s_etharp_input +#define etharp_request t1s_etharp_request +#define etharp_tmr t1s_etharp_tmr +#define etharp_query t1s_etharp_query +#define etharp_output t1s_etharp_output +#define icmp_input t1s_icmp_input +#define icmp_dest_unreach t1s_icmp_dest_unreach +#define ip4_route t1s_ip4_route +#define ip4_input t1s_ip4_input +#define ip4_output_if t1s_ip4_output_if +#define ip4_output_if_src t1s_ip4_output_if_src +#define ip4_output t1s_ip4_output +#define ip4_addr_isbroadcast_u32 t1s_ip4_addr_isbroadcast_u32 +#define ip4_addr_netmask_valid t1s_ip4_addr_netmask_valid +#define ip4addr_aton t1s_ip4addr_aton +#define ipaddr_addr t1s_ipaddr_addr +#define ip4addr_ntoa_r t1s_ip4addr_ntoa_r +#define ip4addr_ntoa t1s_ip4addr_ntoa +#define ip_addr_broadcast t1s_ip_addr_broadcast +#define ip_addr_any t1s_ip_addr_any +#define lwip_strnstr t1s_lwip_strnstr +#define lwip_stricmp t1s_lwip_stricmp +#define lwip_strnicmp t1s_lwip_strnicmp +#define lwip_itoa t1s_lwip_itoa +#define inet_chksum_pseudo t1s_inet_chksum_pseudo +#define ip_chksum_pseudo t1s_ip_chksum_pseudo +#define inet_chksum_pseudo_partial t1s_inet_chksum_pseudo_partial +#define ip_chksum_pseudo_partial t1s_ip_chksum_pseudo_partial +#define inet_chksum t1s_inet_chksum +#define inet_chksum_pbuf t1s_inet_chksum_pbuf +#define lwip_init t1s_lwip_init +#define mem_init t1s_mem_init +#define mem_free t1s_mem_free +#define mem_trim t1s_mem_trim +#define mem_malloc t1s_mem_malloc +#define mem_calloc t1s_mem_calloc +#define memp_init_pool t1s_memp_init_pool +#define memp_init t1s_memp_init +#define memp_malloc_pool t1s_memp_malloc_pool +#define memp_malloc t1s_memp_malloc +#define memp_free_pool t1s_memp_free_pool +#define memp_free t1s_memp_free +#define memp_pools t1s_memp_pools +#define memp_PBUF_POOL t1s_memp_PBUF_POOL +#define memp_PBUF t1s_memp_PBUF +#define memp_SYS_TIMEOUT t1s_memp_SYS_TIMEOUT +#define memp_UDP_PCB t1s_memp_UDP_PCB +#define netif_init t1s_netif_init +#define netif_input t1s_netif_input +#define netif_set_ipaddr t1s_netif_set_ipaddr +#define netif_set_netmask t1s_netif_set_netmask +#define netif_set_gw t1s_netif_set_gw +#define netif_set_addr t1s_netif_set_addr +#define netif_add t1s_netif_add +#define netif_add_noaddr t1s_netif_add_noaddr +#define netif_set_default t1s_netif_set_default +#define netif_set_up t1s_netif_set_up +#define netif_set_down t1s_netif_set_down +#define netif_remove t1s_netif_remove +#define netif_set_status_callback t1s_netif_set_status_callback +#define netif_set_link_up t1s_netif_set_link_up +#define netif_set_link_down t1s_netif_set_link_down +#define netif_get_by_index t1s_netif_get_by_index +#define netif_index_to_name t1s_netif_index_to_name +#define netif_find t1s_netif_find +#define netif_name_to_index t1s_netif_name_to_index +#define pbuf_alloc_reference t1s_pbuf_alloc_reference +#define pbuf_add_header t1s_pbuf_add_header +#define pbuf_add_header_force t1s_pbuf_add_header_force +#define pbuf_remove_header t1s_pbuf_remove_header +#define pbuf_header t1s_pbuf_header +#define pbuf_header_force t1s_pbuf_header_force +#define pbuf_free_header t1s_pbuf_free_header +#define pbuf_clen t1s_pbuf_clen +#define pbuf_cat t1s_pbuf_cat +#define pbuf_chain t1s_pbuf_chain +#define pbuf_dechain t1s_pbuf_dechain +#define pbuf_copy t1s_pbuf_copy +#define pbuf_copy_partial t1s_pbuf_copy_partial +#define pbuf_get_contiguous t1s_pbuf_get_contiguous +#define pbuf_skip t1s_pbuf_skip +#define pbuf_take t1s_pbuf_take +#define pbuf_take_at t1s_pbuf_take_at +#define pbuf_clone t1s_pbuf_clone +#define pbuf_coalesce t1s_pbuf_coalesce +#define pbuf_try_get_at t1s_pbuf_try_get_at +#define pbuf_get_at t1s_pbuf_get_at +#define pbuf_put_at t1s_pbuf_put_at +#define pbuf_memcmp t1s_pbuf_memcmp +#define pbuf_memfind t1s_pbuf_memfind +#define pbuf_strstr t1s_pbuf_strstr +#define sys_timeout t1s_sys_timeout +#define sys_timeouts_init t1s_sys_timeouts_init +#define sys_untimeout t1s_sys_untimeout +#define sys_check_timeouts t1s_sys_check_timeouts +#define sys_restart_timeouts t1s_sys_restart_timeouts +#define sys_timeouts_sleeptime t1s_sys_timeouts_sleeptime +#define lwip_num_cyclic_timers t1s_lwip_num_cyclic_timers +#define lwip_cyclic_timers t1s_lwip_cyclic_timers +#define udp_init t1s_udp_init +#define udp_input t1s_udp_input +#define udp_bind t1s_udp_bind +#define udp_sendto_if_src t1s_udp_sendto_if_src +#define udp_sendto_if t1s_udp_sendto_if +#define udp_sendto t1s_udp_sendto +#define udp_send t1s_udp_send +#define udp_bind_netif t1s_udp_bind_netif +#define udp_connect t1s_udp_connect +#define udp_disconnect t1s_udp_disconnect +#define udp_recv t1s_udp_recv +#define udp_remove t1s_udp_remove +#define udp_new t1s_udp_new +#define udp_new_ip_type t1s_udp_new_ip_type +#define udp_netif_ip_addr_changed t1s_udp_netif_ip_addr_changed +#define bridgeif_fdb_update_src t1s_bridgeif_fdb_update_src +#define bridgeif_fdb_get_dst_ports t1s_bridgeif_fdb_get_dst_ports +#define bridgeif_fdb_init t1s_bridgeif_fdb_init +#define ethernet_input t1s_ethernet_input +#define ethernet_output t1s_ethernet_output +#define ethzero t1s_ethzero +#define ethbroadcast t1s_ethbroadcast +#define pbuf_realloc t1s_pbuf_realloc +#define pbuf_free t1s_pbuf_free +#define pbuf_alloc t1s_pbuf_alloc +#define pbuf_ref t1s_pbuf_ref +#define etharp_cleanup_netif t1s_etharp_cleanup_netif +#define etharp_find_addr t1s_etharp_find_addr +#define etharp_get_entry t1s_etharp_get_entry +#define etharp_input t1s_etharp_input +#define etharp_request t1s_etharp_request +#define etharp_tmr t1s_etharp_tmr +#define etharp_query t1s_etharp_query +#define etharp_output t1s_etharp_output +#define icmp_input t1s_icmp_input +#define icmp_dest_unreach t1s_icmp_dest_unreach + #endif /* LWIP_LWIPOPTS_H */ \ No newline at end of file diff --git a/src/lib/lwip_sys_now.cpp b/src/lib/lwip_sys_now.cpp index 603ee45..8adea55 100644 --- a/src/lib/lwip_sys_now.cpp +++ b/src/lib/lwip_sys_now.cpp @@ -22,6 +22,7 @@ #include +#include "liblwip/include/lwip/opt.h" #include "liblwip/arch/cc.h" /**************************************************************************************