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

TCP/IP API Functions

4.2.10tcp_sleep()

This function is called from the TCP code when a TCP operation is blocked by a temporary lack of resources, typically a lack of free buffers.

Syntax

void tcp_sleep(void *ptr) where:

ptr

is the memory address of some structure relevant to the current task. The

 

tcp_wakeup() function will be called from elsewhere in the stack to

 

restart this task. The tcp_wakeup() function is called with the same

 

memory address.

Return value

None.

Usage

This function should allow the tasking system to attempt to run each task at least once and then return. The calling code then retests the condition and either:

proceeds

times out

calls tcp_sleep() again.

See the detailed description of this in TCP on page 2-12.

ARM DUI 0079B

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

4-13

TCP/IP API Functions

4.2.11tcp_wakeup()

This function is called by the TCP/IP code when an incoming packet or timeout causes a previously blocked process to become runable.

Syntax

void tcp_wakeup(void *ptr) where:

ptr

is the memory address that the sleeping process passed to tcp_sleep().

 

All tasks that called tcp_sleep() with this address will be woken.

Return value

None.

Usage

This function should cause all processes that were sleeping because of a call to tcp_sleep() with the same value for ptr to be marked as runable. In a superloop system, tcp_wakeup() performs no action because tcp_sleep() does not block. Instead, tcp_sleep() calls the nonportable superloop function, tk_yield(). It is possible for tcp_wakeup() to be called even if no process is currently blocked in tcp_sleep().

4-14

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

ARM DUI 0079B