summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-05-21 00:23:53 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-05-21 00:23:53 +0000
commit5c2ab2b81b0e0e851d73fb49cf21def02931e4b9 (patch)
treebd19f40d283ac6085543a696d436c6d8075b6612
parente423a5a5fe5cc3553e3097cff37470b2c5212991 (diff)
downloadnuttx-5c2ab2b81b0e0e851d73fb49cf21def02931e4b9.tar.gz
nuttx-5c2ab2b81b0e0e851d73fb49cf21def02931e4b9.tar.bz2
nuttx-5c2ab2b81b0e0e851d73fb49cf21def02931e4b9.zip
LM3S ethernet driver development
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1811 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/ChangeLog4
-rw-r--r--nuttx/Documentation/NuttX.html4
-rw-r--r--nuttx/arch/arm/src/lm3s/lm3s_ethernet.c547
-rw-r--r--nuttx/arch/arm/src/lm3s/lm3s_ethernet.h1
-rw-r--r--nuttx/configs/eagle100/README.txt1
-rw-r--r--nuttx/configs/eagle100/include/board.h1
-rw-r--r--nuttx/configs/eagle100/nettest/Make.defs120
-rw-r--r--nuttx/configs/eagle100/nettest/defconfig525
-rw-r--r--nuttx/configs/eagle100/nettest/ld.script97
-rwxr-xr-xnuttx/configs/eagle100/nettest/setenv.sh46
-rw-r--r--nuttx/configs/eagle100/src/up_ethernet.c22
11 files changed, 1264 insertions, 104 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 39f5d27be..f7224b673 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -724,3 +724,7 @@
0.4.7 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
+ * arch/arm/src/lm2s: Added an Ethernet driver for the LM3S6918
+ * configs/eagle100/nettest: Added an examples/nettest configuration for the
+ Micromint Eagle100 board.
+
diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html
index 4f3d339ce..6bc942e93 100644
--- a/nuttx/Documentation/NuttX.html
+++ b/nuttx/Documentation/NuttX.html
@@ -1413,6 +1413,10 @@ buildroot-0.1.5 2009-04-25 &lt;spudmonkey@racsa.co.cr&gt;
<pre><ul>
nuttx-0.4.7 2009-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
+ * arch/arm/src/lm2s: Added an Ethernet driver for the LM3S6918
+ * configs/eagle100/nettest: Added an examples/nettest configuration for the
+ Micromint Eagle100 board.
+
pascal-0.1.3 2009-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
buildroot-0.1.6 2009-xx-xx &lt;spudmonkey@racsa.co.cr&gt;
diff --git a/nuttx/arch/arm/src/lm3s/lm3s_ethernet.c b/nuttx/arch/arm/src/lm3s/lm3s_ethernet.c
index b7aab1544..84dadc700 100644
--- a/nuttx/arch/arm/src/lm3s/lm3s_ethernet.c
+++ b/nuttx/arch/arm/src/lm3s/lm3s_ethernet.c
@@ -53,12 +53,20 @@
#include <net/uip/uip-arp.h>
#include <net/uip/uip-arch.h>
+#include "up_arch.h"
+#include "chip.h"
#include "lm3s_internal.h"
/****************************************************************************
* Definitions
****************************************************************************/
+#ifdef CONFIG_ARCH_CHIP_LM3S6918
+# define LM3S_NINTERFACES 1
+#else
+# error "No Ethernet support for this LM3S chip"
+#endif
+
/* TX poll deley = 1 seconds. CLK_TCK is the number of clock ticks per second */
#define LM3S_WDDELAY (1*CLK_TCK)
@@ -70,7 +78,7 @@
/* This is a helper pointer for accessing the contents of the Ethernet header */
-#define BUF ((struct uip_eth_hdr *)skel->ld_dev.d_buf)
+#define BUF ((struct uip_eth_hdr *)priv->ld_dev.d_buf)
/****************************************************************************
* Private Types
@@ -82,6 +90,15 @@
struct lm3s_driver_s
{
+ /* The following fields would only be necessary on chips that support
+ * multiple Ethernet controllers.
+ */
+
+#if LM3S_NINTERFACES > 1
+ uint32 ld_base; /* Ethernet controller base address */
+ int ld-irq; /* Ethernet controller IRQ */
+#endif
+
boolean ld_bifup; /* TRUE:ifup FALSE:ifdown */
WDOG_ID ld_txpoll; /* TX poll timer */
WDOG_ID ld_txtimeout; /* TX timeout timer */
@@ -95,21 +112,34 @@ struct lm3s_driver_s
* Private Data
****************************************************************************/
-static struct lm3s_driver_s g_lm3sdev;
+static struct lm3s_driver_s g_lm3sdev[LM3S_NINTERFACES];
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
+/* Miscellaneous low level helpers */
+
+#if LM3S_NINTERFACES > 1
+static uint32 lm3s_ethin(struct lm3s_driver_s *priv, int offset);
+static void lm3s_ethout(struct lm3s_driver_s *priv, int offset, uint32 value);
+#else
+static inline uint32 lm3s_ethin(struct lm3s_driver_s *priv, int offset);
+static inline void lm3s_ethout(struct lm3s_driver_s *priv, int offset, uint32 value);
+#endif
+static void lm3s_ethreset(struct lm3s_driver_s *priv);
+static void lm3s_phywrite(struct lm3s_driver_s *priv, int regaddr, uint16 value);
+static uint16 lm3s_phyread(struct lm3s_driver_s *priv, int regaddr);
+
/* Common TX logic */
-static int lm3s_transmit(struct lm3s_driver_s *skel);
+static int lm3s_transmit(struct lm3s_driver_s *priv);
static int lm3s_uiptxpoll(struct uip_driver_s *dev);
/* Interrupt handling */
-static void lm3s_receive(struct lm3s_driver_s *skel);
-static void lm3s_txdone(struct lm3s_driver_s *skel);
+static void lm3s_receive(struct lm3s_driver_s *priv);
+static void lm3s_txdone(struct lm3s_driver_s *priv);
static int lm3s_interrupt(int irq, FAR void *context);
/* Watchdog timer expirations */
@@ -128,6 +158,191 @@ static int lm3s_txavail(struct uip_driver_s *dev);
****************************************************************************/
/****************************************************************************
+ * Function: lm3s_ethin
+ *
+ * Description:
+ * Read a register from the Ethernet module
+ *
+ * Parameters:
+ * priv - Reference to the driver state structure
+ * offset - Byte offset of the register from the ethernet base address
+ *
+ * Returned Value:
+ * Register value
+ *
+ ****************************************************************************/
+
+#if LM3S_NINTERFACES > 1
+static uint32 lm3s_ethin(struct lm3s_driver_s *priv, int offset)
+{
+ return getreg32(priv->ld_base + offset);
+}
+#else
+static inline uint32 lm3s_ethin(struct lm3s_driver_s *priv, int offset)
+{
+ return getreg32(LM3S_ETHCON_BASE + offset);
+}
+#endif
+
+/****************************************************************************
+ * Function: lm3s_ethout
+ *
+ * Description:
+ * Write a register to the Ethernet module
+ *
+ * Parameters:
+ * priv - Reference to the driver state structure
+ * offset - Byte offset of the register from the ethernet base address
+ * value - The value to write the the Ethernet register
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+#if LM3S_NINTERFACES > 1
+static void lm3s_ethout(struct lm3s_driver_s *priv, int offset, uint32 value)
+{
+ putreg32(value, priv->ld_base + offset);
+}
+#else
+static inline void lm3s_ethout(struct lm3s_driver_s *priv, int offset, uint32 value)
+{
+ putreg32(value, LM3S_ETHCON_BASE + offset);
+}
+#endif
+
+/****************************************************************************
+ * Function: lm3s_ethreset
+ *
+ * Description:
+ * Configure and reset the Ethernet module, leaving it in a disabled state.
+ *
+ * Parameters:
+ * priv - Reference to the driver state structure
+ *
+ * Returned Value:
+ * OK on success; a negated errno on failure
+ *
+ * Assumptions:
+ *
+ ****************************************************************************/
+
+static void lm3s_ethreset(struct lm3s_driver_s *priv)
+{
+ irqstate_t flags;
+ uint32 regval;
+ volatile uint32 delay;
+ uint32 div;
+
+#if LM3S_NINTERFACES > 1
+# error "If multiple interfaces are supported, this function would have to be redesigned"
+#endif
+
+ /* Make sure that clocking is enabled for the Ethernet (and PHY) peripherals */
+
+ flags = irqsave();
+ regval = getreg32(LM3S_SYSCON_RCGC2);
+ regval |= (SYSCON_RCGC2_EMAC0|SYSCON_RCGC2_EPHY0);
+ putreg32(regval, LM3S_SYSCON_RCGC2);
+ nvdbg("RCGC2: %08x\n", regval);
+
+ /* Put the Ethernet controller into the reset state */
+
+ regval = getreg32(LM3S_SYSCON_SRCR2);
+ regval |= (SYSCON_SRCR2_EMAC0|SYSCON_SRCR2_EPHY0);
+ putreg32(regval, LM3S_SYSCON_SRCR2);
+
+ /* Wait just a bit */
+
+ for (delay = 0; delay < 16; delay++);
+
+ /* Then take the Ethernet controller out of the reset state */
+
+ regval &= ~(SYSCON_SRCR2_EMAC0|SYSCON_SRCR2_EPHY0);
+ putreg32(regval, LM3S_SYSCON_SRCR2);
+ nvdbg("SRCR2: %08x\n", regval);
+
+ /* Enable Port F for Ethernet LEDs: LED0=Bit 3; LED1=Bit 2 */
+
+#ifdef CONFIG_LM3S_ETHLEDS
+ /* Configure the pins for the peripheral function */
+
+ lm3s_configgpio(GPIO_ETHPHY_LED0 | GPIO_STRENGTH_2MA | GPIO_PADTYPE_STD);
+ lm3s_configgpio(GPIO_ETHPHY_LED1 | GPIO_STRENGTH_2MA | GPIO_PADTYPE_STD);
+#endif
+
+ /* Disable all Ethernet controller interrupts */
+
+ regval = lm3s_ethin(priv, LM3S_MAC_IM_OFFSET);
+ regval &= ~MAC_IM_ALLINTS;
+ lm3s_ethout(priv, LM3S_MAC_IM_OFFSET, regval);
+
+ /* Clear any pending interrupts (shouldn't be any) */
+
+ regval = lm3s_ethin(priv, LM3S_MAC_RIS_OFFSET);
+ lm3s_ethout(priv, LM3S_MAC_IACK_OFFSET, regval);
+
+ /* Set the management clock divider register for access to the PHY
+ * register set. The MDC clock is divided down from the system clock per:
+ *
+ * MCLK_FREQUENCY = SYSCLK_FREQUENCY / (2 * (div + 1))
+ * div = (SYSCLK_FREQUENCY / 2 / MCLK_FREQUENCY) - 1
+ *
+ * Where MCLK_FREQUENCY is 2,500,000. We will add 1 to assure the max
+ * MCLK_FREQUENCY is not exceeded.
+ */
+
+ div = SYSCLK_FREQUENCY / 2 / 2500000;
+ lm3s_ethout(priv, LM3S_MAC_MDV_OFFSET, div);
+ nvdbg("MDV: %08x\n", div);
+ irqrestore(flags);
+}
+
+/****************************************************************************
+ * Function: lm3s_phywrite
+ *
+ * Description:
+ * Write a 16-bit word to a PHY register
+ *
+ * Parameters:
+ * priv - Reference to the driver state structure
+ * regaddr - Address of the PHY register to write
+ * value - The value to write to the register
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void lm3s_phywrite(struct lm3s_driver_s *priv, int regaddr, uint16 value)
+{
+# warning "Missing Logic"
+}
+
+/****************************************************************************
+ * Function: lm3s_phywrite
+ *
+ * Description:
+ * Write a 16-bit word to a PHY register
+ *
+ * Parameters:
+ * priv - Reference to the driver state structure
+ * regaddr - Address of the PHY register to write
+ * value - The value to write to the register
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static uint16 lm3s_phyread(struct lm3s_driver_s *priv, int regaddr)
+{
+# warning "Missing Logic"
+ return 0;
+}
+
+/****************************************************************************
* Function: lm3s_transmit
*
* Description:
@@ -135,16 +350,14 @@ static int lm3s_txavail(struct uip_driver_s *dev);
* handling or from watchdog based polling.
*
* Parameters:
- * skel - Reference to the driver state structure
+ * priv - Reference to the driver state structure
*
* Returned Value:
* OK on success; a negated errno on failure
*
- * Assumptions:
- *
****************************************************************************/
-static int lm3s_transmit(struct lm3s_driver_s *skel)
+static int lm3s_transmit(struct lm3s_driver_s *priv)
{
/* Verify that the hardware is ready to send another packet */
#warning "Missing logic"
@@ -152,13 +365,13 @@ static int lm3s_transmit(struct lm3s_driver_s *skel)
/* Disable Ethernet interrupts */
- /* Send the packet: address=skel->ld_dev.d_buf, length=skel->ld_dev.d_len */
+ /* Send the packet: address=priv->ld_dev.d_buf, length=priv->ld_dev.d_len */
/* Restore Ethernet interrupts */
/* Setup the TX timeout watchdog (perhaps restarting the timer) */
- (void)wd_start(skel->ld_txtimeout, LM3S_TXTIMEOUT, lm3s_txtimeout, 1, (uint32)skel);
+ (void)wd_start(priv->ld_txtimeout, LM3S_TXTIMEOUT, lm3s_txtimeout, 1, (uint32)priv);
return OK;
}
@@ -185,16 +398,16 @@ static int lm3s_transmit(struct lm3s_driver_s *skel)
static int lm3s_uiptxpoll(struct uip_driver_s *dev)
{
- struct lm3s_driver_s *skel = (struct lm3s_driver_s *)dev->d_private;
+ struct lm3s_driver_s *priv = (struct lm3s_driver_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
- if (skel->ld_dev.d_len > 0)
+ if (priv->ld_dev.d_len > 0)
{
- uip_arp_out(&skel->ld_dev);
- lm3s_transmit(skel);
+ uip_arp_out(&priv->ld_dev);
+ lm3s_transmit(priv);
/* Check if there is room in the device to hold another packet. If not,
* return a non-zero value to terminate the poll.
@@ -216,7 +429,7 @@ static int lm3s_uiptxpoll(struct uip_driver_s *dev)
* An interrupt was received indicating the availability of a new RX packet
*
* Parameters:
- * skel - Reference to the driver state structure
+ * priv - Reference to the driver state structure
*
* Returned Value:
* None
@@ -225,7 +438,7 @@ static int lm3s_uiptxpoll(struct uip_driver_s *dev)
*
****************************************************************************/
-static void lm3s_receive(struct lm3s_driver_s *skel)
+static void lm3s_receive(struct lm3s_driver_s *priv)
{
do
{
@@ -234,8 +447,8 @@ static void lm3s_receive(struct lm3s_driver_s *skel)
/* Check if the packet is a valid size for the uIP buffer configuration */
- /* Copy the data data from the hardware to skel->ld_dev.d_buf. Set
- * amount of data in skel->ld_dev.d_len
+ /* Copy the data data from the hardware to priv->ld_dev.d_buf. Set
+ * amount of data in priv->ld_dev.d_len
*/
/* We only accept IP packets of the configured type and ARP packets */
@@ -247,34 +460,33 @@ static void lm3s_receive(struct lm3s_driver_s *skel)
#endif
{
uip_arp_ipin();
- uip_input(&skel->ld_dev);
+ uip_input(&priv->ld_dev);
/* If the above function invocation resulted in data that should be
* sent out on the network, the field d_len will set to a value > 0.
*/
- if (skel->ld_dev.d_len > 0)
- {
- uip_arp_out(&skel->ld_dev);
- lm3s_transmit(skel);
- }
- }
- else if (BUF->type == htons(UIP_ETHTYPE_ARP))
- {
- uip_arp_arpin(&skel->ld_dev);
-
- /* If the above function invocation resulted in data that should be
- * sent out on the network, the field d_len will set to a value > 0.
- */
-
- if (skel->ld_dev.d_len > 0)
- {
- lm3s_transmit(skel);
- }
- }
- }
+ if (priv->ld_dev.d_len > 0)
+ {
+ uip_arp_out(&priv->ld_dev);
+ lm3s_transmit(priv);
+ }
+ }
+ else if (BUF->type == htons(UIP_ETHTYPE_ARP))
+ {
+ uip_arp_arpin(&priv->ld_dev);
+
+ /* If the above function invocation resulted in data that should be
+ * sent out on the network, the field d_len will set to a value > 0.
+ */
+
+ if (priv->ld_dev.d_len > 0)
+ {
+ lm3s_transmit(priv);
+ }
+ }
}
- while (); /* While there are more packets to be processed */
+ while ( /* FIX ME */ TRUE /* FIX ME */); /* While there are more packets to be processed */
}
/****************************************************************************
@@ -284,7 +496,7 @@ static void lm3s_receive(struct lm3s_driver_s *skel)
* An interrupt was received indicating that the last TX packet(s) is done
*
* Parameters:
- * skel - Reference to the driver state structure
+ * priv - Reference to the driver state structure
*
* Returned Value:
* None
@@ -293,18 +505,18 @@ static void lm3s_receive(struct lm3s_driver_s *skel)
*
****************************************************************************/
-static void lm3s_txdone(struct lm3s_driver_s *skel)
+static void lm3s_txdone(struct lm3s_driver_s *priv)
{
/* Check for errors and update statistics */
#warning "Missing logic"
/* If no further xmits are pending, then cancel the TX timeout */
- wd_cancel(skel->ld_txtimeout);
+ wd_cancel(priv->ld_txtimeout);
/* Then poll uIP for new XMIT data */
- (void)uip_poll(&skel->ld_dev, lm3s_uiptxpoll);
+ (void)uip_poll(&priv->ld_dev, lm3s_uiptxpoll);
}
/****************************************************************************
@@ -326,7 +538,13 @@ static void lm3s_txdone(struct lm3s_driver_s *skel)
static int lm3s_interrupt(int irq, FAR void *context)
{
- register struct lm3s_driver_s *skel = &g_lm3sdev;
+ register struct lm3s_driver_s *priv;
+
+#if LM3S_NINTERFACES > 1
+# error "A mechanism to associate and interface with an IRQ is needed"
+#else
+ priv = &g_lm3sdev[0];
+#endif
/* Disable Ethernet interrupts */
#warning "Missing logic"
@@ -337,11 +555,11 @@ static int lm3s_interrupt(int irq, FAR void *context)
/* Check if we received an incoming packet, if so, call lm3s_receive() */
- lm3s_receive(skel);
+ lm3s_receive(priv);
/* Check is a packet transmission just completed. If so, call lm3s_txdone */
- lm3s_txdone(skel);
+ lm3s_txdone(priv);
/* Enable Ethernet interrupts (perhaps excluding the TX done interrupt if
* there are no pending transmissions.
@@ -370,7 +588,7 @@ static int lm3s_interrupt(int irq, FAR void *context)
static void lm3s_txtimeout(int argc, uint32 arg, ...)
{
- struct lm3s_driver_s *skel = (struct lm3s_driver_s *)arg;
+ struct lm3s_driver_s *priv = (struct lm3s_driver_s *)arg;
/* Increment statistics and dump debug info */
#warning "Missing logic"
@@ -379,7 +597,7 @@ static void lm3s_txtimeout(int argc, uint32 arg, ...)
/* Then poll uIP for new XMIT data */
- (void)uip_poll(&skel->ld_dev, lm3s_uiptxpoll);
+ (void)uip_poll(&priv->ld_dev, lm3s_uiptxpoll);
}
/****************************************************************************
@@ -401,18 +619,18 @@ static void lm3s_txtimeout(int argc, uint32 arg, ...)
static void lm3s_polltimer(int argc, uint32 arg, ...)
{
- struct lm3s_driver_s *skel = (struct lm3s_driver_s *)arg;
+ struct lm3s_driver_s *priv = (struct lm3s_driver_s *)arg;
/* Check if there is room in the send another Tx packet. */
#warning "Missing logic"
/* If so, update TCP timing states and poll uIP for new XMIT data */
- (void)uip_timer(&skel->ld_dev, lm3s_uiptxpoll, LM3S_POLLHSEC);
+ (void)uip_timer(&priv->ld_dev, lm3s_uiptxpoll, LM3S_POLLHSEC);
/* Setup the watchdog poll timer again */
- (void)wd_start(skel->ld_txpoll, LM3S_WDDELAY, lm3s_polltimer, 1, arg);
+ (void)wd_start(priv->ld_txpoll, LM3S_WDDELAY, lm3s_polltimer, 1, arg);
}
/****************************************************************************
@@ -434,23 +652,123 @@ static void lm3s_polltimer(int argc, uint32 arg, ...)
static int lm3s_ifup(struct uip_driver_s *dev)
{
- struct lm3s_driver_s *skel = (struct lm3s_driver_s *)dev->d_private;
+ struct lm3s_driver_s *priv = (struct lm3s_driver_s *)dev->d_private;
+ irqstate_t flags;
+ uint32 regval;
+ uint16 phyreg;
ndbg("Bringing up: %d.%d.%d.%d\n",
dev->d_ipaddr & 0xff, (dev->d_ipaddr >> 8) & 0xff,
(dev->d_ipaddr >> 16) & 0xff, dev->d_ipaddr >> 24 );
- /* Initilize Ethernet interface */
-#warning "Missing logic"
+ /* Enable and reset the Ethernet controller */
- /* Set and activate a timer process */
+ flags = irqsave();
+ lm3s_ethreset(priv);
+
+ /* Then configure the Ethernet Controller for normal operation
+ *
+ * Setup the transmit control register (Full duplex, TX CRC Auto Generation,
+ * TX Padding Enabled).
+ */
+
+# warning "These should be configurable items"
+ regval = lm3s_ethin(priv, LM3S_MAC_TCTL_OFFSET);
+ regval |= (MAC_TCTL_DUPLEX|MAC_TCTL_CRC|MAC_TCTL_PADEN);
+ lm3s_ethout(priv, LM3S_MAC_TCTL_OFFSET, regval);
+ nvdbg("TCTL: %08x\n", regval);
+
+ /* Setup the receive control register (Disable multicast frames, disable
+ * promiscuous mode, disable bad CRC rejection). >>> These should be configurable items <<<
+ */
+
+# warning "These should be configurable items"
+ regval = lm3s_ethin(priv, LM3S_MAC_RCTL_OFFSET);
+ regval &= ~(MAC_RCTL_BADCRC | MAC_RCTL_PRMS | MAC_RCTL_AMUL);
+ lm3s_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval);
+ nvdbg("RCTL: %08x\n", regval);
+
+ /* Setup the time stamp configuration register */
+
+#ifndef CONFIG_ARCH_CHIP_LM3S6918
+ regval = lm3s_ethin(priv, LM3S_MAC_TS_OFFSET);
+#ifdef CONFIG_LM3S_TIMESTAMP
+ regval |= MAC_TS_EN;
+#else
+ regval &= ~(MAC_TS_EN);
+#endif
+ lm3s_ethout(priv, LM3S_MAC_TS_OFFSET, regval);
+ nvdbg("TS: %08x\n", regval);
+#endif
+
+ /* Wait for the link to come up */
+
+# warning "This should use a semaphore and an interrupt"
+
+ ndbg("Waiting for link\n");
+ do
+ {
+ phyreg = lm3s_phyread(priv, MII_MSR);
+ }
+ while ((phyreg & MII_MSR_LINKSTATUS) == 0);
+ ndbg("Link established\n");
+
+ /* Reset the receive FIFO */
+
+ regval = lm3s_ethin(priv, LM3S_MAC_RCTL_OFFSET);
+ regval |= MAC_RCTL_RSTFIFO;
+ lm3s_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval);
+
+ /* Enable the Ethernet receiver */
+
+ regval = lm3s_ethin(priv, LM3S_MAC_RCTL_OFFSET);
+ regval |= MAC_RCTL_RXEN;
+ lm3s_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval);
+
+ /* Enable the Ethernet transmitter */
- (void)wd_start(skel->ld_txpoll, LM3S_WDDELAY, lm3s_polltimer, 1, (uint32)skel);
+ regval = lm3s_ethin(priv, LM3S_MAC_RCTL_OFFSET);
+ regval |= MAC_TCTL_TXEN;
+ lm3s_ethout(priv, LM3S_MAC_TCTL_OFFSET, regval);
+
+ /* Reset the receive FIFO (again) */
+
+ regval = lm3s_ethin(priv, LM3S_MAC_RCTL_OFFSET);
+ regval |= MAC_RCTL_RSTFIFO;
+ lm3s_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval);
/* Enable the Ethernet interrupt */
- skel->ld_bifup = TRUE;
- up_enable_irq(CONFIG_LM3S_IRQ);
+#if LM3S_NINTERFACES > 1
+ up_enable_irq(priv->irq);
+#else
+ up_enable_irq(LM3S_IRQ_ETHCON);
+#endif
+
+ /* Enable the Ethernet RX packet receipt interrupt */
+
+ regval = lm3s_ethin(priv, LM3S_MAC_IM_OFFSET);
+ regval |= MAC_IM_RXINTM;
+ lm3s_ethout(priv, LM3S_MAC_IM_OFFSET, regval);
+
+ /* Program the hardware with it's MAC address (for filtering) */
+
+ regval = (uint32)priv->ld_dev.d_mac.ether_addr_octet[3] << 24 |
+ (uint32)priv->ld_dev.d_mac.ether_addr_octet[2] << 16 |
+ (uint32)priv->ld_dev.d_mac.ether_addr_octet[1] << 8 |
+ (uint32)priv->ld_dev.d_mac.ether_addr_octet[0];
+ lm3s_ethout(priv, LM3S_MAC_IA0_OFFSET, regval);
+
+ regval = (uint32)priv->ld_dev.d_mac.ether_addr_octet[5] << 8 |
+ (uint32)priv->ld_dev.d_mac.ether_addr_octet[4];
+ lm3s_ethout(priv, LM3S_MAC_IA1_OFFSET, regval);
+
+ /* Set and activate a timer process */
+
+ (void)wd_start(priv->ld_txpoll, LM3S_WDDELAY, lm3s_polltimer, 1, (uint32)priv);
+
+ priv->ld_bifup = TRUE;
+ irqrestore(flags);
return OK;
}
@@ -472,22 +790,26 @@ static int lm3s_ifup(struct uip_driver_s *dev)
static int lm3s_ifdown(struct uip_driver_s *dev)
{
- struct lm3s_driver_s *skel = (struct lm3s_driver_s *)dev->d_private;
+ struct lm3s_driver_s *priv = (struct lm3s_driver_s *)dev->d_private;
irqstate_t flags;
/* Disable the Ethernet interrupt */
flags = irqsave();
- up_disable_irq(CONFIG_LM3S_IRQ);
+#if LM3S_NINTERFACES > 1
+ up_disable_irq(priv->irq);
+#else
+ up_disable_irq(LM3S_IRQ_ETHCON);
+#endif
/* Cancel the TX poll timer and TX timeout timers */
- wd_cancel(skel->ld_txpoll);
- wd_cancel(skel->ld_txtimeout);
+ wd_cancel(priv->ld_txpoll);
+ wd_cancel(priv->ld_txtimeout);
/* Reset the device */
- skel->ld_bifup = FALSE;
+ priv->ld_bifup = FALSE;
irqrestore(flags);
return OK;
}
@@ -513,21 +835,21 @@ static int lm3s_ifdown(struct uip_driver_s *dev)
static int lm3s_txavail(struct uip_driver_s *dev)
{
- struct lm3s_driver_s *skel = (struct lm3s_driver_s *)dev->d_private;
+ struct lm3s_driver_s *priv = (struct lm3s_driver_s *)dev->d_private;
irqstate_t flags;
flags = irqsave();
/* Ignore the notification if the interface is not yet up */
- if (skel->ld_bifup)
+ if (priv->ld_bifup)
{
/* Check if there is room in the hardware to hold another outgoing packet. */
#warning "Missing logic"
/* If so, then poll uIP for new XMIT data */
- (void)uip_poll(&skel->ld_dev, lm3s_uiptxpoll);
+ (void)uip_poll(&priv->ld_dev, lm3s_uiptxpoll);
}
irqrestore(flags);
@@ -542,7 +864,7 @@ static int lm3s_txavail(struct uip_driver_s *dev)
* Function: lm3s_initialize
*
* Description:
- * Initialize the Ethernet driver
+ * Initialize the Ethernet driver for one interface
*
* Parameters:
* None
@@ -556,51 +878,90 @@ static int lm3s_txavail(struct uip_driver_s *dev)
/* Initialize the Ethernet controller and driver */
-int lm3s_initialize(void)
+#if LM3S_NINTERFACES > 1
+int lm3s_initialize(int intf)
+#else
+static inline int lm3s_initialize(int intf)
+#endif
{
+ struct lm3s_driver_s *priv = &g_lm3sdev[intf];
+ int ret;
+
/* Check if the Ethernet module is present */
+#if LM3S_NINTERFACES > 1
+# error "This debug check only works with one interface"
+#else
DEBUGASSERT((getreg32(LM3S_SYSCON_DC4) & (SYSCON_DC4_EMAC0|SYSCON_DC4_EPHY0)) == (SYSCON_DC4_EMAC0|SYSCON_DC4_EPHY0));
+#endif
+ DEBUGASSERT((unsigned)intf < LM3S_NINTERFACES);
- /* Enable Port F for Ethernet LEDs: LED0=Bit 3; LED1=Bit 2 */
+ /* Initialize the driver structure */
-#ifdef CONFIG_LM3S_ETHLEDS
- /* Configure the pins for the peripheral function */
+ memset(priv, 0, sizeof(struct lm3s_driver_s));
+ priv->ld_dev.d_ifup = lm3s_ifup; /* I/F down callback */
+ priv->ld_dev.d_ifdown = lm3s_ifdown; /* I/F up (new IP address) callback */
+ priv->ld_dev.d_txavail = lm3s_txavail; /* New TX data callback */
+ priv->ld_dev.d_private = (void*)&g_lm3sdev[0]; /* Used to recover private state from dev */
- lm3s_configgpio(GPIO_ETHPHY_LED0 | GPIO_STRENGTH_2MA | GPIO_PADTYPE_STD);
- lm3s_configgpio(GPIO_ETHPHY_LED1 | GPIO_STRENGTH_2MA | GPIO_PADTYPE_STD);
+ /* Create a watchdog for timing polling for and timing of transmisstions */
+
+#if LM3S_NINTERFACES > 1
+# error "A mechanism to associate base address an IRQ with an interface is needed"
+ priv->ld_base = ??; /* Ethernet controller base address */
+ priv->ld_irq = ??; /* Ethernet controller IRQ number */
#endif
+ priv->ld_txpoll = wd_create(); /* Create periodic poll timer */
+ priv->ld_txtimeout = wd_create(); /* Create TX timeout timer */
-#warning "Missing logic"
+ /* If the board can provide us with a MAC address, get the address
+ * from the board now. The MAC will not be applied until lm3s_ifup()
+ * is caleld (and the MAC can be overwritten with a netdev ioctl call).
+ */
+
+#ifdef CONFIG_LM3S_BOARDMAC
+ lm3s_ethernetmac(&priv->ld_dev.d_mac);
+#endif
+
+ /* Perform minimal, one-time initialization -- just reset the controller and
+ * leave it disabled. The Ethernet controller will be reset and properly
+ * re-initialized each time lm3s_ifup() is called.
+ */
+
+ lm3s_ethreset(priv);
/* Attach the IRQ to the driver */
- if (irq_attach(CONFIG_LM3S_IRQ, lm3s_interrupt))
+#if LM3S_NINTERFACES > 1
+ ret = irq_attach(priv->irq, lm3s_interrupt);
+#else
+ ret = irq_attach(LM3S_IRQ_ETHCON, lm3s_interrupt);
+#endif
+ if (ret != 0)
{
- /* We could not attach the ISR to the ISR */
+ /* We could not attach the ISR to the IRQ */
return -EAGAIN;
}
- /* Initialize the driver structure */
-
- memset(g_lm3sdev, 0, sizeof(struct lm3s_driver_s));
- g_lm3sdev.ld_dev.d_ifup = lm3s_ifup; /* I/F down callback */
- g_lm3sdev.ld_dev.d_ifdown = lm3s_ifdown; /* I/F up (new IP address) callback */
- g_lm3sdev.ld_dev.d_txavail = lm3s_txavail; /* New TX data callback */
- g_lm3sdev.ld_dev.d_private = (void*)g_lm3sdev; /* Used to recover private state from dev */
-
- /* Create a watchdog for timing polling for and timing of transmisstions */
+ /* Register the device with the OS so that socket IOCTLs can be performed */
- g_lm3sdev.ld_txpoll = wd_create(); /* Create periodic poll timer */
- g_lm3sdev.ld_txtimeout = wd_create(); /* Create TX timeout timer */
+ (void)netdev_register(&priv->ld_dev);
+ return OK;
+}
- /* Read the MAC address from the hardware into g_lm3sdev.ld_dev.d_mac.ether_addr_octet */
- /* Register the device with the OS so that socket IOCTLs can be performed */
+/************************************************************************************
+ * Name: up_netinitialize
+ *
+ * Description:
+ * Initialize the first network interface
+ *
+ ************************************************************************************/
- (void)netdev_register(&g_lm3sdev.ld_dev);
- return OK;
+void up_netinitialize(void)
+{
+ (void)lm3s_initialize(0);
}
#endif /* CONFIG_NET && CONFIG_LM3S_ETHERNET */
diff --git a/nuttx/arch/arm/src/lm3s/lm3s_ethernet.h b/nuttx/arch/arm/src/lm3s/lm3s_ethernet.h
index c479c593a..ec32fb029 100644
--- a/nuttx/arch/arm/src/lm3s/lm3s_ethernet.h
+++ b/nuttx/arch/arm/src/lm3s/lm3s_ethernet.h
@@ -139,6 +139,7 @@
#define MAC_IM_RXERM (1 << 4) /* Bit 4: Mask Receive Error */
#define MAC_IM_MDINTM (1 << 5) /* Bit 5: Mask MII Transaction Complete */
#define MAC_IM_PHYINTM (1 << 6) /* Bit 6: Mask PHY Interrupt */
+#define MAC_IM_ALLINTS 0x7f
/* Ethernet MAC Receive Control (MACRCTL), offset 0x008 */
diff --git a/nuttx/configs/eagle100/README.txt b/nuttx/configs/eagle100/README.txt
index a3a33aa47..5ca6e05e5 100644
--- a/nuttx/configs/eagle100/README.txt
+++ b/nuttx/configs/eagle100/README.txt
@@ -168,6 +168,7 @@ Eagle100-specific Configuration Options
CONFIG_LM3S_ETHERNET - This must be set (along with CONFIG_NET)
to build the LM3S Ethernet driver
+ CONFIG_LM3S_ETHLEDS - Enable to use Ethernet LEDs on the board.
CONFIG_LM3S_BOARDMAC - If the board-specific logic can provide
a MAC address (via lm3s_ethernetmac()), then this should be selected.
diff --git a/nuttx/configs/eagle100/include/board.h b/nuttx/configs/eagle100/include/board.h
index e50b11bee..68204dbdf 100644
--- a/nuttx/configs/eagle100/include/board.h
+++ b/nuttx/configs/eagle100/include/board.h
@@ -138,6 +138,7 @@ extern void lm3s_boardinitialize(void);
************************************************************************************/
#ifdef CONFIG_LM3S_BOARDMAC
+struct ether_addr;
extern void lm3s_ethernetmac(struct ether_addr *ethaddr);
#endif
diff --git a/nuttx/configs/eagle100/nettest/Make.defs b/nuttx/configs/eagle100/nettest/Make.defs
new file mode 100644
index 000000000..c858d506a
--- /dev/null
+++ b/nuttx/configs/eagle100/nettest/Make.defs
@@ -0,0 +1,120 @@
+############################################################################
+# configs/eagle100/nettest/Make.defs
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+#
+# 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.
+#
+############################################################################
+
+include ${TOPDIR}/.config
+
+CROSSDEV = arm-elf-
+CC = $(CROSSDEV)gcc
+CXX = $(CROSSDEV)g++
+CPP = $(CROSSDEV)gcc -E
+LD = $(CROSSDEV)ld
+AR = $(CROSSDEV)ar rcs
+NM = $(CROSSDEV)nm
+OBJCOPY = $(CROSSDEV)objcopy
+OBJDUMP = $(CROSSDEV)objdump
+
+ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
+ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
+
+ARCHCFLAGS = -fno-builtin
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions
+ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
+ARCHWARNINGSXX = -Wall -Wshadow
+
+ifeq ("${CONFIG_DEBUG}","y")
+ ARCHOPTIMIZATION = -g
+else
+ ARCHOPTIMIZATION = -Os -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
+endif
+
+ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+ARCHDEFINES =
+ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
+ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
+
+ARCHPICFLAGS = -fpic
+ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nettest/ld.script
+
+CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
+CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
+ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) -pipe
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
+AFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+OBJEXT = .o
+LIBEXT = .a
+EXEEXT =
+
+ifeq ("${CONFIG_DEBUG}","y")
+ LDFLAGS += -g
+endif
+
+define PREPROCESS
+ @echo "CPP: $1->$2"
+ @$(CPP) $(CPPFLAGS) $1 -o $2
+endef
+
+define COMPILE
+ @echo "CC: $1"
+ @$(CC) -c $(CFLAGS) $1 -o $2
+endef
+
+define COMPILEXX
+ @echo "CXX: $1"
+ @$(CXX) -c $(CXXFLAGS) $1 -o $2
+endef
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(CC) -c $(AFLAGS) $1 -o $2
+endef
+
+define ARCHIVE
+ echo "AR: $2"; \
+ $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
+endef
+
+define CLEAN
+ @rm -f *.o *.a
+endef
+
+MKDEP = $(TOPDIR)/tools/mkdeps.sh
+
+HOSTCC = gcc
+HOSTINCLUDES = -I.
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+HOSTLDFLAGS =
+
diff --git a/nuttx/configs/eagle100/nettest/defconfig b/nuttx/configs/eagle100/nettest/defconfig
new file mode 100644
index 000000000..13071ee44
--- /dev/null
+++ b/nuttx/configs/eagle100/nettest/defconfig
@@ -0,0 +1,525 @@
+############################################################################
+# configs/eagle100/nettest/defconfig
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+#
+# 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.
+#
+############################################################################
+#
+# architecture selection
+#
+# CONFIG_ARCH - identifies the arch subdirectory and, hence, the
+# processor architecture.
+# CONFIG_ARCH_family - for use in C code. This identifies the
+# particular chip family that the architecture is implemented
+# in.
+# CONFIG_ARCH_architecture - for use in C code. This identifies the
+# specific architecture within the chip familyl.
+# CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+# CONFIG_ARCH_CHIP_name - For use in C code
+# CONFIG_ARCH_BOARD - identifies the configs subdirectory and, hence,
+# the board that supports the particular chip or SoC.
+# CONFIG_ARCH_BOARD_name - for use in C code
+# CONFIG_ENDIAN_BIG - define if big endian (default is little endian)
+# CONFIG_BOARD_LOOPSPERMSEC - for delay loops
+# CONFIG_DRAM_SIZE - Describes the installed DRAM.
+# CONFIG_DRAM_START - The start address of DRAM (physical)
+# CONFIG_DRAM_END - Last address+1 of installed RAM
+# CONFIG_ARCH_IRQPRIO - The LM3S6918 supports interrupt prioritization
+# CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+# stack. If defined, this symbol is the size of the interrupt
+# stack in bytes. If not defined, the user task stacks will be
+# used during interrupt handling.
+# CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+# CONFIG_ARCH_BOOTLOADER - Configure to use the MicroMint Eagle-100
+# Ethernet bootloader.
+# CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+# CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+# cause a 100 second delay during boot-up. This 100 second delay
+# serves no purpose other than it allows you to calibratre
+# CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+# the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+# the delay actually is 100 seconds.
+#
+CONFIG_ARCH=arm
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_CORTEXM3=y
+CONFIG_ARCH_CHIP=lm3s
+CONFIG_ARCH_CHIP_LM3S6918=y
+CONFIG_ARCH_BOARD=eagle100
+CONFIG_ARCH_BOARD_EAGLE100=y
+CONFIG_BOARD_LOOPSPERMSEC=4531
+CONFIG_DRAM_SIZE=0x00010000
+CONFIG_DRAM_START=0x20000000
+CONFIG_DRAM_END=(CONFIG_DRAM_START+CONFIG_DRAM_SIZE)
+CONFIG_ARCH_IRQPRIO=y
+CONFIG_DRAM_NUTTXENTRY=0x00002000
+CONFIG_ARCH_INTERRUPTSTACK=n
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_BOOTLOADER=y
+CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_CALIBRATION=n
+
+#
+# LM3S6918 specific serial device driver settings
+#
+# CONFIG_UARTn_DISABLE - select to disable all support for
+# the UART
+# CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
+# console and ttys0 (default is the UART0).
+# CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
+# This specific the size of the receive buffer
+# CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
+# being sent. This specific the size of the transmit buffer
+# CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
+# CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
+# CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+# CONFIG_UARTn_2STOP - Two stop bits
+#
+CONFIG_UART0_DISABLE=n
+CONFIG_UART1_DISABLE=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=n
+CONFIG_UART0_TXBUFSIZE=256
+CONFIG_UART1_TXBUFSIZE=256
+CONFIG_UART0_RXBUFSIZE=256
+CONFIG_UART1_RXBUFSIZE=256
+CONFIG_UART0_BAUD=115200
+CONFIG_UART1_BAUD=115200
+CONFIG_UART0_BITS=8
+CONFIG_UART1_BITS=8
+CONFIG_UART0_PARITY=0
+CONFIG_UART1_PARITY=0
+CONFIG_UART0_2STOP=0
+CONFIG_UART1_2STOP=0
+
+#
+# LM3S6918 specific SPI device driver settings
+#
+# CONFIG_SPIn_DISABLE - select to disable all support for
+# the SPI
+CONFIG_SPI1_DISABLE=n
+CONFIG_SPI2_DISABLE=y
+
+#
+# LM3S6918 specific serial device driver settings
+#
+# CONFIG_LM3S_ETHERNET - This must be set (along with CONFIG_NET)
+# to build the LM3S Ethernet driver
+# CONFIG_LM3S_ETHLEDS - Enable to use Ethernet LEDs on the board.
+# CONFIG_LM3S_BOARDMAC - If the board-specific logic can provide
+# a MAC address (via lm3s_ethernetmac()), then this should be selected.
+
+CONFIG_LM3S_ETHERNET=y
+CONFIG_LM3S_ETHLEDS=n
+CONFIG_LM3S_BOARDMAC=y
+
+#
+# General build options
+#
+# CONFIG_RRLOAD_BINARY - make the rrload binary format used with
+# BSPs from www.ridgerun.com using the tools/mkimage.sh script
+# CONFIG_INTELHEX_BINARY - make the Intel HEX binary format
+# used with many different loaders using the GNU objcopy program
+# Should not be selected if you are not using the GNU toolchain.
+# CONFIG_MOTOROLA_SREC - make the Motorola S-Record binary format
+# used with many different loaders using the GNU objcopy program
+# Should not be selected if you are not using the GNU toolchain.
+# CONFIG_RAW_BINARY - make a raw binary format file used with many
+# different loaders using the GNU objcopy program. This option
+# should not be selected if you are not using the GNU toolchain.
+# CONFIG_HAVE_LIBM - toolchain supports libm.a
+#
+CONFIG_RRLOAD_BINARY=n
+CONFIG_INTELHEX_BINARY=n
+CONFIG_MOTOROLA_SREC=n
+CONFIG_RAW_BINARY=y
+CONFIG_HAVE_LIBM=n
+
+#
+# General OS setup
+#
+# CONFIG_EXAMPLE - identifies the subdirectory in examples
+# that will be used in the build
+# CONFIG_DEBUG - enables built-in debug options
+# CONFIG_DEBUG_VERBOSE - enables verbose debug output
+# CONFIG_MM_REGIONS - If the architecture includes multiple
+# regions of memory to allocate from, this specifies the
+# number of memory regions that the memory manager must
+# handle and enables the API mm_addregion(start, end);
+# CONFIG_ARCH_LOWPUTC - architecture supports low-level, boot
+# time console output
+# CONFIG_TICKS_PER_MSEC - The default system timer is 100Hz
+# or TICKS_PER_MSEC=10. This setting may be defined to
+# inform NuttX that the processor hardware is providing
+# system timer interrupts at some interrupt interval other
+# than 10 msec.
+# CONFIG_RR_INTERVAL - The round robin timeslice will be set
+# this number of milliseconds; Round robin scheduling can
+# be disabled by setting this value to zero.
+# CONFIG_SCHED_INSTRUMENTATION - enables instrumentation in
+# scheduler to monitor system performance
+# CONFIG_TASK_NAME_SIZE - Spcifies that maximum size of a
+# task name to save in the TCB. Useful if scheduler
+# instrumentation is selected. Set to zero to disable.
+# CONFIG_START_YEAR, CONFIG_START_MONTH, CONFIG_START_DAY -
+# Used to initialize the internal time logic.
+# CONFIG_JULIAN_TIME - Enables Julian time conversions
+# CONFIG_DEV_CONSOLE - Set if architecture-specific logic
+# provides /dev/console. Enables stdout, stderr, stdin.
+# CONFIG_DEV_LOWCONSOLE - Use the simple, low-level serial console
+# driver (minimul support)
+# CONFIG_MUTEX_TYPES: Set to enable support for recursive and
+# errorcheck mutexes. Enables pthread_mutexattr_settype().
+# CONFIG_PRIORITY_INHERITANCE : Set to enable support for priority
+# inheritance on mutexes and semaphores.
+#
+CONFIG_EXAMPLE=nettest
+CONFIG_DEBUG=y
+CONFIG_DEBUG_VERBOSE=n
+CONFIG_DEBUG_NET=y
+CONFIG_MM_REGIONS=1
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_INSTRUMENTATION=n
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_START_YEAR=2009
+CONFIG_START_MONTH=5
+CONFIG_START_DAY=20
+CONFIG_JULIAN_TIME=n
+CONFIG_DEV_CONSOLE=y
+CONFIG_DEV_LOWCONSOLE=y
+CONFIG_MUTEX_TYPES=n
+CONFIG_PRIORITY_INHERITANCE=n
+
+#
+# The following can be used to disable categories of
+# APIs supported by the OS. If the compiler supports
+# weak functions, then it should not be necessary to
+# disable functions unless you want to restrict usage
+# of those APIs.
+#
+# There are certain dependency relationships in these
+# features.
+#
+# o mq_notify logic depends on signals to awaken tasks
+# waiting for queues to become full or empty.
+# o pthread_condtimedwait() depends on signals to wake
+# up waiting tasks.
+#
+CONFIG_DISABLE_CLOCK=n
+CONFIG_DISABLE_POSIX_TIMERS=n
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=n
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_ENVIRON=y
+CONFIG_DISABLE_POLL=y
+
+#
+# Misc libc settings
+#
+# CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a
+# little smaller if we do not support fieldwidthes
+#
+CONFIG_NOPRINTF_FIELDWIDTH=n
+
+#
+# Allow for architecture optimized implementations
+#
+# The architecture can provide optimized versions of the
+# following to improve sysem performance
+#
+CONFIG_ARCH_MEMCPY=n
+CONFIG_ARCH_MEMCMP=n
+CONFIG_ARCH_MEMMOVE=n
+CONFIG_ARCH_MEMSET=n
+CONFIG_ARCH_STRCMP=n
+CONFIG_ARCH_STRCPY=n
+CONFIG_ARCH_STRNCPY=n
+CONFIG_ARCH_STRLEN=n
+CONFIG_ARCH_BZERO=n
+CONFIG_ARCH_KMALLOC=n
+CONFIG_ARCH_KZMALLOC=n
+CONFIG_ARCH_KFREE=n
+
+#
+# Sizes of configurable things (0 disables)
+#
+# CONFIG_MAX_TASKS - The maximum number of simultaneously
+# active tasks. This value must be a power of two.
+# CONFIG_MAX_TASK_ARGS - This controls the maximum number of
+# of parameters that a task may receive (i.e., maxmum value
+# of 'argc')
+# CONFIG_NPTHREAD_KEYS - The number of items of thread-
+# specific data that can be retained
+# CONFIG_NFILE_DESCRIPTORS - The maximum number of file
+# descriptors (one for each open)
+# CONFIG_NFILE_STREAMS - The maximum number of streams that
+# can be fopen'ed
+# CONFIG_NAME_MAX - The maximum size of a file name.
+# CONFIG_STDIO_BUFFER_SIZE - Size of the buffer to allocate
+# on fopen. (Only if CONFIG_NFILE_STREAMS > 0)
+# CONFIG_NUNGET_CHARS - Number of characters that can be
+# buffered by ungetc() (Only if CONFIG_NFILE_STREAMS > 0)
+# CONFIG_PREALLOC_MQ_MSGS - The number of pre-allocated message
+# structures. The system manages a pool of preallocated
+# message structures to minimize dynamic allocations
+# CONFIG_MQ_MAXMSGSIZE - Message structures are allocated with
+# a fixed payload size given by this settin (does not include
+# other message structure overhead.
+# CONFIG_MAX_WDOGPARMS - Maximum number of parameters that
+# can be passed to a watchdog handler
+# CONFIG_PREALLOC_WDOGS - The number of pre-allocated watchdog
+# structures. The system manages a pool of preallocated
+# watchdog structures to minimize dynamic allocations
+# CONFIG_PREALLOC_TIMERS - The number of pre-allocated POSIX
+# timer structures. The system manages a pool of preallocated
+# timer structures to minimize dynamic allocations. Set to
+# zero for all dynamic allocations.
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=8
+CONFIG_NFILE_STREAMS=8
+CONFIG_NAME_MAX=32
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_NUNGET_CHARS=0
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=4
+CONFIG_PREALLOC_WDOGS=8
+CONFIG_PREALLOC_TIMERS=8
+
+#
+# Filesystem configuration
+#
+# CONFIG_FS_FAT - Enable FAT filesystem support
+# CONFIG_FAT_SECTORSIZE - Max supported sector size
+# CONFIG_FS_ROMFS - Enable ROMFS filesystem support
+CONFIG_FS_FAT=n
+CONFIG_FS_ROMFS=n
+
+#
+# SPI-based MMC/SD driver
+#
+# CONFIG_MMCSD_NSLOTS
+# Number of MMC/SD slots supported by the driver
+# CONFIG_MMCSD_READONLY
+# Provide read-only access (default is read/write)
+CONFIG_MMCSD_NSLOTS=1
+CONFIG_MMCSD_READONLY=n
+
+#
+# TCP/IP and UDP support via uIP
+# CONFIG_NET - Enable or disable all network features
+# CONFIG_NET_IPv6 - Build in support for IPv6
+# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread.
+# CONFIG_NET_SOCKOPTS - Enable or disable support for socket options
+# CONFIG_NET_BUFSIZE - uIP buffer size
+# CONFIG_NET_TCP - TCP support on or off
+# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
+# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
+# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
+# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
+# accept() is called. The size of the backlog is selected when listen() is called.
+# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
+# CONFIG_NET_UDP - UDP support on or off
+# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections
+# CONFIG_NET_ICMP - ICMP ping response support on or off
+# CONFIG_NET_ICMP_PING - ICMP ping request support on or off
+# CONFIG_NET_PINGADDRCONF - Use "ping" packet for setting IP address
+# CONFIG_NET_STATISTICS - uIP statistics on or off
+# CONFIG_NET_RECEIVE_WINDOW - The size of the advertised receiver's window
+# CONFIG_NET_ARPTAB_SIZE - The size of the ARP table
+# CONFIG_NET_BROADCAST - Broadcast support
+# CONFIG_NET_LLH_LEN - The link level header length
+# CONFIG_NET_FWCACHE_SIZE - number of packets to remember when looking for duplicates
+#
+CONFIG_NET=y
+CONFIG_NET_IPv6=n
+CONFIG_NSOCKET_DESCRIPTORS=8
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_BUFSIZE=420
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_CONNS=8
+CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
+CONFIG_NET_TCPBACKLOG=n
+CONFIG_NET_MAX_LISTENPORTS=8
+CONFIG_NET_UDP=n
+CONFIG_NET_UDP_CHECKSUMS=y
+#CONFIG_NET_UDP_CONNS=10
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_PING=n
+#CONFIG_NET_PINGADDRCONF=0
+CONFIG_NET_STATISTICS=n
+#CONFIG_NET_RECEIVE_WINDOW=
+#CONFIG_NET_ARPTAB_SIZE=8
+CONFIG_NET_BROADCAST=n
+#CONFIG_NET_LLH_LEN=14
+#CONFIG_NET_FWCACHE_SIZE=2
+
+#
+# UIP Network Utilities
+# CONFIG_NET_DHCP_LIGHT - Reduces size of DHCP
+# CONFIG_NET_RESOLV_ENTRIES - Number of resolver entries
+#
+CONFIG_NET_DHCP_LIGHT=n
+CONFIG_NET_RESOLV_ENTRIES=4
+
+#
+# Settings for examples/uip
+#
+CONFIG_EXAMPLE_UIP_IPADDR=(10<<24|0<<16|0<<8|2)
+CONFIG_EXAMPLE_UIP_DRIPADDR=(10<<24|0<<16|0<<8|1)
+CONFIG_EXAMPLE_UIP_NETMASK=(255<<24|255<<16|255<<8|0)
+CONFIG_EXAMPLE_UIP_DHCPC=n
+
+#
+# Settings for examples/nettest
+# CONFIG_EXAMPLE_NETTEST_SERVER - The target board can act
+# as either the client side or server side of the test
+# CONFIG_EXAMPLE_NETTEST_PERFORMANCE - If set, then the
+# client side simply receives messages forever, allowing
+# measurement of throughput
+# CONFIG_EXAMPLE_NETTEST_NOMAC - Set if the hardware has
+# no MAC address; one will be assigned
+# CONFIG_EXAMPLE_NETTEST_IPADDR - Target board IP address
+# CONFIG_EXAMPLE_NETTEST_DRIPADDR - Default router address
+# CONFIG_EXAMPLE_NETTEST_NETMASK - Network mask
+# CONFIG_EXAMPLE_NETTEST_CLIENTIP - IP address of the
+# client side of the test (may be target or host)
+CONFIG_EXAMPLE_NETTEST_SERVER=n
+CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
+CONFIG_EXAMPLE_NETTEST_NOMAC=n
+CONFIG_EXAMPLE_NETTEST_IPADDR=(10L<<24|0L<<16|0L<<8|2L)
+CONFIG_EXAMPLE_NETTEST_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L)
+CONFIG_EXAMPLE_NETTEST_NETMASK=(255L<<24|255L<<16|255L<<8|0L)
+CONFIG_EXAMPLE_NETTEST_CLIENTIP=(10L<<24|0L<<16|0L<<8|1L)
+
+#
+# Settings for examples/ostest
+#
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
+
+#
+# Settings for examples/nsh
+#
+# CONFIG_EXAMPLES_NSH_FILEIOSIZE - Size of a static I/O buffer
+# CONFIG_EXAMPLES_NSH_STRERROR - Use strerror(errno)
+# CONFIG_EXAMPLES_NSH_LINELEN - Maximum length of one command line
+# CONFIG_EXAMPLES_NSH_STACKSIZE - Stack size to use for new threads.
+# CONFIG_EXAMPLES_NSH_NESTDEPTH - Max number of nested if-then[-else]-fi
+# CONFIG_EXAMPLES_NSH_DISABLESCRIPT - Disable scripting support
+# CONFIG_EXAMPLES_NSH_DISABLEBG - Disable background commands
+# CONFIG_EXAMPLES_NSH_ROMFSETC - Use startup script in /etc
+# CONFIG_EXAMPLES_NSH_CONSOLE - Use serial console front end
+# CONFIG_EXAMPLES_NSH_TELNET - Use telnetd console front end
+#
+# If CONFIG_EXAMPLES_NSH_TELNET is selected:
+# CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE -- Telnetd I/O buffer size
+# CONFIG_EXAMPLES_NSH_DHCPC - Obtain address using DHCP
+# CONFIG_EXAMPLES_NSH_IPADDR - Provides static IP address
+# CONFIG_EXAMPLES_NSH_DRIPADDR - Provides static router IP address
+# CONFIG_EXAMPLES_NSH_NETMASK - Provides static network mask
+# CONFIG_EXAMPLES_NSH_NOMAC - Use a bogus MAC address
+#
+# If CONFIG_EXAMPLES_NSH_ROMFSETC is selected:
+# CONFIG_EXAMPLES_NSH_ROMFSMOUNTPT - ROMFS mountpoint
+# CONFIG_EXAMPLES_NSH_INITSCRIPT - Relative path to init script
+# CONFIG_EXAMPLES_NSH_ROMFSDEVNO - ROMFS RAM device minor
+# CONFIG_EXAMPLES_NSH_ROMFSSECTSIZE - ROMF sector size
+# CONFIG_EXAMPLES_NSH_FATDEVNO - FAT FS RAM device minor
+# CONFIG_EXAMPLES_NSH_FATSECTSIZE - FAT FS sector size
+# CONFIG_EXAMPLES_NSH_FATNSECTORS - FAT FS number of sectors
+# CONFIG_EXAMPLES_NSH_FATMOUNTPT - FAT FS mountpoint
+#
+CONFIG_EXAMPLES_NSH_FILEIOSIZE=512
+CONFIG_EXAMPLES_NSH_STRERROR=n
+CONFIG_EXAMPLES_NSH_LINELEN=64
+CONFIG_EXAMPLES_NSH_STACKSIZE=2048
+CONFIG_EXAMPLES_NSH_NESTDEPTH=3
+CONFIG_EXAMPLES_NSH_DISABLESCRIPT=n
+CONFIG_EXAMPLES_NSH_DISABLEBG=n
+CONFIG_EXAMPLES_NSH_ROMFSETC=n
+CONFIG_EXAMPLES_NSH_CONSOLE=y
+CONFIG_EXAMPLES_NSH_TELNET=n
+CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE=512
+CONFIG_EXAMPLES_NSH_DHCPC=n
+CONFIG_EXAMPLES_NSH_NOMAC=n
+CONFIG_EXAMPLES_NSH_IPADDR=(10<<24|0<<16|0<<8|2)
+CONFIG_EXAMPLES_NSH_DRIPADDR=(10<<24|0<<16|0<<8|1)
+CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
+CONFIG_EXAMPLES_NSH_ROMFSMOUNTPT="/etc"
+CONFIG_EXAMPLES_NSH_INITSCRIPT="init.d/rcS"
+CONFIG_EXAMPLES_NSH_ROMFSDEVNO=0
+CONFIG_EXAMPLES_NSH_ROMFSSECTSIZE=64
+CONFIG_EXAMPLES_NSH_FATDEVNO=1
+CONFIG_EXAMPLES_NSH_FATSECTSIZE=512
+CONFIG_EXAMPLES_NSH_FATNSECTORS=1024
+CONFIG_EXAMPLES_NSH_FATMOUNTPT=/tmp
+
+#
+# Stack and heap information
+#
+# CONFIG_BOOT_RUNFROMFLASH - Some configurations support XIP
+# operation from FLASH but must copy initialized .data sections to RAM.
+# (should also be =n for the Eagle100 which always runs from flash)
+# CONFIG_BOOT_COPYTORAM - Some configurations boot in FLASH
+# but copy themselves entirely into RAM for better performance.
+# CONFIG_CUSTOM_STACK - The up_ implementation will handle
+# all stack operations outside of the nuttx model.
+# CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only)
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+# This is the thread that (1) performs the inital boot of the system up
+# to the point where user_start() is spawned, and (2) there after is the
+# IDLE thread that executes only when there is no other thread ready to
+# run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+# for the main user thread that begins at the user_start() entry point.
+# CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
+# CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
+# CONFIG_HEAP_BASE - The beginning of the heap
+# CONFIG_HEAP_SIZE - The size of the heap
+#
+CONFIG_BOOT_RUNFROMFLASH=n
+CONFIG_BOOT_COPYTORAM=n
+CONFIG_CUSTOM_STACK=n
+CONFIG_STACK_POINTER=
+CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=2048
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=2048
+CONFIG_HEAP_BASE=
+CONFIG_HEAP_SIZE=
diff --git a/nuttx/configs/eagle100/nettest/ld.script b/nuttx/configs/eagle100/nettest/ld.script
new file mode 100644
index 000000000..edb5a6c57
--- /dev/null
+++ b/nuttx/configs/eagle100/nettest/ld.script
@@ -0,0 +1,97 @@
+/****************************************************************************
+ * configs/eagle100/nettest/ld.script
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/* The LM3S6918 has 256Kb of FLASH beginning at address 0x0000:0000. However,
+ * if the the Eagle100 Ethernet bootloader is used, then the entry point must
+ * be at the following offset in FLASH (and the size of the FLASH must be
+ * reduced to 248Kb):
+ */
+
+MEMORY
+{
+/* flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K */
+ flash (rx) : ORIGIN = 0x00002000, LENGTH = 248K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata)
+ *(.rodata.str1.1)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got) /* Global offset table */
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ _eronly = ABSOLUTE(.); /* See below */
+
+ /* The LM3S6918 has 64Kb of SRAM beginning at the following address */
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .bss : { /* BSS */
+ _sbss = ABSOLUTE(.);
+ *(.bss)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/nuttx/configs/eagle100/nettest/setenv.sh b/nuttx/configs/eagle100/nettest/setenv.sh
new file mode 100755
index 000000000..d422fcad0
--- /dev/null
+++ b/nuttx/configs/eagle100/nettest/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# configs/eagle100/nettest/setenv.sh
+#
+# Copyright (C) 2009 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+#
+# 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.
+#
+
+if [ "$(basename $0)" = "setenv.sh" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
+
+WD=`pwd`
+export BUILDROOT_BIN=${WD}/../buildroot/build_arm_nofpu/staging_dir/bin
+export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
+
+echo "PATH : ${PATH}"
diff --git a/nuttx/configs/eagle100/src/up_ethernet.c b/nuttx/configs/eagle100/src/up_ethernet.c
index 4dfbeae3f..81c07d021 100644
--- a/nuttx/configs/eagle100/src/up_ethernet.c
+++ b/nuttx/configs/eagle100/src/up_ethernet.c
@@ -41,6 +41,8 @@
#include <nuttx/config.h>
#include <sys/types.h>
+#include <assert.h>
+
#include <arch/board/board.h>
#include <net/ethernet.h>
@@ -72,24 +74,22 @@
#ifdef CONFIG_LM3S_BOARDMAC
void lm3s_ethernetmac(struct ether_addr *ethaddr)
{
-struct ether_addr
-{
uint32 user0;
uint32 user1;
/* Get the current value of the user registers */
- user0 = getreg32();
- user1 = getreg32();
+ user0 = getreg32(LM3S_FLASH_USERREG0);
+ user1 = getreg32(LM3S_FLASH_USERREG1);
DEBUGASSERT(user0 != 0xffffffff && user1 == 0xffffffff);
/* Re-format that MAC address the way that uIP expects to see it */
- ethaddr->ether_addr_octet.addr[0] = ((user0 >> 0) & 0xff);
- ethaddr->ether_addr_octet.addr[1] = ((user0 >> 8) & 0xff);
- ethaddr->ether_addr_octet.addr[2] = ((user0 >> 16) & 0xff);
- ethaddr->ether_addr_octet.addr[3] = ((user1 >> 0) & 0xff);
- ethaddr->ether_addr_octet.addr[4] = ((user1 >> 8) & 0xff);
- ethaddr->ether_addr_octet.addr[5] = ((user1 >> 16) & 0xff);
+ ethaddr->ether_addr_octet[0] = ((user0 >> 0) & 0xff);
+ ethaddr->ether_addr_octet[1] = ((user0 >> 8) & 0xff);
+ ethaddr->ether_addr_octet[2] = ((user0 >> 16) & 0xff);
+ ethaddr->ether_addr_octet[3] = ((user1 >> 0) & 0xff);
+ ethaddr->ether_addr_octet[4] = ((user1 >> 8) & 0xff);
+ ethaddr->ether_addr_octet[5] = ((user1 >> 16) & 0xff);
}
-#endif \ No newline at end of file
+#endif