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

Miscellaneous Library Functions

11.2.8print_uptime()

This function is used to format a time value as an ASCII string for printing.

Syntax

char *print_uptime(unsigned long timetick)

where:

timetick is the number of ticks to be translated to an uptime string.

Return value

Returns a pointer to a statically allocated buffer containing a null-terminated ASCII string that represents the time value passed in timetick.

Usage

This function takes a time value, timetick, in centiseconds and returns a pointer to a static buffer containing an uptime string that indicates the number of days, hours, minutes, and seconds represented.

11-12

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

ARM DUI 0079B

Miscellaneous Library Functions

11.2.9std_in()

This function inputs a character from the standard input channel.

Syntax

int std_in(long s)

where:

s

is the index of the input device (unused by std_in()).

Return value

Returns one of the following:

0

if no character is available from the standard input channel.

the character typed

if a character is available.

Usage

The std_in() function is used with a GenericIO structure to allow the menus system to receive input from the standard input channel.

ARM DUI 0079B

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

11-13

Miscellaneous Library Functions

11.2.10 std_out()

This function outputs characters to the standard output channel.

Syntax

int std_out(long s, char *buf, int len) where:

s

is the index of the output device (unused by std_out()).

buf

is a pointer to the data to be printer.

len

is the number of characters to output from buf.

Return value

Returns the number of characters actually printed.

Usage

The std_out() function is used with a GenericIO structure to allow the ns_printf() function to print network statistics to the standard output channel.

11.2.11sysuptime()

This function returns the age of the system.

Syntax

unsigned long sysuptime(void)

Return value

Returns the number of centiseconds since the clock started counting.

Usage

The sysuptime() function returns the time since some arbitrary epoch. This epoch is usually the moment when the clock driver was initialized at boot time. The time period is expressed in hundredths of a second.

11-14

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

ARM DUI 0079B

Miscellaneous Library Functions

11.2.12 uslash()

This function is used to translate DOS-style path separator characters (\) into

UNIX-style separator characters (/).

Syntax

char *uslash(char *path)

where:

path

is the string to be translated.

Return value

Returns the string pointed to by path, with every occurrence of the \ character replaced with /.

Usage

The string is modified in place, and therefore must not be a constant (read-only) string.

ARM DUI 0079B

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

11-15