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

SPI UART Device Driver
[Serial communication devices.]


Detailed Description

Serial communication device driver.

This stream device driver writes data to and reads data from an external device via the SPI bus. Both, input and output data bytes are buffered and send resp. transmitted by interrupt routines.

Up to eight additional UARTs are supported. All external AVRs, for which the AT90S2313 is a good low cost choice, are connected to the SPI of the main CPU.


Modules

SPI UART Device

Data Structures

struct  _UARTSDCB
 UART device control block structure. More...

struct  _UARTSDCB
 UART device control block structure. More...


Typedefs

typedef _UARTSDCB UARTSDCB

Functions

int UartSpiInput (NUTDEVICE *dev)
 Mode. xxxx xxx0 8 bit xxxx xxx1 7 bit xxxx x0xx No parity bit xxxx x10x Even parity xxxx x11x Odd parity Wait for input.

int UartSpiOutput (NUTDEVICE *dev)
 Initiate output.

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

int UartSpiIOCtl (NUTDEVICE *dev, int req, void *conf)
 Perform SPI UART control functions.

int UartSpiInit (NUTDEVICE *dev)
 Initialize SPI UART device.


Typedef Documentation

typedef struct _UARTSDCB UARTSDCB
 

UART device control block type.


Function Documentation

int UartSpiFlush 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 UartSpiInit NUTDEVICE dev  ) 
 

Initialize SPI UART device.

Prepares the device for subsequent reading or writing.

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

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

int UartSpiInput NUTDEVICE dev  ) 
 

Mode. xxxx xxx0 8 bit xxxx xxx1 7 bit xxxx x0xx No parity bit xxxx x10x Even parity xxxx x11x Odd parity 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 UART device.
Returns:
0 on success, -1 on timeout.

int UartSpiIOCtl NUTDEVICE dev,
int  req,
void *  conf
 

Perform SPI 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
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.

int UartSpiOutput 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.


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