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



Similar documents
1. Overview of Nios II Embedded Development

1. Overview of Nios II Embedded Development

8. Exception Handling

2. Developing Nios II Software

Section II. Hardware Abstraction Layer

Nios II Software Developer s Handbook

2. Getting Started with the Graphical User Interface

Using the NicheStack TCP/IP Stack - Nios II Edition Tutorial

13. Publishing Component Information to Embedded Software

8. Hardware Acceleration and Coprocessing

8. MicroC/OS-II Real-Time Operating System

A. Using the Nios II Integrated Development Environment

!!! Technical Notes : The One-click Installation & The AXIS Internet Dynamic DNS Service. Table of contents

7. Mentor Graphics PCB Design Tools Support

Nios II Classic Software Developer s Handbook

December 2002, ver. 1.0 Application Note 285. This document describes the Excalibur web server demonstration design and includes the following topics:

Applying the Benefits of Network on a Chip Architecture to FPGA System Design

FIXED INCOME ATTRIBUTION

Application Note: AN00121 Using XMOS TCP/IP Library for UDP-based Networking

Remote Configuration Over Ethernet with the Nios II Processor

Embedded Network Firewall on FPGA

Using Altera MAX Series as Microcontroller I/O Expanders

A performance analysis of EtherCAT and PROFINET IRT

VOIP Project: System Design

Troubleshooting Tools

Nios II-Based Intellectual Property Camera Design

PROFINET IRT: Getting Started with The Siemens CPU 315 PLC

10/100/1000Mbps Ethernet MAC with Protocol Acceleration MAC-NET Core with Avalon Interface

Guidelines for Developing a Nios II HAL Device Driver

Data Transfer between Serial Link and TCP/IP Link Using ez80f91 MCU

Quartus II Software Download and Installation Quick Start Guide

AN833. The Microchip TCP/IP Stack INTRODUCTION STACK ARCHITECTURE REFERENCE MODEL

Understanding TCP/IP. Introduction. What is an Architectural Model? APPENDIX

Session NM059. TCP/IP Programming on VMS. Geoff Bryant Process Software

Transport and Network Layer

ModelSim-Altera Software Simulation User Guide

1. Cyclone III Device Family Overview

1. Cyclone IV FPGA Device Family Overview

Using the On-Chip Signal Quality Monitoring Circuitry (EyeQ) Feature in Stratix IV Transceivers

Internetworking Microsoft TCP/IP on Microsoft Windows NT 4.0

Network-Oriented Software Development. Course: CSc4360/CSc6360 Instructor: Dr. Beyah Sessions: M-W, 3:00 4:40pm Lecture 2

Using Nios II Floating-Point Custom Instructions Tutorial

Interfacing an HTML Form to the ez80f91 MCU

LPC2300/LPC2400 TCP/IP Overview. TCP/IP and LPC2300/LPC2400 Family October 2007

Network Programming TDC 561

Linux Driver Devices. Why, When, Which, How?

Digitale Signalverarbeitung mit FPGA (DSF) Soft Core Prozessor NIOS II Stand Mai Jens Onno Krah

Ethernet. Ethernet. Network Devices

Altera SoC Embedded Design Suite User Guide

RARP: Reverse Address Resolution Protocol

CGI-based applications for distributed embedded systems for monitoring temperature and humidity

Procedure: You can find the problem sheet on Drive D: of the lab PCs. 1. IP address for this host computer 2. Subnet mask 3. Default gateway address

Networking Test 4 Study Guide

USB-Blaster Download Cable User Guide

AT12181: ATWINC1500 Wi-Fi Network Controller - AP Provision Mode. Introduction. Features. Atmel SmartConnect APPLICATION NOTE

ACHILLES CERTIFICATION. SIS Module SLS 1508

IP Network Layer. Datagram ID FLAG Fragment Offset. IP Datagrams. IP Addresses. IP Addresses. CSCE 515: Computer Network Programming TCP/IP

Transport Layer Protocols

S12XE IPLL Calculator

Performance Analysis and Software Optimization on Systems Using the LAN91C111

Internet Control Protocols Reading: Chapter 3

Using the Agilent 3070 Tester for In-System Programming in Altera CPLDs

MANAGING NETWORK COMPONENTS USING SNMP

Nios II Development Kit Version 5.1 SP1 Release Notes

Traffic monitoring with sflow and ProCurve Manager Plus

AN 589: Using the Design Security Feature in Cyclone III LS Devices

ECE487/587 Embedded Systems Laboratory Lab 3: Multiple Device Input/Output Programming

HP OpenFlow Switches. Abstract

Final for ECE374 05/06/13 Solution!!

Unix System Administration

Operating System Manual. Realtime Communication System for netx. Kernel API Function Reference.

Course Overview: Learn the essential skills needed to set up, configure, support, and troubleshoot your TCP/IP-based network.

IPv6 Challenges for Embedded Systems István Gyürki

REAL TIME OPERATING SYSTEM PROGRAMMING-II: II: Windows CE, OSEK and Real time Linux. Lesson-12: Real Time Linux

15. Introduction to ALTMEMPHY IP

TCP Performance Management for Dummies

PRODUCTIVITY ESTIMATION OF UNIX OPERATING SYSTEM

IP Addressing A Simplified Tutorial

The Lagopus SDN Software Switch. 3.1 SDN and OpenFlow. 3. Cloud Computing Technology

File Transfer Protocol (FTP) User Guide Express Logic, Inc.

IP Routing Features. Contents

Using the TASKING Software Platform for AURIX

BASIC ANALYSIS OF TCP/IP NETWORKS

Command Manual - Network Protocol Quidway S3000 Series Ethernet Switches. Table of Contents

How do I get to

HOST AUTO CONFIGURATION (BOOTP, DHCP)

CONNECTING WINDOWS XP PROFESSIONAL TO A NETWORK

H0/H2/H4 -ECOM100 DHCP & HTML Configuration. H0/H2/H4--ECOM100 DHCP Disabling DHCP and Assigning a Static IP Address Using HTML Configuration

Subnetting,Supernetting, VLSM & CIDR

Solving complex performance problems in TCP/IP and SNA environments.

10/100/1000 Ethernet MAC with Protocol Acceleration MAC-NET Core

A Dell Technical White Paper Dell PowerConnect Team

Network Protocol Configuration

Hands On Activities: TCP/IP Network Monitoring and Management

(12) United States Patent (10) Patent N0.2 US 8,566,608 B2 Pemmaraju (45) Date of Patent: Oct. 22, 2013

3.5. cmsg Developer s Guide. Data Acquisition Group JEFFERSON LAB. Version

Objectives of Lecture. Network Architecture. Protocols. Contents

Windows Sockets Network Programming

Operating Systems Design 16. Networking: Sockets

Chapter 11. User Datagram Protocol (UDP)

Transcription:

February 2011 NII52013-10.1.0 11. Ethernet and the NicheStack TCP/IP Stack - Nios II Edition NII52013-10.1.0 Overview The NicheStack TCP/IP Stack - Nios II Edition is a small-ootprint implementation o the TCP/IP suite. The ocus o the NicheStack TCP/IP Stack implementation is to reduce resource usage while providing a ull-eatured TCP/IP stack. The NicheStack TCP/IP Stack is designed or use in embedded systems with small memory ootprints, making it suitable or Nios II processor systems. Altera provides the NicheStack TCP/IP Stack as a sotware package that you can add to your board support package (BSP), available through the Nios II Sotware Build Tools (SBT). The NicheStack TCP/IP Stack includes these eatures: Internet Protocol (IP) including packet orwarding over multiple network interaces Internet control message protocol (ICMP) or network maintenance and debugging User datagram protocol (UDP) Transmission Control Protocol (TCP) with congestion control, round trip time (RTT) estimation, and ast recovery and retransmit Dynamic host coniguration protocol (DHCP) Address resolution protocol (ARP) or Ethernet Standard sockets application program interace (API) This chapter discusses the details o how to use the NicheStack TCP/IP Stack or the Nios II processor only. This chapter contains the ollowing sections: Prerequisites on page 11 2 Introduction on page 11 2 Other TCP/IP Stack Providers on page 11 3 Using the NicheStack TCP/IP Stack on page 11 3 Coniguring the NicheStack TCP/IP Stack in a Nios II Program on page 11 9 Further Inormation on page 11 10 Known Limitations on page 11 10 2011 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, HARDCOPY, MAX, MEGACORE, NIOS, QUARTUS and STRATIX are Reg. U.S. Pat. & Tm. O. and/or trademarks o Altera Corporation in the U.S. and other countries. All other trademarks and service marks are the property o their respective holders as described at www.altera.com/common/legal.html. Altera warrants perormance o its semiconductor products to current speciications in accordance with Altera s standard warranty, but reserves the right to make changes to any products and services at any time without notice. Altera assumes no responsibility or liability arising out o the application or use o any inormation, product, or service described herein except as expressly agreed to in writing by Altera. Altera customers are advised to obtain the latest version o device speciications beore relying on any published inormation and beore placing orders or products or services. Nios II Sotware Developer s Handbook February 2011 Subscribe

11 2 Chapter 11: Ethernet and the NicheStack TCP/IP Stack - Nios II Edition Prerequisites Prerequisites To make the best use o inormation in this chapter, you should be amiliar with these topics: Sockets. Several books are available on the topic o programming with sockets. Two good texts are Unix Network Programming by Richard Stevens and Internetworking with TCP/IP Volume 3 by Douglas Comer. The Nios II Embedded Design Suite (EDS). Reer to the Overview chapter o the Nios II Sotware Developer s Handbook or more inormation about the Nios II EDS. The MicroC/OS-II RTOS. To learn about MicroC/OS-II, reer to the MicroC/OS-II Real-Time Operating System chapter o the Nios II Sotware Developer s Handbook, or to the Using MicroC/OS-II RTOS with the Nios II Processor Tutorial. Introduction Altera provides the Nios II implementation o the NicheStack TCP/IP Stack, including source code, in the Nios II EDS. The NicheStack TCP/IP Stack provides you with immediate access to a stack or Ethernet connectivity or the Nios II processor. Altera s implementation o the NicheStack TCP/IP Stack includes an API wrapper, providing the standard, well documented socket API. The NicheStack TCP/IP Stack uses the MicroC/OS-II RTOS multithreaded environment. Thereore, to use the NicheStack TCP/IP Stack with the Nios II EDS, you must base your C/C++ project on the MicroC/OS-II RTOS. The Nios II processor system must also contain an Ethernet interace, or media access control (MAC). The Altera-provided NicheStack TCP/IP Stack includes driver support or the ollowing two MACs: The SMSC lan91c111 device The Altera Triple Speed Ethernet MegaCore unction The Nios II Embedded Design Suite includes hardware or both MACs. The NicheStack TCP/IP Stack driver is interrupt-based, so you must ensure that interrupts or the Ethernet component are connected. Altera s implementation o the NicheStack TCP/IP Stack is based on the hardware abstraction layer (HAL) generic Ethernet device model. In the generic device model, you can write a new driver to support any target Ethernet MAC, and maintain the consistent HAL and sockets API to access the hardware. For details about writing an Ethernet device driver, reer to the Developing Device Drivers or the Hardware Abstraction Layer chapter o the Nios II Sotware Developer s Handbook. Nios II Sotware Developer s Handbook February 2011 Altera Corporation

Chapter 11: Ethernet and the NicheStack TCP/IP Stack - Nios II Edition 11 3 Other TCP/IP Stack Providers The NicheStack TCP/IP Stack Files and Directories You need not edit the NicheStack TCP/IP Stack source code to use the stack in a Nios II C/C++ program. Nonetheless, Altera provides the source code or your reerence. By deault the iles are installed with the Nios II EDS in the <Nios II EDS install path>/components/altera_iniche/ucosii directory. For the sake o brevity, this chapter reers to this directory as <iniche path>. Under <iniche path>, the original code is maintained as much as possible under the <iniche path>/src/downloads directory. This organization acilitates upgrading to more recent versions o the NicheStack TCP/IP Stack. The <iniche path>/src/ downloads/packages directory contains the original NicheStack TCP/IP Stack source code and documentation; the <iniche path>/src/downloads/30src directory contains code speciic to the Nios II implementation o the NicheStack TCP/IP Stack, including source code supporting MicroC/OS-II. The reerence manual or the NicheStack TCP/IP Stack is available on the Literature: Nios II Processor page o the Altera website, under Other Related Documentation. Licensing Altera s implementation o the NicheStack TCP/IP Stack is based on version 3.1 o the protocol stack, with wrappers around the code to integrate it with the HAL. The NicheStack TCP/IP Stack is a TCP/IP protocol stack created by InterNiche Technologies, Inc. You can license the NicheStack TCP/IP Stack rom Altera by going to the Altera website. You can license other protocol stacks directly rom InterNiche. You can obtain details rom InterNiche Technologies, Inc. (www.interniche.com) Other TCP/IP Stack Providers Other third party vendors also provide Ethernet support or the Nios II processor. Notably, third party RTOS vendors oten oer Ethernet modules or their particular RTOS rameworks. For up-to-date inormation about products available rom third party providers, visit the Embedded Sotware page o the Altera website. Using the NicheStack TCP/IP Stack This section discusses how to include the NicheStack TCP/IP Stack in a Nios II program. The primary interace to the NicheStack TCP/IP Stack is the standard sockets interace. In addition, you call the ollowing unctions to initialize the stack and drivers: alt_iniche_init() netmain() You also use the global variable iniche_net_ready in the initialization process. February 2011 Altera Corporation Nios II Sotware Developer s Handbook

11 4 Chapter 11: Ethernet and the NicheStack TCP/IP Stack - Nios II Edition Using the NicheStack TCP/IP Stack You must provide the ollowing simple unctions, which the HAL system code calls to obtain the MAC address and IP address: get_mac_addr() get_ip_addr() Nios II System Requirements To use the NicheStack TCP/IP Stack, your Nios II system must meet the ollowing requirements: The system hardware generated in SOPC Builder must include an Ethernet interace with interrupts enabled. The BSP must be based on MicroC/OS-II. The MicroC/OS-II RTOS must be conigured to have the ollowing settings: TimeManagement / OSTimeTickHook must be enabled. Maximum Number o Tasks must be 4 or higher. The system clock timer must be set to point to an appropriate timer device. The NicheStack TCP/IP Stack Tasks The NicheStack TCP/IP Stack, in its standard Nios II coniguration, consists o two undamental tasks. Each o these tasks consumes a MicroC/OS-II thread resource, along with some memory or the thread s stack. In addition to the tasks your program creates, the ollowing tasks run continuously: The NicheStack main task, tk_netmain() Ater initialization, this task sleeps until a new packet is available or processing. Packets are received by an interrupt service routine (ISR). When the ISR receives a packet, it places it in the receive queue, and wakes up the main task. The NicheStack tick task, tk_nettick() This task wakes up periodically to monitor or time-out conditions. These tasks are started when the initialization process succeeds in the netmain() unction, as described in netmain(). 1 You can modiy the task priority and stack sizes using #deine statements in the coniguration ile ipport.h. You can create additional system tasks by enabling other options in the NicheStack TCP/IP Stack by editing ipport.h. Initializing the Stack Beore you initialize the stack, start the MicroC/OS-II scheduler by calling OSStart() rom main(). Perorm stack initialization in a high priority task, to ensure that the your code does not attempt urther initialization until the RTOS is running and I/O drivers are available. To initialize the stack, call the unctions alt_iniche_init() and netmain(). Global variable iniche_net_ready is set true when stack initialization is complete. Nios II Sotware Developer s Handbook February 2011 Altera Corporation

Chapter 11: Ethernet and the NicheStack TCP/IP Stack - Nios II Edition 11 5 Using the NicheStack TCP/IP Stack 1 Ensure that your code does not use the sockets interace beore iniche_net_ready is set to true. For example, call alt_iniche_init() and netmain() rom the highest priority task, and wait or iniche_net_ready beore allowing other tasks to run, as shown in Example 11 1. alt_iniche_init() alt_iniche_init() initializes the stack or use with the MicroC/OS-II operating system. The prototype or alt_iniche_init() is: void alt_iniche_init(void) alt_iniche_init() returns nothing and has no parameters. netmain() netmain() is responsible or initializing and launching the NicheStack tasks. The prototype or netmain() is: void netmain(void) netmain() returns nothing and has no parameters. iniche_net_ready When the NicheStack stack has completed initialization, it sets the global variable iniche_net_ready to a non-zero value. 1 Do not call any NicheStack API unctions (other than or initialization) until iniche_net_ready is true. Example 11 1 illustrates the use o iniche_net_ready to wait until the network stack has completed initialization. Example 11 1. Instantiating the NicheStack TCP/IP Stack void SSSInitialTask(void *task_data) { INT8U error_code; } alt_iniche_init(); netmain(); while (!iniche_net_ready) TK_SLEEP(1); /* Now that the stack is running, perorm the application initialization steps */... Macro TK_SLEEP() is part o the NicheStack TCP/IP Stack operating system (OS) porting layer. February 2011 Altera Corporation Nios II Sotware Developer s Handbook

11 6 Chapter 11: Ethernet and the NicheStack TCP/IP Stack - Nios II Edition Using the NicheStack TCP/IP Stack get_mac_addr() and get_ip_addr() The NicheStack TCP/IP Stack system code calls get_mac_addr() and get_ip_addr() during the device initialization process. These unctions are necessary or the system code to set the MAC and IP addresses or the network interace, which you select with the altera_iniche.iniche_deault_i BSP setting. Because you write these unctions yoursel, your system has the lexibility to store the MAC address and IP address in an arbitrary location, rather than a ixed location hard-coded in the device driver. For example, some systems might store the MAC address in lash memory, while others might have the MAC address in on-chip embedded memory. Both unctions take as parameters device structures used internally by the NicheStack TCP/IP Stack. However, you do not need to know the details o the structures. You only need to know enough to ill in the MAC and IP addresses. The prototype or get_mac_addr() is: int get_mac_addr(net net, unsigned char mac_addr[6]); You must implement the get_mac_addr() unction to assign the MAC address to the mac_addr argument. Leave the net argument untouched. The prototype or get_mac_addr() is in the header ile <iniche path>/inc/ alt_iniche_dev.h. The NET structure is deined in the <iniche path>/src/downloads/ 30src/h/net.h ile. Example 11 2 shows an implementation o get_mac_addr(). For demonstration purposes only, the MAC address is stored at address CUSTOM_MAC_ADDR in this example. There is no error checking in this example. In a real application, i there is an error, get_mac_addr() must return -1. Example 11 2. An Implementation o get_mac_addr() #include <alt_iniche_dev.h> #include "includes.h" #include "ipport.h" #include "tcpport.h" #include <io.h> int get_mac_addr(net net, unsigned char mac_addr[6]) { int ret_code = -1; /* Read the 6-byte MAC address rom wherever it is stored */ mac_addr[0] = IORD_8DIRECT(CUSTOM_MAC_ADDR, 4); mac_addr[1] = IORD_8DIRECT(CUSTOM_MAC_ADDR, 5); mac_addr[2] = IORD_8DIRECT(CUSTOM_MAC_ADDR, 6); mac_addr[3] = IORD_8DIRECT(CUSTOM_MAC_ADDR, 7); mac_addr[4] = IORD_8DIRECT(CUSTOM_MAC_ADDR, 8); mac_addr[5] = IORD_8DIRECT(CUSTOM_MAC_ADDR, 9); ret_code = ERR_OK; return ret_code; } Nios II Sotware Developer s Handbook February 2011 Altera Corporation

Chapter 11: Ethernet and the NicheStack TCP/IP Stack - Nios II Edition 11 7 Using the NicheStack TCP/IP Stack You must write the unction get_ip_addr() to assign the IP address o the protocol stack. Your program can either assign a static address, or request the DHCP to ind an IP address. The unction prototype or get_ip_addr() is: int get_ip_addr(alt_iniche_dev* p_dev, ip_addr* ipaddr, ip_addr* netmask, ip_addr* gw, int* use_dhcp); get_ip_addr() sets the return parameters as ollows: IP4_ADDR(&ipaddr, IPADDR0,IPADDR1,IPADDR2,IPADDR3); IP4_ADDR(&gw, GWADDR0,GWADDR1,GWADDR2,GWADDR3); IP4_ADDR(&netmask, MSKADDR0,MSKADDR1,MSKADDR2,MSKADDR3); For the dummy variables IP_ADDR0-3, substitute expressions or bytes 0-3 o the IP address. For GWADDR0-3, substitute the bytes o the gateway address. For MSKADDR0-3, substitute the bytes o the network mask. For example, the ollowing statement sets ip_addr to IP address 137.57.136.2: IP4_ADDR ( ip_addr, 137, 57, 136, 2 ); To enable DHCP, include the line: *use_dhcp = 1; The NicheStack TCP/IP stack attempts to get an IP address rom the server. I the server does not provide an IP address within 30 seconds, the stack times out and uses the deault settings speciied in the IP4_ADDR() unction calls. To assign a static IP address, include the lines: *use_dhcp = 0; The prototype or get_ip_addr() is in the header ile <iniche path>/inc/ alt_iniche_dev.h. Example 11 3 shows an implementation o get_ip_addr() and shows a list o the necessary include iles. 1 There is no error checking in Example 11 3. In a real application, you might need to return -1 on error. INICHE_DEFAULT_IF, deined in system.h, identiies the network interace that you deined in SOPC Builder. You can control INICHE_DEFAULT_IF through the iniche_deault_i BSP setting. DHCP_CLIENT, also deined in system.h, speciies whether to use the DHCP client application to obtain an IP address. You can set or clear this property with the altera_iniche.dhcp_client setting. Calling the Sockets Interace Ater you initialize your Ethernet device, use the sockets API in the remainder o your program to access the IP stack. February 2011 Altera Corporation Nios II Sotware Developer s Handbook

11 8 Chapter 11: Ethernet and the NicheStack TCP/IP Stack - Nios II Edition Using the NicheStack TCP/IP Stack To create a new task that talks to the IP stack using the sockets API, you must use the unction TK_NEWTASK(). The TK_NEWTASK() unction is part o the NicheStack TCP/IP Stack operating system (OS) porting layer. TK_NEWTASK() calls the MicroC/OS-II OSTaskCreate() unction to create a thread, and perorms some other actions speciic to the NicheStack TCP/IP Stack. The prototype or TK_NEWTASK() is: int TK_NEWTASK(struct inet_task_ino* nettask); Example 11 3. An Implementation o get_ip_addr() #include <alt_iniche_dev.h> #include "includes.h" #include "ipport.h" #include "tcpport.h" int get_ip_addr(alt_iniche_dev* p_dev, ip_addr* ipaddr, ip_addr* netmask, ip_addr* gw, int* use_dhcp) { int ret_code = -1; /* * The name here is the device name deined in system.h */ i (!strcmp(p_dev->name, "/dev/" INICHE_DEFAULT_IF)) { /* The ollowing is the deault IP address i DHCP ails, or the static IP address i DHCP_CLIENT is undeined. */ IP4_ADDR(&ipaddr, 10, 1, 1,3); /* Assign the Deault Gateway Address */ IP4_ADDR(&gw, 10, 1, 1, 254); /* Assign the Netmask */ IP4_ADDR(&netmask, 255, 255, 255, 0); #ide DHCP_CLIENT *use_dhcp = 1; #else *use_dhcp = 0; #endi /* DHCP_CLIENT */ ret_code = ERR_OK; } return ret_code; } The prototype is deined in <iniche path>/src/downloads/30src/nios2/osport.h. You can include this header ile as ollows: #include "osport.h" You can ind other details o the OS porting layer in the osport.c ile in the NicheStack TCP/IP Stack component directory, <iniche path>/src/downloads/30src/nios2/. For more inormation about how to use TK_NEWTASK() in an application, reer to the Using the NicheStack TCP/IP Stack - Nios II Edition Tutorial. Nios II Sotware Developer s Handbook February 2011 Altera Corporation

Chapter 11: Ethernet and the NicheStack TCP/IP Stack - Nios II Edition 11 9 Coniguring the NicheStack TCP/IP Stack in a Nios II Program Coniguring the NicheStack TCP/IP Stack in a Nios II Program The NicheStack TCP/IP Stack has many options that you can conigure using #deine directives in the ile ipport.h. The Nios II EDS allows you to conigure certain options (that is, modiy the #deines in system.h) without editing source code. The most commonly accessed options are available through a set o BSP options, identiiable by the preix altera_iniche. For urther inormation about BSP settings or the NicheStack, reer to the Nios II Sotware Build Tools Reerence chapter o the Nios II Sotware Developer s Handbook. Some less-requently-used options are not accessible through the BSP settings. I you need to modiy these options, you must edit the ipport.h ile manually. You can ind ipport.h in the debug/system_description directory or your BSP project. The ollowing sections describe the eatures that you can conigure using the Nios II SBT. Both development lows provide a deault value or each eature. In general, these values provide a good starting point, and you can later ine-tune the values to meet the needs o your system. NicheStack TCP/IP Stack General Settings The ARP, UDP, and IP protocols are always enabled. Table 11 1 shows the protocol options. Table 11 1. Protocol Options TCP Option Enables and disables the TCP. Description Table 11 2 shows the global options, which aect the overall behavior o the TCP/IP stack. Table 11 2. Global Options Option Use DHCP to automatically assign IP address Enable statistics MAC interace Description I this option is turned on, the component uses DHCP to acquire an IP address. I this option is turned o, you must assign a static IP address. I this option is turned on, the stack keeps counters o packets received, errors, etc. The counters are deined in mib structures deined in various header iles in directory <iniche path>/src/downloads/30src/h. For details about mib structures, reer to the NicheStack documentation. I the IP stack has more than one network interace, this parameter indicates which interace to use. Reer to Known Limitations on page 11 10. February 2011 Altera Corporation Nios II Sotware Developer s Handbook

11 10 Chapter 11: Ethernet and the NicheStack TCP/IP Stack - Nios II Edition Further Inormation IP Options Table 11 3 shows the IP options. Table 11 3. IP Options Option Forward IP packets Reassemble IP packet ragments Description I there is more than one network interace, this option is turned on, and the IP stack or one interace receives packets that are not addressed to it, the stack orwards the packet out o the other interace. Reer to Known Limitations on page 11 10. I this option is turned on, the NicheStack TCP/IP Stack reassembles IP packet ragments as ull IP packets. Otherwise, it discards IP packet ragments. This topic is explained in Unix Network Programming by Richard Stevens. TCP Options Table 11 4 shows the TCP zero copy option, which is only available i the TCP option is turned on. Table 11 4. TCP Options Option Use TCP zero copy Description This option enables the NicheStack zero copy TCP API. This option allows you to eliminate buer-to-buer copies when using the NicheStack TCP/IP Stack. For details, reer to the NicheStack reerence manual. You must modiy your application code to take advantage o the zero copy API. Further Inormation For urther inormation about the Altera NicheStack implementation, reer to the Using the NicheStack TCP/IP Stack - Nios II Edition Tutorial. The tutorial provides in-depth inormation about the NicheStack TCP/IP Stack, and illustrates how to use it in a networking application. For details about NicheStack, reer to the NicheStack TCP/IP Stack reerence manual, available on the Literature: Nios II Processor page o the Altera website, under Other Related Documentation. Known Limitations Although the NicheStack code contains eatures intended to support multiple network interaces, these eatures are not tested in the Nios II edition. Reer to the NicheStack TCP/IP Stack reerence manual and source code or inormation about multiple network interace support. Nios II Sotware Developer s Handbook February 2011 Altera Corporation

Chapter 11: Ethernet and the NicheStack TCP/IP Stack - Nios II Edition 11 11 Document Revision History Document Revision History Table 11 5. Document Revision History Table 11 5 shows the revision history or this document. Date Version Changes February 2011 10.1.0 Removed Reerenced Documents section. July 2010 10.0.0 Maintenance release. November 2009 9.1.0 Introduced the Nios II Sotware Build Tools or Eclipse. Nios II IDE inormation removed to Appendix A. Using the Nios II Integrated Development Environment. Reorganized and updated inormation and terminology to clariy role o Nios II Sotware March 2009 9.0.0 Build Tools. Corrected minor typographical errors. May 2008 8.0.0 Maintenance release. October 2007 7.2.0 Maintenance release. May 2007 7.1.0 March 2007 7.0.0 Maintenance release. November 2006 6.1.0 Initial release. Minor clariications added to content. Added table o contents to Overview section. Added Reerenced Documents section. February 2011 Altera Corporation Nios II Sotware Developer s Handbook

11 12 Chapter 11: Ethernet and the NicheStack TCP/IP Stack - Nios II Edition Document Revision History Nios II Sotware Developer s Handbook February 2011 Altera Corporation