mirror of
https://github.com/apache/nuttx.git
synced 2026-08-31 14:13:04 +00:00
Merged nuttx/arch into master
This commit is contained in:
commit
27bbb33176
46 changed files with 612 additions and 371 deletions
|
|
@ -52,6 +52,10 @@ else # ARM9, ARM7TDMI
|
|||
ARCH_SUBDIR = arm
|
||||
endif
|
||||
|
||||
CPPFLAGS += $(EXTRADEFINES)
|
||||
CFLAGS += $(EXTRADEFINES)
|
||||
CXXFLAGS += $(EXTRADEFINES)
|
||||
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
ARCH_SRCDIR = $(TOPDIR)\arch\$(CONFIG_ARCH)\src
|
||||
NUTTX = "$(TOPDIR)\nuttx$(EXEEXT)"
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/fs/loop.h>
|
||||
#include <nuttx/net/loopback.h>
|
||||
#include <nuttx/net/tun.h>
|
||||
#include <nuttx/syslog/ramlog.h>
|
||||
|
|
@ -203,6 +204,9 @@ void up_initialize(void)
|
|||
devzero_register(); /* Standard /dev/zero */
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_DEV_LOOP)
|
||||
loop_register(); /* Standard /dev/loop */
|
||||
#endif
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS */
|
||||
|
||||
/* Initialize the serial device driver */
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@ config KINETIS_ENET
|
|||
default n
|
||||
depends on ARCH_FAMILY_K60
|
||||
select NET
|
||||
select ARCH_HAVE_NETDEV_STATISTICS
|
||||
---help---
|
||||
Support Ethernet (K60 only)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* drivers/net/kinetis_enet.c
|
||||
*
|
||||
* Copyright (C) 2011-2012, 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2012, 2014-2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -149,22 +149,6 @@
|
|||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
/* EMAC statistics (debug only) */
|
||||
|
||||
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
|
||||
struct kinetis_statistics_s
|
||||
{
|
||||
uint32_t rx_packets; /* Number of packets received */
|
||||
uint32_t tx_packets; /* Number of Tx packets queued */
|
||||
unit32_t tx_done; /* Number of packets completed */
|
||||
uint32_t tx_timeouts; /* Number of Tx timeout errors */
|
||||
uint32_t errors; /* Number of error interrupts */
|
||||
};
|
||||
# define EMAC_STAT(priv,name) priv->stats.name++
|
||||
#else
|
||||
# define EMAC_STAT(priv,name)
|
||||
#endif
|
||||
|
||||
/* The kinetis_driver_s encapsulates all state information for a single hardware
|
||||
* interface
|
||||
*/
|
||||
|
|
@ -184,12 +168,6 @@ struct kinetis_driver_s
|
|||
|
||||
struct net_driver_s dev; /* Interface understood by uIP */
|
||||
|
||||
/* Statistics */
|
||||
|
||||
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
|
||||
struct kinetis_statistics_s stats;
|
||||
#endif
|
||||
|
||||
/* The DMA descriptors. A unaligned uint8_t is used to allocate the
|
||||
* memory; 16 is added to assure that we can meet the descriptor alignment
|
||||
* requirements.
|
||||
|
|
@ -385,7 +363,7 @@ static int kinetis_transmit(FAR struct kinetis_driver_s *priv)
|
|||
|
||||
/* Increment statistics */
|
||||
|
||||
EMAC_STAT(priv, tx_packets);
|
||||
NETDEV_TXPACKETS(&priv->dev);
|
||||
|
||||
/* Setup the buffer descriptor for transmission: address=priv->dev.d_buf,
|
||||
* length=priv->dev.d_len
|
||||
|
|
@ -516,7 +494,7 @@ static void kinetis_receive(FAR struct kinetis_driver_s *priv)
|
|||
{
|
||||
/* Update statistics */
|
||||
|
||||
EMAC_STAT(priv, rx_packets);
|
||||
NETDEV_RXPACKETS(&priv->dev);
|
||||
|
||||
/* Copy the buffer pointer to priv->dev.d_buf. Set amount of data in
|
||||
* priv->dev.d_len
|
||||
|
|
@ -553,6 +531,7 @@ static void kinetis_receive(FAR struct kinetis_driver_s *priv)
|
|||
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||
{
|
||||
nllvdbg("IPv4 frame\n");
|
||||
NETDEV_RXIPV4(&priv->dev);
|
||||
|
||||
/* Handle ARP on input then give the IPv4 packet to the network
|
||||
* layer
|
||||
|
|
@ -593,6 +572,7 @@ static void kinetis_receive(FAR struct kinetis_driver_s *priv)
|
|||
if (BUF->type == HTONS(ETHTYPE_IP6))
|
||||
{
|
||||
nllvdbg("Iv6 frame\n");
|
||||
NETDEV_RXIPV6(&priv->dev);
|
||||
|
||||
/* Give the IPv6 packet to the network layer */
|
||||
|
||||
|
|
@ -629,6 +609,7 @@ static void kinetis_receive(FAR struct kinetis_driver_s *priv)
|
|||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
{
|
||||
NETDEV_RXARP(&priv->dev);
|
||||
arp_arpin(&priv->dev);
|
||||
|
||||
/* If the above function invocation resulted in data that should
|
||||
|
|
@ -642,6 +623,10 @@ static void kinetis_receive(FAR struct kinetis_driver_s *priv)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
NETDEV_RXDROPPED(&priv->dev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -682,7 +667,7 @@ static void kinetis_txdone(FAR struct kinetis_driver_s *priv)
|
|||
|
||||
/* Update statistics */
|
||||
|
||||
EMAC_STAT(priv, tx_done);
|
||||
NETDEV_TXDONE(&priv->dev);
|
||||
}
|
||||
|
||||
/* Are there other transmissions queued? */
|
||||
|
|
@ -765,7 +750,7 @@ static int kinetis_interrupt(int irq, FAR void *context)
|
|||
{
|
||||
/* An error has occurred, update statistics */
|
||||
|
||||
EMAC_STAT(priv, errors);
|
||||
NETDEV_ERRORS(&priv->dev);
|
||||
|
||||
/* Reinitialize all buffers. */
|
||||
|
||||
|
|
@ -804,7 +789,7 @@ static void kinetis_txtimeout(int argc, uint32_t arg, ...)
|
|||
|
||||
/* Increment statistics and dump debug info */
|
||||
|
||||
EMAC_STAT(priv, tx_timeout);
|
||||
NETDEV_TXTIMEOUT(&priv->dev);
|
||||
|
||||
/* Take the interface down and bring it back up. The is the most agressive
|
||||
* hardware reset.
|
||||
|
|
|
|||
|
|
@ -139,6 +139,7 @@ config LPC17_ETHERNET
|
|||
bool "Ethernet"
|
||||
select NETDEVICES
|
||||
select ARCH_HAVE_PHY
|
||||
select ARCH_HAVE_NETDEV_STATISTICS
|
||||
default n
|
||||
|
||||
config LPC17_LCD
|
||||
|
|
|
|||
|
|
@ -238,45 +238,6 @@
|
|||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/* EMAC statistics (debug only) */
|
||||
|
||||
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
|
||||
struct lpc17_statistics_s
|
||||
{
|
||||
#ifdef ENABLE_WOL
|
||||
uint32_t wol; /* Wake-up interrupts */
|
||||
#endif
|
||||
uint32_t rx_finished; /* Rx finished interrupts */
|
||||
uint32_t rx_done; /* Rx done interrupts */
|
||||
uint32_t rx_ovrerrors; /* Number of Rx overrun error interrupts */
|
||||
uint32_t rx_errors; /* Number of Rx error interrupts (OR of other errors) */
|
||||
uint32_t rx_packets; /* Number of packets received (sum of the following): */
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
uint32_t rx_ip; /* Number of Rx IPv4 packets received */
|
||||
#endif
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
uint32_t rx_ipv6; /* Number of Rx IPv6 packets received */
|
||||
#endif
|
||||
uint32_t rx_arp; /* Number of Rx ARP packets received */
|
||||
uint32_t rx_dropped; /* Number of dropped, unsupported Rx packets */
|
||||
uint32_t rx_pkterr; /* Number of dropped, error in Rx descriptor */
|
||||
uint32_t rx_pktsize; /* Number of dropped, too small or too big */
|
||||
uint32_t rx_fragment; /* Number of dropped, packet fragments */
|
||||
|
||||
uint32_t tx_packets; /* Number of Tx packets queued */
|
||||
uint32_t tx_pending; /* Number of Tx packets that had to wait for a TxDesc */
|
||||
uint32_t tx_unpend; /* Number of pending Tx packets that were sent */
|
||||
uint32_t tx_finished; /* Tx finished interrupts */
|
||||
uint32_t tx_done; /* Tx done interrupts */
|
||||
uint32_t tx_underrun; /* Number of Tx underrun error interrupts */
|
||||
uint32_t tx_errors; /* Number of Tx error inerrupts (OR of other errors) */
|
||||
uint32_t tx_timeouts; /* Number of Tx timeout errors */
|
||||
};
|
||||
# define EMAC_STAT(priv,name) priv->lp_stat.name++
|
||||
#else
|
||||
# define EMAC_STAT(priv,name)
|
||||
#endif
|
||||
|
||||
/* The lpc17_driver_s encapsulates all state information for a single hardware
|
||||
* interface
|
||||
*/
|
||||
|
|
@ -309,10 +270,6 @@ struct lpc17_driver_s
|
|||
uint32_t status;
|
||||
#endif /* CONFIG_NET_NOINTS */
|
||||
|
||||
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
|
||||
struct lpc17_statistics_s lp_stat;
|
||||
#endif
|
||||
|
||||
/* This holds the information visible to the NuttX networking layer */
|
||||
|
||||
struct net_driver_s lp_dev; /* Interface understood by the network layer */
|
||||
|
|
@ -647,7 +604,7 @@ static int lpc17_transmit(struct lpc17_driver_s *priv)
|
|||
|
||||
/* Increment statistics and dump the packet *if so configured) */
|
||||
|
||||
EMAC_STAT(priv, tx_packets);
|
||||
NETDEV_TXPACKETS(&priv->lp_dev);
|
||||
lpc17_dumppacket("Transmit packet",
|
||||
priv->lp_dev.d_buf, priv->lp_dev.d_len);
|
||||
|
||||
|
|
@ -826,7 +783,6 @@ static void lpc17_response(struct lpc17_driver_s *priv)
|
|||
priv->lp_txpending = true;
|
||||
priv->lp_inten &= ~ETH_RXINTS;
|
||||
lpc17_putreg(priv->lp_inten, LPC17_ETH_INTEN);
|
||||
EMAC_STAT(priv, tx_pending);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -869,7 +825,7 @@ static void lpc17_rxdone_process(struct lpc17_driver_s *priv)
|
|||
{
|
||||
/* Update statistics */
|
||||
|
||||
EMAC_STAT(priv, rx_packets);
|
||||
NETDEV_RXPACKETS(&priv->lp_dev);
|
||||
|
||||
/* Get the Rx status and packet length (-4+1) */
|
||||
|
||||
|
|
@ -884,7 +840,7 @@ static void lpc17_rxdone_process(struct lpc17_driver_s *priv)
|
|||
{
|
||||
nlldbg("Error. considx: %08x prodidx: %08x rxstat: %08x\n",
|
||||
considx, prodidx, *rxstat);
|
||||
EMAC_STAT(priv, rx_pkterr);
|
||||
NETDEV_RXERRORS(&priv->lp_dev);
|
||||
}
|
||||
|
||||
/* If the pktlen is greater then the buffer, then we cannot accept
|
||||
|
|
@ -897,20 +853,20 @@ static void lpc17_rxdone_process(struct lpc17_driver_s *priv)
|
|||
{
|
||||
nlldbg("Too big. considx: %08x prodidx: %08x pktlen: %d rxstat: %08x\n",
|
||||
considx, prodidx, pktlen, *rxstat);
|
||||
EMAC_STAT(priv, rx_pktsize);
|
||||
NETDEV_RXERRORS(&priv->lp_dev);
|
||||
}
|
||||
else if ((*rxstat & RXSTAT_INFO_LASTFLAG) == 0)
|
||||
{
|
||||
nlldbg("Fragment. considx: %08x prodidx: %08x pktlen: %d rxstat: %08x\n",
|
||||
considx, prodidx, pktlen, *rxstat);
|
||||
EMAC_STAT(priv, rx_fragment);
|
||||
NETDEV_RXFRAGMENTS(&priv->lp_dev);
|
||||
fragment = true;
|
||||
}
|
||||
else if (fragment)
|
||||
{
|
||||
nlldbg("Last fragment. considx: %08x prodidx: %08x pktlen: %d rxstat: %08x\n",
|
||||
considx, prodidx, pktlen, *rxstat);
|
||||
EMAC_STAT(priv, rx_fragment);
|
||||
NETDEV_RXFRAGMENTS(&priv->lp_dev);
|
||||
fragment = false;
|
||||
}
|
||||
else
|
||||
|
|
@ -952,12 +908,12 @@ static void lpc17_rxdone_process(struct lpc17_driver_s *priv)
|
|||
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||
{
|
||||
nllvdbg("IPv4 frame\n");
|
||||
NETDEV_RXIPV4(&priv->lp_dev);
|
||||
|
||||
/* Handle ARP on input then give the IPv4 packet to the
|
||||
* network layer
|
||||
*/
|
||||
|
||||
EMAC_STAT(priv, rx_ip);
|
||||
arp_ipin(&priv->lp_dev);
|
||||
ipv4_input(&priv->lp_dev);
|
||||
|
||||
|
|
@ -994,10 +950,10 @@ static void lpc17_rxdone_process(struct lpc17_driver_s *priv)
|
|||
if (BUF->type == HTONS(ETHTYPE_IP6))
|
||||
{
|
||||
nllvdbg("Iv6 frame\n");
|
||||
NETDEV_RXIPV6(&priv->lp_dev);
|
||||
|
||||
/* Give the IPv6 packet to the network layer */
|
||||
|
||||
EMAC_STAT(priv, rx_ipv6);
|
||||
ipv6_input(&priv->lp_dev);
|
||||
|
||||
/* If the above function invocation resulted in data that
|
||||
|
|
@ -1032,7 +988,7 @@ static void lpc17_rxdone_process(struct lpc17_driver_s *priv)
|
|||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
{
|
||||
EMAC_STAT(priv, rx_arp);
|
||||
NETDEV_RXARP(&priv->lp_dev);
|
||||
arp_arpin(&priv->lp_dev);
|
||||
|
||||
/* If the above function invocation resulted in data that
|
||||
|
|
@ -1050,7 +1006,7 @@ static void lpc17_rxdone_process(struct lpc17_driver_s *priv)
|
|||
{
|
||||
/* Unrecognized... drop it. */
|
||||
|
||||
EMAC_STAT(priv, rx_dropped);
|
||||
NETDEV_RXDROPPED(&priv->lp_dev);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1104,7 +1060,6 @@ static void lpc17_txdone_process(struct lpc17_driver_s *priv)
|
|||
/* Clear the pending condition, send the packet, and restore Rx interrupts */
|
||||
|
||||
priv->lp_txpending = false;
|
||||
EMAC_STAT(priv, tx_unpend);
|
||||
|
||||
lpc17_transmit(priv);
|
||||
|
||||
|
|
@ -1229,7 +1184,6 @@ static int lpc17_interrupt(int irq, void *context)
|
|||
#ifdef CONFIG_NET_WOL
|
||||
if ((status & ETH_INT_WKUP) != 0)
|
||||
{
|
||||
EMAC_STAT(priv, wol);
|
||||
# warning "Missing logic"
|
||||
}
|
||||
else
|
||||
|
|
@ -1250,13 +1204,13 @@ static int lpc17_interrupt(int irq, void *context)
|
|||
if ((status & ETH_INT_RXOVR) != 0)
|
||||
{
|
||||
nlldbg("RX Overrun. status: %08x\n", status);
|
||||
EMAC_STAT(priv, rx_ovrerrors);
|
||||
NETDEV_RXERRORS(&priv->lp_dev);
|
||||
}
|
||||
|
||||
if ((status & ETH_INT_TXUNR) != 0)
|
||||
{
|
||||
nlldbg("TX Underrun. status: %08x\n", status);
|
||||
EMAC_STAT(priv, tx_underrun);
|
||||
NETDEV_TXERRORS(&priv->lp_dev);
|
||||
}
|
||||
|
||||
/* ifup() will reset the EMAC and bring it back up */
|
||||
|
|
@ -1277,7 +1231,7 @@ static int lpc17_interrupt(int irq, void *context)
|
|||
if ((status & ETH_INT_RXERR) != 0)
|
||||
{
|
||||
nlldbg("RX Error. status: %08x\n", status);
|
||||
EMAC_STAT(priv, rx_errors);
|
||||
NETDEV_RXERRORS(&priv->lp_dev);
|
||||
}
|
||||
|
||||
/* RX FINISHED -- Triggered when all receive descriptors have
|
||||
|
|
@ -1294,8 +1248,6 @@ static int lpc17_interrupt(int irq, void *context)
|
|||
|
||||
if ((status & ETH_INT_RXFIN) != 0 || (status & ETH_INT_RXDONE) != 0)
|
||||
{
|
||||
EMAC_STAT(priv, rx_done);
|
||||
|
||||
/* We have received at least one new incoming packet. */
|
||||
|
||||
#ifdef CONFIG_NET_NOINTS
|
||||
|
|
@ -1331,9 +1283,10 @@ static int lpc17_interrupt(int irq, void *context)
|
|||
if ((status & ETH_INT_TXERR) != 0)
|
||||
{
|
||||
nlldbg("TX Error. status: %08x\n", status);
|
||||
EMAC_STAT(priv, tx_errors);
|
||||
NETDEV_TXERRORS(&priv->lp_dev);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* TX FINISHED -- Triggered when all transmit descriptors have
|
||||
* been processed i.e. on the transition to the situation
|
||||
* where ProduceIndex == ConsumeIndex.
|
||||
|
|
@ -1341,8 +1294,8 @@ static int lpc17_interrupt(int irq, void *context)
|
|||
|
||||
if ((status & ETH_INT_TXFIN) != 0)
|
||||
{
|
||||
EMAC_STAT(priv, tx_finished);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* TX DONE -- Triggered when a descriptor has been transmitted
|
||||
* while the Interrupt bit in the Control field of the
|
||||
|
|
@ -1351,7 +1304,7 @@ static int lpc17_interrupt(int irq, void *context)
|
|||
|
||||
if ((status & ETH_INT_TXDONE) != 0)
|
||||
{
|
||||
EMAC_STAT(priv, tx_done);
|
||||
NETDEV_TXDONE(&priv->lp_dev);
|
||||
|
||||
/* A packet transmission just completed */
|
||||
/* Cancel the pending Tx timeout */
|
||||
|
|
@ -1422,7 +1375,7 @@ static void lpc17_txtimeout_process(FAR struct lpc17_driver_s *priv)
|
|||
{
|
||||
/* Increment statistics and dump debug info */
|
||||
|
||||
EMAC_STAT(priv, tx_timeouts);
|
||||
NETDEV_TXTIMEOUTS(&priv->lp_dev);
|
||||
if (priv->lp_ifup)
|
||||
{
|
||||
/* Then reset the hardware. ifup() will reset the interface, then bring
|
||||
|
|
|
|||
|
|
@ -208,6 +208,7 @@ config SAMV7_EMAC
|
|||
bool
|
||||
default n
|
||||
select ARMV7M_DCACHE_WRITETHROUGH if ARMV7M_DCACHE
|
||||
select ARCH_HAVE_NETDEV_STATISTICS
|
||||
---help---
|
||||
NOTE that write-through caching is automatically selected. This is
|
||||
to work around issues with the RX and TX descriptors with are 8-bytes
|
||||
|
|
|
|||
|
|
@ -131,7 +131,11 @@ static inline void sam_wdtsetup(void)
|
|||
|
||||
static inline void sam_supcsetup(void)
|
||||
{
|
||||
/* Check if the 32-kHz is already selected */
|
||||
#ifdef BOARD_HAVE_SLOWXTAL
|
||||
/* Check if the 32-kHz is already selected. The slow clock defaults to
|
||||
* the RC oscillator, but the software can enable the crystal oscillator
|
||||
* and select it as the slow clock source.
|
||||
*/
|
||||
|
||||
if ((getreg32(SAM_SUPC_SR) & SUPC_SR_OSCSEL) == 0)
|
||||
{
|
||||
|
|
@ -142,6 +146,7 @@ static inline void sam_supcsetup(void)
|
|||
(getreg32(SAM_SUPC_SR) & SUPC_SR_OSCSEL) == 0 && delay < UINT32_MAX;
|
||||
delay++);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
|||
|
|
@ -1364,6 +1364,8 @@ static int sam_transmit(struct sam_emac_s *priv, int qid)
|
|||
uint32_t status;
|
||||
uint16_t txhead;
|
||||
|
||||
NETDEV_TXPACKETS(&priv->dev);
|
||||
|
||||
/* Check parameter */
|
||||
|
||||
if (dev->d_len > EMAC_TX_UNITSIZE)
|
||||
|
|
@ -1642,6 +1644,8 @@ static int sam_recvframe(struct sam_emac_s *priv, int qid)
|
|||
|
||||
while ((rxdesc->addr & EMACRXD_ADDR_OWNER) != 0)
|
||||
{
|
||||
NETDEV_RXFRAGMENTS(&priv->dev);
|
||||
|
||||
/* The start of frame bit indicates the beginning of a frame. Discard
|
||||
* any previous fragments.
|
||||
*/
|
||||
|
|
@ -1722,6 +1726,7 @@ static int sam_recvframe(struct sam_emac_s *priv, int qid)
|
|||
}
|
||||
while (rxndx != xfrq->rxndx);
|
||||
|
||||
NETDEV_RXERRORS(&priv->dev);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
|
@ -1796,6 +1801,7 @@ static int sam_recvframe(struct sam_emac_s *priv, int qid)
|
|||
{
|
||||
nlldbg("ERROR: Buffer size %d; frame size %d\n",
|
||||
dev->d_len, pktlen);
|
||||
NETDEV_RXERRORS(&priv->dev);
|
||||
return -E2BIG;
|
||||
}
|
||||
|
||||
|
|
@ -1876,6 +1882,7 @@ static void sam_receive(struct sam_emac_s *priv, int qid)
|
|||
while (sam_recvframe(priv, qid) == OK)
|
||||
{
|
||||
sam_dumppacket("Received packet", dev->d_buf, dev->d_len);
|
||||
NETDEV_RXPACKETS(&priv->dev);
|
||||
|
||||
/* Check if the packet is a valid size for the network buffer
|
||||
* configuration (this should not happen)
|
||||
|
|
@ -1884,6 +1891,7 @@ static void sam_receive(struct sam_emac_s *priv, int qid)
|
|||
if (dev->d_len > CONFIG_NET_ETH_MTU)
|
||||
{
|
||||
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
|
||||
NETDEV_RXERRORS(&priv->dev);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1899,6 +1907,7 @@ static void sam_receive(struct sam_emac_s *priv, int qid)
|
|||
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||
{
|
||||
nllvdbg("IPv4 frame\n");
|
||||
NETDEV_RXIPV4(&priv->dev);
|
||||
|
||||
/* Handle ARP on input then give the IPv4 packet to the network
|
||||
* layer
|
||||
|
|
@ -1939,6 +1948,7 @@ static void sam_receive(struct sam_emac_s *priv, int qid)
|
|||
if (BUF->type == HTONS(ETHTYPE_IP6))
|
||||
{
|
||||
nllvdbg("Iv6 frame\n");
|
||||
NETDEV_RXIPV6(&priv->dev);
|
||||
|
||||
/* Give the IPv6 packet to the network layer */
|
||||
|
||||
|
|
@ -1976,6 +1986,7 @@ static void sam_receive(struct sam_emac_s *priv, int qid)
|
|||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
{
|
||||
nllvdbg("ARP frame\n");
|
||||
NETDEV_RXARP(&priv->dev);
|
||||
|
||||
/* Handle ARP packet */
|
||||
|
||||
|
|
@ -1994,6 +2005,7 @@ static void sam_receive(struct sam_emac_s *priv, int qid)
|
|||
#endif
|
||||
{
|
||||
nlldbg("DROPPED: Unknown type: %04x\n", BUF->type);
|
||||
NETDEV_RXDROPPED(&priv->dev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2052,6 +2064,8 @@ static void sam_txdone(struct sam_emac_s *priv, int qid)
|
|||
break;
|
||||
}
|
||||
|
||||
NETDEV_TXDONE(&priv->dev);
|
||||
|
||||
/* Process all buffers of the current transmitted frame */
|
||||
|
||||
while (tail != xfrq->txhead &&
|
||||
|
|
@ -2121,6 +2135,8 @@ static void sam_txerr_interrupt(FAR struct sam_emac_s *priv, int qid)
|
|||
uint32_t regval;
|
||||
uint16_t tail;
|
||||
|
||||
NETDEV_TXERRORS(&priv->dev);
|
||||
|
||||
/* Clear TXEN bit into the Network Configuration Register. This is a
|
||||
* workaround to recover from TX lockups that occur on sama5d3 gmac
|
||||
* (r1p24f2) when using scatter-gather. This issue has never been
|
||||
|
|
@ -2360,6 +2376,7 @@ static inline void sam_interrupt_process(FAR struct sam_emac_s *priv, int qid)
|
|||
if ((tsr & EMAC_TSR_COL) != 0)
|
||||
{
|
||||
nlldbg("ERROR: Collision occurred TSR: %08x\n", tsr);
|
||||
NETDEV_TXERRORS(&priv->dev);
|
||||
}
|
||||
|
||||
/* Check Transmit Frame Corruption due to AHB error (TFC) */
|
||||
|
|
@ -2367,6 +2384,7 @@ static inline void sam_interrupt_process(FAR struct sam_emac_s *priv, int qid)
|
|||
if ((tsr & EMAC_TSR_TFC) != 0)
|
||||
{
|
||||
nlldbg("ERROR: Transmit Frame Corruption due to AHB error: %08x\n", tsr);
|
||||
NETDEV_TXERRORS(&priv->dev);
|
||||
}
|
||||
|
||||
/* Clear status */
|
||||
|
|
@ -2562,6 +2580,7 @@ static int sam_emac1_interrupt(int irq, void *context)
|
|||
static inline void sam_txtimeout_process(FAR struct sam_emac_s *priv)
|
||||
{
|
||||
nlldbg("Timeout!\n");
|
||||
NETDEV_TXTIMEOUTS(&priv->dev);
|
||||
|
||||
/* Reset the hardware. Just take the interface down, then back up again. */
|
||||
|
||||
|
|
|
|||
|
|
@ -819,12 +819,10 @@ static int adc_timinit(FAR struct stm32_dev_s *priv)
|
|||
{
|
||||
uint32_t prescaler;
|
||||
uint32_t reload;
|
||||
uint32_t regval;
|
||||
uint32_t timclk;
|
||||
|
||||
uint16_t clrbits = 0;
|
||||
uint16_t setbits = 0;
|
||||
uint16_t cr1;
|
||||
uint16_t cr2;
|
||||
uint16_t ccmr1;
|
||||
uint16_t ccmr2;
|
||||
|
|
@ -1060,7 +1058,7 @@ static int adc_timinit(FAR struct stm32_dev_s *priv)
|
|||
ccer &= ~ccenable;
|
||||
tim_putreg(priv, STM32_GTIM_CCER_OFFSET, ccer);
|
||||
|
||||
/* Fetch the CR2, CCMR1, and CCMR2 register (already have cr1 and ccer) */
|
||||
/* Fetch the CR2, CCMR1, and CCMR2 register (already have ccer) */
|
||||
|
||||
cr2 = tim_getreg(priv, STM32_GTIM_CR2_OFFSET);
|
||||
ccmr1 = tim_getreg(priv, STM32_GTIM_CCMR1_OFFSET);
|
||||
|
|
|
|||
|
|
@ -902,7 +902,7 @@ int up_rtc_getdatetime(FAR struct tm *tp)
|
|||
tmp = (dr & (RTC_DR_YU_MASK | RTC_DR_YT_MASK)) >> RTC_DR_YU_SHIFT;
|
||||
tp->tm_year = rtc_bcd2bin(tmp) + 100;
|
||||
|
||||
#if defined(CONFIG_TIME_EXTENDED)
|
||||
#if defined(CONFIG_LIBC_LOCALTIME) || defined(CONFIG_TIME_EXTENDED)
|
||||
tmp = (dr & RTC_DR_WDU_MASK) >> RTC_DR_WDU_SHIFT;
|
||||
tp->tm_wday = tmp % 7;
|
||||
tp->tm_yday = tp->tm_mday + clock_daysbeforemonth(tp->tm_mon, clock_isleapyear(tp->tm_year + 1900));
|
||||
|
|
@ -1014,7 +1014,7 @@ int stm32_rtc_setdatetime(FAR const struct tm *tp)
|
|||
|
||||
dr = (rtc_bin2bcd(tp->tm_mday) << RTC_DR_DU_SHIFT) |
|
||||
((rtc_bin2bcd(tp->tm_mon + 1)) << RTC_DR_MU_SHIFT) |
|
||||
#if defined(CONFIG_TIME_EXTENDED)
|
||||
#if defined(CONFIG_LIBC_LOCALTIME) || defined(CONFIG_TIME_EXTENDED)
|
||||
((tp->tm_wday == 0 ? 7 : (tp->tm_wday & 7)) << RTC_DR_WDU_SHIFT) |
|
||||
#endif
|
||||
((rtc_bin2bcd(tp->tm_year - 100)) << RTC_DR_YU_SHIFT);
|
||||
|
|
|
|||
|
|
@ -519,12 +519,13 @@ static int stm32_tim14_interrupt(int irq, FAR void *context)
|
|||
|
||||
static int stm32_timer_handler(struct stm32_lowerhalf_s *lower)
|
||||
{
|
||||
uint32_t next_interval_us = 0;
|
||||
bool ret;
|
||||
|
||||
STM32_TIM_ACKINT(lower->tim, 0);
|
||||
|
||||
uint32_t next_interval_us = 0;
|
||||
bool ret = (*lower->handlerUsr)(&next_interval_us);
|
||||
|
||||
if (ret == true)
|
||||
ret = (*lower->handlerUsr)(&next_interval_us);
|
||||
if (ret)
|
||||
{
|
||||
if (next_interval_us > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -532,7 +532,9 @@ config TIVA_TIMER7
|
|||
config TIVA_ETHERNET
|
||||
bool "Ethernet"
|
||||
default n
|
||||
depends on TIVA_HAVE_ETHERNET
|
||||
select NETDEVICES
|
||||
select ARCH_HAVE_NETDEV_STATISTICS if ARCH_CHIP_LM3S || ARCH_CHIP_LM4F
|
||||
---help---
|
||||
This must be set (along with NET) to build the Stellaris Ethernet driver.
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ CHIP_CSRCS += tiva_adclow.c
|
|||
CHIP_CSRCS += tiva_adclib.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
ifeq ($(CONFIG_TIVA_ETHERNET),y)
|
||||
ifeq ($(CONFIG_ARCH_CHIP_LM3S),y)
|
||||
CHIP_CSRCS += lm3s_ethernet.c
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -169,34 +169,6 @@
|
|||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/* EMAC statistics (debug only) */
|
||||
|
||||
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
|
||||
struct tiva_statistics_s
|
||||
{
|
||||
uint32_t rx_int; /* Number of Rx interrupts received */
|
||||
uint32_t rx_packets; /* Number of packets received (sum of the following): */
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
uint32_t rx_ip; /* Number of Rx IPv4 packets received */
|
||||
#endif
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
uint32_t rx_ipv6; /* Number of Rx IPv6 packets received */
|
||||
#endif
|
||||
uint32_t rx_arp; /* Number of Rx ARP packets received */
|
||||
uint32_t rx_dropped; /* Number of dropped, unsupported Rx packets */
|
||||
uint32_t rx_pktsize; /* Number of dropped, too small or too big */
|
||||
uint32_t rx_errors; /* Number of Rx errors (reception error) */
|
||||
uint32_t rx_ovrerrors; /* Number of Rx FIFO overrun errors */
|
||||
uint32_t tx_int; /* Number of Tx interrupts received */
|
||||
uint32_t tx_packets; /* Number of Tx packets queued */
|
||||
uint32_t tx_errors; /* Number of Tx errors (transmission error) */
|
||||
uint32_t tx_timeouts; /* Number of Tx timeout errors */
|
||||
};
|
||||
# define EMAC_STAT(priv,name) priv->ld_stat.name++
|
||||
#else
|
||||
# define EMAC_STAT(priv,name)
|
||||
#endif
|
||||
|
||||
/* The tiva_driver_s encapsulates all state information for a single hardware
|
||||
* interface
|
||||
*/
|
||||
|
|
@ -216,10 +188,6 @@ struct tiva_driver_s
|
|||
WDOG_ID ld_txpoll; /* TX poll timer */
|
||||
WDOG_ID ld_txtimeout; /* TX timeout timer */
|
||||
|
||||
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
|
||||
struct tiva_statistics_s ld_stat;
|
||||
#endif
|
||||
|
||||
/* This holds the information visible to uIP/NuttX */
|
||||
|
||||
struct net_driver_s ld_dev; /* Interface understood by uIP */
|
||||
|
|
@ -518,7 +486,7 @@ static int tiva_transmit(struct tiva_driver_s *priv)
|
|||
{
|
||||
/* Increment statistics */
|
||||
|
||||
EMAC_STAT(priv, tx_packets);
|
||||
NETDEV_TXPACKETS(&priv->ld_dev);
|
||||
tiva_dumppacket("Transmit packet", priv->ld_dev.d_buf, priv->ld_dev.d_len);
|
||||
|
||||
/* Transfer the packet into the Tx FIFO. The LS 16-bits of the first
|
||||
|
|
@ -687,7 +655,7 @@ static void tiva_receive(struct tiva_driver_s *priv)
|
|||
{
|
||||
/* Update statistics */
|
||||
|
||||
EMAC_STAT(priv, rx_packets);
|
||||
NETDEV_RXPACKETS(&priv->ld_dev);
|
||||
|
||||
/* Copy the data data from the hardware to priv->ld_dev.d_buf. Set
|
||||
* amount of data in priv->ld_dev.d_len
|
||||
|
|
@ -720,7 +688,7 @@ static void tiva_receive(struct tiva_driver_s *priv)
|
|||
/* We will have to drop this packet */
|
||||
|
||||
nlldbg("Bad packet size dropped (%d)\n", pktlen);
|
||||
EMAC_STAT(priv, rx_pktsize);
|
||||
NETDEV_RXERRORS(&priv->ld_dev);
|
||||
|
||||
/* The number of bytes and words left to read is pktlen - 4 (including,
|
||||
* the final, possibly partial word) because we've already read 4 bytes.
|
||||
|
|
@ -804,12 +772,12 @@ static void tiva_receive(struct tiva_driver_s *priv)
|
|||
if (ETHBUF->type == HTONS(ETHTYPE_IP))
|
||||
{
|
||||
nllvdbg("IPv4 frame\n");
|
||||
NETDEV_RXIPV4(&priv->ld_dev);
|
||||
|
||||
/* Handle ARP on input then give the IPv4 packet to the network
|
||||
* layer
|
||||
*/
|
||||
|
||||
EMAC_STAT(priv, rx_ip);
|
||||
arp_ipin(&priv->ld_dev);
|
||||
ipv4_input(&priv->ld_dev);
|
||||
|
||||
|
|
@ -845,10 +813,10 @@ static void tiva_receive(struct tiva_driver_s *priv)
|
|||
if (ETHBUF->type == HTONS(ETHTYPE_IP6))
|
||||
{
|
||||
nllvdbg("Iv6 frame\n");
|
||||
NETDEV_RXIPV6(&priv->ld_dev);
|
||||
|
||||
/* Give the IPv6 packet to the network layer */
|
||||
|
||||
EMAC_STAT(priv, rx_ipv6);
|
||||
arp_ipin(&priv->ld_dev);
|
||||
ipv6_input(&priv->ld_dev);
|
||||
|
||||
|
|
@ -884,7 +852,7 @@ static void tiva_receive(struct tiva_driver_s *priv)
|
|||
if (ETHBUF->type == htons(ETHTYPE_ARP))
|
||||
{
|
||||
nllvdbg("ARP packet received (%02x)\n", ETHBUF->type);
|
||||
EMAC_STAT(priv, rx_arp);
|
||||
NETDEV_RXARP(&priv->ld_dev);
|
||||
|
||||
arp_arpin(&priv->ld_dev);
|
||||
|
||||
|
|
@ -901,7 +869,7 @@ static void tiva_receive(struct tiva_driver_s *priv)
|
|||
#endif
|
||||
{
|
||||
nlldbg("Unsupported packet type dropped (%02x)\n", htons(ETHBUF->type));
|
||||
EMAC_STAT(priv, rx_dropped);
|
||||
NETDEV_RXDROPPED(&priv->ld_dev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -981,20 +949,26 @@ static int tiva_interrupt(int irq, FAR void *context)
|
|||
|
||||
/* Check for errors */
|
||||
|
||||
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
|
||||
#if defined(CONFIG_NETDEV_STATISTICS)
|
||||
if ((ris & MAC_RIS_TXER) != 0)
|
||||
{
|
||||
EMAC_STAT(priv, tx_errors); /* Number of Tx errors */
|
||||
/* Tx error */
|
||||
|
||||
NETDEV_TXERRORS(&priv->ld_dev);
|
||||
}
|
||||
|
||||
if ((ris & MAC_RIS_FOV) != 0)
|
||||
{
|
||||
EMAC_STAT(priv, rx_ovrerrors); /* Number of Rx FIFO overrun errors */
|
||||
/* Rx FIFO overrun */
|
||||
|
||||
NETDEV_RXERRORS(&priv->ld_dev);
|
||||
}
|
||||
|
||||
if ((ris & MAC_RIS_RXER) != 0)
|
||||
{
|
||||
EMAC_STAT(priv, rx_errors); /* Number of Rx errors */
|
||||
/* Rx error */
|
||||
|
||||
NETDEV_RXERRORS(&priv->ld_dev);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -1008,7 +982,6 @@ static int tiva_interrupt(int irq, FAR void *context)
|
|||
{
|
||||
/* Handle the incoming packet */
|
||||
|
||||
EMAC_STAT(priv, rx_int);
|
||||
tiva_receive(priv);
|
||||
}
|
||||
|
||||
|
|
@ -1018,7 +991,6 @@ static int tiva_interrupt(int irq, FAR void *context)
|
|||
{
|
||||
/* Handle the complete of the transmission */
|
||||
|
||||
EMAC_STAT(priv, tx_int);
|
||||
tiva_txdone(priv);
|
||||
}
|
||||
|
||||
|
|
@ -1054,7 +1026,7 @@ static void tiva_txtimeout(int argc, uint32_t arg, ...)
|
|||
/* Increment statistics */
|
||||
|
||||
nlldbg("Tx timeout\n");
|
||||
EMAC_STAT(priv, tx_timeouts);
|
||||
NETDEV_TXTIMEOUTS(&priv->ld_dev);
|
||||
|
||||
/* Then reset the hardware */
|
||||
|
||||
|
|
|
|||
|
|
@ -12,12 +12,14 @@ choice
|
|||
config ARCH_CHIP_ATMEGA
|
||||
bool "ATMega family"
|
||||
select ARCH_FAMILY_AVR
|
||||
select MM_SMALL
|
||||
---help---
|
||||
Atmel ATMega family of 8-bit AVRs.
|
||||
|
||||
config ARCH_CHIP_AT90USB
|
||||
bool "AT90USB family"
|
||||
select ARCH_FAMILY_AVR
|
||||
select MM_SMALL
|
||||
---help---
|
||||
Atmel AT90USB family of 8-bit AVRs.
|
||||
|
||||
|
|
|
|||
|
|
@ -66,10 +66,10 @@ else
|
|||
endif
|
||||
endif
|
||||
|
||||
CPPFLAGS += $(INCLUDES)
|
||||
CFLAGS += $(INCLUDES)
|
||||
CXXFLAGS += $(INCLUDES)
|
||||
AFLAGS += $(INCLUDES)
|
||||
CPPFLAGS += $(INCLUDES) $(EXTRADEFINES)
|
||||
CFLAGS += $(INCLUDES) $(EXTRADEFINES)
|
||||
CXXFLAGS += $(INCLUDES) $(EXTRADEFINES)
|
||||
AFLAGS += $(INCLUDES) $(EXTRADEFINES)
|
||||
|
||||
HEAD_OBJ = $(HEAD_ASRC:.S=$(OBJEXT))
|
||||
STARTUP_OBJS ?= $(HEAD_OBJ)
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/fs/loop.h>
|
||||
#include <nuttx/net/loopback.h>
|
||||
#include <nuttx/net/tun.h>
|
||||
#include <nuttx/syslog/ramlog.h>
|
||||
|
|
@ -235,6 +236,9 @@ void up_initialize(void)
|
|||
devzero_register(); /* Standard /dev/zero */
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_DEV_LOOP)
|
||||
loop_register(); /* Standard /dev/loop */
|
||||
#endif
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS */
|
||||
|
||||
/* Initialize the serial device driver */
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ choice
|
|||
config ARCH_CHIP_MCS92S12NEC64
|
||||
bool "MCS92S12NEC64"
|
||||
select ARCH_HSC12
|
||||
select MM_SMALL
|
||||
---help---
|
||||
Motorola/Freescale MCS92S12NEC64 (M9S12)
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,10 @@ ifeq ($(CONFIG_ARCH_HCS12),y)
|
|||
ARCH_SUBDIR = hcs12
|
||||
endif
|
||||
|
||||
CPPFLAGS += $(EXTRADEFINES)
|
||||
CFLAGS += $(EXTRADEFINES)
|
||||
CXXFLAGS += $(EXTRADEFINES)
|
||||
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
ARCH_SRCDIR = $(TOPDIR)\arch\$(CONFIG_ARCH)\src
|
||||
NUTTX = "$(TOPDIR)\nuttx$(EXEEXT)"
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/fs/loop.h>
|
||||
#include <nuttx/net/loopback.h>
|
||||
#include <nuttx/net/tun.h>
|
||||
#include <nuttx/syslog/ramlog.h>
|
||||
|
|
@ -159,6 +160,9 @@ void up_initialize(void)
|
|||
devzero_register(); /* Standard /dev/zero */
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_DEV_LOOP)
|
||||
loop_register(); /* Standard /dev/loop */
|
||||
#endif
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS */
|
||||
|
||||
/* Initialize the serial device driver */
|
||||
|
|
|
|||
|
|
@ -40,6 +40,10 @@ ifeq ($(CONFIG_ARCH_MIPS),y)
|
|||
ARCH_SUBDIR = mips32
|
||||
endif
|
||||
|
||||
CPPFLAGS += $(EXTRADEFINES)
|
||||
CFLAGS += $(EXTRADEFINES)
|
||||
CXXFLAGS += $(EXTRADEFINES)
|
||||
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
ARCH_SRCDIR = $(TOPDIR)\arch\$(CONFIG_ARCH)\src
|
||||
NUTTX = $(TOPDIR)\nuttx$(EXEEXT)
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/fs/loop.h>
|
||||
#include <nuttx/net/loopback.h>
|
||||
#include <nuttx/net/tun.h>
|
||||
#include <nuttx/syslog/ramlog.h>
|
||||
|
|
@ -161,6 +162,9 @@ void up_initialize(void)
|
|||
devzero_register(); /* Standard /dev/zero */
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_DEV_LOOP)
|
||||
loop_register(); /* Standard /dev/loop */
|
||||
#endif
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS */
|
||||
|
||||
/* Initialize the serial device driver */
|
||||
|
|
|
|||
|
|
@ -666,6 +666,7 @@ config PIC32MX_ETHERNET
|
|||
default n
|
||||
select NETDEVICES
|
||||
select ARCH_HAVE_PHY
|
||||
select ARCH_HAVE_NETDEV_STATISTICS
|
||||
|
||||
config PIC32MX_CTMU
|
||||
bool "Charge Time Measurement Unit (CMTU)"
|
||||
|
|
|
|||
|
|
@ -290,42 +290,6 @@
|
|||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/* EMAC statistics (debug only) */
|
||||
|
||||
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
|
||||
struct pic32mx_statistics_s
|
||||
{
|
||||
uint32_t rx_done; /* Rx done interrupts */
|
||||
uint32_t rx_errors; /* Number of Rx error interrupts */
|
||||
uint32_t rx_ovflw; /* Number of Rx overflow error interrupts */
|
||||
uint32_t rx_bufna; /* Number of Rx buffer not available errors */
|
||||
uint32_t rx_buse; /* Number of Rx BVCI bus errors */
|
||||
uint32_t rx_packets; /* Number of packets received (sum of the following): */
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
uint32_t rx_ip; /* Number of Rx IPv4 packets received */
|
||||
#endif
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
uint32_t rx_ipv6; /* Number of Rx IPv6 packets received */
|
||||
#endif
|
||||
uint32_t rx_arp; /* Number of Rx ARP packets received */
|
||||
uint32_t rx_dropped; /* Number of dropped, unsupported Rx packets */
|
||||
uint32_t rx_pkterr; /* Number of dropped, error in Rx descriptor */
|
||||
uint32_t rx_pktsize; /* Number of dropped, too small or too big */
|
||||
uint32_t rx_fragment; /* Number of dropped, packet fragments */
|
||||
uint32_t tx_done; /* Tx done interrupts */
|
||||
uint32_t tx_errors; /* Number of Tx error interrupts (OR of other errors) */
|
||||
uint32_t tx_abort; /* Number of Tx abort interrupts */
|
||||
uint32_t tx_buse; /* Number of Tx bus errors */
|
||||
uint32_t tx_packets; /* Number of Tx packets queued */
|
||||
uint32_t tx_pending; /* Number of Tx packets that had to wait for a TxDesc */
|
||||
uint32_t tx_unpend; /* Number of pending Tx packets that were sent */
|
||||
uint32_t tx_timeouts; /* Number of Tx timeout errors */
|
||||
};
|
||||
# define EMAC_STAT(priv,name) priv->pd_stat.name++
|
||||
#else
|
||||
# define EMAC_STAT(priv,name)
|
||||
#endif
|
||||
|
||||
/* The pic32mx_driver_s encapsulates all state information for a single hardware
|
||||
* interface
|
||||
*/
|
||||
|
|
@ -356,10 +320,6 @@ struct pic32mx_driver_s
|
|||
|
||||
sq_queue_t pd_freebuffers; /* The free buffer list */
|
||||
|
||||
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
|
||||
struct pic32mx_statistics_s pd_stat;
|
||||
#endif
|
||||
|
||||
/* This holds the information visible to uIP/NuttX */
|
||||
|
||||
struct net_driver_s pd_dev; /* Interface understood by uIP */
|
||||
|
|
@ -1051,7 +1011,7 @@ static int pic32mx_transmit(struct pic32mx_driver_s *priv)
|
|||
|
||||
/* Increment statistics and dump the packet (if so configured) */
|
||||
|
||||
EMAC_STAT(priv, tx_packets);
|
||||
NETDEV_TXPACKETS(&priv->pd_dev);
|
||||
pic32mx_dumppacket("Transmit packet", priv->pd_dev.d_buf, priv->pd_dev.d_len);
|
||||
|
||||
/* In order to transmit a message:
|
||||
|
|
@ -1348,7 +1308,6 @@ static void pic32mx_response(struct pic32mx_driver_s *priv)
|
|||
priv->pd_txpending = true;
|
||||
priv->pd_inten &= ~ETH_RXINTS;
|
||||
pic32mx_putreg(priv->pd_inten, PIC32MX_ETH_IEN);
|
||||
EMAC_STAT(priv, tx_pending);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1397,7 +1356,7 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv)
|
|||
|
||||
/* Update statistics */
|
||||
|
||||
EMAC_STAT(priv, rx_packets);
|
||||
NETDEV_RXPACKETS(&priv->pd_dev);
|
||||
|
||||
/* Get the packet length */
|
||||
|
||||
|
|
@ -1408,7 +1367,7 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv)
|
|||
if ((rxdesc->rsv2 & RXDESC_RSV2_OK) == 0)
|
||||
{
|
||||
nlldbg("ERROR. rsv1: %08x rsv2: %08x\n", rxdesc->rsv1, rxdesc->rsv2);
|
||||
EMAC_STAT(priv, rx_pkterr);
|
||||
NETDEV_RXERRORS(&priv->pd_dev);
|
||||
pic32mx_rxreturn(rxdesc);
|
||||
}
|
||||
|
||||
|
|
@ -1422,7 +1381,7 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv)
|
|||
{
|
||||
nlldbg("Too big. packet length: %d rxdesc: %08x\n",
|
||||
priv->pd_dev.d_len, rxdesc->status);
|
||||
EMAC_STAT(priv, rx_pktsize);
|
||||
NETDEV_RXERRORS(&priv->pd_dev);
|
||||
pic32mx_rxreturn(rxdesc);
|
||||
}
|
||||
|
||||
|
|
@ -1432,7 +1391,7 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv)
|
|||
(RXDESC_STATUS_EOP | RXDESC_STATUS_SOP))
|
||||
{
|
||||
nlldbg("Fragment. packet length: %d rxdesc: %08x\n", priv->pd_dev.d_len, rxdesc->status);
|
||||
EMAC_STAT(priv, rx_fragment);
|
||||
NETDEV_RXFRAGMENTS(&priv->pd_dev);
|
||||
pic32mx_rxreturn(rxdesc);
|
||||
}
|
||||
else
|
||||
|
|
@ -1470,12 +1429,12 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv)
|
|||
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||
{
|
||||
nllvdbg("IPv4 frame\n");
|
||||
NETDEV_RXIPV4(&priv->pd_dev);
|
||||
|
||||
/* Handle ARP on input then give the IPv4 packet to the network
|
||||
* layer
|
||||
*/
|
||||
|
||||
EMAC_STAT(priv, rx_ip);
|
||||
arp_ipin(&priv->pd_dev);
|
||||
ipv4_input(&priv->pd_dev);
|
||||
|
||||
|
|
@ -1512,10 +1471,10 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv)
|
|||
if (BUF->type == HTONS(ETHTYPE_IP6))
|
||||
{
|
||||
nllvdbg("Iv6 frame\n");
|
||||
NETDEV_RXIPV6(&priv->pd_dev);
|
||||
|
||||
/* Give the IPv6 packet to the network layer */
|
||||
|
||||
EMAC_STAT(priv, rx_ipv6);
|
||||
ipv6_input(&priv->pd_dev);
|
||||
|
||||
/* If the above function invocation resulted in data that
|
||||
|
|
@ -1552,7 +1511,7 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv)
|
|||
{
|
||||
/* Handle the incoming ARP packet */
|
||||
|
||||
EMAC_STAT(priv, rx_arp);
|
||||
NETDEV_RXARP(&priv->pd_dev);
|
||||
arp_arpin(&priv->pd_dev);
|
||||
|
||||
/* If the above function invocation resulted in data that
|
||||
|
|
@ -1571,7 +1530,7 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv)
|
|||
/* Unrecognized... drop it. */
|
||||
|
||||
nlldbg("Unrecognized packet type dropped: %04x\n", ntohs(BUF->type));
|
||||
EMAC_STAT(priv, rx_dropped);
|
||||
NETDEV_RXDROPPED(&priv->pd_dev);
|
||||
}
|
||||
|
||||
/* Discard any buffers still attached to the device structure */
|
||||
|
|
@ -1669,7 +1628,6 @@ static void pic32mx_txdone(struct pic32mx_driver_s *priv)
|
|||
/* Clear the pending condition, send the packet, and restore Rx interrupts */
|
||||
|
||||
priv->pd_txpending = false;
|
||||
EMAC_STAT(priv, tx_unpend);
|
||||
|
||||
pic32mx_transmit(priv);
|
||||
|
||||
|
|
@ -1733,9 +1691,8 @@ static int pic32mx_interrupt(int irq, void *context)
|
|||
|
||||
if ((status & ETH_INT_RXOVFLW) != 0)
|
||||
{
|
||||
nlldbg("RX Overrun. status: %08x\n", status);
|
||||
EMAC_STAT(priv, rx_errors);
|
||||
EMAC_STAT(priv, rx_ovflw);
|
||||
nlldbg("RX Overrun. status: %08x\n", status);
|
||||
NETDEV_RXERRORS(&priv->pd_dev);
|
||||
}
|
||||
|
||||
/* RXBUFNA: Receive Buffer Not Available Interrupt. This bit is set by
|
||||
|
|
@ -1746,8 +1703,7 @@ static int pic32mx_interrupt(int irq, void *context)
|
|||
if ((status & ETH_INT_RXBUFNA) != 0)
|
||||
{
|
||||
nlldbg("RX buffer descriptor overrun. status: %08x\n", status);
|
||||
EMAC_STAT(priv, rx_errors);
|
||||
EMAC_STAT(priv, rx_bufna);
|
||||
NETDEV_RXERRORS(&priv->pd_dev);
|
||||
}
|
||||
|
||||
/* RXBUSE: Receive BVCI Bus Error Interrupt. This bit is set when the
|
||||
|
|
@ -1758,8 +1714,7 @@ static int pic32mx_interrupt(int irq, void *context)
|
|||
if ((status & ETH_INT_RXBUSE) != 0)
|
||||
{
|
||||
nlldbg("RX BVCI bus error. status: %08x\n", status);
|
||||
EMAC_STAT(priv, rx_errors);
|
||||
EMAC_STAT(priv, rx_buse);
|
||||
NETDEV_RXERRORS(&priv->pd_dev);
|
||||
}
|
||||
|
||||
/* Receive Normal Events **********************************************/
|
||||
|
|
@ -1781,8 +1736,6 @@ static int pic32mx_interrupt(int irq, void *context)
|
|||
|
||||
if ((status & ETH_INT_RXDONE) != 0)
|
||||
{
|
||||
EMAC_STAT(priv, rx_done);
|
||||
|
||||
/* We have received at least one new incoming packet. */
|
||||
|
||||
pic32mx_rxdone(priv);
|
||||
|
|
@ -1804,8 +1757,7 @@ static int pic32mx_interrupt(int irq, void *context)
|
|||
if ((status & ETH_INT_TXABORT) != 0)
|
||||
{
|
||||
nlldbg("TX abort. status: %08x\n", status);
|
||||
EMAC_STAT(priv, tx_errors);
|
||||
EMAC_STAT(priv, tx_abort);
|
||||
NETDEV_TXERRORS(&priv->pd_dev);
|
||||
}
|
||||
|
||||
/* TXBUSE: Transmit BVCI Bus Error Interrupt. This bit is set when the
|
||||
|
|
@ -1816,8 +1768,7 @@ static int pic32mx_interrupt(int irq, void *context)
|
|||
if ((status & ETH_INT_TXBUSE) != 0)
|
||||
{
|
||||
nlldbg("TX BVCI bus error. status: %08x\n", status);
|
||||
EMAC_STAT(priv, tx_errors);
|
||||
EMAC_STAT(priv, tx_buse);
|
||||
NETDEV_TXERRORS(&priv->pd_dev);
|
||||
}
|
||||
|
||||
/* TXDONE: Transmit Done Interrupt. This bit is set when the currently
|
||||
|
|
@ -1829,7 +1780,7 @@ static int pic32mx_interrupt(int irq, void *context)
|
|||
|
||||
if ((status & ETH_INT_TXDONE) != 0)
|
||||
{
|
||||
EMAC_STAT(priv, tx_done);
|
||||
NETDEV_TXDONE(&priv->pd_dev);
|
||||
|
||||
/* A packet transmission just completed */
|
||||
|
||||
|
|
@ -1889,7 +1840,7 @@ static void pic32mx_txtimeout(int argc, uint32_t arg, ...)
|
|||
|
||||
/* Increment statistics and dump debug info */
|
||||
|
||||
EMAC_STAT(priv, tx_timeouts);
|
||||
NETDEV_TXTIMEOUTS(&priv->pd_dev);
|
||||
if (priv->pd_ifup)
|
||||
{
|
||||
/* Then reset the hardware. ifup() will reset the interface, then bring
|
||||
|
|
|
|||
|
|
@ -259,6 +259,7 @@ config PIC32MZ_ETHERNET
|
|||
default n
|
||||
select NETDEVICES
|
||||
select ARCH_HAVE_PHY
|
||||
select ARCH_HAVE_NETDEV_STATISTICS
|
||||
|
||||
config PIC32MZ_CTMU
|
||||
bool "Charge Time Measurement Unit (CMTU)"
|
||||
|
|
|
|||
|
|
@ -308,42 +308,6 @@
|
|||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/* EMAC statistics (debug only) */
|
||||
|
||||
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
|
||||
struct pic32mz_statistics_s
|
||||
{
|
||||
uint32_t rx_done; /* Rx done interrupts */
|
||||
uint32_t rx_errors; /* Number of Rx error interrupts */
|
||||
uint32_t rx_ovflw; /* Number of Rx overflow error interrupts */
|
||||
uint32_t rx_bufna; /* Number of Rx buffer not available errors */
|
||||
uint32_t rx_buse; /* Number of Rx BVCI bus errors */
|
||||
uint32_t rx_packets; /* Number of packets received (sum of the following): */
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
uint32_t rx_ip; /* Number of Rx IPv4 packets received */
|
||||
#endif
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
uint32_t rx_ipv6; /* Number of Rx IPv6 packets received */
|
||||
#endif
|
||||
uint32_t rx_arp; /* Number of Rx ARP packets received */
|
||||
uint32_t rx_dropped; /* Number of dropped, unsupported Rx packets */
|
||||
uint32_t rx_pkterr; /* Number of dropped, error in Rx descriptor */
|
||||
uint32_t rx_pktsize; /* Number of dropped, too small or too big */
|
||||
uint32_t rx_fragment; /* Number of dropped, packet fragments */
|
||||
uint32_t tx_done; /* Tx done interrupts */
|
||||
uint32_t tx_errors; /* Number of Tx error interrupts (OR of other errors) */
|
||||
uint32_t tx_abort; /* Number of Tx abort interrupts */
|
||||
uint32_t tx_buse; /* Number of Tx bus errors */
|
||||
uint32_t tx_packets; /* Number of Tx packets queued */
|
||||
uint32_t tx_pending; /* Number of Tx packets that had to wait for a TxDesc */
|
||||
uint32_t tx_unpend; /* Number of pending Tx packets that were sent */
|
||||
uint32_t tx_timeouts; /* Number of Tx timeout errors */
|
||||
};
|
||||
# define EMAC_STAT(priv,name) priv->pd_stat.name++
|
||||
#else
|
||||
# define EMAC_STAT(priv,name)
|
||||
#endif
|
||||
|
||||
/* The pic32mz_driver_s encapsulates all state information for a single hardware
|
||||
* interface
|
||||
*/
|
||||
|
|
@ -374,10 +338,6 @@ struct pic32mz_driver_s
|
|||
|
||||
sq_queue_t pd_freebuffers; /* The free buffer list */
|
||||
|
||||
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
|
||||
struct pic32mz_statistics_s pd_stat;
|
||||
#endif
|
||||
|
||||
/* This holds the information visible to uIP/NuttX */
|
||||
|
||||
struct net_driver_s pd_dev; /* Interface understood by uIP */
|
||||
|
|
@ -1069,7 +1029,7 @@ static int pic32mz_transmit(struct pic32mz_driver_s *priv)
|
|||
|
||||
/* Increment statistics and dump the packet (if so configured) */
|
||||
|
||||
EMAC_STAT(priv, tx_packets);
|
||||
NETDEV_TXPACKETS(&priv->pd_dev);
|
||||
pic32mz_dumppacket("Transmit packet", priv->pd_dev.d_buf, priv->pd_dev.d_len);
|
||||
|
||||
/* In order to transmit a message:
|
||||
|
|
@ -1366,7 +1326,6 @@ static void pic32mz_response(struct pic32mz_driver_s *priv)
|
|||
priv->pd_txpending = true;
|
||||
priv->pd_inten &= ~ETH_RXINTS;
|
||||
pic32mz_putreg(priv->pd_inten, PIC32MZ_ETH_IEN);
|
||||
EMAC_STAT(priv, tx_pending);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1415,7 +1374,7 @@ static void pic32mz_rxdone(struct pic32mz_driver_s *priv)
|
|||
|
||||
/* Update statistics */
|
||||
|
||||
EMAC_STAT(priv, rx_packets);
|
||||
NETDEV_RXPACKETS(&priv->pd_dev);
|
||||
|
||||
/* Get the packet length */
|
||||
|
||||
|
|
@ -1426,7 +1385,7 @@ static void pic32mz_rxdone(struct pic32mz_driver_s *priv)
|
|||
if ((rxdesc->rsv2 & RXDESC_RSV2_OK) == 0)
|
||||
{
|
||||
nlldbg("ERROR. rsv1: %08x rsv2: %08x\n", rxdesc->rsv1, rxdesc->rsv2);
|
||||
EMAC_STAT(priv, rx_pkterr);
|
||||
NETDEV_RXERRORS(&priv->pd_dev);
|
||||
pic32mz_rxreturn(rxdesc);
|
||||
}
|
||||
|
||||
|
|
@ -1439,7 +1398,7 @@ static void pic32mz_rxdone(struct pic32mz_driver_s *priv)
|
|||
else if (priv->pd_dev.d_len > CONFIG_NET_ETH_MTU)
|
||||
{
|
||||
nlldbg("Too big. packet length: %d rxdesc: %08x\n", priv->pd_dev.d_len, rxdesc->status);
|
||||
EMAC_STAT(priv, rx_pktsize);
|
||||
NETDEV_RXERRORS(&priv->pd_dev);
|
||||
pic32mz_rxreturn(rxdesc);
|
||||
}
|
||||
|
||||
|
|
@ -1449,7 +1408,7 @@ static void pic32mz_rxdone(struct pic32mz_driver_s *priv)
|
|||
(RXDESC_STATUS_EOP | RXDESC_STATUS_SOP))
|
||||
{
|
||||
nlldbg("Fragment. packet length: %d rxdesc: %08x\n", priv->pd_dev.d_len, rxdesc->status);
|
||||
EMAC_STAT(priv, rx_fragment);
|
||||
NETDEV_RXFRAGMENTS(&priv->pd_dev);
|
||||
pic32mz_rxreturn(rxdesc);
|
||||
}
|
||||
else
|
||||
|
|
@ -1487,12 +1446,12 @@ static void pic32mz_rxdone(struct pic32mz_driver_s *priv)
|
|||
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||
{
|
||||
nllvdbg("IPv4 frame\n");
|
||||
NETDEV_RXIPV4(&priv->pd_dev);
|
||||
|
||||
/* Handle ARP on input then give the IPv4 packet to the network
|
||||
* layer
|
||||
*/
|
||||
|
||||
EMAC_STAT(priv, rx_ip);
|
||||
arp_ipin(&priv->pd_dev);
|
||||
ipv4_input(&priv->pd_dev);
|
||||
|
||||
|
|
@ -1529,10 +1488,10 @@ static void pic32mz_rxdone(struct pic32mz_driver_s *priv)
|
|||
if (BUF->type == HTONS(ETHTYPE_IP6))
|
||||
{
|
||||
nllvdbg("Iv6 frame\n");
|
||||
NETDEV_RXIPV6(&priv->pd_dev);
|
||||
|
||||
/* Give the IPv6 packet to the network layer */
|
||||
|
||||
EMAC_STAT(priv, rx_ipv6);
|
||||
ipv6_input(&priv->pd_dev);
|
||||
|
||||
/* If the above function invocation resulted in data that
|
||||
|
|
@ -1569,7 +1528,7 @@ static void pic32mz_rxdone(struct pic32mz_driver_s *priv)
|
|||
{
|
||||
/* Handle the incoming ARP packet */
|
||||
|
||||
EMAC_STAT(priv, rx_arp);
|
||||
NETDEV_RXARP(&priv->pd_dev);
|
||||
arp_arpin(&priv->pd_dev);
|
||||
|
||||
/* If the above function invocation resulted in data that
|
||||
|
|
@ -1588,7 +1547,7 @@ static void pic32mz_rxdone(struct pic32mz_driver_s *priv)
|
|||
/* Unrecognized... drop it. */
|
||||
|
||||
nlldbg("Unrecognized packet type dropped: %04x\n", ntohs(BUF->type));
|
||||
EMAC_STAT(priv, rx_dropped);
|
||||
NETDEV_RXDROPPED(&priv->pd_dev);
|
||||
}
|
||||
|
||||
/* Discard any buffers still attached to the device structure */
|
||||
|
|
@ -1686,7 +1645,6 @@ static void pic32mz_txdone(struct pic32mz_driver_s *priv)
|
|||
/* Clear the pending condition, send the packet, and restore Rx interrupts */
|
||||
|
||||
priv->pd_txpending = false;
|
||||
EMAC_STAT(priv, tx_unpend);
|
||||
|
||||
pic32mz_transmit(priv);
|
||||
|
||||
|
|
@ -1750,9 +1708,8 @@ static int pic32mz_interrupt(int irq, void *context)
|
|||
|
||||
if ((status & ETH_INT_RXOVFLW) != 0)
|
||||
{
|
||||
nlldbg("RX Overrun. status: %08x\n", status);
|
||||
EMAC_STAT(priv, rx_errors);
|
||||
EMAC_STAT(priv, rx_ovflw);
|
||||
nlldbg("RX Overrun. status: %08x\n", status);
|
||||
NETDEV_RXERRORS(&priv->pd_dev);
|
||||
}
|
||||
|
||||
/* RXBUFNA: Receive Buffer Not Available Interrupt. This bit is set by
|
||||
|
|
@ -1763,8 +1720,7 @@ static int pic32mz_interrupt(int irq, void *context)
|
|||
if ((status & ETH_INT_RXBUFNA) != 0)
|
||||
{
|
||||
nlldbg("RX buffer descriptor overrun. status: %08x\n", status);
|
||||
EMAC_STAT(priv, rx_errors);
|
||||
EMAC_STAT(priv, rx_bufna);
|
||||
NETDEV_RXERRORS(&priv->pd_dev);
|
||||
}
|
||||
|
||||
/* RXBUSE: Receive BVCI Bus Error Interrupt. This bit is set when the
|
||||
|
|
@ -1775,8 +1731,7 @@ static int pic32mz_interrupt(int irq, void *context)
|
|||
if ((status & ETH_INT_RXBUSE) != 0)
|
||||
{
|
||||
nlldbg("RX BVCI bus error. status: %08x\n", status);
|
||||
EMAC_STAT(priv, rx_errors);
|
||||
EMAC_STAT(priv, rx_buse);
|
||||
NETDEV_RXERRORS(&priv->pd_dev);
|
||||
}
|
||||
|
||||
/* Receive Normal Events **********************************************/
|
||||
|
|
@ -1798,8 +1753,6 @@ static int pic32mz_interrupt(int irq, void *context)
|
|||
|
||||
if ((status & ETH_INT_RXDONE) != 0)
|
||||
{
|
||||
EMAC_STAT(priv, rx_done);
|
||||
|
||||
/* We have received at least one new incoming packet. */
|
||||
|
||||
pic32mz_rxdone(priv);
|
||||
|
|
@ -1821,8 +1774,7 @@ static int pic32mz_interrupt(int irq, void *context)
|
|||
if ((status & ETH_INT_TXABORT) != 0)
|
||||
{
|
||||
nlldbg("TX abort. status: %08x\n", status);
|
||||
EMAC_STAT(priv, tx_errors);
|
||||
EMAC_STAT(priv, tx_abort);
|
||||
NETDEV_TXERRORS(&priv->pd_dev);
|
||||
}
|
||||
|
||||
/* TXBUSE: Transmit BVCI Bus Error Interrupt. This bit is set when the
|
||||
|
|
@ -1833,8 +1785,7 @@ static int pic32mz_interrupt(int irq, void *context)
|
|||
if ((status & ETH_INT_TXBUSE) != 0)
|
||||
{
|
||||
nlldbg("TX BVCI bus error. status: %08x\n", status);
|
||||
EMAC_STAT(priv, tx_errors);
|
||||
EMAC_STAT(priv, tx_buse);
|
||||
NETDEV_TXERRORS(&priv->pd_dev);
|
||||
}
|
||||
|
||||
/* TXDONE: Transmit Done Interrupt. This bit is set when the currently
|
||||
|
|
@ -1846,7 +1797,7 @@ static int pic32mz_interrupt(int irq, void *context)
|
|||
|
||||
if ((status & ETH_INT_TXDONE) != 0)
|
||||
{
|
||||
EMAC_STAT(priv, tx_done);
|
||||
NETDEV_TXDONE(&priv->pd_dev);
|
||||
|
||||
/* A packet transmission just completed */
|
||||
|
||||
|
|
@ -1906,7 +1857,7 @@ static void pic32mz_txtimeout(int argc, uint32_t arg, ...)
|
|||
|
||||
/* Increment statistics and dump debug info */
|
||||
|
||||
EMAC_STAT(priv, tx_timeouts);
|
||||
NETDEV_TXTIMEOUTS(&priv->pd_dev);
|
||||
if (priv->pd_ifup)
|
||||
{
|
||||
/* Then reset the hardware. ifup() will reset the interface, then bring
|
||||
|
|
|
|||
|
|
@ -39,7 +39,9 @@ include $(CONFIG_RGMP_SUBARCH)/Make.defs
|
|||
RGMP_ARCH_ASRCS := $(addprefix $(CONFIG_RGMP_SUBARCH)/,$(RGMP_ARCH_ASRCS))
|
||||
RGMP_ARCH_CSRCS := $(addprefix $(CONFIG_RGMP_SUBARCH)/,$(RGMP_ARCH_CSRCS))
|
||||
|
||||
CFLAGS += -I$(TOPDIR)/sched -I$(TOPDIR)/fs
|
||||
CPPFLAGS += -I$(TOPDIR)/sched -I$(TOPDIR)/fs $(EXTRADEFINES)
|
||||
CFLAGS += -I$(TOPDIR)/sched -I$(TOPDIR)/fs $(EXTRADEFINES)
|
||||
CXXFLAGS += -I$(TOPDIR)/sched -I$(TOPDIR)/fs $(EXTRADEFINES)
|
||||
|
||||
ASRCS = $(RGMP_ARCH_ASRCS)
|
||||
CSRCS = nuttx.c cxx.c $(RGMP_ARCH_CSRCS)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ config ARCH_CHIP_SH7032
|
|||
config ARCH_CHIP_M30262F8
|
||||
bool "M30262F8"
|
||||
select ARCH_M16C
|
||||
select MM_SMALL
|
||||
---help---
|
||||
Renesas M30262F8 (M16C)
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,10 @@
|
|||
-include $(TOPDIR)/Make.defs
|
||||
-include chip/Make.defs
|
||||
|
||||
CPPFLAGS += $(EXTRADEFINES)
|
||||
CFLAGS += $(EXTRADEFINES)
|
||||
CXXFLAGS += $(EXTRADEFINES)
|
||||
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
ARCH_SRCDIR = $(TOPDIR)\arch\$(CONFIG_ARCH)\src
|
||||
NUTTX = $(TOPDIR)\nuttx$(EXEEXT)
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/fs/loop.h>
|
||||
#include <nuttx/net/loopback.h>
|
||||
#include <nuttx/net/tun.h>
|
||||
#include <nuttx/syslog/ramlog.h>
|
||||
|
|
@ -146,6 +147,9 @@ void up_initialize(void)
|
|||
devzero_register(); /* Standard /dev/zero */
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_DEV_LOOP)
|
||||
loop_register(); /* Standard /dev/loop */
|
||||
#endif
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS */
|
||||
|
||||
/* Initialize the serial device driver */
|
||||
|
|
|
|||
|
|
@ -76,14 +76,14 @@ typedef signed long long _int64_t;
|
|||
typedef unsigned long long _uint64_t;
|
||||
#define __INT64_DEFINED
|
||||
|
||||
#ifdef CONFIG_HOST_X86_64
|
||||
/* 32-bit build on 64-bit machine: A pointer is 8 bytes */
|
||||
#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
|
||||
/* 64-bit build on 64-bit machine: A pointer is 8 bytes */
|
||||
|
||||
typedef signed long long _intptr_t;
|
||||
typedef unsigned long long _uintptr_t;
|
||||
|
||||
#else
|
||||
/* 32-bit build on 32-bit machine: A pointer is 4 bytes */
|
||||
/* 32-bit build on 32- or 64-bit machine: A pointer is 4 bytes */
|
||||
|
||||
typedef signed int _intptr_t;
|
||||
typedef unsigned int _uintptr_t;
|
||||
|
|
|
|||
1
arch/sim/src/.gitignore
vendored
1
arch/sim/src/.gitignore
vendored
|
|
@ -3,6 +3,7 @@
|
|||
/Cygwin-names.dat
|
||||
/Linux-names.dat
|
||||
/nuttx.rel
|
||||
/hostfs.h
|
||||
/GNU
|
||||
/chip
|
||||
/board
|
||||
|
|
|
|||
|
|
@ -35,7 +35,9 @@
|
|||
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
CFLAGS += -I$(TOPDIR)/sched
|
||||
CPPFLAGS += -I$(TOPDIR)/sched $(EXTRADEFINES)
|
||||
CFLAGS += -I$(TOPDIR)/sched $(EXTRADEFINES)
|
||||
CXXFLAGS += -I$(TOPDIR)/sched $(EXTRADEFINES)
|
||||
|
||||
ASRCS =
|
||||
|
||||
|
|
@ -68,10 +70,6 @@ ifeq ($(CONFIG_DEV_CONSOLE),y)
|
|||
HOSTSRCS += up_simuart.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
||||
CSRCS += up_appinit.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NX_LCDDRIVER),y)
|
||||
CSRCS += board_lcd.c
|
||||
else
|
||||
|
|
@ -91,28 +89,38 @@ endif
|
|||
endif
|
||||
|
||||
ifeq ($(CONFIG_ELF),y)
|
||||
CSRCS += up_elf.c
|
||||
CSRCS += up_elf.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_FS_FAT),y)
|
||||
CSRCS += up_blockdevice.c up_deviceimage.c
|
||||
CSRCS += up_blockdevice.c up_deviceimage.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_ROMGETC),y)
|
||||
CSRCS += up_romgetc.c
|
||||
CSRCS += up_romgetc.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NET_ETHERNET),y)
|
||||
CSRCS += up_netdriver.c
|
||||
HOSTCFLAGS += -DNETDEV_BUFSIZE=$(CONFIG_NET_ETH_MTU)
|
||||
CSRCS += up_netdriver.c
|
||||
HOSTCFLAGS += -DNETDEV_BUFSIZE=$(CONFIG_NET_ETH_MTU)
|
||||
ifneq ($(HOSTOS),Cygwin)
|
||||
HOSTSRCS += up_tapdev.c up_netdev.c
|
||||
HOSTSRCS += up_tapdev.c up_netdev.c
|
||||
else
|
||||
HOSTSRCS += up_wpcap.c up_netdev.c
|
||||
DRVLIB = /lib/w32api/libws2_32.a /lib/w32api/libiphlpapi.a
|
||||
HOSTSRCS += up_wpcap.c up_netdev.c
|
||||
DRVLIB = /lib/w32api/libws2_32.a /lib/w32api/libiphlpapi.a
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_FS_HOSTFS),y)
|
||||
HOSTSRCS += up_hostfs.c
|
||||
|
||||
up_hostfs.c: hostfs.h
|
||||
|
||||
hostfs.h: $(TOPDIR)/include/nuttx/fs/hostfs.h
|
||||
@echo "CP: $<"
|
||||
$(Q) cp $< $@
|
||||
endif
|
||||
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
NUTTXOBJS = $(AOBJS) $(COBJS)
|
||||
|
|
@ -260,6 +268,7 @@ distclean: clean
|
|||
fi
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
$(call DELFILE, hostfs.h)
|
||||
$(Q) rm -rf GNU
|
||||
|
||||
-include Make.dep
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ poll NXpoll
|
|||
printf NXprintf
|
||||
pthread_create NXpthread_create
|
||||
read NXread
|
||||
readdir NXreaddir
|
||||
realloc NXrealloc
|
||||
recv NXrecv
|
||||
recvfrom NXrecvfrom
|
||||
|
|
|
|||
|
|
@ -1,65 +0,0 @@
|
|||
/****************************************************************************
|
||||
* arch/sim/src/up_appinit.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_app_initialize
|
||||
*
|
||||
* Description:
|
||||
* Perform application specific initialization. This function is never
|
||||
* called directly from application code, but only indirectly via the
|
||||
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_LIB_BOARDCTL
|
||||
int board_app_initialize(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_LIB_BOARDCTL */
|
||||
|
|
@ -102,7 +102,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
|||
|
||||
/* Move up to next even word boundary if necessary */
|
||||
|
||||
size_t adj_stack_size = (stack_size + 3) & ~3;
|
||||
size_t adj_stack_size = (stack_size + 3) & ~3;
|
||||
size_t adj_stack_words = adj_stack_size >> 2;
|
||||
|
||||
/* Allocate the memory for the stack */
|
||||
|
|
@ -115,7 +115,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
|||
{
|
||||
/* This is the address of the last word in the allocation */
|
||||
|
||||
size_t *adj_stack_ptr = &stack_alloc_ptr[adj_stack_words - 1];
|
||||
void *adj_stack_ptr = &stack_alloc_ptr[adj_stack_words - 1];
|
||||
|
||||
/* Save the values in the TCB */
|
||||
|
||||
|
|
|
|||
386
arch/sim/src/up_hostfs.c
Normal file
386
arch/sim/src/up_hostfs.c
Normal file
|
|
@ -0,0 +1,386 @@
|
|||
/****************************************************************************
|
||||
* arch/sim/src/up_hostfs.c
|
||||
*
|
||||
* Copyright (C) 2015 Ken Pettit. All rights reserved.
|
||||
* Author: Ken Pettit <pettitkd@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
#define _BSD_SOURCE
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/statfs.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <dirent.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "hostfs.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int host_open(const char *pathname, int flags, int mode)
|
||||
{
|
||||
int mapflags;
|
||||
|
||||
/* Perform flag mapping */
|
||||
|
||||
if ((flags & (HOSTFS_FLAG_RDOK | HOSTFS_FLAG_WROK)) ==
|
||||
(HOSTFS_FLAG_RDOK | HOSTFS_FLAG_WROK))
|
||||
{
|
||||
mapflags = O_RDWR;
|
||||
}
|
||||
else if (flags & HOSTFS_FLAG_RDOK)
|
||||
{
|
||||
mapflags = O_RDONLY;
|
||||
}
|
||||
else if (flags & HOSTFS_FLAG_WROK)
|
||||
{
|
||||
mapflags = O_WRONLY;
|
||||
}
|
||||
|
||||
if (flags & HOSTFS_FLAG_APPEND)
|
||||
{
|
||||
mapflags |= O_APPEND;
|
||||
}
|
||||
|
||||
if (flags & HOSTFS_FLAG_CREAT)
|
||||
{
|
||||
mapflags |= O_CREAT;
|
||||
}
|
||||
|
||||
if (flags & HOSTFS_FLAG_EXCL)
|
||||
{
|
||||
mapflags |= O_EXCL;
|
||||
}
|
||||
|
||||
if (flags & HOSTFS_FLAG_TRUNC)
|
||||
{
|
||||
mapflags |= O_TRUNC;
|
||||
}
|
||||
|
||||
return open(pathname, mapflags, mode);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int host_close(int fd)
|
||||
{
|
||||
/* Just call the close routine */
|
||||
|
||||
return close(fd);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
ssize_t host_read(int fd, void* buf, size_t count)
|
||||
{
|
||||
/* Just call the read routine */
|
||||
|
||||
return read(fd, buf, count);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
ssize_t host_write(int fd, const void *buf, size_t count)
|
||||
{
|
||||
/* Just call the write routine */
|
||||
|
||||
return write(fd, buf, count);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
off_t host_lseek(int fd, off_t offset, int whence)
|
||||
{
|
||||
/* Just call the lseek routine */
|
||||
|
||||
return lseek(fd, offset, whence);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int host_ioctl(int fd, int request, unsigned long arg)
|
||||
{
|
||||
/* Just call the ioctl routine */
|
||||
|
||||
return ioctl(fd, request, arg);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
void host_sync(int fd)
|
||||
{
|
||||
/* Just call the sync routine */
|
||||
|
||||
sync();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int host_dup(int fd)
|
||||
{
|
||||
return dup(fd);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
void *host_opendir(const char *name)
|
||||
{
|
||||
return (void *) opendir(name);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int host_readdir(void* dirp, struct host_dirent_s* entry)
|
||||
{
|
||||
struct dirent *ent;
|
||||
|
||||
/* Call the host's readdir routine */
|
||||
|
||||
ent = readdir(dirp);
|
||||
|
||||
if (ent != NULL)
|
||||
{
|
||||
/* Copy the entry name */
|
||||
|
||||
strncpy(entry->d_name, ent->d_name, sizeof(entry->d_name));
|
||||
|
||||
/* Map the type */
|
||||
|
||||
entry->d_type = 0;
|
||||
if (ent->d_type == DT_REG)
|
||||
{
|
||||
entry->d_type = HOSTFS_DTYPE_FILE;
|
||||
}
|
||||
else if (ent->d_type == DT_CHR)
|
||||
{
|
||||
entry->d_type = HOSTFS_DTYPE_CHR;
|
||||
}
|
||||
else if (ent->d_type == DT_BLK)
|
||||
{
|
||||
entry->d_type = HOSTFS_DTYPE_BLK;
|
||||
}
|
||||
else if (ent->d_type == DT_DIR)
|
||||
{
|
||||
entry->d_type = HOSTFS_DTYPE_DIRECTORY;
|
||||
}
|
||||
}
|
||||
|
||||
if (ent)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
void host_rewinddir(void* dirp)
|
||||
{
|
||||
/* Just call the rewinddir routine */
|
||||
|
||||
rewinddir(dirp);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int host_closedir(void* dirp)
|
||||
{
|
||||
return closedir(dirp);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int host_statfs(const char *path, struct host_statfs_s *buf)
|
||||
{
|
||||
int ret;
|
||||
struct statfs host_buf;
|
||||
|
||||
/* Call the host's statfs routine */
|
||||
|
||||
ret = statfs(path, &host_buf);
|
||||
|
||||
/* Map the return values */
|
||||
|
||||
buf->f_type = host_buf.f_type;
|
||||
buf->f_bsize = host_buf.f_bsize;
|
||||
buf->f_blocks = host_buf.f_blocks;
|
||||
buf->f_bfree = host_buf.f_bfree;
|
||||
buf->f_bavail = host_buf.f_bavail;
|
||||
buf->f_files = host_buf.f_files;
|
||||
buf->f_ffree = host_buf.f_ffree;
|
||||
buf->f_fsid = 0;
|
||||
buf->f_namelen = host_buf.f_namelen;
|
||||
buf->f_frsize = host_buf.f_frsize;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int host_unlink(const char *pathname)
|
||||
{
|
||||
return unlink(pathname);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int host_mkdir(const char *pathname, mode_t mode)
|
||||
{
|
||||
/* Just call the host's mkdir routine */
|
||||
|
||||
return mkdir(pathname, mode);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int host_rmdir(const char *pathname)
|
||||
{
|
||||
return rmdir(pathname);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int host_rename(const char *oldpath, const char *newpath)
|
||||
{
|
||||
return rename(oldpath, newpath);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int host_stat(const char *path, struct host_stat_s *buf)
|
||||
{
|
||||
struct stat host_buf;
|
||||
int ret;
|
||||
|
||||
/* Call the host's stat routine */
|
||||
|
||||
ret = stat(path, &host_buf);
|
||||
|
||||
/* Now map the return values to the common struct */
|
||||
|
||||
buf->st_dev = host_buf.st_dev; /* ID of the device containing file */
|
||||
buf->st_ino = host_buf.st_ino;; /* inode number */
|
||||
buf->st_nlink = host_buf.st_nlink; /* number of hard links */
|
||||
buf->st_uid = host_buf.st_uid; /* user ID of owner */
|
||||
buf->st_gid = host_buf.st_gid; /* group ID of owner */
|
||||
buf->st_rdev = host_buf.st_rdev; /* device ID */
|
||||
buf->st_size = host_buf.st_size; /* total size, in bytes */
|
||||
buf->st_blksize = host_buf.st_blksize; /* blocksize for file system I/O */
|
||||
buf->st_blocks = host_buf.st_blocks; /* number of 512B blocks allocated */
|
||||
buf->st_atim = host_buf.st_atime; /* time of last access */
|
||||
buf->st_mtim = host_buf.st_mtime; /* time of last modification */
|
||||
buf->st_ctim = host_buf.st_ctime; /* time of last status change */
|
||||
|
||||
/* Map the mode bits */
|
||||
|
||||
buf->st_mode = host_buf.st_mode & 0xFFF;
|
||||
if (S_ISREG(host_buf.st_mode))
|
||||
{
|
||||
buf->st_mode |= HOST_ST_MODE_REG;
|
||||
}
|
||||
|
||||
if (S_ISDIR(host_buf.st_mode))
|
||||
{
|
||||
buf->st_mode |= HOST_ST_MODE_DIR;
|
||||
}
|
||||
|
||||
if (S_ISCHR(host_buf.st_mode))
|
||||
{
|
||||
buf->st_mode |= HOST_ST_MODE_CHR;
|
||||
}
|
||||
|
||||
if (S_ISBLK(host_buf.st_mode))
|
||||
{
|
||||
buf->st_mode |= HOST_ST_MODE_BLK;
|
||||
}
|
||||
|
||||
if (S_ISFIFO(host_buf.st_mode))
|
||||
{
|
||||
buf->st_mode |= HOST_ST_MODE_PIPE;
|
||||
}
|
||||
|
||||
if (S_ISLNK(host_buf.st_mode))
|
||||
{
|
||||
buf->st_mode |= HOST_ST_MODE_LINK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -43,6 +43,7 @@
|
|||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/fs/loop.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
#include <nuttx/net/loopback.h>
|
||||
#include <nuttx/net/tun.h>
|
||||
|
|
@ -149,6 +150,9 @@ void up_initialize(void)
|
|||
devzero_register(); /* Standard /dev/zero */
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_DEV_LOOP)
|
||||
loop_register(); /* Standard /dev/loop */
|
||||
#endif
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS */
|
||||
|
||||
#if defined(USE_DEVCONSOLE)
|
||||
|
|
|
|||
|
|
@ -40,6 +40,10 @@ ifeq ($(CONFIG_ARCH_I486),y)
|
|||
ARCH_SUBDIR = i486
|
||||
endif
|
||||
|
||||
CPPFLAGS += $(EXTRADEFINES)
|
||||
CFLAGS += $(EXTRADEFINES)
|
||||
CXXFLAGS += $(EXTRADEFINES)
|
||||
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
ARCH_SRCDIR = $(TOPDIR)\arch\$(CONFIG_ARCH)\src
|
||||
NUTTX = $(TOPDIR)\nuttx$(EXEEXT)
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/fs/loop.h>
|
||||
#include <nuttx/net/loopback.h>
|
||||
#include <nuttx/net/tun.h>
|
||||
#include <nuttx/syslog/ramlog.h>
|
||||
|
|
@ -161,6 +162,9 @@ void up_initialize(void)
|
|||
devzero_register(); /* Standard /dev/zero */
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_DEV_LOOP)
|
||||
loop_register(); /* Standard /dev/loop */
|
||||
#endif
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS */
|
||||
|
||||
/* Initialize the serial device driver */
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ endif
|
|||
|
||||
INCLUDES = $(ARCHSTDINCLUDES) $(USRINCLUDES)
|
||||
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(INCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
CPPFLAGS += -I$(ARCHSRCDIR)
|
||||
CPPFLAGS += -I$(ARCHSRCDIR) $(EXTRADEFINES)
|
||||
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
LDFLAGS += @"$(ARCHSRCDIR)/nuttx.linkcmd"
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/fs/loop.h>
|
||||
#include <nuttx/net/loopback.h>
|
||||
#include <nuttx/net/tun.h>
|
||||
#include <nuttx/syslog/ramlog.h>
|
||||
|
|
@ -165,6 +166,9 @@ void up_initialize(void)
|
|||
devzero_register(); /* Standard /dev/zero */
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_DEV_LOOP)
|
||||
loop_register(); /* Standard /dev/loop */
|
||||
#endif
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS */
|
||||
|
||||
/* Initialize the serial device driver */
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ choice
|
|||
config ARCH_CHIP_Z80
|
||||
bool "Classic z80"
|
||||
select ARCH_NOINTC
|
||||
select MM_SMALL
|
||||
---help---
|
||||
Classic ZiLOG z80 chip
|
||||
|
||||
|
|
@ -378,6 +379,7 @@ config ARCH_CHIP_Z8F640X
|
|||
|
||||
config ARCH_CHIP_Z180
|
||||
bool
|
||||
select MM_SMALL
|
||||
select ARCH_NOINTC
|
||||
select ARCH_HAVE_ADDRENV
|
||||
select ARCH_ADDRENV
|
||||
|
|
@ -406,9 +408,11 @@ config ARCH_CHIP_Z8S180
|
|||
|
||||
config ARCH_CHIP_Z8
|
||||
bool
|
||||
select MM_SMALL
|
||||
|
||||
config ARCH_CHIP_EZ80
|
||||
bool
|
||||
select MM_SMALL if EZ80_Z80MODE
|
||||
select HAVE_LOWSERIALINIT
|
||||
select ARCH_HAVE_PHY
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/fs/loop.h>
|
||||
#include <nuttx/net/loopback.h>
|
||||
#include <nuttx/net/tun.h>
|
||||
|
||||
|
|
@ -157,6 +158,9 @@ void up_initialize(void)
|
|||
devzero_register(); /* Standard /dev/zero */
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_DEV_LOOP)
|
||||
loop_register(); /* Standard /dev/loop */
|
||||
#endif
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS */
|
||||
|
||||
/* Initialize the serial device driver */
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ config EZ80_EMAC
|
|||
bool "Ethernet MAC"
|
||||
default n
|
||||
select ARCH_HAVE_PHY
|
||||
select ARCH_HAVE_NETDEV_STATISTICS
|
||||
---help---
|
||||
Enables support for ez80 EMAC driver.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue