Nut/OS  4.10.3
API Reference
io.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2001-2004 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  * $Log$
00035  * Revision 1.7  2007/05/02 11:30:33  haraldkipp
00036  * Mapped _write_P to _write for non Harvard architectures.
00037  *
00038  * Revision 1.6  2006/10/08 16:48:09  haraldkipp
00039  * Documentation fixed
00040  *
00041  * Revision 1.5  2005/08/05 11:18:00  olereinhardt
00042  * Added support for _seek, _tell, fseek, ftell functions
00043  *
00044  * Revision 1.4  2005/08/02 17:46:47  haraldkipp
00045  * Major API documentation update.
00046  *
00047  * Revision 1.3  2004/07/30 19:10:42  drsung
00048  * First proposal to define some global ioctl commands.
00049  *
00050  */
00051 
00052 #ifndef _NUT_IO_H_
00053 #define _NUT_IO_H_
00054  
00055  
00056 #include <sys/types.h>
00057 
00062 
00063 /* 
00064  * Some global definitions for ioctl commands.
00065  */
00066 #define IOCTL_GETSTATUS                 0x0001
00067 #define IOCTL_SETSTATUS                 0x0002
00068 #define IOCTL_SETBUFFERMODE             0x0003
00069 #define IOCTL_GETBUFFERMODE             0x0004
00070 #define IOCTL_GETOUTBUFSIZE             0x0005
00071 #define IOCTL_SETOUTBUFSIZE             0x0006
00072 #define IOCTL_GETINBUFSIZE              0x0007
00073 #define IOCTL_SETINBUFSIZE              0x0008
00074 
00078 #define IOCTL_FLUSHOUTBUF               0x0009
00079 
00081 #define IOCTL_GETFILESIZE               0x000A
00082 
00084 #define IOCTL_GETOUTBUFCOUNT            0x000B
00085 
00087 #define IOCTL_GETINBUFCOUNT             0x000C
00088 
00091 extern int _close(int fd);
00092 extern int _open(CONST char *name, int mode);
00093 extern int _read(int fd, void *buffer, size_t count);
00094 extern int _write(int fd, CONST void *buffer, size_t count);
00095 #ifdef __HARVARD_ARCH__
00096 extern int _write_P(int fd, PGM_P buffer, size_t count);
00097 #else
00098 #define _write_P(fd, buffer, count) _write(fd, buffer, count)
00099 #endif
00100 extern int _seek(int fd, long offset, int origin);
00101 extern long _tell(int fd);
00102 
00103 extern int _ioctl(int fd, int cmd, void *buffer);
00104 extern long _filelength(int fd);
00105 
00106 #endif