From 68057507c96dfe49cbc1455e6ba2ac10d10a7e8c Mon Sep 17 00:00:00 2001 From: Eyck-Alexander Jentzsch Date: Fri, 10 Apr 2026 13:22:54 +0200 Subject: [PATCH] adds small cleanups towards updating the entire build system --- CMakeLists.txt | 36 +- port/netxduo/CMakeLists.txt | 12 + port/netxduo/inc/nx_port.h | 183 ++++ port/netxduo/inc/nx_user.h | 781 ++++++++++++++++++ .../src/mnrs_network_driver.c | 0 port/threadx/inc/tx_port.h | 1 - 6 files changed, 988 insertions(+), 25 deletions(-) create mode 100644 port/netxduo/CMakeLists.txt create mode 100644 port/netxduo/inc/nx_port.h create mode 100644 port/netxduo/inc/nx_user.h rename port/{moonlight => netxduo}/src/mnrs_network_driver.c (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index c483711..de1d0e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,26 +4,30 @@ cmake_minimum_required(VERSION 3.21) set(BUILD_SHARED_LIBS OFF) include(${CMAKE_TOOLCHAIN_FILE}) ############################################################################### +add_subdirectory(port/moonlight) +set(TARGET_MEM "ram" CACHE STRING "memory map to use") +############################################################################### # Adds picolibc #set(CMAKE_SYSTEM_PROCESSOR riscv) set(__THREAD_LOCAL_STORAGE OFF) add_subdirectory(third-party/picolibc) #add_subdirectory(picolibc/semihost) -target_link_libraries(c PUBLIC gcc) +target_sources(c PRIVATE ${CMAKE_CURRENT_LIST_DIR}/port/picolibc/port.c) +target_link_libraries(c PUBLIC moonlight gcc) ############################################################################### # Adds threadx set(THREADX_CUSTOM_PORT ${CMAKE_CURRENT_LIST_DIR}/port/threadx) add_subdirectory(third-party/threadx) -target_link_libraries(threadx PUBLIC c) +target_link_libraries(threadx PUBLIC c moonlight) #Adds threadx_smp add_subdirectory(port/threadx_smp) -target_link_libraries(threadx_smp PUBLIC c) +target_link_libraries(threadx_smp PUBLIC c moonlight) # Adds netxduo set(NETXDUO_CUSTOM_PORT ${CMAKE_CURRENT_LIST_DIR}/port/threadx) set(NXD_ENABLE_FILE_SERVERS OFF) -set(NX_USER_FILE ${CMAKE_CURRENT_LIST_DIR}/port/threadx/inc/nx_user.h) +#set(NX_USER_FILE ${CMAKE_CURRENT_LIST_DIR}/port/threadx/inc/nx_user.h) add_subdirectory(third-party/netxduo) -target_link_libraries(netxduo PUBLIC c) +target_link_libraries(netxduo PUBLIC threadx) if(NX_DEBUG) target_compile_definitions(netxduo PRIVATE NX_DEBUG NX_DEBUG_PACKET NX_ENABLE_PACKET_DEBUG_INFO) endif() @@ -36,14 +40,10 @@ endif() project(threadx_demo C ASM) option(NX_DEBUG "compile netxduo debug output in" OFF) option(TX_TRACE "Enable dump of traces to be read by TraceX" OFF) -set(TARGET_MEM "ram" CACHE STRING "memory map to use") set(CMAKE_EXECUTABLE_SUFFIX_C ".elf") -add_subdirectory(port/moonlight) - function(setup_target TARGET) set(options) - set(oneValueArgs PLATFORM_TARGET) set(multiValueArgs LIBRARIES SOURCES) cmake_parse_arguments(ST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) if(ST_UNPARSED_ARGUMENTS) @@ -54,15 +54,7 @@ function(setup_target TARGET) set_target_properties(${TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} ) - if(ST_PLATFORM_TARGET) - target_add_moonlight_platform(${TARGET} PLATFORM_TARGET ${ST_PLATFORM_TARGET}) - else() - target_add_moonlight_platform(${TARGET}) - endif() - - if("netxduo" IN_LIST ST_LIBRARIES) - target_add_moonlight_network_driver(${TARGET}) - endif() + target_link_libraries(${TARGET} PRIVATE moonlight) if(ST_SOURCES) target_sources(${TARGET} PRIVATE ${ST_SOURCES}) @@ -73,10 +65,6 @@ function(setup_target TARGET) endif() target_link_options(${TARGET} PRIVATE - -nostartfiles - -nostdlib - -T ${CMAKE_SOURCE_DIR}/src/${TARGET_MEM}.lds - -Wl,--gc-sections -Wl,-Map=${CMAKE_BINARY_DIR}/${TARGET}.map) add_custom_command(TARGET ${TARGET} POST_BUILD @@ -89,5 +77,5 @@ function(setup_target TARGET) endfunction() setup_target(thread_demo LIBRARIES threadx SOURCES src/thread_demo/main.c) -setup_target(tcp_demo LIBRARIES threadx netxduo SOURCES src/tcp_demo/main.c) -setup_target(smp_demo PLATFORM_TARGET moonlight_platform_common_smp LIBRARIES threadx_smp SOURCES src/thread_demo/main.c) +#setup_target(tcp_demo LIBRARIES threadx netxduo SOURCES src/tcp_demo/main.c) +#setup_target(smp_demo LIBRARIES threadx_smp SOURCES src/thread_demo/main.c) diff --git a/port/netxduo/CMakeLists.txt b/port/netxduo/CMakeLists.txt new file mode 100644 index 0000000..ea5297c --- /dev/null +++ b/port/netxduo/CMakeLists.txt @@ -0,0 +1,12 @@ + +target_sources(${PROJECT_NAME} + PRIVATE + # {{BEGIN_TARGET_SOURCES}} + ${CMAKE_CURRENT_LIST_DIR}/src/mnrs_network_driver.c + # {{END_TARGET_SOURCES}} +) + +target_include_directories(${PROJECT_NAME} + PUBLIC + ${CMAKE_CURRENT_LIST_DIR}/inc +) diff --git a/port/netxduo/inc/nx_port.h b/port/netxduo/inc/nx_port.h new file mode 100644 index 0000000..2605d8d --- /dev/null +++ b/port/netxduo/inc/nx_port.h @@ -0,0 +1,183 @@ +/*************************************************************************** + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2025-present Eclipse ThreadX Contributors + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * SPDX-License-Identifier: MIT + **************************************************************************/ + +/**************************************************************************/ +/**************************************************************************/ +/** */ +/** NetX Component */ +/** */ +/** Port Specific */ +/** */ +/**************************************************************************/ +/**************************************************************************/ + +/**************************************************************************/ +/* */ +/* PORT SPECIFIC C INFORMATION RELEASE */ +/* */ +/* nx_port.h PIC32x/Microchip */ +/* 6.4.3 */ +/* */ +/* AUTHOR */ +/* */ +/* William E. Lamie, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This file contains data type definitions that make the NetX */ +/* real-time TCP/IP function identically on a variety of different */ +/* processor architectures. */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* 10-31-2022 Zhen Kong Initial PIC32x/Microchip */ +/* Support Version 6.2.0 */ +/* */ +/**************************************************************************/ + +#ifndef NX_PORT_H +#define NX_PORT_H +/* Determine if the optional NetX user define file should be used. */ + +#ifdef NX_INCLUDE_USER_DEFINE_FILE + +/* Yes, include the user defines in nx_user.h. The defines in this file may + alternately be defined on the command line. */ + +#include "nx_user.h" +#endif + +/* Default to little endian, since this is what most RISC-V targets are. */ + +#define NX_LITTLE_ENDIAN + +/* Define macros that swap the endian for little endian ports. */ +#ifdef NX_LITTLE_ENDIAN +#define NX_CHANGE_ULONG_ENDIAN(arg) \ + { \ + ULONG _i; \ + ULONG _tmp; \ + _i = (UINT)arg; \ + /* _i = A, B, C, D */ \ + _tmp = _i ^ (((_i) >> 16) | (_i << 16)); \ + /* _tmp = _i ^ (_i ROR 16) = A^C, B^D, C^A, D^B */ \ + _tmp &= 0xff00ffff; \ + /* _tmp = A^C, 0, C^A, D^B */ \ + _i = ((_i) >> 8) | (_i << 24); \ + /* _i = D, A, B, C */ \ + _i = _i ^ ((_tmp) >> 8); \ + /* _i = D, C, B, A */ \ + arg = _i; \ + } +#define NX_CHANGE_USHORT_ENDIAN(a) (a = (((a >> 8) | (a << 8)) & 0xFFFF)) + +#ifndef htonl +#define htonl(val) NX_CHANGE_ULONG_ENDIAN(val) +#endif /* htonl */ + +#ifndef ntohl +#define ntohl(val) NX_CHANGE_ULONG_ENDIAN(val) +#endif /* ntohl */ + +#ifndef htons +#define htons(val) NX_CHANGE_USHORT_ENDIAN(val) +#endif /*htons */ + +#ifndef ntohs +#define ntohs(val) NX_CHANGE_USHORT_ENDIAN(val) +#endif /*ntohs */ + +#else + +#define NX_CHANGE_ULONG_ENDIAN(a) +#define NX_CHANGE_USHORT_ENDIAN(a) + +#ifndef htons +#define htons(val) (val) +#endif /* htons */ + +#ifndef ntohs +#define ntohs(val) (val) +#endif /* ntohs */ + +#ifndef ntohl +#define ntohl(val) (val) +#endif + +#ifndef htonl +#define htonl(val) (val) +#endif /* htonl */ + +#endif + +/* Define several macros for the error checking shell in NetX. */ + +#ifndef TX_TIMER_PROCESS_IN_ISR + +#define NX_CALLER_CHECKING_EXTERNS \ + extern TX_THREAD* _tx_thread_current_ptr; \ + extern TX_THREAD _tx_timer_thread; \ + extern volatile ULONG TX_THREAD_GET_SYSTEM_STATE(); + +#define NX_THREADS_ONLY_CALLER_CHECKING \ + if ((TX_THREAD_GET_SYSTEM_STATE()) || (_tx_thread_current_ptr == TX_NULL) || \ + (_tx_thread_current_ptr == &_tx_timer_thread)) \ + return (NX_CALLER_ERROR); + +#define NX_INIT_AND_THREADS_CALLER_CHECKING \ + if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG)0xF0F0F0F0))) || \ + (_tx_thread_current_ptr == &_tx_timer_thread)) \ + return (NX_CALLER_ERROR); + +#define NX_NOT_ISR_CALLER_CHECKING \ + if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG)0xF0F0F0F0))) \ + return (NX_CALLER_ERROR); + +#define NX_THREAD_WAIT_CALLER_CHECKING \ + if ((wait_option) && ((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()) || \ + (_tx_thread_current_ptr == &_tx_timer_thread))) \ + return (NX_CALLER_ERROR); + +#else + +#define NX_CALLER_CHECKING_EXTERNS \ + extern TX_THREAD* _tx_thread_current_ptr; \ + extern volatile ULONG TX_THREAD_GET_SYSTEM_STATE(); + +#define NX_THREADS_ONLY_CALLER_CHECKING \ + if ((TX_THREAD_GET_SYSTEM_STATE()) || (_tx_thread_current_ptr == TX_NULL)) \ + return (NX_CALLER_ERROR); + +#define NX_INIT_AND_THREADS_CALLER_CHECKING \ + if (((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG)0xF0F0F0F0)))) \ + return (NX_CALLER_ERROR); + +#define NX_NOT_ISR_CALLER_CHECKING \ + if ((TX_THREAD_GET_SYSTEM_STATE()) && (TX_THREAD_GET_SYSTEM_STATE() < ((ULONG)0xF0F0F0F0))) \ + return (NX_CALLER_ERROR); + +#define NX_THREAD_WAIT_CALLER_CHECKING \ + if ((wait_option) && ((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()))) \ + return (NX_CALLER_ERROR); + +#endif + +/* Define the version ID of NetX. This may be utilized by the application. */ + +#ifdef NX_SYSTEM_INIT +CHAR _nx_version_id[] = "Copyright (c) 2024 Microsoft Corporation. * NetX Duo PIC32x/MPLAB Version 6.4.1 *"; +#else +extern CHAR _nx_version_id[]; +#endif + +#endif diff --git a/port/netxduo/inc/nx_user.h b/port/netxduo/inc/nx_user.h new file mode 100644 index 0000000..9d72a5c --- /dev/null +++ b/port/netxduo/inc/nx_user.h @@ -0,0 +1,781 @@ +/*************************************************************************** + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2025-present Eclipse ThreadX Contributors + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * SPDX-License-Identifier: MIT + **************************************************************************/ + +/**************************************************************************/ +/**************************************************************************/ +/** */ +/** NetX Component */ +/** */ +/** User Specific */ +/** */ +/**************************************************************************/ +/**************************************************************************/ + +/**************************************************************************/ +/* */ +/* PORT SPECIFIC C INFORMATION RELEASE */ +/* */ +/* nx_user.h PORTABLE C */ +/* 6.4.3 */ +/* */ +/* AUTHOR */ +/* */ +/* Yuxin Zhou, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This file contains user defines for configuring NetX in specific */ +/* ways. This file will have an effect only if the application and */ +/* NetX library are built with NX_INCLUDE_USER_DEFINE_FILE defined. */ +/* Note that all the defines in this file may also be made on the */ +/* command line when building NetX library and application objects. */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ +/* 08-02-2021 Yuxin Zhou Modified comment(s), and */ +/* supported TCP/IP offload, */ +/* resulting in version 6.1.8 */ +/* 04-25-2022 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1.11 */ +/* 10-31-2023 Tiejun Zhou Modified comment(s), */ +/* supported random IP id, */ +/* resulting in version 6.3.0 */ +/* */ +/**************************************************************************/ + +#ifndef NX_USER_H +#define NX_USER_H + +/* Define the base exponent of 2 for huge number. + * Only 16 and 32 are supported. */ +#define NX_CRYPTO_HUGE_NUMBER_BITS 32 +/* Define various build options for the NetX Duo port. The application should either make changes + here by commenting or un-commenting the conditional compilation defined OR supply the defines + though the compiler's equivalent of the -D option. */ + +/* Override various options with default values already assigned in nx_api.h or nx_port.h. Please + also refer to nx_port.h for descriptions on each of these options. */ + +/* Configuration options for Interface */ + +/* NX_MAX_PHYSICAL_INTERFACES defines the number physical network interfaces + present to NetX Duo IP layer. Physical interface does not include + loopback interface. By default there is at least one physical interface + in the system. */ +#define NX_MAX_PHYSICAL_INTERFACES 2 + +/* Defined, this option disables NetX Duo support on the 127.0.0.1 loopback interface. + 127.0.0.1 loopback interface is enabled by default. Uncomment out the follow code to disable + the loopback interface. */ +/* +#define NX_DISABLE_LOOPBACK_INTERFACE +*/ + +/* If defined, the link driver is able to specify extra capability, such as checksum offloading features. */ +/* +#define NX_ENABLE_INTERFACE_CAPABILITY +*/ + +/* Configuration options for IP */ + +/* This defines specifies the number of ThreadX timer ticks in one second. The default value is based + on ThreadX timer interrupt. */ +#ifdef TX_TIMER_TICKS_PER_SECOND +#define NX_IP_PERIODIC_RATE TX_TIMER_TICKS_PER_SECOND +#else +#define NX_IP_PERIODIC_RATE 100 +#endif + +/* Defined, NX_ENABLE_IP_RAW_PACKET_FILTER allows an application to install a filter + for incoming raw packets. This feature is disabled by default. */ +/* +#define NX_ENABLE_IP_RAW_PACKET_FILTER +*/ + +/* This define specifies the maximum number of RAW packets can be queued for receive. The default + value is 20. */ +/* +#define NX_IP_RAW_MAX_QUEUE_DEPTH 20 +*/ + +/* Defined, this option enables IP static routing feature. By default IP static routing + feature is not compiled in. */ +/* +#define NX_ENABLE_IP_STATIC_ROUTING +*/ + +/* This define specifies the size of IP routing table. The default value is 8. */ +/* +#define NX_IP_ROUTING_TABLE_SIZE 8 +*/ + +/* Defined, this option enables random IP id. By default IP id is increased by one for each packet. */ +/* +#define NX_ENABLE_IP_ID_RANDOMIZATION +*/ + +/* This define specifies the maximum number of multicast groups that can be joined. + The default value is 7. */ +/* +#define NX_MAX_MULTICAST_GROUPS 7 +*/ + +/* Configuration options for IPv6 */ + +/* Disable IPv6 processing in NetX Duo. */ + +#define NX_DISABLE_IPV6 + +/* Define the number of entries in IPv6 address pool. */ +/* +#ifdef NX_MAX_PHYSICAL_INTERFACES +#define NX_MAX_IPV6_ADDRESSES (NX_MAX_PHYSICAL_INTERFACES * 3) +#endif +*/ + +/* Do not process IPv6 ICMP Redirect Messages. */ +/* +#define NX_DISABLE_ICMPV6_REDIRECT_PROCESS +*/ + +/* Do not process IPv6 Router Advertisement Messages. */ +/* +#define NX_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS +*/ + +/* Do not send IPv6 Router Solicitation Messages. */ +/* +#define NX_DISABLE_ICMPV6_ROUTER_SOLICITATION +*/ + +/* Define the max number of router solicitations a host sends until a router response + is received. If no response is received, the host concludes no router is present. */ +/* +#define NX_ICMPV6_MAX_RTR_SOLICITATIONS 3 +*/ + +/* Define the interval between which the host sends router solicitations in seconds. */ +/* +#define NX_ICMPV6_RTR_SOLICITATION_INTERVAL 4 +*/ + +/* Define the maximum delay for the initial router solicitation in seconds. */ +/* +#define NX_ICMPV6_RTR_SOLICITATION_DELAY 1 +*/ + +/* Do not send ICMPv4 Error Messages. */ +/* +#define NX_DISABLE_ICMPV4_ERROR_MESSAGE +*/ + +/* Do not send ICMPv6 Error Messages. */ +/* +#define NX_DISABLE_ICMPV6_ERROR_MESSAGE +*/ + +/* Disable the Duplicate Address Detection (DAD) protocol when configuring the host IP address. */ +/* +#define NX_DISABLE_IPV6_DAD +*/ + +/* If defined, application is able to control whether or not to perform IPv6 stateless + address autoconfiguration with nxd_ipv6_stateless_address_autoconfig_enable() or + nxd_ipv6_stateless_address_autoconfig_disable() service. If defined, the system starts + with IPv6 stateless address autoconfiguration enabled. This feature is disabled by default. */ +/* +#define NX_IPV6_STATELESS_AUTOCONFIG_CONTROL +*/ + +/* If enabled, application is able to install a callback function to get notified + when an interface IPv6 address is changed. By default this feature is disabled. */ +/* +#define NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY +*/ + +/* Defined, this option prevents NetX Duo from removing stale (old) cache table entries + whose timeout has not expired so are otherwise still valid) to make room for new entries + when the table is full. Static and router entries are not purged. */ +/* +#define NX_DISABLE_IPV6_PURGE_UNUSED_CACHE_ENTRIES +*/ + +/* This define enables simple IPv6 multicast group join/leave function. By default + the IPv6 multicast join/leave function is not enabled. */ +/* +#define NX_ENABLE_IPV6_MULTICAST +*/ + +/* Defined, Minimum Path MTU Discovery feature is enabled. */ +/* +#define NX_ENABLE_IPV6_PATH_MTU_DISCOVERY +*/ + +/* Define wait interval in seconds to reset the path MTU for a destination + table entry after decreasing it in response to a packet too big error message. + RFC 1981 Section 5.4 states the minimum time to wait is + 5 minutes and recommends 10 minutes. +*/ +/* +#define NX_PATH_MTU_INCREASE_WAIT_INTERVAL 600 +*/ + +/* Configuration options for Neighbor Discovery. */ +/* Define values used for Neighbor Discovery protocol. + The default values are suggested by RFC2461, chapter 10. */ + +/* Define the maximum number of multicast Neighbor Solicitation packets + NetX Duo sends for a packet destination needing physical mapping + to the IP address. */ +/* +#define NX_MAX_MULTICAST_SOLICIT 3 +*/ + +/* Define the maximum number of unicast Neighbor Solicitation packets + NetX Duo sends for a cache entry whose reachable time has expired + and gone "stale". */ +/* +#define NX_MAX_UNICAST_SOLICIT 3 +*/ + +/* Define the length of time, in seconds, that a Neighbor Cache table entry + remains in the reachable state before it becomes state. */ +/* +#define NX_REACHABLE_TIME 30 +*/ + +/* Define the length of time, in milliseconds, between retransmitting + Neighbor Solicitation (NS) packets. */ +/* +#define NX_RETRANS_TIMER 1000 +*/ + +/* Define the length of time, in seconds, for a Neighbor Cache entry + to remain in the Delay state. This is the Delay first probe timer. */ +/* +#define NX_DELAY_FIRST_PROBE_TIME 5 +*/ + +/* This defines specifies the maximum number of packets that can be queued while waiting for a + Neighbor Discovery to resolve an IPv6 address. The default value is 4. */ +/* +#define NX_ND_MAX_QUEUE_DEPTH 4 +*/ + +/* Define the maximum ICMPv6 Duplicate Address Detect Transmit . */ +/* +#define NX_IPV6_DAD_TRANSMITS 3 +*/ + +/* Define the number of neighbor cache entries. */ +/* +#define NX_IPV6_NEIGHBOR_CACHE_SIZE 16 +*/ + +/* Define the size of the IPv6 destination table. */ +/* +#define NX_IPV6_DESTINATION_TABLE_SIZE 8 +*/ + +/* Define the size of the IPv6 prefix table. */ +/* +#define NX_IPV6_PREFIX_LIST_TABLE_SIZE 8 +*/ + +/* Configuration options for IPSEC */ + +/* This define enables IPSEC in NetX Duo. */ +/* +#define NX_IPSEC_ENABLE +*/ + +/* Configuration options for NAT */ + +/* This define enables NAT process in NetX Duo. */ +/* +#define NX_NAT_ENABLE +*/ + +/* Configuration options for IGMP */ + +/* Defined, IGMP v2 support is disabled. By default NetX Duo + is built with IGMPv2 enabled . By uncommenting this option, + NetX Duo reverts back to IGMPv1 only. */ +/* +#define NX_DISABLE_IGMPV2 +*/ + +/* Configuration options for ARP */ + +/* When defines, ARP reply is sent when address conflict occurs. */ +/* +#define NX_ARP_DEFEND_BY_REPLY +*/ + +/* To use the ARP collision handler to check for invalid ARP messages + matching existing entries in the table (man in the middle attack), + enable this feature. */ +/* +#define NX_ENABLE_ARP_MAC_CHANGE_NOTIFICATION +*/ + +/* This define specifies the number of seconds ARP entries remain valid. The default value of 0 disables + aging of ARP entries. */ +/* +#define NX_ARP_EXPIRATION_RATE 0 +*/ + +/* This define specifies the number of seconds between ARP retries. The default value is 10, which represents + 10 seconds. */ +/* +#define NX_ARP_UPDATE_RATE 10 +*/ + +/* This define specifies the maximum number of ARP retries made without an ARP response. The default + value is 18. */ +/* +#define NX_ARP_MAXIMUM_RETRIES 18 +*/ + +/* This defines specifies the maximum number of packets that can be queued while waiting for an ARP + response. The default value is 4. */ +/* +#define NX_ARP_MAX_QUEUE_DEPTH 4 +*/ + +/* Defined, this option disables entering ARP request information in the ARP cache. */ +/* +#define NX_DISABLE_ARP_AUTO_ENTRY +*/ + +/* Define the ARP defend interval. The default value is 10 seconds. */ +/* +#define NX_ARP_DEFEND_INTERVAL 10 +*/ + +/* Configuration options for TCP */ + +/* This define specifies how the number of system ticks (NX_IP_PERIODIC_RATE) is divided to calculate the + timer rate for the TCP delayed ACK processing. The default value is 5, which represents 200ms. */ +/* +#define NX_TCP_ACK_TIMER_RATE 5 +*/ + +/* This define specifies how the number of system ticks (NX_IP_PERIODIC_RATE) is divided to calculate the + fast TCP timer rate. The fast TCP timer is used to drive various TCP timers, including the delayed ACK + timer. The default value is 10, which represents 100ms. */ +/* +#define NX_TCP_FAST_TIMER_RATE 10 +*/ + +/* This define specifies how the number of system ticks (NX_IP_PERIODIC_RATE) is divided to calculate the + timer rate for the TCP transmit retry processing. The default value is 1, which represents 1 second. */ +/* +#define NX_TCP_TRANSMIT_TIMER_RATE 1 +*/ + +/* This define specifies how many seconds of inactivity before the keepalive timer activates. The default + value is 7200, which represents 2 hours. */ +/* +#define NX_TCP_KEEPALIVE_INITIAL 7200 +*/ + +/* This define specifies how many seconds between retries of the keepalive timer assuming the other side + of the connection is not responding. The default value is 75, which represents 75 seconds between + retries. */ +/* +#define NX_TCP_KEEPALIVE_RETRY 75 +*/ + +/* This define specifies the maximum packets that are out of order. The default value is 8. */ +/* +#define NX_TCP_MAX_OUT_OF_ORDER_PACKETS 8 +*/ + +/* This define specifies the maximum number of TCP server listen requests. The default value is 10. */ +/* +#define NX_MAX_LISTEN_REQUESTS 10 +*/ + +/* Defined, this option enables the optional TCP keepalive timer. */ +/* +#define NX_ENABLE_TCP_KEEPALIVE +*/ + +/* Defined, this option enables the optional TCP immediate ACK response processing. */ +/* +#define NX_TCP_IMMEDIATE_ACK +*/ + +/* This define specifies the number of TCP packets to receive before sending an ACK. */ +/* The default value is 2: ack every 2 packets. */ +/* +#define NX_TCP_ACK_EVERY_N_PACKETS 2 +*/ + +/* Automatically define NX_TCP_ACK_EVERY_N_PACKETS to 1 if NX_TCP_IMMEDIATE_ACK is defined. + This is needed for backward compatibility. */ +#if (defined(NX_TCP_IMMEDIATE_ACK) && !defined(NX_TCP_ACK_EVERY_N_PACKETS)) +#define NX_TCP_ACK_EVERY_N_PACKETS 1 +#endif + +/* This define specifies how many transmit retires are allowed before the connection is deemed broken. + The default value is 10. */ +/* +#define NX_TCP_MAXIMUM_RETRIES 10 +*/ + +/* This define specifies the maximum depth of the TCP transmit queue before TCP send requests are + suspended or rejected. The default value is 20, which means that a maximum of 20 packets can be in + the transmit queue at any given time. */ +/* +#define NX_TCP_MAXIMUM_TX_QUEUE 20 +*/ + +/* This define specifies how the retransmit timeout period changes between successive retries. If this + value is 0, the initial retransmit timeout is the same as subsequent retransmit timeouts. If this + value is 1, each successive retransmit is twice as long. The default value is 0. */ +/* +#define NX_TCP_RETRY_SHIFT 0 +*/ + +/* This define specifies how many keepalive retries are allowed before the connection is deemed broken. + The default value is 10. */ +/* +#define NX_TCP_KEEPALIVE_RETRIES 10 +*/ + +/* Defined, this option enables the TCP window scaling feature. (RFC 1323). Default disabled. */ +/* +#define NX_ENABLE_TCP_WINDOW_SCALING +*/ + +/* Defined, this option disables the reset processing during disconnect when the timeout value is + specified as NX_NO_WAIT. */ +/* +#define NX_DISABLE_RESET_DISCONNECT +*/ + +/* If defined, the incoming SYN packet (connection request) is checked for a minimum acceptable + MSS for the host to accept the connection. The default minimum should be based on the host + application packet pool payload, socket transmit queue depth and relevant application specific parameters. */ +/* +#define NX_ENABLE_TCP_MSS_CHECK +#define NX_TCP_MSS_MINIMUM 128 +*/ + +/* If defined, NetX Duo has a notify callback for the transmit TCP socket queue decreased from + the maximum queue depth. */ +/* +#define NX_ENABLE_TCP_QUEUE_DEPTH_UPDATE_NOTIFY +*/ + +/* Defined, feature of low watermark is enabled. */ +/* +#define NX_ENABLE_LOW_WATERMARK +*/ + +/* Define the maximum receive queue for TCP socket. */ +/* +#ifdef NX_ENABLE_LOW_WATERMARK +#define NX_TCP_MAXIMUM_RX_QUEUE 20 +#endif +*/ + +/* Configuration options for fragmentation */ + +/* Defined, this option disables both IPv4 and IPv6 fragmentation and reassembly logic. */ +/* +#define NX_DISABLE_FRAGMENTATION +*/ + +/* Defined, this option process IP fragmentation immediately. */ +/* +#define NX_FRAGMENT_IMMEDIATE_ASSEMBLY +*/ + +/* This define specifies the maximum time of IP reassembly. The default value is 60. + By default this option is not defined. */ +/* +#define NX_IP_MAX_REASSEMBLY_TIME 60 +*/ + +/* This define specifies the maximum time of IPv4 reassembly. The default value is 15. + Note that if NX_IP_MAX_REASSEMBLY_TIME is defined, this option is automatically defined as 60. + By default this option is not defined. */ +/* +#define NX_IPV4_MAX_REASSEMBLY_TIME 15 +*/ + +/* This define specifies the maximum time of IPv6 reassembly. The default value is 60. + Note that if NX_IP_MAX_REASSEMBLY_TIME is defined, this option is automatically defined as 60. + By default this option is not defined. */ +/* +#define NX_IPV6_MAX_REASSEMBLY_TIME 60 +*/ + +/* Configuration options for checksum */ + +/* Defined, this option disables checksum logic on received ICMPv4 packets. + Note that if NX_DISABLE_ICMP_RX_CHECKSUM is defined, this option is + automatically defined. By default this option is not defined.*/ +/* +#define NX_DISABLE_ICMPV4_RX_CHECKSUM +*/ + +/* Defined, this option disables checksum logic on received ICMPv6 packets. + Note that if NX_DISABLE_ICMP_RX_CHECKSUM is defined, this option is + automatically defined. By default this option is not defined.*/ +/* +#define NX_DISABLE_ICMPV6_RX_CHECKSUM +*/ + +/* Defined, this option disables checksum logic on received ICMPv4 or ICMPv6 packets. + Note that if NX_DISABLE_ICMP_RX_CHECKSUM is defined, NX_DISABLE_ICMPV4_RX_CHECKSUM + and NX_DISABLE_ICMPV6_RX_CHECKSUM are automatically defined. */ +/* +#define NX_DISABLE_ICMP_RX_CHECKSUM +*/ + +/* Defined, this option disables checksum logic on transmitted ICMPv4 packets. + Note that if NX_DISABLE_ICMP_TX_CHECKSUM is defined, this option is + automatically defined. By default this option is not defined.*/ +/* +#define NX_DISABLE_ICMPV4_TX_CHECKSUM +*/ + +/* Defined, this option disables checksum logic on transmitted ICMPv6 packets. + Note that if NX_DISABLE_ICMP_TX_CHECKSUM is defined, this option is + automatically defined. By default this option is not defined.*/ +/* +#define NX_DISABLE_ICMPV6_TX_CHECKSUM +*/ + +/* Defined, this option disables checksum logic on transmitted ICMPv4 or ICMPv6 packets. + Note that if NX_DISABLE_ICMP_TX_CHECKSUM is defined, NX_DISABLE_ICMPV4_TX_CHECKSUM + and NX_DISABLE_ICMPV6_TX_CHECKSUM are automatically defined. */ +/* +#define NX_DISABLE_ICMP_TX_CHECKSUM +*/ + +/* Defined, this option disables checksum logic on received IP packets. This is useful if the link-layer + has reliable checksum or CRC logic. */ +/* +#define NX_DISABLE_IP_RX_CHECKSUM +*/ + +/* Defined, this option disables checksum logic on transmitted IP packets. */ +/* +#define NX_DISABLE_IP_TX_CHECKSUM +*/ + +/* Defined, this option disables checksum logic on received TCP packets. */ +/* +#define NX_DISABLE_TCP_RX_CHECKSUM +*/ + +/* Defined, this option disables checksum logic on transmitted TCP packets. */ +/* +#define NX_DISABLE_TCP_TX_CHECKSUM +*/ + +/* Defined, this option disables checksum logic on received UDP packets. */ + +/* +#define NX_DISABLE_UDP_RX_CHECKSUM +*/ + +/* Defined, this option disables checksum logic on transmitted UDP packets. Note that + IPV6 requires the UDP checksum computed for outgoing packets. If this option is + defined, the IPv6 NetX Duo host must ensure the UDP checksum is computed elsewhere + before the packet is transmitted. */ +/* +#define NX_DISABLE_UDP_TX_CHECKSUM +*/ + +/* Configuration options for statistics. */ + +/* Defined, ARP information gathering is disabled. */ +/* +#define NX_DISABLE_ARP_INFO +*/ + +/* Defined, IP information gathering is disabled. */ +/* +#define NX_DISABLE_IP_INFO +*/ + +/* Defined, ICMP information gathering is disabled. */ +/* +#define NX_DISABLE_ICMP_INFO +*/ + +/* Defined, IGMP information gathering is disabled. */ +/* +#define NX_DISABLE_IGMP_INFO +*/ + +/* Defined, packet information gathering is disabled. */ +/* +#define NX_DISABLE_PACKET_INFO +*/ + +/* Defined, RARP information gathering is disabled. */ +/* +#define NX_DISABLE_RARP_INFO +*/ + +/* Defined, TCP information gathering is disabled. */ +/* +#define NX_DISABLE_TCP_INFO +*/ + +/* Defined, UDP information gathering is disabled. */ +/* +#define NX_DISABLE_UDP_INFO +*/ + +/* Configuration options for Packet Pool */ + +/* This define specifies the size of the physical packet header. The default value is 16 (based on + a typical 16-byte Ethernet header). */ +/* +#define NX_PHYSICAL_HEADER 16 +*/ + +/* This define specifies the size of the physical packet trailer and is typically used to reserve storage + for things like Ethernet CRCs, etc. */ +/* +#define NX_PHYSICAL_TRAILER 4 +*/ + +/* Defined, this option disables the addition size checking on received packets. */ +/* +#define NX_DISABLE_RX_SIZE_CHECKING +*/ + +/* Defined, packet debug infromation is enabled. */ +/* +#define NX_ENABLE_PACKET_DEBUG_INFO +*/ + +/* Defined, NX_PACKET structure is padded for alignment purpose. The default is no padding. */ +/* +#define NX_PACKET_HEADER_PAD +#define NX_PACKET_HEADER_PAD_SIZE 1 +*/ + +/* Defined, packet header and payload are aligned automatically by the value. The default value is sizeof(ULONG). */ +/* +#define NX_PACKET_ALIGNMENT sizeof(ULONG) +*/ + +/* If defined, the packet chain feature is removed. */ +/* +#define NX_DISABLE_PACKET_CHAIN +*/ + +/* Defined, the IP instance manages two packet pools. */ +/* +#define NX_ENABLE_DUAL_PACKET_POOL +*/ + +/* Configuration options for Others */ + +/* Defined, this option bypasses the basic NetX error checking. This define is typically used + after the application is fully debugged. */ +/* +#define NX_DISABLE_ERROR_CHECKING +*/ + +/* Defined, this option enables deferred driver packet handling. This allows the driver to place a raw + packet on the IP instance and have the driver's real processing routine called from the NetX internal + IP helper thread. */ +#define NX_DRIVER_DEFERRED_PROCESSING + +/* Defined, the source address of incoming packet is checked. The default is disabled. */ +/* +#define NX_ENABLE_SOURCE_ADDRESS_CHECK +*/ + +/* Defined, the extended notify support is enabled. This feature adds additional callback/notify services + to NetX Duo API for notifying the application of socket events, such as TCP connection and disconnect + completion. These extended notify functions are mainly used by the BSD wrapper. The default is this + feature is disabled. */ +/* +#define NX_ENABLE_EXTENDED_NOTIFY_SUPPORT +*/ + +/* Defined, ASSERT is disabled. The default is enabled. */ +/* +#define NX_DISABLE_ASSERT +*/ + +/* Define the process when assert fails. */ +/* +#define NX_ASSERT_FAIL while (1) tx_thread_sleep(NX_WAIT_FOREVER); +*/ + +/* Defined, the IPv4 feature is disabled. */ +/* +#define NX_DISABLE_IPV4 +*/ + +/* Defined, the destination address of ICMP packet is checked. The default is disabled. + An ICMP Echo Request destined to an IP broadcast or IP multicast address will be silently discarded. +*/ +/* +#define NX_ENABLE_ICMP_ADDRESS_CHECK +*/ + +/* Define the max string length. The default value is 1024. */ +/* +#define NX_MAX_STRING_LENGTH 1024 +*/ + +/* Defined, the TCP/IP offload feature is enabled. + NX_ENABLE_INTERFACE_CAPABILITY must be defined to enable this feature. */ +/* +#define NX_ENABLE_TCPIP_OFFLOAD +*/ + +/* Defined, the VLAN feature is enabled. + Note: Require driver support to use APIs from this file. + A quick check in driver is to search for + NX_LINK_RAW_PACKET_SEND. VLAN APIs are not supported if not found. */ +/* +#define NX_ENABLE_VLAN +*/ + +#ifdef __cplusplus +extern "C" +{ +#endif + + int rand(void); + void srand(unsigned seed); + +#ifdef __cplusplus +} +#endif + +#define NX_RAND rand +#define NX_SRAND srand +#endif +// hacky workaround for missing include in netxduo/common/src/nx_ram_network_driver.c +#ifdef NX_DEBUG +#include +#endif \ No newline at end of file diff --git a/port/moonlight/src/mnrs_network_driver.c b/port/netxduo/src/mnrs_network_driver.c similarity index 100% rename from port/moonlight/src/mnrs_network_driver.c rename to port/netxduo/src/mnrs_network_driver.c diff --git a/port/threadx/inc/tx_port.h b/port/threadx/inc/tx_port.h index 3bd9927..98b46d9 100644 --- a/port/threadx/inc/tx_port.h +++ b/port/threadx/inc/tx_port.h @@ -77,7 +77,6 @@ /* Yes, include the user defines in tx_user.h. The defines in this file may alternately be defined on the command line. */ -#include "nx_user.h" #include "tx_user.h" #endif