summaryrefslogtreecommitdiff
path: root/digital/zigbit/bitcloud/stack/Components/HAL/include/uart.h
diff options
context:
space:
mode:
Diffstat (limited to 'digital/zigbit/bitcloud/stack/Components/HAL/include/uart.h')
-rw-r--r--digital/zigbit/bitcloud/stack/Components/HAL/include/uart.h118
1 files changed, 118 insertions, 0 deletions
diff --git a/digital/zigbit/bitcloud/stack/Components/HAL/include/uart.h b/digital/zigbit/bitcloud/stack/Components/HAL/include/uart.h
new file mode 100644
index 00000000..a2a52d38
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/HAL/include/uart.h
@@ -0,0 +1,118 @@
+/************************************************************************//**
+ \file uart.h
+
+ \brief
+ UART interface
+
+ \author
+ Atmel Corporation: http://www.atmel.com \n
+ Support email: avr@atmel.com
+
+ Copyright (c) 2008-2011, Atmel Corporation. All rights reserved.
+ Licensed under Atmel's Limited License Agreement (BitCloudTM).
+
+ \internal
+ History:
+ 17.11.2010 D. Loskutnikov - Created.
+******************************************************************************/
+#ifndef _UART_H
+#define _UART_H
+
+/******************************************************************************
+ Includes section
+******************************************************************************/
+#include <usart.h>
+#include <halUart.h>
+
+/******************************************************************************
+ Functions prototypes section
+******************************************************************************/
+/**************************************************************************//**
+\brief Open UART
+
+\param[in] desc UART descriptor
+\return 1 if success, -1 if error
+******************************************************************************/
+int HAL_OpenUart(HAL_UartDescriptor_t *descriptor);
+
+/**************************************************************************//**
+\brief Close UART
+
+\param[in] desc UART descriptor
+\return
+******************************************************************************/
+int HAL_CloseUart(HAL_UartDescriptor_t *descriptor);
+
+/**************************************************************************//**
+\brief Send contents of buffer over UART
+
+\param[in] desc UART descriptor
+\param[in] buffer buffer to be sent
+\param[in] length buffer length
+\return number of sent bytes or -1 if error
+******************************************************************************/
+int HAL_WriteUart(HAL_UartDescriptor_t *descriptor, uint8_t *buffer, uint16_t length);
+
+/**************************************************************************//**
+\brief Copy received by UART bytes to user-supplied buffer
+
+\param[in] desc UART descriptor
+\param[in] buffer buffer to store data
+\param[in] length maximum length of buffer
+\return number of actually copied bytes or -1 if error
+******************************************************************************/
+int HAL_ReadUart(HAL_UartDescriptor_t *descriptor, uint8_t *buffer, uint16_t length);
+
+/**************************************************************************//**
+\brief Check if any bytes are pending for transmission over UART
+
+\param[in] desc descriptor
+\return -1 if error, 0 if not, 1 if yes
+******************************************************************************/
+int HAL_IsUartTxEmpty(HAL_UartDescriptor_t *descriptor);
+
+/**************************************************************************//**
+\brief Store UART error conditions
+
+\param[in] desc UART descriptor
+\param[in] err error condition
+******************************************************************************/
+void halUartStoreError(HAL_UartDescriptor_t *desc, uint8_t err);
+
+/**************************************************************************//**
+\brief Send byte from FIFO over UART
+
+\param[in] desc UART descriptor
+******************************************************************************/
+void halUartTx(HAL_UartDescriptor_t *desc);
+
+/**************************************************************************//**
+\brief Store received byte to FIFO
+
+\param[in] desc UART descriptor
+******************************************************************************/
+void halUartStoreRx(HAL_UartDescriptor_t *desc);
+
+/**************************************************************************//**
+\brief UART transmission complete handler
+
+\param[in] desc UART descriptor
+******************************************************************************/
+void halSigUartTransmissionComplete(HAL_UartDescriptor_t *desc);
+
+/**************************************************************************//**
+\brief UART reception complete handler
+
+\param[in] desc UART descriptor
+******************************************************************************/
+void halSigUartReceptionComplete(HAL_UartDescriptor_t *desc);
+
+/**************************************************************************//**
+\brief UART error handler
+
+\param[in] desc UART descriptor
+******************************************************************************/
+void halSigUartErrorOccurred(HAL_UartDescriptor_t *desc);
+
+#endif /* _UART_H */
+// eof uart.h