14.07.2013 Views

Ethernet and the NicheStack TCP/IP Stack - Nios II Edition ... - Altera

Ethernet and the NicheStack TCP/IP Stack - Nios II Edition ... - Altera

Ethernet and the NicheStack TCP/IP Stack - Nios II Edition ... - Altera

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 11: <strong>E<strong>the</strong>rnet</strong> <strong>and</strong> <strong>the</strong> <strong>Niche<strong>Stack</strong></strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Stack</strong> - <strong>Nios</strong> <strong>II</strong> <strong>Edition</strong> 11–3<br />

O<strong>the</strong>r <strong>TCP</strong>/<strong>IP</strong> <strong>Stack</strong> Providers for <strong>the</strong> <strong>Nios</strong> <strong>II</strong> Processor<br />

The <strong>Niche<strong>Stack</strong></strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Stack</strong> Files <strong>and</strong> Directories<br />

You need not edit <strong>the</strong> <strong>Niche<strong>Stack</strong></strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Stack</strong> source code to use <strong>the</strong> stack in a<br />

<strong>Nios</strong> <strong>II</strong> C/C++ program. None<strong>the</strong>less, <strong>Altera</strong> provides <strong>the</strong> source code for your<br />

reference. By default <strong>the</strong> files are installed with <strong>the</strong> <strong>Nios</strong> <strong>II</strong> EDS in <strong>the</strong><br />

/components/altera_iniche/UCOS<strong>II</strong> directory. For <strong>the</strong> sake<br />

of brevity, this chapter refers to this directory as .<br />

Under , <strong>the</strong> original code is maintained—as much as possible—under <strong>the</strong><br />

/src/downloads directory. This organization facilitates upgrading to<br />

more recent versions of <strong>the</strong> <strong>Niche<strong>Stack</strong></strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Stack</strong>. The /src/<br />

downloads/packages directory contains <strong>the</strong> original <strong>Niche<strong>Stack</strong></strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Stack</strong> source<br />

code <strong>and</strong> documentation; <strong>the</strong> /src/downloads/30src directory contains<br />

code specific to <strong>the</strong> <strong>Nios</strong> <strong>II</strong> implementation of <strong>the</strong> <strong>Niche<strong>Stack</strong></strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Stack</strong>, including<br />

source code supporting MicroC/OS-<strong>II</strong>.<br />

f The reference manual for <strong>the</strong> <strong>Niche<strong>Stack</strong></strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Stack</strong> is available on <strong>the</strong> Literature:<br />

<strong>Nios</strong> <strong>II</strong> Processor page of <strong>the</strong> <strong>Altera</strong> website, under O<strong>the</strong>r Related Documentation.<br />

Licensing<br />

<strong>Altera</strong>’s implementation of <strong>the</strong> <strong>Niche<strong>Stack</strong></strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Stack</strong> is based on version 3.1 of <strong>the</strong><br />

protocol stack, with wrappers around <strong>the</strong> code to integrate it with <strong>the</strong> HAL.<br />

The <strong>Niche<strong>Stack</strong></strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Stack</strong> is a <strong>TCP</strong>/<strong>IP</strong> protocol stack created by InterNiche<br />

Technologies, Inc. You can license <strong>the</strong> <strong>Niche<strong>Stack</strong></strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Stack</strong> from <strong>Altera</strong> by going<br />

to <strong>the</strong> <strong>Altera</strong> website.<br />

f You can license o<strong>the</strong>r protocol stacks directly from InterNiche. You can obtain details<br />

from InterNiche Technologies, Inc. (www.interniche.com)<br />

O<strong>the</strong>r <strong>TCP</strong>/<strong>IP</strong> <strong>Stack</strong> Providers for <strong>the</strong> <strong>Nios</strong> <strong>II</strong> Processor<br />

O<strong>the</strong>r third party vendors also provide <strong>E<strong>the</strong>rnet</strong> support for <strong>the</strong> <strong>Nios</strong> <strong>II</strong> processor.<br />

Notably, third party RTOS vendors often offer <strong>E<strong>the</strong>rnet</strong> modules for <strong>the</strong>ir particular<br />

RTOS frameworks.<br />

f For up-to-date information about products available from third party providers, visit<br />

<strong>the</strong> Embedded Software page of <strong>the</strong> <strong>Altera</strong> website.<br />

Using <strong>the</strong> <strong>Niche<strong>Stack</strong></strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Stack</strong> - <strong>Nios</strong> <strong>II</strong> <strong>Edition</strong><br />

This section discusses how to include <strong>the</strong> <strong>Niche<strong>Stack</strong></strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Stack</strong> in a <strong>Nios</strong> <strong>II</strong><br />

program.<br />

The primary interface to <strong>the</strong> <strong>Niche<strong>Stack</strong></strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Stack</strong> is <strong>the</strong> st<strong>and</strong>ard sockets<br />

interface. In addition, you call <strong>the</strong> following functions to initialize <strong>the</strong> stack <strong>and</strong><br />

drivers:<br />

■ alt_iniche_init()<br />

■ netmain()<br />

You also use <strong>the</strong> global variable iniche_net_ready in <strong>the</strong> initialization process.<br />

May 2011 <strong>Altera</strong> Corporation <strong>Nios</strong> <strong>II</strong> Software Developer’s H<strong>and</strong>book

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!