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

TCP/IP API Functions

3.1.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 is 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 must allow the tasking system to attempt to run each task at least once and then return. The calling code then retests the condition and:

proceeds

times out

calls tcp_sleep() again.

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

3-12

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

ARM DUI 0144B

TCP/IP API Functions

3.1.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 is woken.

Return value

None.

Usage

This function must 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(). tcp_wakeup() can be called even if no process is currently blocked in tcp_sleep().

ARM DUI 0144B

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

3-13