Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

uart.h File Reference

UART I/O function prototypes. More...

#include <sys/types.h>

Go to the source code of this file.

Functions

int UartAvrInit (NUTDEVICE *dev)
 Initialize on chip uart device.

int UartAvrIOCtl (NUTDEVICE *dev, int req, void *conf)
 Perform on-chip UART control functions.

int UartAvrInput (NUTDEVICE *dev)
 Wait for input.

int UartAvrOutput (NUTDEVICE *dev)
 Initiate output.

int UartAvrFlush (NUTDEVICE *dev)
 Wait for output buffer empty.

int UartAvrGetRaw (u_char *cp)
 Get raw byte from the UART receiver register.

int UartAvrPutRaw (u_char ch)
 Put raw byte to the UART transmit register.


Detailed Description

UART I/O function prototypes.


Function Documentation

int UartAvrFlush NUTDEVICE   dev
 

Wait for output buffer empty.

If the output buffer contains any data, the calling thread is suspended until all data has been transmitted.

Parameters:
dev  Indicates the UART device.
Returns:
0 on success, -1 otherwise.

int UartAvrGetRaw u_char   cp
 

Get raw byte from the UART receiver register.

Parameters:
cp  Pointer to the character buffer.
Returns:
1 if a byte has been available, 0 otherwise.

int UartAvrInit NUTDEVICE   dev
 

Initialize on chip uart device.

Prepares the device for subsequent reading or writing. Enables UART transmitter and receiver interrupts.

Applications should not use this function, but call NutDeviceOpen().

Parameters:
dev  Identifies the device to initialize.
Returns:
0 on success, -1 otherwise.

int UartAvrInput NUTDEVICE   dev
 

Wait for input.

This function checks the input buffer for any data. If the buffer is empty, the calling thread unknown reference! will be blocked until at least one new character is received or a timeout occurs.

Parameters:
dev  Indicates the UART device.
Returns:
0 on success, -1 on timeout.

int UartAvrIOCtl NUTDEVICE   dev,
int    req,
void *    conf
 

Perform on-chip UART control functions.

Parameters:
dev  Identifies the device that receives the device-control function. This pointer must have been retrieved previously by using the NutDeviceOpen() function.
req  Requested control function. May be set to one of the following constants:
  • UART_SETSPEED, if conf points to an u_long value containing the baudrate.
  • UART_GETSPEED, if conf points to an u_long value receiving the current baudrate.
  • UART_SETDATABITS
  • UART_GETDATABITS
  • UART_SETPARITY
  • UART_GETPARITY
  • UART_SETSTOPBITS
  • UART_GETSTOPBITS
  • UART_SETSTATUS
  • UART_GETSTATUS
  • UART_SETREADTIMEOUT
  • UART_GETREADTIMEOUT
  • UART_SETWRITETIMEOUT
  • UART_GETWRITETIMEOUT
Parameters:
conf  Points to a buffer that contains any data required for the given control function or receives data from that function.
Returns:
0 on success, -1 otherwise.
Note:
Timeout is limited to the granularity of the system timer.

int UartAvrOutput NUTDEVICE   dev
 

Initiate output.

This function checks the output buffer for any data. If the buffer contains at least one character, the transmitter is started, if not already running. The function returns immediately, without waiting for the character being completely transmitted. Any remaining characters in the output buffer are transmitted in the background.

Parameters:
dev  Indicates the UART device.
Returns:
0 on success, -1 otherwise.

int UartAvrPutRaw u_char    ch
 

Put raw byte to the UART transmit register.

Parameters:
ch  Character to transmit.
Returns:
1 if the byte has been stored in the transmit register, 0 if the transmitter is busy.


Generated on Thu Jan 30 22:30:55 2003 for EduNet by doxygen1.2.18