mirror of
https://github.com/apache/nuttx.git
synced 2026-09-21 05:14:27 +08:00
Complete Rx side of ethernet driver
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1812 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -727,4 +727,5 @@
|
||||
* arch/arm/src/lm2s: Added an Ethernet driver for the LM3S6918
|
||||
* configs/eagle100/nettest: Added an examples/nettest configuration for the
|
||||
Micromint Eagle100 board.
|
||||
* Documentation/NuttxPortingGuide.html: Added a section on NuttX device drivers.
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<tr align="center" bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
|
||||
<p>Last Updated: May 19, 2009</p>
|
||||
<p>Last Updated: May 21, 2009</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -696,7 +696,8 @@
|
||||
These unreleased changes are listed <a href="#pendingchanges">here</a>.
|
||||
</p>
|
||||
<p>
|
||||
The release features support for the Micromint Eagle-100 development board.
|
||||
The release features support for the <a href=" http://www.micromint.com/">Micromint</a>
|
||||
Eagle-100 development board.
|
||||
This board is based around, the Luminary LM3S6918 MCU.
|
||||
This is the first ARM Cortex-M3 architecture supported by Nuttx.
|
||||
This initial, basic port includes timer and serial console with configurations to execute the NuttX OS test and to run the <a href="NuttShell.html">NuttShell (NSH)</a>.
|
||||
@@ -860,8 +861,8 @@
|
||||
<td>
|
||||
<p>
|
||||
<b>Luminary LM3S6918</b>.
|
||||
This port uses the Micromint Eagle-100 development board with a GNU arm-elf toolchain*
|
||||
under either Linux or Cygwin.
|
||||
This port uses the <a href=" http://www.micromint.com/">Micromint</a> Eagle-100 development
|
||||
board with a GNU arm-elf toolchain* under either Linux or Cygwin.
|
||||
</p>
|
||||
<p>
|
||||
<b>STATUS:</b>
|
||||
@@ -1416,6 +1417,7 @@ nuttx-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.
|
||||
* Documentation/NuttxPortingGuide.html: Added a section on NuttX device drivers.
|
||||
|
||||
pascal-0.1.3 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
@@ -1487,9 +1489,10 @@ buildroot-0.1.6 2009-xx-xx <spudmonkey@racsa.co.cr>
|
||||
</tr>
|
||||
</table>
|
||||
<ul>
|
||||
<li>ARM, ARM7 ARM7TDMI, ARM9, ARM920T, ARM926EJS are trademarks of Advanced RISC Machines, Limited.</li>
|
||||
<li>ARM, ARM7 ARM7TDMI, ARM9, ARM920T, ARM926EJS Cortex-M3 are trademarks of Advanced RISC Machines, Limited.</li>
|
||||
<li>Cygwin is a trademark of Red Hat, Incorporated.</li>
|
||||
<li>Linux is a registered trademark of Linus Torvalds.</li>
|
||||
<li>Eagle-100 is a trademark of <a href=" http://www.micromint.com/">Micromint USA, LLC</a>.
|
||||
<li>LPC2148 is a trademark of NXP Semiconductors.</li>
|
||||
<li>TI is a tradename of Texas Instruments Incorporated.</li>
|
||||
<li>UNIX is a registered trademark of The Open Group.</li>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<h1><big><font color="#3c34ec">
|
||||
<i>NuttX RTOS Porting Guide</i>
|
||||
</font></big></h1>
|
||||
<p>Last Updated: May 9, 2009</p>
|
||||
<p>Last Updated: May 21, 2009</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -104,6 +104,18 @@
|
||||
</ul>
|
||||
</ul>
|
||||
<a href="#NxFileSystem">5.0 NuttX File System</a><br>
|
||||
<a href="#DeviceDrivers">6.0 NuttX Device Drivers</a><br>
|
||||
<ul>
|
||||
<a href="#chardrivers">6.1 Character Device Drivers</a><br>
|
||||
<a href="#blockdrivers">6.2 Block Device Drivers</a><br>
|
||||
<a href="#blockdrivers">6.3 Specialized Device Drivers</a>
|
||||
<ul>
|
||||
<a href="#ethdrivers">6.3.1 Ethernet Device Drivers</a><br>
|
||||
<a href="#spidrivers">6.3.2 SPI Device Drivers</a><br>
|
||||
<a href="#i2cdrivers">6.3.3 I2C Device Drivers</a><br>
|
||||
<a href="#serialdrivers">6.3.4 Serial Device Drivers</a>
|
||||
</ul>
|
||||
</ul>
|
||||
<a href="#apndxconfigs">Appendix A: NuttX Configuration Settings</a><br>
|
||||
<a href="#apndxtrademarks">Appendix B: Trademarks</a>
|
||||
</ul>
|
||||
@@ -1621,6 +1633,243 @@ extern void up_ledoff(int led);
|
||||
from the very tiny platform to the moderate platform.
|
||||
</p>
|
||||
|
||||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<h1><a name="DeviceDrivers">6.0 NuttX Device Drivers</a></h1>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
NuttX supports a variety of device drivers including:
|
||||
<ul>
|
||||
<li><i>Character</i> Device Drivers,</li>
|
||||
<li><i>Block</i> Device Drivers, and</li>
|
||||
<li>Other <i>Specialized</i> Drivers.</li>
|
||||
</ul>
|
||||
As discussed in the following paragraphs.
|
||||
</p>
|
||||
|
||||
<h2><a name="chardrivers">6.1 Character Device Drivers</a></h2>
|
||||
|
||||
<p>
|
||||
Character device drivers have these properties:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
<b><code>include/nuttx/fs.h</code></b>.
|
||||
All structures and APIs needed to work with character drivers are provided in this header file.
|
||||
</li>
|
||||
<li>
|
||||
<b><code>struct file_operations</code></b>.
|
||||
Each character device driver must implement an instance of <code>struct file_operations</code>.
|
||||
That structure defines a call table with the following methods:
|
||||
<ul>
|
||||
<p><code>int open(FAR struct file *filp);</code></p>
|
||||
<p><code>int close(FAR struct file *filp);</code></p>
|
||||
<p><code>ssize_t read(FAR struct file *filp, FAR char *buffer, size_t buflen);</code></p>
|
||||
<p><code>ssize_t write(FAR struct file *filp, FAR const char *buffer, size_t buflen);</code></p>
|
||||
<p><code>off_t seek(FAR struct file *filp, off_t offset, int whence);</code></p>
|
||||
<p><code>int ioctl(FAR struct file *filp, int cmd, unsigned long arg);</code></p>
|
||||
<p><code>int poll(FAR struct file *filp, struct pollfd *fds, boolean setup);</code></p>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<b><code>int register_driver(const char *path, const struct file_operations *fops, mode_t mode, void *priv);</code></b>.
|
||||
Each character driver registers itself by calling <code>register_driver()</code>, passing it the
|
||||
<code>path</code> where it will appear in the <a href="#NxFileSystem">pseudo-file-system</a> and it's
|
||||
initialized instance of <code>struct file_operations</code>.
|
||||
</li>
|
||||
<li>
|
||||
<b>User Access</b>.
|
||||
After it has been registered, the character driver can be accessed by user code using the standard functions <code>open()</code>, <code>close()</code>, <code>read()</code>, <code>write()</code>, etc.
|
||||
</li>
|
||||
<li>
|
||||
<b>Examples</b>.
|
||||
<code>drivers/dev_null.c</code>, <code>drivers/fifo.c</code>, <code>drivers/serial.c</code>, etc.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2><a name="blockdrivers">6.2 Block Device Drivers</a></h2>
|
||||
|
||||
<p>
|
||||
Block device drivers have these properties:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
<b><code>include/nuttx/fs.h</code></b>.
|
||||
All structures and APIs needed to work with block drivers are provided in this header file.
|
||||
</li>
|
||||
<li>
|
||||
<b><code>struct block_operations</code></b>.
|
||||
Each block device driver must implement an instance of <code>struct block_operations</code>.
|
||||
That structure defines a call table with the following methods:
|
||||
<ul>
|
||||
<p><code>int open(FAR struct inode *inode);</code></p>
|
||||
<p><code>int close(FAR struct inode *inode);</code></p>
|
||||
<p><code>ssize_t read(FAR struct inode *inode, FAR unsigned char *buffer, size_t start_sector, unsigned int nsectors);</code></p>
|
||||
<p><code>ssize_t write(FAR struct inode *inode, FAR const unsigned char *buffer, size_t start_sector, unsigned int nsectors);</code></p>
|
||||
<p><code>int geometry(FAR struct inode *inode, FAR struct geometry *geometry);</code></p>
|
||||
<p><code>int ioctl(FAR struct inode *inode, int cmd, unsigned long arg);</code></p>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<b><code>int register_blockdriver(const char *path, const struct block_operations *bops, mode_t mode, void *priv);</code></b>.
|
||||
Each block driver registers itself by calling <code>register_blockdriver()</code>, passing it the
|
||||
<code>path</code> where it will appear in the <a href="#NxFileSystem">pseudo-file-system</a> and it's
|
||||
initialized instance of <code>struct block_operations</code>.
|
||||
</li>
|
||||
<li>
|
||||
<b>User Access</b>.
|
||||
Users do not normally access block drivers directly, rather, they access block drivers
|
||||
indirectly through the <code>mount()</code> API.
|
||||
The <code>mount()</code> API binds a block driver instance with a file system and with a mountpoint.
|
||||
Then the user may use the block driver to access the file system on the underlying media.
|
||||
<b>Example:</b> See the <code>cmd_mount()</code> implementation in <code>examples/nsh/nsh_fscmds.c</code>.
|
||||
</li>
|
||||
<li>
|
||||
<b>Accessing a Character Driver as a Block Device</b>.
|
||||
See the loop device at <code>drivers/loop.c</code>.
|
||||
<b>Example:</b> See the <code>cmd_losetup()</code> implementation in <code>examples/nsh/nsh_fscmds.c</code>.
|
||||
</li>
|
||||
<li>
|
||||
<b>Accessing a Block Driver as Character Device</b>.
|
||||
See the Block-to-Character (BCH) conversion logic in <code>drivers/bch/</code>.
|
||||
<b>Example:</b> See the <code>cmd_dd()</code> implementation in <code>examples/nsh/nsh_ddcmd.c</code>.
|
||||
</li>
|
||||
<li>
|
||||
<b>Examples</b>.
|
||||
<code>drivers/loop.c</code>, <code>drivers/mmcds/mmcsd_spi.c</code>, <code>drivers/ramdisk.c</code>, etc.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2><a name="blockdrivers">6.3 Specialized Device Drivers</a></h2>
|
||||
|
||||
<h3><a name="ethdrivers">6.3.1 Ethernet Device Drivers</a></h3>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<b><code>include/net/uip/uip-arch.h</code></b>.
|
||||
All structures and APIs needed to work with Ethernet drivers are provided in this header file.
|
||||
The structure <code>struct uip_driver_s</code> defines the interface and is passed to uIP via
|
||||
<code>netdev_register()</code>.
|
||||
</li>
|
||||
<li>
|
||||
<b><code>int netdev_register(FAR struct uip_driver_s *dev);</code></b>.
|
||||
Each Eterhenet driver registers itself by calling <code>netdev_register()</code>.
|
||||
</li>
|
||||
<li>
|
||||
<b>Examples</b>.
|
||||
<code>drivers/net/dm90x0.c</code>, <code>arch/drivers/arm/src/c5471/c5471_ethernet.c</code>, <code>arch/z80/src/ez80/ez80_emac.c</code>, etc.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3><a name="spidrivers">6.3.2 SPI Device Drivers</a></h3>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<b><code>include/nuttx/spi.h</code></b>.
|
||||
All structures and APIs needed to work with SPI drivers are provided in this header file.
|
||||
</li>
|
||||
<li>
|
||||
<b><code>struct spi_ops_s</code></b>.
|
||||
Each SPI device driver must implement an instance of <code>struct spi_ops_s</code>.
|
||||
That structure defines a call table with the following methods:
|
||||
<ul>
|
||||
<p><code>void select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, boolean selected);</code></p>
|
||||
<p><code>uint32 setfrequency(FAR struct spi_dev_s *dev, uint32 frequency);</code></p>
|
||||
<p><code>void setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode);</code></p>
|
||||
<p><code>void setbits(FAR struct spi_dev_s *dev, int nbits);</code></p>
|
||||
<p><code>ubyte status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);</code></p>
|
||||
<p><code>uint16 send(FAR struct spi_dev_s *dev, uint16 wd);</code></p>
|
||||
<p><code>void exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer, FAR void *rxbuffer, size_t nwords);</code></p>
|
||||
<p><codei>nt registercallback(FAR struct spi_dev_s *dev, mediachange_t callback, void *arg);</code></p>
|
||||
</ul>
|
||||
<li>
|
||||
<b>Binding SPI Drivers</b>.
|
||||
SPI drivers are not normally directly accessed by user code, but are usually bound to another,
|
||||
higher level device driver.
|
||||
See for example, <code>int mmcsd_spislotinitialize(int minor, int slotno, FAR struct spi_dev_s *spi)</code> in <code>drivers/mmcsd/mmcsd_spi.c</code>.
|
||||
</li>
|
||||
<li>
|
||||
<b>Examples</b>.
|
||||
<code>drivers/loop.c</code>, <code>drivers/mmcds/mmcsd_spi.c</code>, <code>drivers/ramdisk.c</code>, etc.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3><a name="i2cdrivers">6.3.3 I2C Device Drivers</a></h3>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<b><code>include/nuttx/i2c.h</code></b>.
|
||||
All structures and APIs needed to work with I2C drivers are provided in this header file.
|
||||
</li>
|
||||
<li>
|
||||
<b><code>struct i2c_ops_s</code></b>.
|
||||
Each I2C device driver must implement an instance of <code>struct i2c_ops_s</code>.
|
||||
That structure defines a call table with the following methods:
|
||||
<ul>
|
||||
<p><code>uint32 setfrequency(FAR struct i2c_dev_s *dev, uint32 frequency);</code></p>
|
||||
<p><code>int setaddress(FAR struct i2c_dev_s *dev, int addr, int nbits);</code></p>
|
||||
<p><code>int write(FAR struct i2c_dev_s *dev, const ubyte *buffer, int buflen);</code></p>
|
||||
<p><code>int read(FAR struct i2c_dev_s *dev, ubyte *buffer, int buflen);</code></p>
|
||||
</ul>
|
||||
<li>
|
||||
<b>Binding I2C Drivers</b>.
|
||||
SPI drivers are not normally directly accessed by user code, but are usually bound to another,
|
||||
higher level device driver.
|
||||
</li>
|
||||
<li>
|
||||
<b>Examples</b>.
|
||||
<code>arch/z80/src/ez80/ez80_i2c.c</code>, <code>arch/z80/src/z8/z8_i2c.c</code>, etc.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3><a name="serialdrivers">6.3.4 Serial Device Drivers</a></h3>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<b><code>include/nuttx/serial.h</code></b>.
|
||||
All structures and APIs needed to work with serial drivers are provided in this header file.
|
||||
</li>
|
||||
<li>
|
||||
<b><code>struct uart_ops_s</code></b>.
|
||||
Each serial device driver must implement an instance of <code>struct uart_ops_s</code>.
|
||||
That structure defines a call table with the following methods:
|
||||
<ul>
|
||||
<p><code>int setup(FAR struct uart_dev_s *dev);</code></p>
|
||||
<p><code>void shutdown(FAR struct uart_dev_s *dev);</code></p>
|
||||
<p><code>int attach(FAR struct uart_dev_s *dev);</code></p>
|
||||
<p><code>void detach(FAR struct uart_dev_s *dev);</code></p>
|
||||
<p><code>int ioctl(FAR struct file *filep, int cmd, unsigned long arg);</code></p>
|
||||
<p><code>int receive(FAR struct uart_dev_s *dev, unsigned int *status);</code></p>
|
||||
<p><code>void rxint(FAR struct uart_dev_s *dev, boolean enable);</code></p>
|
||||
<p><code>boolean rxavailable(FAR struct uart_dev_s *dev);</code></p>
|
||||
<p><code>void send(FAR struct uart_dev_s *dev, int ch);</code></p>
|
||||
<p><code>void txint(FAR struct uart_dev_s *dev, boolean enable);</code></p>
|
||||
<p><code>boolean txready(FAR struct uart_dev_s *dev);</code></p>
|
||||
<p><code>boolean txempty(FAR struct uart_dev_s *dev);</code></p>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<b><code>int uart_register(FAR const char *path, FAR uart_dev_t *dev);</code></b>.
|
||||
A serial driver may register itself by calling <code>uart_register()</code>, passing it the
|
||||
<code>path</code> where it will appear in the <a href="#NxFileSystem">pseudo-file-system</a> and it's
|
||||
initialized instance of <code>struct uart_ops_s</code>.
|
||||
By convention, serial device drivers are registered at pathes like <code>/dev/ttyS0</code>, <code>/dev/ttyS1</code>, etc.
|
||||
See the <code>uart_register()</code> implementation in <code>drivers/serial.c</code>.
|
||||
</li>
|
||||
<li>
|
||||
<b>User Access</b>.
|
||||
Serial drivers are, ultimately, normal <a href="#chardrivers">character drivers</a> and are accessed as other character drivers.
|
||||
</li>
|
||||
<li>
|
||||
<b>Examples</b>.
|
||||
<code>arch/arm/src/chip/lm3s_serial.c</code>, <code>arch/arm/src/lpc214x/lpc214x_serial.c</code>, <code>arch/z16/src/z16f/z16f_serial.c</code>, etc.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
@@ -2255,9 +2504,10 @@ extern void up_ledoff(int led);
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<li>ARM, ARM7 ARM7TDMI, ARM9, ARM926EJS are trademarks of Advanced RISC Machines, Limited.</li>
|
||||
<li>ARM, ARM7 ARM7TDMI, ARM9, ARM920T, ARM926EJS, Cortex-M3 are trademarks of Advanced RISC Machines, Limited.</li>
|
||||
<li>Cygwin is a trademark of Red Hat, Incorporated.</li>
|
||||
<li>Linux is a registered trademark of Linus Torvalds.</li>
|
||||
<li>Eagle-100 is a trademark of <a href=" http://www.micromint.com/">Micromint USA, LLC</a>.
|
||||
<li>LPC2148 is a trademark of NXP Semiconductors.</li>
|
||||
<li>TI is a tradename of Texas Instruments Incorporated.</li>
|
||||
<li>UNIX is a registered trademark of The Open Group.</li>
|
||||
|
||||
+20
-19
@@ -72,33 +72,34 @@ void up_doirq(int irq, uint32 *regs)
|
||||
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
||||
PANIC(OSERR_ERREXCEPTION);
|
||||
#else
|
||||
if ((unsigned)irq < NR_IRQS)
|
||||
{
|
||||
/* Current regs non-zero indicates that we are processing
|
||||
* an interrupt; current_regs is also used to manage
|
||||
* interrupt level context switches.
|
||||
*/
|
||||
/* Nested interrupts are not supported in this implementation. If you want
|
||||
* implemented nested interrupts, you would have to (1) change the way that
|
||||
* current regs is handled and (2) the design associated with
|
||||
* CONFIG_ARCH_INTERRUPTSTACK.
|
||||
*/
|
||||
|
||||
current_regs = regs;
|
||||
/* Current regs non-zero indicates that we are processing an interrupt;
|
||||
* current_regs is also used to manage interrupt level context switches.
|
||||
*/
|
||||
|
||||
/* Mask and acknowledge the interrupt */
|
||||
DEBUGASSERT(current_regs == NULL);
|
||||
current_regs = regs;
|
||||
|
||||
up_maskack_irq(irq);
|
||||
/* Mask and acknowledge the interrupt */
|
||||
|
||||
/* Deliver the IRQ */
|
||||
up_maskack_irq(irq);
|
||||
|
||||
irq_dispatch(irq, regs);
|
||||
/* Deliver the IRQ */
|
||||
|
||||
/* Indicate that we are no long in an interrupt handler */
|
||||
irq_dispatch(irq, regs);
|
||||
|
||||
current_regs = NULL;
|
||||
/* Indicate that we are no long in an interrupt handler */
|
||||
|
||||
/* Unmask the last interrupt (global interrupts are still
|
||||
* disabled.
|
||||
*/
|
||||
current_regs = NULL;
|
||||
|
||||
up_enable_irq(irq);
|
||||
}
|
||||
up_ledoff(LED_INIRQ);
|
||||
/* Unmask the last interrupt (global interrupts are still disabled) */
|
||||
|
||||
up_enable_irq(irq);
|
||||
#endif
|
||||
up_ledoff(LED_INIRQ);
|
||||
}
|
||||
|
||||
@@ -72,42 +72,43 @@ uint32 *up_doirq(int irq, uint32 *regs)
|
||||
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
||||
PANIC(OSERR_ERREXCEPTION);
|
||||
#else
|
||||
if ((unsigned)irq < NR_IRQS)
|
||||
{
|
||||
/* Current regs non-zero indicates that we are processing
|
||||
* an interrupt; current_regs is also used to manage
|
||||
* interrupt level context switches.
|
||||
*/
|
||||
/* Nested interrupts are not supported in this implementation. If you want
|
||||
* implemented nested interrupts, you would have to (1) change the way that
|
||||
* current regs is handled and (2) the design associated with
|
||||
* CONFIG_ARCH_INTERRUPTSTACK.
|
||||
*/
|
||||
|
||||
current_regs = regs;
|
||||
/* Current regs non-zero indicates that we are processing an interrupt;
|
||||
* current_regs is also used to manage interrupt level context switches.
|
||||
*/
|
||||
|
||||
/* Mask and acknowledge the interrupt */
|
||||
DEBUGASSERT(current_regs == NULL);
|
||||
current_regs = regs;
|
||||
|
||||
up_maskack_irq(irq);
|
||||
/* Mask and acknowledge the interrupt */
|
||||
|
||||
/* Deliver the IRQ */
|
||||
up_maskack_irq(irq);
|
||||
|
||||
irq_dispatch(irq, regs);
|
||||
/* Deliver the IRQ */
|
||||
|
||||
/* If a context switch occurred while processing the interrupt
|
||||
* then current_regs may have change value. If we return any value
|
||||
* different from the input regs, then the lower level will know
|
||||
* that a context switch occurred during interrupt processing.
|
||||
*/
|
||||
irq_dispatch(irq, regs);
|
||||
|
||||
regs = current_regs;
|
||||
/* If a context switch occurred while processing the interrupt then
|
||||
* current_regs may have change value. If we return any value different
|
||||
* from the input regs, then the lower level will know that a context
|
||||
* switch occurred during interrupt processing.
|
||||
*/
|
||||
|
||||
/* Indicate that we are no long in an interrupt handler */
|
||||
regs = current_regs;
|
||||
|
||||
current_regs = NULL;
|
||||
/* Indicate that we are no long in an interrupt handler */
|
||||
|
||||
/* Unmask the last interrupt (global interrupts are still
|
||||
* disabled.
|
||||
*/
|
||||
current_regs = NULL;
|
||||
|
||||
up_enable_irq(irq);
|
||||
}
|
||||
up_ledoff(LED_INIRQ);
|
||||
/* Unmask the last interrupt (global interrupts are still disabled) */
|
||||
|
||||
up_enable_irq(irq);
|
||||
#endif
|
||||
up_ledoff(LED_INIRQ);
|
||||
return regs;
|
||||
}
|
||||
|
||||
@@ -43,17 +43,27 @@
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "lm3s_memorymap.h" /* Memory map */
|
||||
#include "lm3s_syscontrol.h" /* System control module */
|
||||
#include "lm3s_gpio.h" /* GPIO module */
|
||||
#include "lm3s_uart.h" /* UART peripherals */
|
||||
#include "lm3s_ethernet.h" /* Ethernet MAC and PHY */
|
||||
#include "lm3s_flash.h" /* FLASH */
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Get customizations for each supported chip (only the LM3S6918 right now) */
|
||||
|
||||
#ifdef CONFIG_ARCH_CHIP_LM3S6918
|
||||
# define LMS_NETHCONTROLLERS 1 /* One ethenet controller */
|
||||
#else
|
||||
# error "No Ethernet support for this LM3S chip"
|
||||
#endif
|
||||
|
||||
/* Then get all of the register definitions */
|
||||
|
||||
#include "lm3s_memorymap.h" /* Memory map */
|
||||
#include "lm3s_syscontrol.h" /* System control module */
|
||||
#include "lm3s_gpio.h" /* GPIO module */
|
||||
#include "lm3s_uart.h" /* UART peripherals */
|
||||
#include "lm3s_ethernet.h" /* Ethernet MAC and PHY */
|
||||
#include "lm3s_flash.h" /* FLASH */
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -44,8 +44,7 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "lm3s_memorymap.h"
|
||||
#include "lm3s_gpio.h"
|
||||
#include "chip.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
@@ -290,6 +289,29 @@ EXTERN boolean lm3s_gpioread(uint32 pinset, boolean value);
|
||||
|
||||
EXTERN int weak_function gpio_irqinitialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Function: lm3s_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the Ethernet driver for one interface. If the LM3S chip
|
||||
* supports multiple Ethernet controllers, then bould specific logic
|
||||
* must implement up_netinitialize() and call this function to initialize
|
||||
* the desiresed interfaces.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* OK on success; Negated errno on failure.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if LMS_NETHCONTROLLERS > 1
|
||||
EXTERN int lm3s_initialize(int intf);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
||||
@@ -1179,7 +1179,7 @@ static int ez80emac_receive(struct ez80emac_driver_s *priv)
|
||||
EMAC_STAT(priv, rx_packets);
|
||||
|
||||
/* Skip over bad packers */
|
||||
|
||||
|
||||
if ((rxdesc->stat & EMAC_RXDESC_OK) == 0)
|
||||
{
|
||||
nvdbg("Skipping bad RX pkt: %04x\n", rxdesc->stat);
|
||||
@@ -1381,7 +1381,7 @@ static int ez80emac_txinterrupt(int irq, FAR void *context)
|
||||
if (!priv->txhead)
|
||||
{
|
||||
nvdbg("No pending Tx.. Stopping XMIT function.\n");
|
||||
|
||||
|
||||
/* Stop the Tx poll timer. (It will get restarted when we have
|
||||
* something to send
|
||||
*/
|
||||
@@ -1406,7 +1406,7 @@ static int ez80emac_txinterrupt(int irq, FAR void *context)
|
||||
|
||||
wd_cancel(priv->txtimeout);
|
||||
}
|
||||
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,21 @@
|
||||
README
|
||||
^^^^^^
|
||||
|
||||
References:
|
||||
^^^^^^^^^^
|
||||
|
||||
Micromint: http://www.micromint.com/
|
||||
Luminary: http://www.luminarymicro.com/
|
||||
|
||||
Development Environment
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Either Linux or Cygwin on Windows can be used for the development environment.
|
||||
The source has been built only using the GNU toolchain (see below). Other
|
||||
toolchains will likely cause problems. Testing was performed using the Cygwin
|
||||
environment because the Luminary FLASH programming application was used for
|
||||
writing to FLASH and this application works only under Windows.
|
||||
|
||||
Toolchain
|
||||
^^^^^^^^^
|
||||
|
||||
@@ -43,8 +58,10 @@ Ethernet-Bootloader
|
||||
Here are some notes about using the Luminary Ethernet boot-loader built
|
||||
into the Eagle-100 board.
|
||||
|
||||
Built-In Application:
|
||||
|
||||
- The board has no fixed IP address but uses DHCP to get an address.
|
||||
I use a D-link router; I can use a web browser to surf to the D-link
|
||||
I used a D-link router; I can use a web browser to surf to the D-link
|
||||
web page to get the address assigned by
|
||||
|
||||
- Then you can use this IP address in your browser to surf to the Eagle-100
|
||||
@@ -52,15 +69,22 @@ Ethernet-Bootloader
|
||||
the page called "Firmware Update". That page includes instructions on
|
||||
how to download code to the Eagle-100.
|
||||
|
||||
- After you burn the first program, you lose this application. Then you
|
||||
will probably be better off connected directly to the Eagle-100 board
|
||||
or through a switch (The router caused problems for me during downloads).
|
||||
|
||||
Using the Ethernet Bootloader:
|
||||
|
||||
- You will need the "LM Flash Programmer application". You can get that
|
||||
program from the Luminary web site. There is a link on the LM3S6918 page.
|
||||
|
||||
- Is there any documentation for using the bootloader? Yes and No: There
|
||||
is an application note covering the bootloader on the Luminary site, but
|
||||
it is not very informative.
|
||||
it is not very informative. The Eagle100 User's Manual has the best
|
||||
information.
|
||||
|
||||
- Are there any special things I have to do in my code, other than setting
|
||||
the origin to 0x0000:2000 (APP_START_ADDRESS)? No. The bootload assumes
|
||||
the origin to 0x0000:2000 (APP_START_ADDRESS)? No. The bootloader assumes
|
||||
that you have a vector table at that address . The bootloader does the
|
||||
following each time it boots (after you have downloaded the first valid
|
||||
application):
|
||||
@@ -75,6 +99,16 @@ Ethernet-Bootloader
|
||||
Eagle-100 board while resetting the board. The user button is GPIOA, pin 6
|
||||
(call FORCED_UPDATE_PIN in the bootloader code).
|
||||
|
||||
- Note 1: I had to remove my D-Link router from the configuration in order
|
||||
to use the LM Flash Programmer (the Bootloader issues BOOTP requests to
|
||||
communicate with the LM Flash Programmer, my router was responding to
|
||||
these BOOTP requests and hosing the download). It is safer to connect
|
||||
via a switch or via an Ethernet switch.
|
||||
|
||||
- Note 2: You don't need the router's DHCPD server in the download
|
||||
configuration; the Luminary Flash Programmer has the capability of
|
||||
temporarily assigning the IP address to the Eagle-100 via BOOTP.
|
||||
|
||||
Eagle100-specific Configuration Options
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -185,8 +219,23 @@ can be selected as follow:
|
||||
|
||||
Where <subdir> is one of the following:
|
||||
|
||||
nettest
|
||||
^^^^^^^
|
||||
|
||||
This configuration directory may be used to enable networking using the
|
||||
LM3S6918's Ethernet controller. It uses examples/nettest to excercise the
|
||||
TCP/IP network.
|
||||
|
||||
nsh
|
||||
^^^
|
||||
|
||||
Configures the NuttShell (nsh) located at examples/nsh. The
|
||||
Configuration enables both the serial and telnetd NSH interfaces.
|
||||
|
||||
ostest
|
||||
^^^^^^
|
||||
|
||||
This configuration directory, performs a simple OS test using
|
||||
examples/ostest.
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user