uart.h File Reference

The header file describes the uart interface. More...

Go to the source code of this file.

Data Structures

struct  HAL_UartDescriptor_t
 Uart descriptor. More...

Functions

int HAL_OpenUart (HAL_UartDescriptor_t *descriptor)
 Registers uart's event handlers. Performs configuration of uart registers. Performs configuration of RTS, CTS and DTR pins.
int HAL_CloseUart (HAL_UartDescriptor_t *descriptor)
 Releases the uart channel and pins, if hardware flow control was used.
int HAL_WriteUart (HAL_UartDescriptor_t *descriptor, uint8_t *buffer, uint8_t length)
 Writes a number of bytes to uart channel. txCallback function will be used to notify when the transmission is finished. If hardware flow control is used for transmitting then RTS and DTR pins will be tested during transmission.
int HAL_ReadUart (HAL_UartDescriptor_t *descriptor, uint8_t *buffer, uint8_t length)
 Reads a number of bytes from uart and places them to the buffer.
int HAL_OnUartCts (HAL_UartDescriptor_t *descriptor)
 Forbids the host to transmit data. Only UART_CHANNEL_1 can be used for hardware flow control for avr.
int HAL_OffUartCts (HAL_UartDescriptor_t *descriptor)
 Allows the host to transmit data. Only UART_CHANNEL_1 can be used for hardware flow control for avr.
int HAL_ReadUartRts (HAL_UartDescriptor_t *descriptor)
 Reads RTS pin state. Only UART_CHANNEL_1 can be used for hardware flow control for avr.
int HAL_ReadUartDtr (HAL_UartDescriptor_t *descriptor)
 Reads DTR pin state. Only UART_CHANNEL_1 can be used for hardware flow control for avr.
int HAL_IsTxEmpty (HAL_UartDescriptor_t *descriptor)
 Checks the status of tx buffer.


Detailed Description

The header file describes the uart interface.

Author:
Atmel Corporation: http://www.atmel.com
Support email: avr@atmel.com
Copyright (c) 2008 , Atmel Corporation. All rights reserved. Licensed under Atmel's Limited License Agreement (BitCloudTM).

Definition in file uart.h.


Function Documentation

int HAL_OpenUart ( HAL_UartDescriptor_t descriptor  ) 

Registers uart's event handlers. Performs configuration of uart registers. Performs configuration of RTS, CTS and DTR pins.

Parameters:
[in] descriptor - pointer to HAL_UartDescriptor_t structure
Returns:
Returns positive uart descriptor on success or -1 in cases:
  • bad uart channel;
  • there are not enough resources;

int HAL_CloseUart ( HAL_UartDescriptor_t descriptor  ) 

Releases the uart channel and pins, if hardware flow control was used.

Parameters:
[in] descriptor - pointer to HAL_UartDescriptor_t structure
Returns:
-1 - bad descriptor;
0 - success.

int HAL_WriteUart ( HAL_UartDescriptor_t descriptor,
uint8_t *  buffer,
uint8_t  length 
)

Writes a number of bytes to uart channel. txCallback function will be used to notify when the transmission is finished. If hardware flow control is used for transmitting then RTS and DTR pins will be tested during transmission.

Parameters:
[in] descriptor - pointer to HAL_UartDescriptor_t structure;
[in] buffer - pointer to the application data buffer;
[in] length - number of bytes to transfer;
Returns:
-1 - bad descriptor;
Number of bytes placed to the buffer - success.

int HAL_ReadUart ( HAL_UartDescriptor_t descriptor,
uint8_t *  buffer,
uint8_t  length 
)

Reads a number of bytes from uart and places them to the buffer.

Parameters:
[in] descriptor - pointer to HAL_UartDescriptor_t structure;
[in] buffer - pointer to the application buffer;
[in] length - number of bytes to be placed to the buffer;
Returns:
-1 - bad descriptor, or bad number of bytes to read;
Number of bytes placed to the buffer - success.

int HAL_OnUartCts ( HAL_UartDescriptor_t descriptor  ) 

Forbids the host to transmit data. Only UART_CHANNEL_1 can be used for hardware flow control for avr.

Parameters:
[in] descriptor - pointer to HAL_UartDescriptor_t structure;
Returns:
-1 - bad descriptor, bad uart, or unsupported mode;
0 - success.

int HAL_OffUartCts ( HAL_UartDescriptor_t descriptor  ) 

Allows the host to transmit data. Only UART_CHANNEL_1 can be used for hardware flow control for avr.

Parameters:
[in] descriptor - pointer to HAL_UartDescriptor_t structure;
Returns:
-1 - bad descriptor, bad uart, or unsupported mode;
0 - success.

int HAL_ReadUartRts ( HAL_UartDescriptor_t descriptor  ) 

Reads RTS pin state. Only UART_CHANNEL_1 can be used for hardware flow control for avr.

Parameters:
[in] descriptor - pointer to HAL_UartDescriptor_t structure;
Returns:
-1 - bad descriptor, bad uart, or unsupported mode;
0 - RTS is low level;
1 - RTS is high level;

int HAL_ReadUartDtr ( HAL_UartDescriptor_t descriptor  ) 

Reads DTR pin state. Only UART_CHANNEL_1 can be used for hardware flow control for avr.

Parameters:
[in] descriptor - pointer to HAL_UartDescriptor_t structure;
Returns:
-1 - bad descriptor, bad uart, or unsupported mode;
0 - DTR is low level;
1 - DTR is high level;

int HAL_IsTxEmpty ( HAL_UartDescriptor_t descriptor  ) 

Checks the status of tx buffer.

Parameters:
[in] descriptor - pointer to HAL_UartDescriptor_t structure;
Returns:
-1 - bad descriptor, no tx buffer;
1 - tx buffer is empty;
0 - tx buffer is not empty;


Generated on Mon Feb 16 17:53:40 2009 for BitCloud Stack Documentation by  doxygen 1.5.1-p1