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

ARM-specific Functions

10.16uart.c debug TTY interface functions

The debug TTY interface functions in uart.c allow the code in \armthumb\ttyio.c to work with a UART in order to provide a debug channel to which diagnostic messages can be sent. It is preferable to use a UART for this task rather than rely on an RDI link to an ARM debugger, because the RDI link impedes the performance of the system and does not support the concept of polling to see if user input is available.

The Menus example project (see menus on page 12-6) is configured to use ttyio.c in conjunction with these functions to allow interactive use of the menus while the TCP/IP and PPP stacks operate in the background.

The debug TTY interface functions are:

dputchar() on page 10-31

getch() on page 10-32

kbhit() on page 10-32.

10.16.1 dputchar()

This function outputs a single character to the debug UART.

Syntax

void dputchar(unsigned ch)

where:

ch

is the character to be sent.

Usage

This function is used to send a single character to the debug UART. If the character being sent is a linefeed character, a carriage return character is also sent to the UART.

ARM DUI 0079B

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

10-31

ARM-specific Functions

10.16.2 getch()

This function gets a single character from the debug UART.

Syntax

unsigned getch(void)

Return value

Returns the ASCII character read from the UART.

Usage

This function is used to read a single character from the debug UART. If there are no characters currently available for reading, getch() will loop, calling YIELD(), until one becomes available.

10.16.3 kbhit()

This function polls to see if there are any characters available to be read from the debug UART.

Syntax

unsigned kbhit(void)

Return value

Returns one of the following:

1

if at least one character is available.

0

if no characters are available.

Usage

This function is used to check if there are any characters that can be read from the debug UART. If there are characters available, they can be retrieved by calling getch().

10-32

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

ARM DUI 0079B

ARM-specific Functions

10.1782595.c

The Olicom Ethernet driver uses all of the functions implemented within this file. You should not call them directly, because doing so will change the state of the Olicom Ethernet hardware without making the corresponding change to the state of the Olicom driver state machine. The following functions are implemented in this file:

i595_badpacketrx()

i595_bringup()

i595_packetgone()

i595_promiscmode()

i595_rxpackets()

i595_takedown()

i595_txchain()

i595_txstart().

ARM DUI 0079B

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

10-33

ARM-specific Functions

10-34

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

ARM DUI 0079B