adds ThreadX clang-format settings and applies it to maceth driver

This commit is contained in:
2026-02-03 22:55:54 +01:00
parent 3e8fa257d5
commit 28c14404d2
3 changed files with 474 additions and 428 deletions

10
.clang-format Normal file
View File

@@ -0,0 +1,10 @@
BasedOnStyle: Microsoft
BinPackArguments: false
BinPackParameters: false
AlignAfterOpenBracket: DontAlign
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: true
IndentCaseLabels: true
PointerAlignment: Left
BraceWrapping:
AfterCaseLabel: true

View File

@@ -6,7 +6,7 @@
"comment": "clang-format" "comment": "clang-format"
} }
], ],
"editor.formatOnSave": false, "editor.formatOnSave": true,
"clangd.arguments": [ "clangd.arguments": [
"--pretty", "--pretty",
"--background-index", "--background-index",

View File

@@ -41,7 +41,6 @@ extern int register_irq_handler(unsigned irq_num, void (*handler)());
#define NX_LINK_MTU 1514 #define NX_LINK_MTU 1514
#define NX_MAX_PACKET_SIZE 1536 #define NX_MAX_PACKET_SIZE 1536
/* Define Ethernet address format. This is prepended to the incoming IP /* Define Ethernet address format. This is prepended to the incoming IP
and ARP/RARP messages. The frame beginning is 14 bytes, but for speed and ARP/RARP messages. The frame beginning is 14 bytes, but for speed
purposes, we are going to assume there are 16 bytes free in front of the purposes, we are going to assume there are 16 bytes free in front of the
@@ -71,7 +70,6 @@ extern int register_irq_handler(unsigned irq_num, void (*handler)());
const ULONG mnrs_mac_address_msw = 0x0200; const ULONG mnrs_mac_address_msw = 0x0200;
const ULONG mnrs_mac_address_lsw = 0x00334450; const ULONG mnrs_mac_address_lsw = 0x00334450;
/* Define driver prototypes. */ /* Define driver prototypes. */
VOID _nx_mnrs_network_driver(NX_IP_DRIVER *driver_req_ptr); VOID _nx_mnrs_network_driver(NX_IP_DRIVER *driver_req_ptr);
@@ -200,9 +198,12 @@ ULONG *ethernet_frame_ptr;
/* Obtain the index number of the network interface. */ /* Obtain the index number of the network interface. */
interface_index = interface_ptr -> nx_interface_index; interface_index = interface_ptr -> nx_interface_index;
/* Find out the driver interface if the driver command is not ATTACH. */ /* Find out the driver interface if the driver command is not ATTACH. */
if(driver_req_ptr->nx_ip_driver_command != NX_LINK_INTERFACE_ATTACH) { if (driver_req_ptr->nx_ip_driver_command != NX_LINK_INTERFACE_ATTACH)
for(i = 0; i < NX_MAX_PHYSICAL_INTERFACES; i++) { {
if(nx_mnrs_driver[i].nx_mnrs_network_driver_in_use == 0) { for (i = 0; i < NX_MAX_PHYSICAL_INTERFACES; i++)
{
if (nx_mnrs_driver[i].nx_mnrs_network_driver_in_use == 0)
{
continue; continue;
} }
if (nx_mnrs_driver[i].nx_mnrs_driver_ip_ptr != ip_ptr) if (nx_mnrs_driver[i].nx_mnrs_driver_ip_ptr != ip_ptr)
@@ -214,7 +215,8 @@ ULONG *ethernet_frame_ptr;
break; break;
} }
} }
if(i == NX_MAX_PHYSICAL_INTERFACES) { if (i == NX_MAX_PHYSICAL_INTERFACES)
{
driver_req_ptr->nx_ip_driver_status = NX_INVALID_INTERFACE; driver_req_ptr->nx_ip_driver_status = NX_INVALID_INTERFACE;
return; return;
} }
@@ -226,13 +228,16 @@ ULONG *ethernet_frame_ptr;
case NX_LINK_INTERFACE_ATTACH: case NX_LINK_INTERFACE_ATTACH:
{ {
/* Find an available driver instance to attach the interface. */ /* Find an available driver instance to attach the interface. */
for(i = 0; i < NX_MAX_PHYSICAL_INTERFACES; i++) { for (i = 0; i < NX_MAX_PHYSICAL_INTERFACES; i++)
if(nx_mnrs_driver[i].nx_mnrs_network_driver_in_use == 0) { {
if (nx_mnrs_driver[i].nx_mnrs_network_driver_in_use == 0)
{
break; break;
} }
} }
/* An available entry is found. */ /* An available entry is found. */
if(i < NX_MAX_PHYSICAL_INTERFACES) { if (i < NX_MAX_PHYSICAL_INTERFACES)
{
/* Set the IN USE flag.*/ /* Set the IN USE flag.*/
nx_mnrs_driver[i].nx_mnrs_network_driver_in_use = 1; nx_mnrs_driver[i].nx_mnrs_network_driver_in_use = 1;
nx_mnrs_driver[i].nx_mnrs_network_driver_id = i; nx_mnrs_driver[i].nx_mnrs_network_driver_id = i;
@@ -244,7 +249,8 @@ ULONG *ethernet_frame_ptr;
nx_mnrs_driver[i].nx_mnrs_driver_mac_address.nx_mac_address_msw = mnrs_mac_address_msw; nx_mnrs_driver[i].nx_mnrs_driver_mac_address.nx_mac_address_msw = mnrs_mac_address_msw;
nx_mnrs_driver[i].nx_mnrs_driver_mac_address.nx_mac_address_lsw = mnrs_mac_address_lsw + i; nx_mnrs_driver[i].nx_mnrs_driver_mac_address.nx_mac_address_lsw = mnrs_mac_address_lsw + i;
/* Record the peripheral address */ /* Record the peripheral address */
switch(i) { switch (i)
{
case 0: case 0:
nx_mnrs_driver[i].ethmac = ethmac0; nx_mnrs_driver[i].ethmac = ethmac0;
break; break;
@@ -285,7 +291,8 @@ ULONG *ethernet_frame_ptr;
#endif #endif
// enable TX & RX path // enable TX & RX path
set_ethmac_mac_ctrl(nx_mnrs_driver[i].ethmac, set_ethmac_mac_ctrl(nx_mnrs_driver[i].ethmac,
get_ethmac_mac_ctrl(nx_mnrs_driver[i].ethmac) & ~(ETHMAC_MAC_CTRL_TX_FLUSH(1)| ETHMAC_MAC_CTRL_RX_FLUSH(1))); get_ethmac_mac_ctrl(nx_mnrs_driver[i].ethmac) &
~(ETHMAC_MAC_CTRL_TX_FLUSH(1) | ETHMAC_MAC_CTRL_RX_FLUSH(1)));
register_irq_handler(ETH0_IRQ, &_nx_mnrs_eth_recv_packet_eth0); register_irq_handler(ETH0_IRQ, &_nx_mnrs_eth_recv_packet_eth0);
register_irq_handler(ETH1_IRQ, &_nx_mnrs_eth_recv_packet_eth1); register_irq_handler(ETH1_IRQ, &_nx_mnrs_eth_recv_packet_eth1);
csr_read_set_bits_mie(1 << ETH0_IRQ | 1 << ETH1_IRQ); csr_read_set_bits_mie(1 << ETH0_IRQ | 1 << ETH1_IRQ);
@@ -300,9 +307,11 @@ ULONG *ethernet_frame_ptr;
/* For this MNRS ETH driver, the MAC address is constructed by /* For this MNRS ETH driver, the MAC address is constructed by
incrementing a base lsw value, to simulate multiple nodes on the incrementing a base lsw value, to simulate multiple nodes on the
ethernet. */ ethernet. */
nx_ip_interface_physical_address_set(ip_ptr, interface_index, nx_ip_interface_physical_address_set(ip_ptr,
interface_index,
nx_mnrs_driver[i].nx_mnrs_driver_mac_address.nx_mac_address_msw, nx_mnrs_driver[i].nx_mnrs_driver_mac_address.nx_mac_address_msw,
nx_mnrs_driver[i].nx_mnrs_driver_mac_address.nx_mac_address_lsw, NX_FALSE); nx_mnrs_driver[i].nx_mnrs_driver_mac_address.nx_mac_address_lsw,
NX_FALSE);
/* Indicate to the IP software that IP to physical mapping is required. */ /* Indicate to the IP software that IP to physical mapping is required. */
nx_ip_interface_address_mapping_configure(ip_ptr, interface_index, NX_TRUE); nx_ip_interface_address_mapping_configure(ip_ptr, interface_index, NX_TRUE);
break; break;
@@ -317,7 +326,8 @@ ULONG *ethernet_frame_ptr;
// set_ethmac_mac_ctrl_tx_flush(nx_mnrs_driver[i].ethmac, 1); // set_ethmac_mac_ctrl_tx_flush(nx_mnrs_driver[i].ethmac, 1);
// set_ethmac_mac_ctrl_rx_flush(nx_mnrs_driver[i].ethmac, 1); // set_ethmac_mac_ctrl_rx_flush(nx_mnrs_driver[i].ethmac, 1);
set_ethmac_mac_ctrl(nx_mnrs_driver[i].ethmac, set_ethmac_mac_ctrl(nx_mnrs_driver[i].ethmac,
get_ethmac_mac_ctrl(nx_mnrs_driver[i].ethmac) | ETHMAC_MAC_CTRL_TX_FLUSH(1)| ETHMAC_MAC_CTRL_RX_FLUSH(1)); get_ethmac_mac_ctrl(nx_mnrs_driver[i].ethmac) | ETHMAC_MAC_CTRL_TX_FLUSH(1) |
ETHMAC_MAC_CTRL_RX_FLUSH(1));
/* Zero out the driver instance. */ /* Zero out the driver instance. */
memset(&(nx_mnrs_driver[i]), 0, sizeof(_nx_mnrs_network_driver_instance_type)); memset(&(nx_mnrs_driver[i]), 0, sizeof(_nx_mnrs_network_driver_instance_type));
break; break;
@@ -392,7 +402,8 @@ ULONG *ethernet_frame_ptr;
#ifdef NX_ENABLE_VLAN #ifdef NX_ENABLE_VLAN
/* Add Ethernet header. */ /* Add Ethernet header. */
if (nx_link_ethernet_header_add(ip_ptr, if (nx_link_ethernet_header_add(ip_ptr,
driver_req_ptr -> nx_ip_driver_interface -> nx_interface_index, packet_ptr, driver_req_ptr->nx_ip_driver_interface->nx_interface_index,
packet_ptr,
driver_req_ptr->nx_ip_driver_physical_address_msw, driver_req_ptr->nx_ip_driver_physical_address_msw,
driver_req_ptr->nx_ip_driver_physical_address_lsw, driver_req_ptr->nx_ip_driver_physical_address_lsw,
(UINT)ether_type)) (UINT)ether_type))
@@ -461,8 +472,10 @@ ULONG *ethernet_frame_ptr;
if (nx_mnrs_driver[i].nx_mnrs_driver_mcast_address[mcast_index].nx_mac_address_msw == 0 && if (nx_mnrs_driver[i].nx_mnrs_driver_mcast_address[mcast_index].nx_mac_address_msw == 0 &&
nx_mnrs_driver[i].nx_mnrs_driver_mcast_address[mcast_index].nx_mac_address_lsw == 0) nx_mnrs_driver[i].nx_mnrs_driver_mcast_address[mcast_index].nx_mac_address_lsw == 0)
{ {
nx_mnrs_driver[i].nx_mnrs_driver_mcast_address[mcast_index].nx_mac_address_msw = driver_req_ptr -> nx_ip_driver_physical_address_msw; nx_mnrs_driver[i].nx_mnrs_driver_mcast_address[mcast_index].nx_mac_address_msw =
nx_mnrs_driver[i].nx_mnrs_driver_mcast_address[mcast_index].nx_mac_address_lsw = driver_req_ptr -> nx_ip_driver_physical_address_lsw; driver_req_ptr->nx_ip_driver_physical_address_msw;
nx_mnrs_driver[i].nx_mnrs_driver_mcast_address[mcast_index].nx_mac_address_lsw =
driver_req_ptr->nx_ip_driver_physical_address_lsw;
break; break;
} }
} }
@@ -485,8 +498,10 @@ ULONG *ethernet_frame_ptr;
multicast MAC addresses by a simple look up table. */ multicast MAC addresses by a simple look up table. */
for (mcast_index = 0; mcast_index < NX_MNRS_DRIVER_MAX_MCAST_ADDRESSES; mcast_index++) for (mcast_index = 0; mcast_index < NX_MNRS_DRIVER_MAX_MCAST_ADDRESSES; mcast_index++)
{ {
if (nx_mnrs_driver[i].nx_mnrs_driver_mcast_address[mcast_index].nx_mac_address_msw == driver_req_ptr -> nx_ip_driver_physical_address_msw && if (nx_mnrs_driver[i].nx_mnrs_driver_mcast_address[mcast_index].nx_mac_address_msw ==
nx_mnrs_driver[i].nx_mnrs_driver_mcast_address[mcast_index].nx_mac_address_lsw == driver_req_ptr -> nx_ip_driver_physical_address_lsw) driver_req_ptr->nx_ip_driver_physical_address_msw &&
nx_mnrs_driver[i].nx_mnrs_driver_mcast_address[mcast_index].nx_mac_address_lsw ==
driver_req_ptr->nx_ip_driver_physical_address_lsw)
{ {
nx_mnrs_driver[i].nx_mnrs_driver_mcast_address[mcast_index].nx_mac_address_msw = 0; nx_mnrs_driver[i].nx_mnrs_driver_mcast_address[mcast_index].nx_mac_address_msw = 0;
nx_mnrs_driver[i].nx_mnrs_driver_mcast_address[mcast_index].nx_mac_address_lsw = 0; nx_mnrs_driver[i].nx_mnrs_driver_mcast_address[mcast_index].nx_mac_address_lsw = 0;
@@ -569,16 +584,21 @@ ULONG *ethernet_frame_ptr;
case NX_LINK_SET_PHYSICAL_ADDRESS: case NX_LINK_SET_PHYSICAL_ADDRESS:
{ {
/* Find an driver instance to attach the interface. */ /* Find an driver instance to attach the interface. */
for(i = 0; i < NX_MAX_PHYSICAL_INTERFACES; i++) { for (i = 0; i < NX_MAX_PHYSICAL_INTERFACES; i++)
if(nx_mnrs_driver[i].nx_mnrs_driver_interface_ptr == interface_ptr) { {
if (nx_mnrs_driver[i].nx_mnrs_driver_interface_ptr == interface_ptr)
{
break; break;
} }
} }
/* An available entry is found. */ /* An available entry is found. */
if(i < NX_MAX_PHYSICAL_INTERFACES) { if (i < NX_MAX_PHYSICAL_INTERFACES)
{
/* Set the physical address. */ /* Set the physical address. */
nx_mnrs_driver[i].nx_mnrs_driver_mac_address.nx_mac_address_msw = driver_req_ptr -> nx_ip_driver_physical_address_msw; nx_mnrs_driver[i].nx_mnrs_driver_mac_address.nx_mac_address_msw =
nx_mnrs_driver[i].nx_mnrs_driver_mac_address.nx_mac_address_lsw = driver_req_ptr -> nx_ip_driver_physical_address_lsw; driver_req_ptr->nx_ip_driver_physical_address_msw;
nx_mnrs_driver[i].nx_mnrs_driver_mac_address.nx_mac_address_lsw =
driver_req_ptr->nx_ip_driver_physical_address_lsw;
} }
else else
{ {
@@ -589,7 +609,8 @@ ULONG *ethernet_frame_ptr;
#ifdef NX_ENABLE_INTERFACE_CAPABILITY #ifdef NX_ENABLE_INTERFACE_CAPABILITY
case NX_INTERFACE_CAPABILITY_GET: case NX_INTERFACE_CAPABILITY_GET:
{ {
/* Return the capability of the Ethernet controller speed in the supplied return pointer. Unsupported feature. */ /* Return the capability of the Ethernet controller speed in the supplied return pointer. Unsupported
* feature. */
*(driver_req_ptr->nx_ip_driver_return_ptr) = 0; *(driver_req_ptr->nx_ip_driver_return_ptr) = 0;
break; break;
} }
@@ -703,7 +724,8 @@ UINT i, j;
/* Release the packet. */ /* Release the packet. */
nx_link_packet_transmitted(nx_mnrs_driver[interface_instance_id].nx_mnrs_driver_ip_ptr, nx_link_packet_transmitted(nx_mnrs_driver[interface_instance_id].nx_mnrs_driver_ip_ptr,
nx_mnrs_driver[interface_instance_id].nx_mnrs_driver_interface_ptr->nx_interface_index, nx_mnrs_driver[interface_instance_id].nx_mnrs_driver_interface_ptr->nx_interface_index,
packet_ptr, NX_NULL); packet_ptr,
NX_NULL);
#else #else
/* Remove the Ethernet header. In real hardware environments, this is typically /* Remove the Ethernet header. In real hardware environments, this is typically
done after a transmit complete interrupt. */ done after a transmit complete interrupt. */
@@ -776,7 +798,8 @@ UINT packet_type;
#ifdef NX_ENABLE_VLAN #ifdef NX_ENABLE_VLAN
nx_link_ethernet_packet_received(ip_ptr, nx_link_ethernet_packet_received(ip_ptr,
nx_mnrs_driver[interface_instance_id].nx_mnrs_driver_interface_ptr->nx_interface_index, nx_mnrs_driver[interface_instance_id].nx_mnrs_driver_interface_ptr->nx_interface_index,
packet_ptr, NX_NULL); packet_ptr,
NX_NULL);
#else #else
/* Pickup the packet header to determine where the packet needs to be /* Pickup the packet header to determine where the packet needs to be
@@ -784,7 +807,8 @@ UINT packet_type;
packet_type = (((UINT)(*(packet_ptr->nx_packet_prepend_ptr + 12))) << 8) | packet_type = (((UINT)(*(packet_ptr->nx_packet_prepend_ptr + 12))) << 8) |
((UINT)(*(packet_ptr->nx_packet_prepend_ptr + 13))); ((UINT)(*(packet_ptr->nx_packet_prepend_ptr + 13)));
/* Setup interface pointer. */ /* Setup interface pointer. */
packet_ptr -> nx_packet_address.nx_packet_interface_ptr = nx_mnrs_driver[interface_instance_id].nx_mnrs_driver_interface_ptr; packet_ptr->nx_packet_address.nx_packet_interface_ptr =
nx_mnrs_driver[interface_instance_id].nx_mnrs_driver_interface_ptr;
/* Route the incoming packet according to its ethernet type. */ /* Route the incoming packet according to its ethernet type. */
/* The MNRS ETH driver accepts both IPv4 and IPv6 frames. */ /* The MNRS ETH driver accepts both IPv4 and IPv6 frames. */
if ((packet_type == NX_ETHERNET_IP) || (packet_type == NX_ETHERNET_IPV6)) if ((packet_type == NX_ETHERNET_IP) || (packet_type == NX_ETHERNET_IPV6))
@@ -842,7 +866,8 @@ UINT packet_type;
#endif /* NX_ENABLE_VLAN */ #endif /* NX_ENABLE_VLAN */
} }
UINT _nx_mnrs_eth_send_packet(NX_PACKET *packet_ptr, volatile ethmac_t* ethmac){ UINT _nx_mnrs_eth_send_packet(NX_PACKET* packet_ptr, volatile ethmac_t* ethmac)
{
ULONG size = 0; ULONG size = 0;
UCHAR* data; UCHAR* data;
UINT i; UINT i;
@@ -861,10 +886,14 @@ ULONG words;
while (get_ethmac_mac_ctrl_tx_ready(ethmac) == 0) while (get_ethmac_mac_ctrl_tx_ready(ethmac) == 0)
; ;
set_ethmac_mac_tx(ethmac, size * 8); set_ethmac_mac_tx(ethmac, size * 8);
for(i=0; i<size; i+=4) { for (i = 0; i < size; i += 4)
if(i<size-3) { {
if (i < size - 3)
{
memcpy(&buffer, data + i, 4); memcpy(&buffer, data + i, 4);
} else { }
else
{
memcpy(&buffer, data + i, size - i); memcpy(&buffer, data + i, size - i);
} }
while (!get_ethmac_mac_ctrl_tx_ready(ethmac)) while (!get_ethmac_mac_ctrl_tx_ready(ethmac))
@@ -875,7 +904,8 @@ ULONG words;
return NX_SUCCESS; return NX_SUCCESS;
} }
UINT mac_addr_hit(UINT i, MAC_ADDRESS* mac_addr) { UINT mac_addr_hit(UINT i, MAC_ADDRESS* mac_addr)
{
UINT mcast_index; UINT mcast_index;
if (nx_mnrs_driver[i].nx_mnrs_driver_mac_address.nx_mac_address_msw == mac_addr->nx_mac_address_msw && if (nx_mnrs_driver[i].nx_mnrs_driver_mac_address.nx_mac_address_msw == mac_addr->nx_mac_address_msw &&
nx_mnrs_driver[i].nx_mnrs_driver_mac_address.nx_mac_address_lsw == mac_addr->nx_mac_address_lsw) nx_mnrs_driver[i].nx_mnrs_driver_mac_address.nx_mac_address_lsw == mac_addr->nx_mac_address_lsw)
@@ -885,12 +915,15 @@ UINT mac_addr_hit(UINT i, MAC_ADDRESS* mac_addr) {
return 0; return 0;
} }
UINT mcast_mac_addr_hit_idx(UINT i, MAC_ADDRESS*mac_addr) { UINT mcast_mac_addr_hit_idx(UINT i, MAC_ADDRESS* mac_addr)
{
UINT mcast_index; UINT mcast_index;
for (mcast_index = 0; mcast_index < NX_MNRS_DRIVER_MAX_MCAST_ADDRESSES; mcast_index++) for (mcast_index = 0; mcast_index < NX_MNRS_DRIVER_MAX_MCAST_ADDRESSES; mcast_index++)
{ {
if (nx_mnrs_driver[i].nx_mnrs_driver_mcast_address[mcast_index].nx_mac_address_msw == mac_addr->nx_mac_address_msw && if (nx_mnrs_driver[i].nx_mnrs_driver_mcast_address[mcast_index].nx_mac_address_msw ==
nx_mnrs_driver[i].nx_mnrs_driver_mcast_address[mcast_index].nx_mac_address_lsw == mac_addr -> nx_mac_address_lsw) mac_addr->nx_mac_address_msw &&
nx_mnrs_driver[i].nx_mnrs_driver_mcast_address[mcast_index].nx_mac_address_lsw ==
mac_addr->nx_mac_address_lsw)
{ {
return i; return i;
} }
@@ -899,7 +932,8 @@ UINT mcast_mac_addr_hit_idx(UINT i, MAC_ADDRESS*mac_addr) {
} }
static UCHAR nx_mnrs_receive_buffer[NX_MAX_PACKET_SIZE]; static UCHAR nx_mnrs_receive_buffer[NX_MAX_PACKET_SIZE];
VOID _nx_mnrs_eth_recv_packet(UINT id, volatile ethmac_t* ethmac) { VOID _nx_mnrs_eth_recv_packet(UINT id, volatile ethmac_t* ethmac)
{
UINT bits_received; UINT bits_received;
UINT words_to_read; UINT words_to_read;
UINT i, j; UINT i, j;
@@ -929,12 +963,12 @@ VOID _nx_mnrs_eth_recv_packet(UINT id, volatile ethmac_t* ethmac) {
return; return;
} }
// find the diver instance belonging to our ethmac // find the diver instance belonging to our ethmac
for(i=0; i<NX_MAX_PHYSICAL_INTERFACES; ++i) { for (i = 0; i < NX_MAX_PHYSICAL_INTERFACES; ++i)
{
if (nx_mnrs_driver[i].ethmac == ethmac) if (nx_mnrs_driver[i].ethmac == ethmac)
{ {
ip_ptr = nx_mnrs_driver[i].nx_mnrs_driver_ip_ptr; ip_ptr = nx_mnrs_driver[i].nx_mnrs_driver_ip_ptr;
status = nx_packet_allocate(ip_ptr->nx_ip_default_packet_pool, status = nx_packet_allocate(ip_ptr->nx_ip_default_packet_pool, &packet_ptr, NX_RECEIVE_PACKET, NX_NO_WAIT);
&packet_ptr, NX_RECEIVE_PACKET, NX_NO_WAIT);
if (status) if (status)
{ {
packet_ptr = NX_NULL; packet_ptr = NX_NULL;
@@ -968,8 +1002,8 @@ VOID _nx_mnrs_eth_recv_packet(UINT id, volatile ethmac_t* ethmac) {
if (data == nx_mnrs_receive_buffer) if (data == nx_mnrs_receive_buffer)
{ {
/* Copy data into packet. */ /* Copy data into packet. */
status = nx_packet_data_append(packet_ptr, (VOID *)data, bytes_received, status = nx_packet_data_append(
ip_ptr -> nx_ip_default_packet_pool, NX_NO_WAIT); packet_ptr, (VOID*)data, bytes_received, ip_ptr->nx_ip_default_packet_pool, NX_NO_WAIT);
if (status) if (status)
{ {
nx_packet_release(packet_ptr); nx_packet_release(packet_ptr);
@@ -989,14 +1023,16 @@ VOID _nx_mnrs_eth_recv_packet(UINT id, volatile ethmac_t* ethmac) {
set_ethmac_mac_intr_rx_data_avail_intr_enable(ethmac, 1); set_ethmac_mac_intr_rx_data_avail_intr_enable(ethmac, 1);
} }
VOID _nx_mnrs_eth_recv_packet_eth0(VOID) { VOID _nx_mnrs_eth_recv_packet_eth0(VOID)
{
if (get_ethmac_mac_ctrl_rx_pending(ethmac0)) if (get_ethmac_mac_ctrl_rx_pending(ethmac0))
{ {
_nx_mnrs_eth_recv_packet(0, ethmac0); _nx_mnrs_eth_recv_packet(0, ethmac0);
} }
} }
VOID _nx_mnrs_eth_recv_packet_eth1(VOID) { VOID _nx_mnrs_eth_recv_packet_eth1(VOID)
{
if (get_ethmac_mac_ctrl_rx_pending(ethmac1)) if (get_ethmac_mac_ctrl_rx_pending(ethmac1))
{ {
_nx_mnrs_eth_recv_packet(1, ethmac1); _nx_mnrs_eth_recv_packet(1, ethmac1);