00001 /*! \file uart.h \brief UART driver for ARM ADuC7000 16450. */ 00002 //***************************************************************************** 00003 // 00004 // File Name : 'uart.h' 00005 // Title : UART driver for ARM ADuC7000 16450 00006 // Author : Pascal Stang - Copyright (C) 2005 00007 // Created : 2/5/2005 00008 // Revised : 2/5/2005 00009 // Version : 0.1 00010 // Target MCU : Analog Devices ARM ADuC7000 Series 00011 // Editor Tabs : 4 00012 // 00013 // This code is distributed under the GNU Public License 00014 // which can be found at http://www.gnu.org/licenses/gpl.txt 00015 // 00016 //***************************************************************************** 00017 00018 #ifndef UART_H 00019 #define UART_H 00020 00021 #include "global.h" 00022 //#include "buffer.h" 00023 #include "aduc7026.h" 00024 00025 // defines 00026 00027 // UART_BAUD calculates a division rate given a baud rate 00028 // for use with uartInit() 00029 // example: uartInit(UART_BAUD(115200), UART_8N1); 00030 // 00031 // BEWARE: additional code will be generated if 'baud' is not a contant 00032 #define UART_BAUD(baud) (uint16_t)((PCLK+baud*8L)/(baud*16)) 00033 00034 // Definitions for UART mode settings (databits, parity, stopbits) 00035 #define UART_8N1 00036 #define UART_7N1 00037 #define UART_8N2 00038 #define UART_7N2 00039 #define UART_8E1 00040 #define UART_7E1 00041 #define UART_8E2 00042 #define UART_7E2 00043 #define UART_8O1 00044 #define UART_7O1 00045 #define UART_8O2 00046 #define UART_7O2 00047 00048 // functions 00049 00050 //! initializes uart 00051 void uartInit(uint16_t baud, uint32_t mode); 00052 00053 //! sends a single byte over the uart 00054 int uartSendByte(int data); 00055 00056 //! gets a single byte from the uart receive buffer 00057 int uartGetByte(void); 00058 00059 00060 #endif