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

UART
[* Serial]

Collaboration diagram for UART:


Detailed Description

TODO.


Functions

int SciH8Init (NUTDEVICE *dev)
 Initialize on chip uart device.
int SciH8IOCtl (NUTDEVICE *dev, int req, void *conf)
 Perform on-chip UART control functions.
int SciH8Input (NUTDEVICE *dev)
 Wait for input.
int SciH8Output (NUTDEVICE *dev)
 Initiate output.
int SciH8Flush (NUTDEVICE *dev)
 Wait for output buffer empty.
int SciH8GetRaw (u_char *cp)
int SciH8PutRaw (u_char ch)
int SciH8Read (NUTFILE *fp, void *buffer, int size)
 Read from device.
int SciH8Write (NUTFILE *fp, CONST void *buffer, int len)
NUTFILESciH8Open (NUTDEVICE *dev, CONST char *name, int mode, int acc)
 Open a device or file.
int SciH8Close (NUTFILE *fp)
 Close a device or file.

Variables

__END_DECLS NUTDEVICE devSci0
 SCI0 Device information structure.
NUTDEVICE devSci1
 SCI1 Device information structure.
NUTDEVICE devSci2
 SCI2 Device information structure.


Function Documentation

int SciH8Flush 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 SCI device.
Returns:
0 on success, -1 otherwise.

int SciH8Init NUTDEVICE dev  ) 
 

Initialize on chip uart device.

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

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

int SciH8Input NUTDEVICE dev  ) 
 

Wait for input.

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

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

int SciH8IOCtl NUTDEVICE dev,
int  req,
void *  conf
 

Perform on-chip UART control functions.

Parameters:
dev Identifies the device that receives the device-control function.
req Requested control function. May be set to one of the following constants:
  • UART_SETSPEED, conf points to an u_long value containing the baudrate.
  • UART_GETSPEED, conf points to an u_long value receiving the current baudrate.
  • UART_SETDATABITS, conf points to an u_long value containing the number of data bits, 5, 6, 7 or 8.
  • UART_GETDATABITS, conf points to an u_long value receiving the number of data bits, 5, 6, 7 or 8.
  • UART_SETPARITY, conf points to an u_long value containing the parity, 0 (no), 1 (odd) or 2 (even).
  • UART_GETPARITY, conf points to an u_long value receiving the parity, 0 (no), 1 (odd) or 2 (even).
  • UART_SETSTOPBITS, conf points to an u_long value containing the number of stop bits 1 or 2.
  • UART_GETSTOPBITS, conf points to an u_long value receiving the number of stop bits 1 or 2.
  • UART_SETSTATUS
  • UART_GETSTATUS
  • UART_SETREADTIMEOUT, conf points to an u_long value containing the read timeout.
  • UART_GETREADTIMEOUT, conf points to an u_long value receiving the read timeout.
  • UART_SETWRITETIMEOUT, conf points to an u_long value containing the write timeout.
  • UART_GETWRITETIMEOUT, conf points to an u_long value receiving the write timeout.
  • UART_SETLOCALECHO, conf points to an u_long value containing 0 (off) or 1 (on).
  • UART_GETLOCALECHO, conf points to an u_long value receiving 0 (off) or 1 (on).
  • UART_SETFLOWCONTROL, conf points to an u_long value containing combined UART_FCTL_ values.
  • UART_GETFLOWCONTROL, conf points to an u_long value containing receiving UART_FCTL_ values.
  • UART_SETCOOKEDMODE, conf points to an u_long value containing 0 (off) or 1 (on).
  • UART_GETCOOKEDMODE, conf points to an u_long value receiving 0 (off) or 1 (on).
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.
Warning:
Timeout values are given in milliseconds and are limited to the granularity of the system timer.
Bug:
For ATmega103, only 8 data bits, 1 stop bit and no parity are allowed.

int SciH8Output 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 SCI device.
Returns:
0 on success, -1 otherwise.


© 2000-2006 by egnite Software GmbH - visit http://www.ethernut.de/