changes ULONG to UINT32 for 64bit netxduo

This commit is contained in:
2026-04-12 19:02:44 +02:00
parent 91632bcdee
commit 5b8c72cd9d
5 changed files with 31 additions and 28 deletions

View File

@@ -56,6 +56,9 @@
#include "nx_user.h"
#endif
#include "tx_port.h"
typedef unsigned int UINT32;
_Static_assert(sizeof(UINT32) == 4, "UINT32 must be 4 bytes");
/* Default to little endian, since this is what most RISC-V targets are. */
@@ -63,10 +66,10 @@
/* Define macros that swap the endian for little endian ports. */
#ifdef NX_LITTLE_ENDIAN
#define NX_CHANGE_ULONG_ENDIAN(arg) \
#define NX_CHANGE_UINT32_ENDIAN(arg) \
{ \
ULONG _i; \
ULONG _tmp; \
UINT32 _i; \
UINT32 _tmp; \
_i = (UINT)arg; \
/* _i = A, B, C, D */ \
_tmp = _i ^ (((_i) >> 16) | (_i << 16)); \
@@ -82,11 +85,11 @@
#define NX_CHANGE_USHORT_ENDIAN(a) (a = (((a >> 8) | (a << 8)) & 0xFFFF))
#ifndef htonl
#define htonl(val) NX_CHANGE_ULONG_ENDIAN(val)
#define htonl(val) NX_CHANGE_UINT32_ENDIAN(val)
#endif /* htonl */
#ifndef ntohl
#define ntohl(val) NX_CHANGE_ULONG_ENDIAN(val)
#define ntohl(val) NX_CHANGE_UINT32_ENDIAN(val)
#endif /* ntohl */
#ifndef htons
@@ -99,7 +102,7 @@
#else
#define NX_CHANGE_ULONG_ENDIAN(a)
#define NX_CHANGE_UINT32_ENDIAN(a)
#define NX_CHANGE_USHORT_ENDIAN(a)
#ifndef htons

View File

@@ -136,9 +136,9 @@
/* 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

View File

@@ -66,8 +66,8 @@ extern int register_irq_handler(unsigned irq_num, void (*handler)());
/* For the ethernet driver, physical addresses are allocated starting
at the preset value and then incremented before the next allocation. */
// Locally Administered Addresses that can be assigned by network, range is 02-00-00 to 02-00-5E
const ULONG mnrs_mac_address_msw = 0x0200;
const ULONG mnrs_mac_address_lsw = 0x00334450;
const UINT32 mnrs_mac_address_msw = 0x0200;
const UINT32 mnrs_mac_address_lsw = 0x00334450;
/* Define driver prototypes. */
VOID nx_mnrs_network_driver(NX_IP_DRIVER* driver_req_ptr);
@@ -81,8 +81,8 @@ static VOID _nx_mnrs_eth_recv_packet_eth1(VOID);
#define NX_MNRS_DRIVER_MAX_MCAST_ADDRESSES 3
typedef struct MAC_ADDRESS_STRUCT
{
ULONG nx_mac_address_msw;
ULONG nx_mac_address_lsw;
UINT32 nx_mac_address_msw;
UINT32 nx_mac_address_lsw;
} MAC_ADDRESS;
/* Define an application-specific data structure that holds internal
@@ -173,7 +173,7 @@ VOID nx_mnrs_network_driver(NX_IP_DRIVER* driver_req_ptr)
UINT interface_index;
USHORT ether_type;
#ifndef NX_ENABLE_VLAN
ULONG* ethernet_frame_ptr;
UINT32* ethernet_frame_ptr;
#endif /* NX_ENABLE_VLAN */
/* Setup the IP pointer from the driver request. */
@@ -408,7 +408,7 @@ VOID nx_mnrs_network_driver(NX_IP_DRIVER* driver_req_ptr)
/* Setup the ethernet frame pointer to build the ethernet frame. Backup another 2
bytes to get 32-bit word alignment. */
/*lint -e{927} -e{826} suppress cast of pointer to pointer, since it is necessary */
ethernet_frame_ptr = (ULONG*)(packet_ptr->nx_packet_prepend_ptr - 2);
ethernet_frame_ptr = (UINT32*)(packet_ptr->nx_packet_prepend_ptr - 2);
/* Build the ethernet frame. */
*ethernet_frame_ptr = driver_req_ptr->nx_ip_driver_physical_address_msw;
*(ethernet_frame_ptr + 1) = driver_req_ptr->nx_ip_driver_physical_address_lsw;
@@ -416,10 +416,10 @@ VOID nx_mnrs_network_driver(NX_IP_DRIVER* driver_req_ptr)
(interface_ptr->nx_interface_physical_address_lsw >> 16);
*(ethernet_frame_ptr + 3) = (interface_ptr->nx_interface_physical_address_lsw << 16) | ether_type;
/* Endian swapping if NX_LITTLE_ENDIAN is defined. */
NX_CHANGE_ULONG_ENDIAN(*(ethernet_frame_ptr));
NX_CHANGE_ULONG_ENDIAN(*(ethernet_frame_ptr + 1));
NX_CHANGE_ULONG_ENDIAN(*(ethernet_frame_ptr + 2));
NX_CHANGE_ULONG_ENDIAN(*(ethernet_frame_ptr + 3));
NX_CHANGE_UINT32_ENDIAN(*(ethernet_frame_ptr));
NX_CHANGE_UINT32_ENDIAN(*(ethernet_frame_ptr + 1));
NX_CHANGE_UINT32_ENDIAN(*(ethernet_frame_ptr + 2));
NX_CHANGE_UINT32_ENDIAN(*(ethernet_frame_ptr + 3));
#endif /* NX_ENABLE_VLAN */
#ifdef NX_DEBUG_PACKET
printf("NetX MNRS ETH Driver Packet Send - %s\n", ip_ptr->nx_ip_name);
@@ -840,11 +840,11 @@ void _nx_mnrs_network_driver_receive(NX_IP* ip_ptr, NX_PACKET* packet_ptr, UINT
UINT _nx_mnrs_eth_send_packet(NX_PACKET* packet_ptr, volatile ethmac_t* ethmac)
{
ULONG size = 0;
UINT32 size = 0;
UCHAR* data;
UINT i;
ULONG buffer;
ULONG words;
UINT32 buffer;
UINT32 words;
/* Make sure the data length is less than MTU. */
if (packet_ptr->nx_packet_length > NX_MAX_PACKET_SIZE)
@@ -967,7 +967,7 @@ VOID _nx_mnrs_eth_recv_packet(UINT i)
VOID _nx_mnrs_eth_recv_packet_eth0(VOID)
{
ULONG old_threshold;
UINT32 old_threshold;
if (get_ethmac_mac_ctrl_rx_pending(ethmac0))
{
@@ -986,7 +986,7 @@ VOID _nx_mnrs_eth_recv_packet_eth0(VOID)
VOID _nx_mnrs_eth_recv_packet_eth1(VOID)
{
ULONG old_threshold;
UINT32 old_threshold;
if (get_ethmac_mac_ctrl_rx_pending(ethmac1))
{

View File

@@ -137,11 +137,11 @@ void thread_0_entry(ULONG thread_input)
UINT status;
NX_PACKET* my_packet;
ULONG length;
UINT32 length;
NXD_ADDRESS server_ipv4_address;
NXD_ADDRESS peer_address;
ULONG peer_port;
UINT32 peer_port;
NX_PARAMETER_NOT_USED(thread_input);
@@ -259,7 +259,7 @@ void thread_1_entry(ULONG thread_input)
UINT status;
NX_PACKET* packet_ptr;
ULONG actual_status;
UINT32 actual_status;
NX_PARAMETER_NOT_USED(thread_input);
@@ -331,7 +331,7 @@ void thread_1_entry(ULONG thread_input)
else
{
char buffer[64];
ULONG size;
UINT32 size;
nx_packet_data_extract_offset(packet_ptr, 0, buffer, 64, &size);
buffer[size] = 0;
printf("Received packet %lu with %s\n", thread_1_counter, buffer);