Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

device.h

Go to the documentation of this file.
00001 #ifndef _SYS_DEVICE_H_
00002 #define _SYS_DEVICE_H_
00003 
00004 /*
00005  * Copyright (C) 2001-2002 by egnite Software GmbH. All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in the
00015  *    documentation and/or other materials provided with the distribution.
00016  * 3. All advertising materials mentioning features or use of this
00017  *    software must display the following acknowledgement:
00018  *
00019  *    This product includes software developed by egnite Software GmbH
00020  *    and its contributors.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
00023  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00025  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
00026  * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00029  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00030  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00031  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00032  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00033  * SUCH DAMAGE.
00034  *
00035  * For additional information see http://www.ethernut.de/
00036  *
00037  */
00038 
00039 /*
00040  * $Log: device.h,v $
00041  * Revision 1.2  2003/01/24 12:01:11  przemko
00042  * Obciecie dosowych znakow konca lini
00043  *
00044  * Revision 1.1.1.1  2002/12/07 07:16:52  marwi
00045  *
00046  *
00047  * Revision 1.14  2002/11/02 15:17:01  harald
00048  * Library dependencies moved to compiler.h
00049  *
00050  * Revision 1.13  2002/09/15 16:46:28  harald
00051  * *** empty log message ***
00052  *
00053  * Revision 1.12  2002/08/08 17:24:21  harald
00054  * Using time constants by KU
00055  *
00056  * Revision 1.11  2002/07/03 16:45:41  harald
00057  * Using GCC 3.2
00058  *
00059  * Revision 1.10  2002/06/26 17:29:28  harald
00060  * First pre-release with 2.4 stack
00061  *
00062  */
00063 
00064 #include <sys/types.h>
00065 
00075 
00076 
00077 // wait times for emulation and reality
00078 // has to be overworked
00079 
00080 #ifndef __EMULATION__
00081 #define WAIT5           5
00082 #define WAIT50          50
00083 #define WAIT100         100
00084 #define WAIT250         250
00085 #define WAIT500         500
00086 #else
00087 #define WAIT5           1
00088 #define WAIT50          5
00089 #define WAIT100         10
00090 #define WAIT250         25
00091 #define WAIT500         50
00092 #endif
00093 
00094 
00095 
00096 
00097 #define IFTYP_RAM       0   
00098 #define IFTYP_ROM       1   
00099 #define IFTYP_STREAM    2   
00100 #define IFTYP_NET       3   
00105 typedef struct _NUTDEVICE NUTDEVICE;
00106 
00111 struct _NUTDEVICE {
00112     NUTDEVICE *dev_next;       
00113     u_char  dev_name[9];    
00114     u_char  dev_type;       
00121     u_short dev_base;       
00126     u_char  dev_irq;        
00131     void   *dev_icb;        
00137     void   *dev_dcb;        
00140     int   (*dev_init)(NUTDEVICE *);   
00145     int   (*dev_ioctl)(NUTDEVICE *, int, void *);  
00149 };
00157 
00158 #define UART_SETSPEED       0x0101  
00159 #define UART_GETSPEED       0x0102  
00160 #define UART_SETDATABITS    0x0103  
00161 #define UART_GETDATABITS    0x0104  
00162 #define UART_SETPARITY      0x0105  
00163 #define UART_GETPARITY      0x0106  
00164 #define UART_SETSTOPBITS    0x0107  
00165 #define UART_GETSTOPBITS    0x0108  
00166 #define UART_SETSTATUS      0x0109  
00167 #define UART_GETSTATUS      0x010a  
00168 #define UART_SETREADTIMEOUT 0x010b  
00169 #define UART_GETREADTIMEOUT 0x010c  
00170 #define UART_SETWRITETIMEOUT 0x010d 
00171 #define UART_GETWRITETIMEOUT 0x010e 
00173 #define DIO_SETSTATUS       0x0209  
00174 #define DIO_GETSTATUS       0x020a  
00175 #define DIO_WAITSTATUS      0x020b  
00178 
00179 
00183 #define UART_FRAMINGERROR   0x00000001  
00184 #define UART_OVERRUNERROR   0x00000002  
00185 #define UART_RXBUFFEREMPTY  0x00000004  
00186 #define UART_TXBUFFEREMPTY  0x00000008  
00188 
00189 extern NUTDEVICE *nutDeviceList;
00190 
00191 extern int NutRegisterDevice(NUTDEVICE *dev, u_short base, u_char irq);
00192 extern NUTDEVICE *NutDeviceLookup(CONST char *name);
00193 extern NUTDEVICE *NutDeviceOpen(CONST char *name);
00194 extern int NutDeviceClose(NUTDEVICE *dev);
00195 extern int NutDeviceRead(NUTDEVICE *dev, void *data, int size);
00196 extern int NutDeviceReadTran(NUTDEVICE *dev, void *data, int size);
00197 extern int NutDeviceGetLine(NUTDEVICE *dev, void *data, int size);
00198 extern int NutDeviceWrite(NUTDEVICE *dev, CONST void *data, int len);
00199 extern int NutDeviceWriteTran(NUTDEVICE *dev, CONST void *data);
00200 extern int NutDeviceWrite_P(NUTDEVICE *dev, PGM_P data, int len);
00201 extern int NutDeviceIOCtl(NUTDEVICE *dev, int req, void *conf);
00202 
00203 #ifdef __GNUC__
00204 #ifdef __AVR_ATmega128__
00205 #define UDR     UDR0
00206 #define UBRR    UBRR0L
00207 #define USR     UCSR0A
00208 #define UCR     UCSR0B
00209 #define EICR    EICRB
00210 #endif
00211 #endif
00212 
00213 #endif

Generated on Thu Jan 30 22:30:44 2003 for EduNet by doxygen1.2.18