This adds support for the CFC-400X BSP including an option to select SGMII instead of the default RGMII PHY interface and adds a way for ZynqMP BSPs to provide additional configuration via lwipbspopts.h. --- .../aarch64/xilinx_zynqmp_lp64_cfc400x.json | 11 ++++ .../contrib/ports/xilinx/netif/xemacpsif_hw.c | 6 ++ rtemslwip/zynqmp/lwipopts.h | 2 + rtemslwip/zynqmp_cfc400x/lwipbspopts.h | 33 ++++++++++ rtemslwip/zynqmp_cfc400x/netstart.c | 66 +++++++++++++++++++ rtemslwip/zynqmp_hardware/lwipbspopts.h | 1 + rtemslwip/zynqmp_qemu/lwipbspopts.h | 1 + 7 files changed, 120 insertions(+) create mode 100644 defs/bsps/aarch64/xilinx_zynqmp_lp64_cfc400x.json create mode 100644 rtemslwip/zynqmp_cfc400x/lwipbspopts.h create mode 100644 rtemslwip/zynqmp_cfc400x/netstart.c create mode 100644 rtemslwip/zynqmp_hardware/lwipbspopts.h create mode 100644 rtemslwip/zynqmp_qemu/lwipbspopts.h
diff --git a/defs/bsps/aarch64/xilinx_zynqmp_lp64_cfc400x.json b/defs/bsps/aarch64/xilinx_zynqmp_lp64_cfc400x.json new file mode 100644 index 0000000..5fe676c --- /dev/null +++ b/defs/bsps/aarch64/xilinx_zynqmp_lp64_cfc400x.json @@ -0,0 +1,11 @@ +{ + "includes": [ + "xilinx_zynqmp_base" + ], + "header-paths-to-import": [ + "rtemslwip/zynqmp_cfc400x" + ], + "source-paths-to-import": [ + "rtemslwip/zynqmp_cfc400x" + ] +} diff --git a/embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif_hw.c b/embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif_hw.c index a1fdeda..f0ddf84 100644 --- a/embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif_hw.c +++ b/embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif_hw.c @@ -74,6 +74,12 @@ void init_emacps(xemacpsif_s *xemacps, struct netif *netif) xemacpsp = &xemacps->emacps; +#ifdef __rtems__ +#ifdef ZYNQMP_USE_SGMII + XEmacPs_SetOptions(xemacpsp, XEMACPS_SGMII_ENABLE_OPTION); +#endif +#endif + #ifdef ZYNQMP_USE_JUMBO XEmacPs_SetOptions(xemacpsp, XEMACPS_JUMBO_ENABLE_OPTION); #endif diff --git a/rtemslwip/zynqmp/lwipopts.h b/rtemslwip/zynqmp/lwipopts.h index b9fe277..feabe73 100644 --- a/rtemslwip/zynqmp/lwipopts.h +++ b/rtemslwip/zynqmp/lwipopts.h @@ -123,4 +123,6 @@ #define portTICK_RATE_MS ( rtems_clock_get_ticks_per_second() * 1000 ) #define vTaskDelay( x ) sys_arch_delay( x ) +#include <lwipbspopts.h> + #endif /* __LWIPOPTS_H__ */ diff --git a/rtemslwip/zynqmp_cfc400x/lwipbspopts.h b/rtemslwip/zynqmp_cfc400x/lwipbspopts.h new file mode 100644 index 0000000..27eb6a9 --- /dev/null +++ b/rtemslwip/zynqmp_cfc400x/lwipbspopts.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2022 On-Line Applications Research Corporation (OAR) + * Written by Kinsey Moore <kinsey.mo...@oarcorp.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RTEMSLWIP_LWIPBSPOPTS_H +#define RTEMSLWIP_LWIPBSPOPTS_H + +/* Use SGMII mode for all interfaces on the CFC-400X */ +#define ZYNQMP_USE_SGMII + +#endif /* RTEMSLWIP_LWIPBSPOPTS_H */ diff --git a/rtemslwip/zynqmp_cfc400x/netstart.c b/rtemslwip/zynqmp_cfc400x/netstart.c new file mode 100644 index 0000000..d19b36c --- /dev/null +++ b/rtemslwip/zynqmp_cfc400x/netstart.c @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2022 On-Line Applications Research Corporation (OAR) + * Written by Kinsey Moore <kinsey.mo...@oarcorp.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <netstart.h> +#include "netif/xadapter.h" +#include "xparameters.h" +#include <lwip/tcpip.h> + +int start_networking( + struct netif *net_interface, + ip_addr_t *ipaddr, + ip_addr_t *netmask, + ip_addr_t *gateway, + unsigned char *mac_ethernet_address +) +{ + tcpip_init( NULL, NULL ); + + if ( !xemac_add( + net_interface, + ipaddr, + netmask, + gateway, + mac_ethernet_address, + XPAR_PSU_ETHERNET_0_BASEADDR + ) ) { + return 1; + } + + netif_set_default( net_interface ); + + netif_set_up( net_interface ); + + sys_thread_new( + "xemacif_input_thread", + ( void ( * )( void * ) )xemacif_input_thread, + net_interface, + 1024, + DEFAULT_THREAD_PRIO + ); + + return 0; +} diff --git a/rtemslwip/zynqmp_hardware/lwipbspopts.h b/rtemslwip/zynqmp_hardware/lwipbspopts.h new file mode 100644 index 0000000..d35e631 --- /dev/null +++ b/rtemslwip/zynqmp_hardware/lwipbspopts.h @@ -0,0 +1 @@ +/* This file is a stub and intentionally left blank */ diff --git a/rtemslwip/zynqmp_qemu/lwipbspopts.h b/rtemslwip/zynqmp_qemu/lwipbspopts.h new file mode 100644 index 0000000..d35e631 --- /dev/null +++ b/rtemslwip/zynqmp_qemu/lwipbspopts.h @@ -0,0 +1 @@ +/* This file is a stub and intentionally left blank */ -- 2.30.2 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel