Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
(ARM).Porting TCP-IP programmer's guide.Ver 1.6.pdf
Скачиваний:
43
Добавлен:
23.08.2013
Размер:
2.64 Mб
Скачать

Porting TCP/IP

Version 1.6

Programmer’s Guide

Copyright © 1998-2001 ARM Limited. All rights reserved.

ARM DUI 0144B

Copyright © 1998-2001 ARM Limited. All rights reserved.

Release Information

The following changes have been made to this document.

 

 

Change History

 

 

 

Date

Issue

Change

 

 

 

Sept 2000

A

First release of independent TCP/IP version (DUI 0144), without PPP information.

 

 

 

June 2001

B

Second release. Minor changes.

 

 

 

Proprietary Notice

ARM, the ARM Powered logo, Thumb, and StrongARM are registered trademarks of ARM Limited.

The ARM logo, AMBA, PrimeCell, Angel, ARMulator, EmbeddedICE, ModelGen, MultiICE, ARM7TDMI, ARM7TDMI-S, ARM9TDMI, TDMI, and STRONG are trademarks of ARM Limited.

Portions of source code are provided under the copyright of the respective owners, and are acknowledged in the appropriate source files:

Copyright 1998-2000 by InterNiche Technologies Inc.

Copyright © 1984, 1985, 1986 by the Massachusetts Institute of Technology.

Copyright © 1982, 1985, 1986 by the Regents of the University of California. All Rights Reserved. Redistribution and use in source and binary forms are permitted provided that the above copyright notice and this paragraph are duplicated in all such forms and that any documentation, advertising materials, and other materials related to such distribution and use acknowledge that the software was developed by the University of California, Berkeley. The name of the University may not be used to endorse or promote products derived from this software without specific prior written permission.

Copyright © 1988, 1989 by Carnegie Mellon University. All Rights Reserved. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of CMU not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission.

All other products or services mentioned herein may be trademarks of their respective owners.

Neither the whole or any part of the information contained in, or the product described in, this document may be adapted or reproduced in any material form except with prior written permission of the copyright holder.

The product described in this document is subject to continuous development and improvements. All particulars of the product and its use contained in this document are given by ARM in good faith. However, all warranties implied or expressed, including but not limited to implied warranties of merchantability, or fitness for purpose, are excluded.

This document is intended only to assist the reader in the use of the product. ARM Ltd shall not be liable for any loss or damage arising from the use of any information in this document, or any error or omission in such information, or any incorrect use of the product.

ii

Copyright © 1998-2001 ARM Limited. All rights reserved.

ARM DUI 0144B

Contents

TCP/IP Programmer’s Guide

Preface

 

 

About this book ............................................................................................

viii

 

 

Feedback ......................................................................................................

xii

Chapter 1

Introduction

 

 

1.1

A typical embedded networking stack .........................................................

1-2

 

1.2

ARM TCP/IP requirements ..........................................................................

1-4

 

1.3

Sample package directories ........................................................................

1-7

 

1.4

Sample programs ........................................................................................

1-8

Chapter 2

TCP/IP Porting

 

 

2.1

Porting procedure .......................................................................................

2-2

 

2.2

Portable and nonportable files ....................................................................

2-3

 

2.3

Creating the IP port file ...............................................................................

2-4

 

2.4

Coding the glue layer ................................................................................

2-14

 

2.5

Specifying IP addresses ...........................................................................

2-18

 

2.6

Testing the TCP/IP port ............................................................................

2-20

Chapter 3

TCP/IP API Functions

 

 

3.1

User-provided TCP and IP functions ...........................................................

3-2

 

3.2

Network interfaces ....................................................................................

3-14

ARM DUI 0144B

Copyright © 1998-2001 ARM Limited. All rights reserved.

iii

Chapter 4

DHCP Client Functions

 

 

4.1

DHCP client functions .................................................................................

4-2

Chapter 5

Sockets

 

 

5.1

ARM implementation of sockets .................................................................

5-2

 

5.2

Socket API reference ..................................................................................

5-3

Chapter 6

Low-overhead UDP Functions

 

 

6.1

UDP functions .............................................................................................

6-2

Chapter 7

The TCP Zero-copy API

 

 

7.1

About the TCP Zero-copy API ....................................................................

7-2

 

7.2

Sending data with the TCP Zero-copy API .................................................

7-4

 

7.3

Receiving data with the TCP Zero-copy API ..............................................

7-6

 

7.4

TCP Zero-copy API reference ....................................................................

7-8

Chapter 8

ARM-specific Functions

 

 

8.1

ARM directories ..........................................................................................

8-2

 

8.2

ARM Firmware Suite ..................................................................................

8-8

Chapter 9

Miscellaneous Library Functions

 

 

9.1

Description of misclib files ..........................................................................

9-2

 

9.2

in_utils.c ......................................................................................................

9-6

 

9.3

nextcarg.c .................................................................................................

9-17

 

9.4

parseip.c ...................................................................................................

9-18

 

9.5

reshost.c ...................................................................................................

9-19

 

9.6

timeouts.c .................................................................................................

9-21

 

9.7

testmenu.c ................................................................................................

9-23

 

9.8

userpass.c ................................................................................................

9-24

Chapter 10

Internal Functions

 

 

10.1

ARP routines ............................................................................................

10-2

 

10.2

IP routines ................................................................................................

10-4

 

10.3

ICMP routines .........................................................................................

10-14

Appendix A

Error Codes

 

 

A.1

ENP_ error codes .......................................................................................

A-2

 

A.2

Socket error codes .....................................................................................

A-4

Appendix B

Editing ARM Networking .nv Files

 

 

B.1

About the .nv files .......................................................................................

B-2

 

B.2

Primary .nv file parameters .........................................................................

B-3

 

B.3

Secondary .nv file parameters ....................................................................

B-6

iv

Copyright © 1998-2001 ARM Limited. All rights reserved.

ARM DUI 0144B

Appendix C

Sample Applications

 

 

C.1

Requirements .............................................................................................

C-2

 

C.2

Building projects .........................................................................................

C-3

 

C.3

Running the examples ...............................................................................

C-4

 

C.4

Descriptions of the examples .....................................................................

C-5

Appendix D

The i8255x Ethernet Driver

 

 

D.1

About the i8255x driver ..............................................................................

D-2

 

D.2

Build options ..............................................................................................

D-4

 

D.3

Porting the i8255x driver ............................................................................

D-6

ARM DUI 0144B

Copyright © 1998-2001 ARM Limited. All rights reserved.

v

vi

Copyright © 1998-2001 ARM Limited. All rights reserved.

ARM DUI 0144B