diff options
author | Vijay Kumar Banerjee <vijay@rtems.org> | 2021-06-14 18:42:56 -0600 |
---|---|---|
committer | Kinsey Moore <kinsey.moore@oarcorp.com> | 2022-07-08 16:14:55 -0500 |
commit | 5857da3fa8f88d7028d80fe270d03e779706e533 (patch) | |
tree | d660fc757b82de55573b0358525f6bf536ec623e /uLan | |
parent | b9f8a984bef5861b79dbfaddc68dfc1ab1ec32e9 (diff) |
lwip: Add bbb and tms570 drivers
+ Add networking01 and telnetd01 tests
Diffstat (limited to 'uLan')
-rw-r--r-- | uLan/ports/driver/tms570_emac/eth_lwip.c | 2 | ||||
-rw-r--r-- | uLan/ports/driver/tms570_emac/eth_lwip_default.h | 3 | ||||
-rw-r--r-- | uLan/ports/driver/tms570_emac/ti_drv_mdio.h | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | uLan/ports/driver/tms570_emac/tms570_netif.h | 120 | ||||
-rw-r--r-- | uLan/ports/os/lwipopts.h | 210 |
5 files changed, 274 insertions, 63 deletions
diff --git a/uLan/ports/driver/tms570_emac/eth_lwip.c b/uLan/ports/driver/tms570_emac/eth_lwip.c index b1ae4bb..6105268 100644 --- a/uLan/ports/driver/tms570_emac/eth_lwip.c +++ b/uLan/ports/driver/tms570_emac/eth_lwip.c @@ -39,7 +39,7 @@ #include "netif/etharp.h" /* includes - lwip/ip.h, lwip/netif.h, lwip/ip_addr.h, lwip/pbuf.h */ #include "eth_lwip_default.h" #include "eth_lwip.h" -#include "tms570_netif.h" +#include "beaglebone.h" #include <stdio.h> /* The lwIP network interface structure for the Ethernet EMAC. */ diff --git a/uLan/ports/driver/tms570_emac/eth_lwip_default.h b/uLan/ports/driver/tms570_emac/eth_lwip_default.h index 6194d06..863e9e1 100644 --- a/uLan/ports/driver/tms570_emac/eth_lwip_default.h +++ b/uLan/ports/driver/tms570_emac/eth_lwip_default.h @@ -3,7 +3,7 @@ /* #define DEBUG 1 */ /* #define STATIC_IP_ADDRESS 1 */ - +#if 0 void tms570_eth_memp_avaible(int type); #define ETH_LWIP_INIT_NETIF_FNC tms570_eth_init_netif @@ -14,6 +14,7 @@ void tms570_eth_memp_avaible(int type); /** * Default MAC address for interface. */ +#endif /* 0 */ #define MAC_ADDR_LEN ETHARP_HWADDR_LEN #ifndef ETH_MAC_ADDR diff --git a/uLan/ports/driver/tms570_emac/ti_drv_mdio.h b/uLan/ports/driver/tms570_emac/ti_drv_mdio.h index e115231..e17046c 100644 --- a/uLan/ports/driver/tms570_emac/ti_drv_mdio.h +++ b/uLan/ports/driver/tms570_emac/ti_drv_mdio.h @@ -32,6 +32,7 @@ * */ +#if 0 #ifndef __MDIO_H__ #define __MDIO_H__ @@ -163,3 +164,4 @@ MDIOInit(volatile tms570_mdio_t *baseAddr, uint32_t mdioInputFreq, } #endif #endif /* __MDIO_H__ */ +#endif /* 0 */ diff --git a/uLan/ports/driver/tms570_emac/tms570_netif.h b/uLan/ports/driver/tms570_emac/tms570_netif.h index 325249a..c2087ed 100644..100755 --- a/uLan/ports/driver/tms570_emac/tms570_netif.h +++ b/uLan/ports/driver/tms570_emac/tms570_netif.h @@ -1,60 +1,60 @@ -/* - * Copyright (c) 2013, 2015 Czech Technical University in Prague - * Czech Republic - * - * 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. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. - * - * Author: Premysl Houdek <houdepre@fel.cvut.cz> - * Mentor: Pavel Pisa <pisa@cmp.felk.cvut.cz> - * Industrial Informatics Group, FEE, Czech Technical University in Prague - * - * Based on work of Carlos Jenkins, Rostislav Lisovy, Jan Dolezal - */ - -#ifndef __TMS570_NETIF_H -#define __TMS570_NETIF_H - -//#define TMS570_NETIF_DEBUG 1 - -#ifdef TMS570_NETIF_DEBUG -#define tms570_eth_debug_printf sys_arch_printk -#else -#define tms570_eth_debug_printf(...) -#endif - -err_t tms570_eth_init_netif(struct netif *netif); -struct tms570_netif_state *tms570_eth_init_state(); - -#if TMS570_NETIF_DEBUG -struct emac_rx_bd; -int tms570_eth_debug_get_BD_num(volatile void *ptr, struct tms570_netif_state *nf_state); -void tms570_eth_debug_print_rxch(struct tms570_netif_state *nf_state); -void tms570_eth_debug_print_txch(struct tms570_netif_state *nf_state); -void tms570_eth_debug_show_BD_chain(volatile struct emac_rx_bd *curr_bd, struct tms570_netif_state *nf_state); -void tms570_eth_debug_show_rx(struct tms570_netif_state *nf_state); -void tms570_eth_debug_show_tx(struct tms570_netif_state *nf_state); -void tms570_eth_debug_print_HDP(struct tms570_netif_state *nf_state); -void tms570_eth_debug_print_info(struct netif *netif); -#endif /* TMS570_NETIF_DEBUG */ - -#endif /* __TMS570_NETIF_H */ +/*
+ * Copyright (c) 2013, 2015 Czech Technical University in Prague
+ * Czech Republic
+ *
+ * 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.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *
+ * Author: Premysl Houdek <houdepre@fel.cvut.cz>
+ * Mentor: Pavel Pisa <pisa@cmp.felk.cvut.cz>
+ * Industrial Informatics Group, FEE, Czech Technical University in Prague
+ *
+ * Based on work of Carlos Jenkins, Rostislav Lisovy, Jan Dolezal
+ */
+
+#ifndef __TMS570_NETIF_H
+#define __TMS570_NETIF_H
+
+//#define TMS570_NETIF_DEBUG 1
+
+#ifdef TMS570_NETIF_DEBUG
+#define tms570_eth_debug_printf sys_arch_printk
+#else
+#define tms570_eth_debug_printf(...)
+#endif
+
+err_t tms570_eth_init_netif(struct netif *netif);
+struct tms570_netif_state *tms570_eth_init_state();
+
+#if TMS570_NETIF_DEBUG
+struct emac_rx_bd;
+int tms570_eth_debug_get_BD_num(volatile void *ptr, struct tms570_netif_state *nf_state);
+void tms570_eth_debug_print_rxch(struct tms570_netif_state *nf_state);
+void tms570_eth_debug_print_txch(struct tms570_netif_state *nf_state);
+void tms570_eth_debug_show_BD_chain(volatile struct emac_rx_bd *curr_bd, struct tms570_netif_state *nf_state);
+void tms570_eth_debug_show_rx(struct tms570_netif_state *nf_state);
+void tms570_eth_debug_show_tx(struct tms570_netif_state *nf_state);
+void tms570_eth_debug_print_HDP(struct tms570_netif_state *nf_state);
+void tms570_eth_debug_print_info(struct netif *netif);
+#endif /* TMS570_NETIF_DEBUG */
+
+#endif /* __TMS570_NETIF_H */
diff --git a/uLan/ports/os/lwipopts.h b/uLan/ports/os/lwipopts.h index 50ac639..6e4287a 100644 --- a/uLan/ports/os/lwipopts.h +++ b/uLan/ports/os/lwipopts.h @@ -1,3 +1,4 @@ +#if 0 /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. * All rights reserved. @@ -43,12 +44,23 @@ #define LWIP_ETHERNET 1 #define LWIP_NETIF_API 1 +#define LWIP_AUTOIP 1 /* Enable DHCP to test it, disable UDP checksum to easier inject packets */ #define LWIP_DHCP 1 #define LWIP_TIMEVAL_PRIVATE 0 -#define LWIP_POSIX_SOCKETS_IO_NAMES 0 +#define LWIP_POSIX_SOCKETS_IO_NAMES 1 +//#define LWIP_COMPAT_SOCKETS 2 +#ifndef FIONREAD +#define FIONREAD 1 +#endif +#ifndef FIONBIO +#define FIONBIO 1 +#endif +#define THREAD_STACK_SIZE 4096 +#define LWIP_TIMERS 1 /* Minimal changes to opt.h required for tcp unit tests: */ + #define MEM_SIZE 16000 #define TCP_SND_QUEUELEN 40 #define MEMP_NUM_TCP_SEG TCP_SND_QUEUELEN @@ -62,3 +74,199 @@ #define ETHARP_SUPPORT_STATIC_ENTRIES 1 #endif /* LWIP_HDR_LWIPOPTS_H__ */ + +#endif /* 0 */ + +/** + * \file lwipopts.h - Configuration options for lwIP + * + * Copyright (c) 2010 Texas Instruments Incorporated + */ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * 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. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels <adam@sics.se> + * + */ + +#ifndef __LWIPOPTS_H__ +#define __LWIPOPTS_H__ + +/***************************************************************************** +** CONFIGURATIONS +*****************************************************************************/ + +/* +** The macro CPSW_DUAL_MAC_MODE shall be defined for using CPSW ports in +** Dual MAC mode. +*/ +#define CPSW_DUAL_MAC_MODE + +/* +** The below macro should be defined for using lwIP with cache. For cache +** enabling, pbuf pool shall be cache line aligned. This is done by using +** separate pool for each memory. The alignment of pbuf pool to cache line +** size is done in /ports/cpsw/include/arch/cc.h. +*/ +/*#define LWIP_CACHE_ENABLED*/ + +#define SOC_CACHELINE_SIZE_BYTES 64 /* Number of bytes in + a cache line */ +/* +** The timeout for DHCP completion. lwIP library will wait for DHCP +** completion for (LWIP_DHCP_TIMEOUT / 100) seconds. +*/ +#define LWIP_DHCP_TIMEOUT 1000 + +/* +** The number of times DHCP is attempted. Each time, the library will wait +** for (LWIP_DHCP_TIMEOUT / 100) seconds for DHCP completion. +*/ +#define NUM_DHCP_TRIES 5 + +#define LWIP_ETHERNET 1 +#define LWIP_ARP 1 +#define LWIP_DNS 1 + +/***************************************************************************** +** lwIP SPECIFIC DEFINITIONS - To be used by lwIP stack +*****************************************************************************/ +#define HOST_TMR_INTERVAL 0 +#define DYNAMIC_HTTP_HEADERS + +/***************************************************************************** +** Platform specific locking +*****************************************************************************/ +#define SYS_LIGHTWEIGHT_PROT 1 +#define NO_SYS 0 +#define NO_SYS_NO_TIMERS 0 + +/***************************************************************************** +** Memory Options +*****************************************************************************/ +#define MEM_ALIGNMENT 4 +#define MEM_SIZE (1024 * 1024) /* 4K */ + +#define MEMP_NUM_PBUF 96 +#define MEMP_NUM_TCP_PCB 32 +#define MEMP_NUM_TCP_SEG 32 +#define PBUF_POOL_SIZE 512 +#define MEMP_MEM_MALLOC 1 +#define MEMP_MEM_INIT 1 +#define MEMP_OVERFLOW_CHECK 0 + +#ifdef LWIP_CACHE_ENABLED +#define MEMP_SEPARATE_POOLS 1 /* We want the pbuf + pool cache line + aligned*/ +#endif + +//#define MEMP_NUM_SYS_TIMEOUT (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_SUPPORT) + +/***************************************************************************** +** IP Options +*****************************************************************************/ +#define IP_REASSEMBLY 0 +#define IP_FRAG 0 +#define LWIP_IPV4 1 +#define LWIP_IPV6 1 + +/***************************************************************************** +** DHCP Options +*****************************************************************************/ +#define LWIP_DHCP 1 +#define DHCP_DOES_ARP_CHECK 0 + +/***************************************************************************** +** Auto IP Options +*****************************************************************************/ +#define LWIP_AUTOIP 1 +#define LWIP_DHCP_AUTOIP_COOP ((LWIP_DHCP) && (LWIP_AUTOIP)) + +/***************************************************************************** +** TCP Options +*****************************************************************************/ +#define TCP_MSS 1500 +#define TCP_WND (8 * TCP_MSS) +#define TCP_SND_BUF (8 * TCP_MSS) +#define TCP_OVERSIZE TCP_MSS +#define LWIP_TCPIP_CORE_LOCKING 1 + +/***************************************************************************** +** PBUF Options +*****************************************************************************/ +#define PBUF_LINK_HLEN 14 +#define PBUF_POOL_BUFSIZE 1520 /* + size of struct pbuf + shall be cache line + aligned be enabled */ +#define ETH_PAD_SIZE 0 +#define LWIP_NETCONN 1 + +/***************************************************************************** +** Socket Options +*****************************************************************************/ +#define LWIP_SOCKET 1 +#define SO_REUSE 1 + +/***************************************************************************** +** Debugging options +*****************************************************************************/ +#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_OFF +#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON | LWIP_DBG_TRACE \ + |LWIP_DBG_STATE | LWIP_DBG_FRESH) +#define DHCP_DEBUG LWIP_DBG_OFF +#define NETIF_DEBUG LWIP_DBG_OFF +#define IP_DEBUG LWIP_DBG_OFF +#define UDP_DEBUG LWIP_DBG_OFF +#define ETHARP_DEBUG LWIP_DBG_OFF +#define SYS_DEBUG LWIP_DBG_OFF +#define RAW_DEBUG LWIP_DBG_OFF +#define MEM_DEBUG LWIP_DBG_OFF +#define MEMP_DEBUG LWIP_DBG_OFF +#define PBUF_DEBUG LWIP_DBG_OFF +#define TCPIP_DEBUG LWIP_DBG_OFF +#define APP_DEBUG LWIP_DBG_OFF +#define SOCKETS_DEBUG LWIP_DBG_OFF +#define LWIP_STATS 0 +#define LWIP_STATS_DISPLAY 0 +#define LWIP_STATS_POSIX 0 +#define LWIP_DNS_API_DEFINE_ERRORS 1 + + + +/** + * LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names. + * (only used if you use sockets.c) + */ +#define LWIP_COMPAT_SOCKETS 0 + + #define LWIP_TIMEVAL_PRIVATE 0 + + #define LWIP_RAW 0 + +#endif /* __LWIPOPTS_H__ */ |