uart.h

Go to the documentation of this file.
00001 /******************************************************************************/
00013 #ifndef _UART_H
00014 #define _UART_H
00015 
00016 /******************************************************************************
00017                    Includes section
00018 ******************************************************************************/
00019 // \cond
00020 #include <halUart.h>
00021 
00022 /******************************************************************************
00023                    Define(s) section
00024 ******************************************************************************/
00025 #define UART_FLOW_CONTROL_NONE 0
00026 #define UART_FLOW_CONTROL_HARDWARE 1
00027 #define UART_DTR_CONTROL 2
00028 // this define is used only by HAL.
00029 #define USART_SPI_MODE 16
00030 
00031 #ifndef NUM_USART_CHANNELS
00032 #define NUM_USART_CHANNELS 1 // Number of USART channels
00033 #endif
00034 // \endcond
00035 
00036 /******************************************************************************
00037                    Types section
00038 ******************************************************************************/
00040 typedef struct
00041 {
00044   uint8_t tty;
00049   UartMode_t mode;
00060   UartBaudRate_t baudrate;  
00066   UartData_t dataLength;          
00071   UartParity_t parity;       
00075   UartStopBits_t stopbits;  
00079   UartSyncMode_t edge;
00081   UartClckMode_t syncMode;  
00085   uint8_t *rxBuffer; 
00087   uint16_t rxBufferLength; 
00091   uint8_t *txBuffer; 
00093   uint16_t txBufferLength; 
00097   void (*rxCallback)(uint8_t);
00100   void (*txCallback)();
00102   uint8_t flowControl;
00103 } HAL_UartDescriptor_t;
00104 
00105 /******************************************************************************
00106                    Prototypes section
00107 ******************************************************************************/
00108 /**************************************************************************/
00120 int HAL_OpenUart(HAL_UartDescriptor_t *descriptor);
00121 
00122 /*************************************************************************/
00132 int HAL_CloseUart(HAL_UartDescriptor_t *descriptor);
00133 
00134 /**************************************************************************/
00153 int HAL_WriteUart(HAL_UartDescriptor_t *descriptor, uint8_t *buffer, uint8_t length);
00154 
00155 /*************************************************************************/
00171 int HAL_ReadUart(HAL_UartDescriptor_t *descriptor, uint8_t *buffer, uint8_t length);
00172 
00173 /**************************************************************************/
00184 int HAL_OnUartCts(HAL_UartDescriptor_t *descriptor);
00185 
00186 /**************************************************************************/
00197 int HAL_OffUartCts(HAL_UartDescriptor_t *descriptor);
00198 
00199 /**************************************************************************/
00210 int HAL_ReadUartRts(HAL_UartDescriptor_t *descriptor);
00211 
00212 /**************************************************************************/
00223 int HAL_ReadUartDtr(HAL_UartDescriptor_t *descriptor);
00224 
00225 /**************************************************************************/
00236 int HAL_IsTxEmpty(HAL_UartDescriptor_t *descriptor);
00237 
00238 /**************************************************************************/
00241 void HAL_EnableDtrWakeUp(void);
00242 
00243 /**************************************************************************/
00246 void HAL_DisableDtrWakeUp(void);
00247 
00248 #endif /* _UART_H */
00249 // eof uart.h

Generated on Wed Apr 2 19:06:16 2008 for ZigBeeNet Stack Documentation by  doxygen 1.5.1-p1