Skip to content

Commit c0ff964

Browse files
authored
Merge pull request #10 from bcmi-labs/giga_compatibility
Giga compatibility
2 parents 946e69a + 062cc79 commit c0ff964

File tree

9 files changed

+202
-46
lines changed

9 files changed

+202
-46
lines changed

.github/workflows/compile-examples.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ jobs:
4242
- fqbn: arduino:renesas_uno:unor4wifi
4343
platforms: |
4444
- name: arduino:renesas_uno
45+
- fqbn: arduino:mbed_giga:giga
46+
platforms: |
47+
- name: arduino:mbed_giga
4548
4649
steps:
4750
- name: Checkout

examples/UDP_Client/UDP_Client.ino

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,15 @@ static uint16_t const UDP_SERVER_PORT = 8888;
3434
* GLOBAL VARIABLES
3535
**************************************************************************************/
3636

37-
auto const tc6_io = new TC6::TC6_Io
38-
( SPI
39-
, CS_PIN
40-
, RESET_PIN
41-
, IRQ_PIN);
37+
auto const tc6_io = new TC6::TC6_Io(
38+
#ifdef ARDUINO_GIGA
39+
SPI1
40+
#else
41+
SPI
42+
#endif
43+
, CS_PIN
44+
, RESET_PIN
45+
, IRQ_PIN);
4246
auto const tc6_inst = new TC6::TC6_Arduino_10BASE_T1S(tc6_io);
4347
Arduino_10BASE_T1S_UDP udp_client;
4448

@@ -143,17 +147,15 @@ void loop()
143147
if (rx_packet_size)
144148
{
145149
/* Print some metadata from received UDP packet. */
146-
Serial.print("Received ");
150+
Serial.print("[");
151+
Serial.print(millis());
152+
Serial.print("] Received ");
147153
Serial.print(rx_packet_size);
148154
Serial.print(" bytes from ");
149155
Serial.print(udp_client.remoteIP());
150156
Serial.print(" port ");
151157
Serial.print(udp_client.remotePort());
152-
Serial.println();
153-
154-
Serial.print("[");
155-
Serial.print(millis());
156-
Serial.print("] UDP_Client received packet content: \"");
158+
Serial.print(", data = \"");
157159

158160
/* Read from received UDP packet. */
159161
size_t const UDP_RX_MSG_BUF_SIZE = 16 + 1; /* Reserve the last byte for the '\0' termination. */

examples/UDP_Server/UDP_Server.ino

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,15 @@ static uint16_t const UDP_SERVER_LOCAL_PORT = 8888;
3838
* GLOBAL VARIABLES
3939
**************************************************************************************/
4040

41-
auto const tc6_io = new TC6::TC6_Io
42-
( SPI
43-
, CS_PIN
44-
, RESET_PIN
45-
, IRQ_PIN);
41+
auto const tc6_io = new TC6::TC6_Io(
42+
#ifdef ARDUINO_GIGA
43+
SPI1
44+
#else
45+
SPI
46+
#endif
47+
, CS_PIN
48+
, RESET_PIN
49+
, IRQ_PIN);
4650
auto const tc6_inst = new TC6::TC6_Arduino_10BASE_T1S(tc6_io);
4751
Arduino_10BASE_T1S_UDP udp_server;
4852

@@ -126,17 +130,15 @@ void loop()
126130
uint16_t const destination_port = udp_server.remotePort();
127131

128132
/* Print some metadata from received UDP packet. */
129-
Serial.print("Received ");
133+
Serial.print("[");
134+
Serial.print(millis());
135+
Serial.print("] Received ");
130136
Serial.print(rx_packet_size);
131137
Serial.print(" bytes from ");
132138
Serial.print(udp_server.remoteIP());
133139
Serial.print(" port ");
134140
Serial.print(udp_server.remotePort());
135-
Serial.println();
136-
137-
Serial.print("[");
138-
Serial.print(millis());
139-
Serial.print("] UDP_Client received packet content: \"");
141+
Serial.print(", data = \"");
140142

141143
/* Read from received UDP packet. */
142144
size_t const UDP_RX_MSG_BUF_SIZE = 16 + 1; /* Reserve the last byte for the '\0' termination. */
@@ -166,7 +168,6 @@ void loop()
166168
}
167169
}
168170

