Updates NetX Duo to the upstream implementation
Uses the upstream ULONG APIs and passes RV64 callback pointers through ThreadX extension fields.
This commit is contained in:
1 parent
d404e17e5a
commit
608c4e0b0d
5 files changed
+63
-59
No files matched your search
@@ -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 UINT32 mnrs_mac_address_msw = 0x0200;
|
||||
const UINT32 mnrs_mac_address_lsw = 0x00334450;
|
||||
const ULONG mnrs_mac_address_msw = 0x0200;
|
||||
const ULONG 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
|
||||
{
|
||||
UINT32 nx_mac_address_msw;
|
||||
UINT32 nx_mac_address_lsw;
|
||||
ULONG nx_mac_address_msw;
|
||||
ULONG 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
|
||||
UINT32* ethernet_frame_ptr;
|
||||
ULONG* ethernet_frame_ptr;
|
||||
#endif /* NX_ENABLE_VLAN */
|
||||
|
||||
/* Setup the IP pointer from the driver request. */
|
||||
@@ -275,7 +275,7 @@ VOID nx_mnrs_network_driver(NX_IP_DRIVER* driver_req_ptr)
|
||||
/* Device driver shall initialize the Ethernet Controller here. */
|
||||
#ifdef NX_DEBUG
|
||||
printf("NetX MNRS ETH Driver Initialization - %s\n", ip_ptr->nx_ip_name);
|
||||
printf(" IP Address =%08X\n", ip_ptr->nx_ip_address);
|
||||
printf(" IP Address =%08lX\n", (unsigned long)ip_ptr->nx_ip_address);
|
||||
#endif
|
||||
// enable TX & RX path
|
||||
set_ethmac_mac_ctrl(nx_mnrs_driver[i].ethmac,
|
||||
@@ -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 = (UINT32*)(packet_ptr->nx_packet_prepend_ptr - 2);
|
||||
ethernet_frame_ptr = (ULONG*)(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_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));
|
||||
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));
|
||||
#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,10 @@ 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)
|
||||
{
|
||||
UINT32 size = 0;
|
||||
ULONG size = 0;
|
||||
UCHAR* data;
|
||||
UINT i;
|
||||
UINT32 buffer;
|
||||
UINT32 words;
|
||||
ULONG buffer;
|
||||
|
||||
/* Make sure the data length is less than MTU. */
|
||||
if (packet_ptr->nx_packet_length > NX_MAX_PACKET_SIZE)
|
||||
@@ -852,9 +851,8 @@ UINT _nx_mnrs_eth_send_packet(NX_PACKET* packet_ptr, volatile ethmac_t* ethmac)
|
||||
return NX_NOT_SUCCESSFUL;
|
||||
}
|
||||
/* get data pointer to be transmitted. */
|
||||
data = packet_ptr->nx_packet_prepend_ptr;
|
||||
size = packet_ptr->nx_packet_length;
|
||||
words = (size + 3) / 4;
|
||||
data = packet_ptr->nx_packet_prepend_ptr;
|
||||
size = packet_ptr->nx_packet_length;
|
||||
/* wait until ethmac is ready to receive packets */
|
||||
while (get_ethmac_mac_ctrl_tx_ready(ethmac) == 0)
|
||||
;
|
||||
@@ -967,7 +965,7 @@ VOID _nx_mnrs_eth_recv_packet(UINT i)
|
||||
|
||||
VOID _nx_mnrs_eth_recv_packet_eth0(VOID)
|
||||
{
|
||||
UINT32 old_threshold;
|
||||
UINT old_threshold;
|
||||
|
||||
if (get_ethmac_mac_ctrl_rx_pending(ethmac0))
|
||||
{
|
||||
@@ -986,7 +984,7 @@ VOID _nx_mnrs_eth_recv_packet_eth0(VOID)
|
||||
|
||||
VOID _nx_mnrs_eth_recv_packet_eth1(VOID)
|
||||
{
|
||||
UINT32 old_threshold;
|
||||
UINT old_threshold;
|
||||
|
||||
if (get_ethmac_mac_ctrl_rx_pending(ethmac1))
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user