00001 /* 00002 * Copyright (C) 2001-2003 by egnite Software GmbH. All rights reserved. 00003 * 00004 * Redistribution and use in source and binary forms, with or without 00005 * modification, are permitted provided that the following conditions 00006 * are met: 00007 * 00008 * 1. Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * 2. Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * 3. Neither the name of the copyright holders nor the names of 00014 * contributors may be used to endorse or promote products derived 00015 * from this software without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS 00018 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00019 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00020 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE 00021 * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00022 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00023 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 00024 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 00025 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00026 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 00027 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00028 * SUCH DAMAGE. 00029 * 00030 * For additional information see http://www.ethernut.de/ 00031 * 00032 */ 00033 00034 /* 00035 * $Log$ 00036 * Revision 1.2 2005/08/02 17:46:45 haraldkipp 00037 * Major API documentation update. 00038 * 00039 * Revision 1.1 2005/07/26 18:02:40 haraldkipp 00040 * Moved from dev. 00041 * 00042 * Revision 1.3 2004/05/24 20:15:49 drsung 00043 * Added function UartAvrSize to return number of chars in input buffer. 00044 * 00045 * Revision 1.2 2004/03/18 14:01:53 haraldkipp 00046 * Deprecated header file removed 00047 * 00048 * Revision 1.1.1.1 2003/05/09 14:40:53 haraldkipp 00049 * Initial using 3.2.1 00050 * 00051 * Revision 1.10 2003/02/04 17:50:55 harald 00052 * Version 3 released 00053 * 00054 * Revision 1.9 2003/01/14 13:43:32 harald 00055 * Definintions were moved 00056 * 00057 * Revision 1.8 2002/06/26 17:29:08 harald 00058 * First pre-release with 2.4 stack 00059 * 00060 */ 00061 00062 #include <dev/uartavr.h> 00063 00064 extern int UartAvrInit(NUTDEVICE * dev); 00065 extern int UartAvrIOCtl(NUTDEVICE * dev, int req, void *conf); 00066 extern int UartAvrInput(NUTDEVICE * dev); 00067 extern int UartAvrOutput(NUTDEVICE * dev); 00068 extern int UartAvrFlush(NUTDEVICE * dev); 00069 00070 extern int UartAvrGetRaw(uint8_t * cp); 00071 extern int UartAvrPutRaw(uint8_t ch); 00072 00073 extern int UartAvrRead(NUTFILE * fp, void *buffer, int size); 00074 extern int UartAvrWrite(NUTFILE * fp, CONST void *buffer, int len); 00075 #ifdef __HARVARD_ARCH__ 00076 extern int UartAvrWrite_P(NUTFILE * fp, PGM_P buffer, int len); 00077 #endif 00078 extern NUTFILE *UartAvrOpen(NUTDEVICE * dev, CONST char *name, int mode, int acc); 00079 extern long UartAvrSize(NUTFILE * fp); 00080 extern int UartAvrClose(NUTFILE * fp); 00081 00086 00087 00088 static UARTDCB dcb_uart0; 00089 static IFSTREAM ifs_uart0; 00090 00094 NUTDEVICE devUart0 = { 00095 0, 00096 {'u', 'a', 'r', 't', '0', 0, 0, 0, 0}, 00097 IFTYP_STREAM, 00098 0, 00099 0, 00100 &ifs_uart0, 00101 &dcb_uart0, 00102 UartAvrInit, 00103 UartAvrIOCtl, 00104 UartAvrRead, 00105 UartAvrWrite, 00106 UartAvrWrite_P, 00107 UartAvrOpen, 00108 UartAvrClose, 00109 UartAvrSize 00110 }; 00111