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

TCP/IP Porting

2.3.5Timers and multitasking

The ARM TCP/IP stack requires a clock tick for TCP and ARP timers. The stack depends on an unsigned long variable named cticks.

The cticks variable should be regularly incremented (between 5 and 100 times per second) by the port code, wrapping back to 0 after reaching 0xffffffff. The stack code uses the TPS macro to adjust cticks (ticks per second) for actual time. This must be defined in ipport.h, for example:

#define TPS

50 /* cticks per second*/

An example based on your hardware timer is available in \pid7tdm\clock.c. The example sets the PID card’s on-board timer to match the value assigned to TPS in ipport.h.

If you are testing the stack using the ARMulator, you can define cticks to call the clock() library function instead:

#define cticks (clock()) extern long clock(void);

If you use clock() to provide the value for cticks, you must define TPS to be 100 in the ipport.h file.

2.3.6Stack features and options

The stack assumes that you have at least one device for sending and receiving network packets. These devices are usually hardware devices, such as Ethernet or serial ports, but they can be logical devices, such as loopback drivers or inter-process communication software.

Most IP stacks on embedded systems support only one device. However, devices like routers need two or more. The ARM stack supports multiple logical devices and has been used with up to three. The structures to manage these devices are statically allocated at compile time, so the maximum number of devices the system will use at runtime must be set in ipport.h:

/* define the maximum number of hardware interfaces */ #define MAXNETS 2 /* maximum entries of nets[] array */

2-8

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

ARM DUI 0079B

TCP/IP Porting

The following list of optional compilation switches can be defined in ipport.h. These must be commented out if the option is not required. Some of these switches add hooks.

#define MULTI_HOMED

1

/* more than one net interface

*/

#define FULL_ICMP

1

/* use all ICMP (as opposed to

*/

 

 

/* ping only).*/

 

 

#define IP_FRAGMENTS

1

/* IP fragment reassembly

*/

 

#define NPDEBUG

1

/* turn on debugging dprintf()s */

#define PING_APP

1

/* application provides a

ping

upcall */

#define INCLUDE_TCP

1

/* this link will include

ARM TCP */

Note

Setting the defined value to 0 does not disable the feature. You must comment out the definition.

ARM DUI 0079B

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

2-9