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

Introduction

1.4ARM PPP requirements

The ARM PPP software requires the following support from the host system:

line management functions

static memory

dynamic memory ( malloc() and free())

periodic clock tick.

These requirements are explained in the following sections.

1.4.1Line management functions

PPPmust send and receive characters on the line hardware of the target system. It may also need to initiate a connection (for example, dial the phone number) or disconnect. You must provide a set of low-level functions to do this. If more than one type of line is to be used, such as ISDN and Dialup, a set of functions must be provided for each line type.

PPP defines a structure that contains a set of pointers to these functions. You must ensure that all these pointers are set to appropriate functions at system initialization time, even if the function does nothing other than return. Providing these functions is generally the bulk of the work required to implement PPP on a new target system.

The PPP code comes with two sets of line management functions:

a Universal Asynchronous Receiver/Transmitter (UART) serial line with modem dialer

a loopback driver.

If your target hardware is an embedded system and you intend to use an 8250/16450/16550 (or similar) UART and a Hayes-compatible modem, you can use the (UART) line drivers exactly as provided.

The loopback drivers are for testing purposes only and are not expected to be the primary line drivers of a real product.

The line driver calls are described in detail in Serial line drivers on page 5-10.

1-12

Copyright © 1998 and 1999 ARM Limited. All rights reserved.

ARM DUI 0079B

Introduction

1.4.2Static memory

As with all embedded system code, the PPP code takes up some code and data space. On embedded systems, the code is usually stored in ROM and can be moved to RAM at boot time. The exact amount of code space required varies depending on:

the PPP optional features you enable

your processor

your compiler.

Table 1-3 on page 1-14 and Table 1-4 on page 1-14 provide sample sizes of the major modules in the sample program compilation.

These statistics were obtained under the following conditions:

compiled with space optimization enabled

APCS 3 32-bit, no software stack check, no frame pointer

Linker configured to remove unused sections.

Note

Because the code is subject to continuous development, these values may change with subsequent releases.

Total static memory for a configuration will be the amounts shown in the following tables plus about three kilobytes of data space multiplied by the maximum number of connections (_NPPP).

ARM DUI 0079B

Copyright © 1998 and 1999 ARM Limited. All rights reserved.

1-13

Introduction

Table 1-3 PPP code size—CHAP, MS-CHAP, VJ compression, UPAP, and DHCP client enabled (values shown in bytes)

 

ARM

Thumb

 

 

 

 

 

 

code and

code and

Read-

Zero-init

ARM

Thumb

RAM

 

read-only

read-only

write data

data

ROM

ROM

 

 

 

data

data

 

 

 

 

 

 

 

 

 

 

 

 

 

PPP

12272

9372

708

500

12980

10080

1208

 

 

 

 

 

 

 

 

IPCP

5648

4076

64

192

5712

4140

256

 

 

 

 

 

 

 

 

LCP

5852

3980

64

144

5916

4044

208

 

 

 

 

 

 

 

 

CHAP

7940

5924

64

164

8004

5988

228

 

 

 

 

 

 

 

 

MS-CHAP

3320

2148

64

0

3384

2212

64

 

 

 

 

 

 

 

 

FSM

3980

2564

4

0

3984

2568

4

 

 

 

 

 

 

 

 

Van

2208

1500

0

0

2208

1500

0

Jacobson

 

 

 

 

 

 

 

Compression

 

 

 

 

 

 

 

(VJC)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(U)PAP

2120

1508

0

48

2120

1508

48

 

 

 

 

 

 

 

 

Totals

43340

31072

968

1048

44308

32040

2016

 

 

 

 

 

 

 

Table 1-4 PPP code size—all optional features disabled (values shown in bytes)

 

 

 

 

 

 

 

 

 

ARM

Thumb

 

 

 

 

 

 

code and

code and

Read-

Zero-init

ARM

Thumb

RAM

 

read-only

read-only

write data

data

ROM

ROM

 

 

 

data

data

 

 

 

 

 

 

 

 

 

 

 

 

 

PPP

8772

6540

708

500

9480

7248

1208

 

 

 

 

 

 

 

 

IPCP

5628

4048

64

192

5692

4112

256

 

 

 

 

 

 

 

 

LCP

5720

3892

64

144

5784

3956

208

 

 

 

 

 

 

 

 

FSM

3980

2556

4

0

3984

2560

4

 

 

 

 

 

 

 

 

Totals

24100

17036

840

836

24940

17876

1676

 

 

 

 

 

 

 

 

1-14

Copyright © 1998 and 1999 ARM Limited. All rights reserved.

ARM DUI 0079B

Introduction

1.4.3Dynamic memory

PPPhas no real dynamic memory requirements. However, due to the way some compilers allocate memory, some of the uninitialized static data areas are allocated at initialization time rather than statically. PPP allocates these areas by calling functions that have the same syntax as a standard C library malloc() call. These calls differ from malloc() in two ways:

they expect the returned buffer to be initialized to zeros (like calloc())

each macro is used for one kind of buffer or structure only, so a reasonable expected maximum size can be defined at compile time.

If your C compiler and development environment support calloc(), you can map the allocation macros directly to calloc() using the default macro definitions in the sample source code.

If your system does not support calloc() or if you do not want to use it for performance reasons, you can reserve arrays of static buffers of the sizes required and return pointers to them from the allocation macros. The exact sizes required vary with the environment (for example, CPU type and compiler packing options), so you should use sizeof() operators in your static declaration statements.

The number of buffers of each type vary with the number of lines (units) you can open at once.

1.4.4Periodic clock tick

The PPP code includes a function that must be called by the system once per second. This function drives retransmissions and timeouts.

In addition, the PPP code expects the system to maintain a 32-bit clock tick counter variable, cticks, that increments TPS times a second. The macro TPS must be defined in your ipport.h file or one of its nested includes (see Timers and multitasking on page 2-8).

ARM DUI 0079B

Copyright © 1998 and 1999 ARM Limited. All rights reserved.

1-15