169-
170171
static void OnPlcaStatus(bool success, bool plcaStatus)
171172
{
172173
if (!success)

examples/iperf-client/iperf-client.ino

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,15 @@ static T1SMacSettings const t1s_mac_settings{MAC_PROMISCUOUS_MODE, MAC_TX_CUT_TH
4141
* GLOBAL VARIABLES
4242
**************************************************************************************/
4343

44+
auto const tc6_io = new TC6::TC6_Io(
4445
#ifdef ARDUINO_GIGA
45-
auto const tc6_io = new TC6::TC6_Io
46-
( SPI1
47-
, CS_PIN
48-
, RESET_PIN
49-
, IRQ_PIN);
46+
SPI1
5047
#else
51-
auto const tc6_io = new TC6::TC6_Io
52-
( SPI
48+
SPI
49+
#endif
5350
, CS_PIN
5451
, RESET_PIN
5552
, IRQ_PIN);
56-
#endif
5753
auto const tc6_inst = new TC6::TC6_Arduino_10BASE_T1S(tc6_io);
5854

5955
/**************************************************************************************

examples/tools/Control-DIOx/Control-DIOx.ino

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,15 @@ static auto const DIO_PIN = TC6::DIO::A0;
3535
* GLOBAL VARIABLES
3636
**************************************************************************************/
3737

38-
auto const tc6_io = new TC6::TC6_Io
39-
( SPI
40-
, CS_PIN
41-
, RESET_PIN
42-
, IRQ_PIN);
38+
auto const tc6_io = new TC6::TC6_Io(
39+
#ifdef ARDUINO_GIGA
40+
SPI1
41+
#else
42+
SPI
43+
#endif
44+
, CS_PIN
45+
, RESET_PIN
46+
, IRQ_PIN);
4347
auto const tc6_inst = new TC6::TC6_Arduino_10BASE_T1S(tc6_io);
4448

4549
/**************************************************************************************

examples/tools/PoDL-Sink-Auto-TurnOff/PoDL-Sink-Auto-TurnOff.ino

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ static T1SMacSettings const t1s_default_mac_settings;
3232
* GLOBAL VARIABLES
3333
**************************************************************************************/
3434

35-
auto const tc6_io = new TC6::TC6_Io
36-
( SPI
37-
, CS_PIN
38-
, RESET_PIN
39-
, IRQ_PIN);
35+
auto const tc6_io = new TC6::TC6_Io(
36+
#ifdef ARDUINO_GIGA
37+
SPI1
38+
#else
39+
SPI
40+
#endif
41+
, CS_PIN
42+
, RESET_PIN
43+
, IRQ_PIN);
4044
auto const tc6_inst = new TC6::TC6_Arduino_10BASE_T1S(tc6_io);
4145

4246
/**************************************************************************************

examples/tools/PoDL-Source/PoDL-Source.ino

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ static T1SMacSettings const t1s_default_mac_settings;
3232
* GLOBAL VARIABLES
3333
**************************************************************************************/
3434

35-
auto const tc6_io = new TC6::TC6_Io
36-
( SPI
37-
, CS_PIN
38-
, RESET_PIN
39-
, IRQ_PIN);
35+
auto const tc6_io = new TC6::TC6_Io(
36+
#ifdef ARDUINO_GIGA
37+
SPI1
38+
#else
39+
SPI
40+
#endif
41+
, CS_PIN
42+
, RESET_PIN
43+
, IRQ_PIN);
4044
auto const tc6_inst = new TC6::TC6_Arduino_10BASE_T1S(tc6_io);
4145

4246
/**************************************************************************************

src/lib/liblwip/cfg/lwipopts.h

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,4 +586,145 @@
586586
extern unsigned char debug_flags;
587587
#define LWIP_DBG_TYPES_ON debug_flags
588588

589+
// Rename APIs / structs to avoid clashes
590+
#define sys_now t1s_sys_now
591+
#define etharp_cleanup_netif t1s_etharp_cleanup_netif
592+
#define etharp_find_addr t1s_etharp_find_addr
593+
#define etharp_get_entry t1s_etharp_get_entry
594+
#define etharp_input t1s_etharp_input
595+
#define etharp_request t1s_etharp_request
596+
#define etharp_tmr t1s_etharp_tmr
597+
#define etharp_query t1s_etharp_query
598+
#define etharp_output t1s_etharp_output
599+
#define icmp_input t1s_icmp_input
600+
#define icmp_dest_unreach t1s_icmp_dest_unreach
601+
#define ip4_route t1s_ip4_route
602+
#define ip4_input t1s_ip4_input
603+
#define ip4_output_if t1s_ip4_output_if
604+
#define ip4_output_if_src t1s_ip4_output_if_src
605+
#define ip4_output t1s_ip4_output
606+
#define ip4_addr_isbroadcast_u32 t1s_ip4_addr_isbroadcast_u32
607+
#define ip4_addr_netmask_valid t1s_ip4_addr_netmask_valid
608+
#define ip4addr_aton t1s_ip4addr_aton
609+
#define ipaddr_addr t1s_ipaddr_addr
610+
#define ip4addr_ntoa_r t1s_ip4addr_ntoa_r
611+
#define ip4addr_ntoa t1s_ip4addr_ntoa
612+
#define ip_addr_broadcast t1s_ip_addr_broadcast
613+
#define ip_addr_any t1s_ip_addr_any
614+
#define lwip_strnstr t1s_lwip_strnstr
615+
#define lwip_stricmp t1s_lwip_stricmp
616+
#define lwip_strnicmp t1s_lwip_strnicmp
617+
#define lwip_itoa t1s_lwip_itoa
618+
#define inet_chksum_pseudo t1s_inet_chksum_pseudo
619+
#define ip_chksum_pseudo t1s_ip_chksum_pseudo
620+
#define inet_chksum_pseudo_partial t1s_inet_chksum_pseudo_partial
621+
#define ip_chksum_pseudo_partial t1s_ip_chksum_pseudo_partial
622+
#define inet_chksum t1s_inet_chksum
623+
#define inet_chksum_pbuf t1s_inet_chksum_pbuf
624+
#define lwip_init t1s_lwip_init
625+
#define mem_init t1s_mem_init
626+
#define mem_free t1s_mem_free
627+
#define mem_trim t1s_mem_trim
628+
#define mem_malloc t1s_mem_malloc
629+
#define mem_calloc t1s_mem_calloc
630+
#define memp_init_pool t1s_memp_init_pool
631+
#define memp_init t1s_memp_init
632+
#define memp_malloc_pool t1s_memp_malloc_pool
633+
#define memp_malloc t1s_memp_malloc
634+
#define memp_free_pool t1s_memp_free_pool
635+
#define memp_free t1s_memp_free
636+
#define memp_pools t1s_memp_pools
637+
#define memp_PBUF_POOL t1s_memp_PBUF_POOL
638+
#define memp_PBUF t1s_memp_PBUF
639+
#define memp_SYS_TIMEOUT t1s_memp_SYS_TIMEOUT
640+
#define memp_UDP_PCB t1s_memp_UDP_PCB
641+
#define netif_init t1s_netif_init
642+
#define netif_input t1s_netif_input
643+
#define netif_set_ipaddr t1s_netif_set_ipaddr
644+
#define netif_set_netmask t1s_netif_set_netmask
645+
#define netif_set_gw t1s_netif_set_gw
646+
#define netif_set_addr t1s_netif_set_addr
647+
#define netif_add t1s_netif_add
648+
#define netif_add_noaddr t1s_netif_add_noaddr
649+
#define netif_set_default t1s_netif_set_default
650+
#define netif_set_up t1s_netif_set_up
651+
#define netif_set_down t1s_netif_set_down
652+
#define netif_remove t1s_netif_remove
653+
#define netif_set_status_callback t1s_netif_set_status_callback
654+
#define netif_set_link_up t1s_netif_set_link_up
655+
#define netif_set_link_down t1s_netif_set_link_down
656+
#define netif_get_by_index t1s_netif_get_by_index
657+
#define netif_index_to_name t1s_netif_index_to_name
658+
#define netif_find t1s_netif_find
659+
#define netif_name_to_index t1s_netif_name_to_index
660+
#define pbuf_alloc_reference t1s_pbuf_alloc_reference
661+
#define pbuf_add_header t1s_pbuf_add_header
662+
#define pbuf_add_header_force t1s_pbuf_add_header_force
663+
#define pbuf_remove_header t1s_pbuf_remove_header
664+
#define pbuf_header t1s_pbuf_header
665+
#define pbuf_header_force t1s_pbuf_header_force
666+
#define pbuf_free_header t1s_pbuf_free_header
667+
#define pbuf_clen t1s_pbuf_clen
668+
#define pbuf_cat t1s_pbuf_cat
669+
#define pbuf_chain t1s_pbuf_chain
670+
#define pbuf_dechain t1s_pbuf_dechain
671+
#define pbuf_copy t1s_pbuf_copy
672+
#define pbuf_copy_partial t1s_pbuf_copy_partial
673+
#define pbuf_get_contiguous t1s_pbuf_get_contiguous
674+
#define pbuf_skip t1s_pbuf_skip
675+
#define pbuf_take t1s_pbuf_take
676+
#define pbuf_take_at t1s_pbuf_take_at
677+
#define pbuf_clone t1s_pbuf_clone
678+
#define pbuf_coalesce t1s_pbuf_coalesce
679+
#define pbuf_try_get_at t1s_pbuf_try_get_at
680+
#define pbuf_get_at t1s_pbuf_get_at
681+
#define pbuf_put_at t1s_pbuf_put_at
682+
#define pbuf_memcmp t1s_pbuf_memcmp
683+
#define pbuf_memfind t1s_pbuf_memfind
684+
#define pbuf_strstr t1s_pbuf_strstr
685+
#define sys_timeout t1s_sys_timeout
686+
#define sys_timeouts_init t1s_sys_timeouts_init
687+
#define sys_untimeout t1s_sys_untimeout
688+
#define sys_check_timeouts t1s_sys_check_timeouts
689+
#define sys_restart_timeouts t1s_sys_restart_timeouts
690+
#define sys_timeouts_sleeptime t1s_sys_timeouts_sleeptime
691+
#define lwip_num_cyclic_timers t1s_lwip_num_cyclic_timers
692+
#define lwip_cyclic_timers t1s_lwip_cyclic_timers
693+
#define udp_init t1s_udp_init
694+
#define udp_input t1s_udp_input
695+
#define udp_bind t1s_udp_bind
696+
#define udp_sendto_if_src t1s_udp_sendto_if_src
697+
#define udp_sendto_if t1s_udp_sendto_if
698+
#define udp_sendto t1s_udp_sendto
699+
#define udp_send t1s_udp_send
700+
#define udp_bind_netif t1s_udp_bind_netif
701+
#define udp_connect t1s_udp_connect
702+
#define udp_disconnect t1s_udp_disconnect
703+
#define udp_recv t1s_udp_recv
704+
#define udp_remove t1s_udp_remove
705+
#define udp_new t1s_udp_new
706+
#define udp_new_ip_type t1s_udp_new_ip_type
707+
#define udp_netif_ip_addr_changed t1s_udp_netif_ip_addr_changed
708+
#define bridgeif_fdb_update_src t1s_bridgeif_fdb_update_src
709+
#define bridgeif_fdb_get_dst_ports t1s_bridgeif_fdb_get_dst_ports
710+
#define bridgeif_fdb_init t1s_bridgeif_fdb_init
711+
#define ethernet_input t1s_ethernet_input
712+
#define ethernet_output t1s_ethernet_output
713+
#define ethzero t1s_ethzero
714+
#define ethbroadcast t1s_ethbroadcast
715+
#define pbuf_realloc t1s_pbuf_realloc
716+
#define pbuf_free t1s_pbuf_free
717+
#define pbuf_alloc t1s_pbuf_alloc
718+
#define pbuf_ref t1s_pbuf_ref
719+
#define etharp_cleanup_netif t1s_etharp_cleanup_netif
720+
#define etharp_find_addr t1s_etharp_find_addr
721+
#define etharp_get_entry t1s_etharp_get_entry
722+
#define etharp_input t1s_etharp_input
723+
#define etharp_request t1s_etharp_request
724+
#define etharp_tmr t1s_etharp_tmr
725+
#define etharp_query t1s_etharp_query
726+
#define etharp_output t1s_etharp_output
727+
#define icmp_input t1s_icmp_input
728+
#define icmp_dest_unreach t1s_icmp_dest_unreach
729+
589730
#endif /* LWIP_LWIPOPTS_H */

src/lib/lwip_sys_now.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include <Arduino.h>
2424

25+
#include "liblwip/include/lwip/opt.h"
2526
#include "liblwip/arch/cc.h"
2627

2728
/**************************************************************************************

0 commit comments

Comments
 (0)