— eCos Support for Nios II Triple-Speed Ethernet Devices
A Nios II hardware design can include one or more triple speed
ethernet devices or TSEs. The package
CYGPKG_DEVS_ETH_NIOS2_TSE provides an eCos driver
for a single TSE device. It supports both polled mode for use by
RedBoot and interrupt-driven mode for use by a full TCP/IP stack.
The Nios II TSE driver package should be loaded automatically when
creating an eCos configuration for a hardware design which includes
the required devices, and it should never be necessary to load the
package explicitly. If the application does not actually require
ethernet functionality then the package is inactive and the final
executable will not suffer any overheads from unused functionality.
This is determined by the presence of the generic ethernet I/O package
CYGPKG_IO_ETH_DRIVERS. Typically the choice of eCos
template causes the right thing to happen. For example the default
template does not include any TCP/IP stack so
CYGPKG_IO_ETH_DRIVERS is not included, but both the
net and redboot templates do include a TCP/IP stack so will specify
that package and hence enable the ethernet driver.
The driver package will only instantiate the support for a single TSE
device. If the hardware design involves multiple TSE devices then
support for the additional ones can be instantiated by application
code. This can be achieved largely by cloning file
src/tse0.c in this package.
There are two configuration options related to the device
the device name, defaulting to “eth0”. Typically this only
needs to be changed if the hardware design includes other types of
ethernet device and their drivers also attempt to create a device
CYGDAT_DEVS_ETH_NIOS2_TSE_ETH0_MAC specifies the
fallback ethernet station address or MAC address. In typical eCos
systems the MAC address is provided via a RedBoot fconfig option,
allowing each board to have its own address. However if the fconfig
functionality is unavailable, for example when debugging via jtag,
then the fallback address will be used instead. Note that each board
on a network must have a unique MAC address, so if there are several
boards on the network using the fallback address and the same eCos
configuration then network communication can be expected to fail.
Applications can also change the MAC address at run-time using
ioctl should not be used when debugging over
ethernet because it will break the debug channel.
Each triple speed ethernet device requires three units in the hardware design: the tse_mac unit itself, and sgdma_rx and sgdma_tx scatter-gather DMA controllers. Typically the hardware design will also include a bank of on-chip RAM to hold the DMA descriptors. The settings for these units are best cloned from a reference hardware design such as the TSE_SGDMA examples in the Nios II Embedded Design Suite, or the eCosPro_TSEplus design. The h/w design HAL package should provide address and interrupt vector definitions for the various units.
|2018-06-19||eCosPro Non-Commercial Public License|