diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c1eeea..f0fcd06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,12 @@ set(NXD_ENABLE_FILE_SERVERS OFF) 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) +if(NX_DEBUG) + target_compile_definitions(netxduo PRIVATE NX_DEBUG NX_DEBUG_PACKET NX_ENABLE_PACKET_DEBUG_INFO) +endif() +if(TX_TRACE) + target_compile_definitions(netxduo PUBLIC TX_ENABLE_EVENT_TRACE) +endif() ############################################################################### project(threadx_demo C ASM) option(NX_DEBUG "compile netxduo debug output in" OFF) diff --git a/port/moonlight/mnrs_network_driver.c b/port/moonlight/mnrs_network_driver.c index d151011..2a1bb72 100644 --- a/port/moonlight/mnrs_network_driver.c +++ b/port/moonlight/mnrs_network_driver.c @@ -799,7 +799,7 @@ void _nx_mnrs_network_driver_receive(NX_IP* ip_ptr, NX_PACKET* packet_ptr, UINT /* Adjust the packet length. */ packet_ptr->nx_packet_length = packet_ptr->nx_packet_length - NX_ETHERNET_SIZE; /* Route to the ip receive function. */ -#ifdef NX_DEBUG_PACKET +#ifdef NX_DEBUG printf("NetX MNRS ETH Driver IP Packet Receive - %s\n", ip_ptr->nx_ip_name); #endif _nx_ip_packet_deferred_receive(ip_ptr, packet_ptr); @@ -895,8 +895,9 @@ VOID _nx_mnrs_eth_recv_packet(UINT i) UINT packet_type; /* read the number of bits in the frame and convert it into number of words to read */ - bits_received = get_ethmac_mac_rx(nx_mnrs_driver[i].ethmac); - words_to_read = (bits_received + 31) / 32; + bits_received = get_ethmac_mac_rx(nx_mnrs_driver[i].ethmac); + bytes_received = (bits_received + 7) / 8; + words_to_read = (bits_received + 31) / 32; if (words_to_read < 4) { for (j = 0; j < words_to_read; j++) @@ -956,8 +957,8 @@ VOID _nx_mnrs_eth_recv_packet(UINT i) } else { - packet_ptr->nx_packet_length = (ULONG)bytes_received; - packet_ptr->nx_packet_append_ptr += (ULONG)bytes_received; + packet_ptr->nx_packet_length = bytes_received; + packet_ptr->nx_packet_append_ptr += bytes_received; } _nx_mnrs_network_driver_receive(ip_ptr, packet_ptr, i); diff --git a/port/threadx/inc/nx_user.h b/port/threadx/inc/nx_user.h index 9190965..c0915dd 100644 --- a/port/threadx/inc/nx_user.h +++ b/port/threadx/inc/nx_user.h @@ -776,3 +776,7 @@ extern "C" #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/threadx/inc/tx_port.h b/port/threadx/inc/tx_port.h index 2d647b3..c0ac1cd 100644 --- a/port/threadx/inc/tx_port.h +++ b/port/threadx/inc/tx_port.h @@ -103,8 +103,6 @@ typedef unsigned long long ULONG64; typedef short SHORT; typedef unsigned short USHORT; #define ULONG64_DEFINED -#define ALIGN_TYPE_DEFINED -#define ALIGN_TYPE ULONG64 /* Define the priority levels for ThreadX. Legal values range from 32 to 1024 and MUST be evenly divisible by 32. */