OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [io/] [fileio/] [v2_0/] [src/] [fio.h] - Blame information for rev 27

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
#ifndef CYGONCE_FIO_H
2
#define CYGONCE_FIO_H
3
//=============================================================================
4
//
5
//      fio.h
6
//
7
//      Fileio private header
8
//
9
//=============================================================================
10
//####ECOSGPLCOPYRIGHTBEGIN####
11
// -------------------------------------------
12
// This file is part of eCos, the Embedded Configurable Operating System.
13
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
14
// Copyright (C) 2002 Nick Garnett
15
//
16
// eCos is free software; you can redistribute it and/or modify it under
17
// the terms of the GNU General Public License as published by the Free
18
// Software Foundation; either version 2 or (at your option) any later version.
19
//
20
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
21
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
22
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23
// for more details.
24
//
25
// You should have received a copy of the GNU General Public License along
26
// with eCos; if not, write to the Free Software Foundation, Inc.,
27
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
28
//
29
// As a special exception, if other files instantiate templates or use macros
30
// or inline functions from this file, or you compile this file and link it
31
// with other works to produce a work based on this file, this file does not
32
// by itself cause the resulting work to be covered by the GNU General Public
33
// License. However the source code for this file must still be made available
34
// in accordance with section (3) of the GNU General Public License.
35
//
36
// This exception does not invalidate any other reasons why a work based on
37
// this file might be covered by the GNU General Public License.
38
//
39
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
40
// at http://sources.redhat.com/ecos/ecos-license/
41
// -------------------------------------------
42
//####ECOSGPLCOPYRIGHTEND####
43
//=============================================================================
44
//#####DESCRIPTIONBEGIN####
45
//
46
// Author(s):     nickg
47
// Contributors:  nickg
48
// Date:          2000-05-25
49
// Purpose:       Fileio private header
50
// Description:   This file contains private definitions for communication
51
//                between the parts of the fileio package.
52
//              
53
// Usage:
54
//              #include "fio.h"
55
//              ...
56
//              
57
//
58
//####DESCRIPTIONEND####
59
//
60
//=============================================================================
61
 
62
#include <pkgconf/hal.h>
63
#include <pkgconf/io_fileio.h>
64
#include <pkgconf/isoinfra.h>
65
 
66
#include <cyg/infra/cyg_type.h>
67
 
68
#include <stddef.h>             // NULL, size_t
69
#include <unistd.h>
70
#include <limits.h>
71
#include <sys/types.h>
72
 
73
#include <cyg/fileio/fileio.h>
74
#include <cyg/fileio/sockio.h>
75
 
76
#include <errno.h>
77
 
78
#ifdef CYGPKG_KERNEL
79
#include <pkgconf/kernel.h>
80
#include <cyg/kernel/mutex.hxx>        // mutex definitions
81
 
82
#define FILEIO_MUTEX_LOCK(_m_)   ((_m_).lock())
83
#define FILEIO_MUTEX_UNLOCK(_m_) ((_m_).unlock())
84
 
85
#else
86
#define FILEIO_MUTEX_LOCK(_m_) 
87
#define FILEIO_MUTEX_UNLOCK(_m_)
88
#endif
89
 
90
 
91
//=============================================================================
92
// POSIX API support
93
 
94
#ifdef CYGPKG_POSIX
95
 
96
#include <cyg/posix/export.h>
97
 
98
#define CYG_FILEIO_FUNCTION_START() CYG_POSIX_FUNCTION_START()
99
 
100
#define CYG_FILEIO_FUNCTION_FINISH() CYG_POSIX_FUNCTION_FINISH()
101
 
102
#define CYG_FILEIO_SIGMASK_SET( __set, __oset ) \
103
        CYG_PTHREAD_SIGMASK_SET( __set, __oset )
104
 
105
#define CYG_FILEIO_SIGPENDING() CYG_POSIX_SIGPENDING()
106
 
107
#define CYG_FILEIO_DELIVER_SIGNALS( __mask ) \
108
        CYG_POSIX_DELIVER_SIGNALS( __mask )
109
 
110
#else
111
 
112
#define CYG_FILEIO_FUNCTION_START() CYG_EMPTY_STATEMENT
113
 
114
#define CYG_FILEIO_FUNCTION_FINISH() CYG_EMPTY_STATEMENT
115
 
116
#define CYG_FILEIO_SIGMASK_SET( __set, __oset ) CYG_EMPTY_STATEMENT
117
 
118
#define CYG_FILEIO_SIGPENDING() (0)
119
 
120
#define CYG_FILEIO_DELIVER_SIGNALS( __mask ) CYG_EMPTY_STATEMENT
121
 
122
typedef int sigset_t;
123
 
124
#endif
125
 
126
//=============================================================================
127
// Fileio function entry and return macros.
128
 
129
// Handle entry to a fileio package function. 
130
#define FILEIO_ENTRY()                          \
131
    CYG_REPORT_FUNCTYPE( "returning %d" );      \
132
    CYG_FILEIO_FUNCTION_START();                \
133
 
134
// Do a fileio package defined return. This requires the error code
135
// to be placed in errno, and if it is non-zero, -1 returned as the
136
// result of the function. This also gives us a place to put any
137
// generic tidyup handling needed for things like signal delivery and
138
// cancellation.
139
#define FILEIO_RETURN(err)                      \
140
CYG_MACRO_START                                 \
141
    int __retval = 0;                           \
142
    CYG_FILEIO_FUNCTION_FINISH();               \
143
    if( err != 0 ) __retval = -1, errno = err;  \
144
    CYG_REPORT_RETVAL( __retval );              \
145
    return __retval;                            \
146
CYG_MACRO_END
147
 
148
#define FILEIO_RETURN_VALUE(val)                \
149
CYG_MACRO_START                                 \
150
    CYG_FILEIO_FUNCTION_FINISH();               \
151
    CYG_REPORT_RETVAL( val );                   \
152
    return val;                                 \
153
CYG_MACRO_END
154
 
155
#define FILEIO_RETURN_VOID()                    \
156
CYG_MACRO_START                                 \
157
    CYG_FILEIO_FUNCTION_FINISH();               \
158
    CYG_REPORT_RETURN();                        \
159
    return;                                     \
160
CYG_MACRO_END
161
 
162
//=============================================================================
163
// Cancellation support
164
// If the POSIX package is present we want to include cancellation points
165
// in the routines that are defined to contain them.
166
// The macro CYG_CANCELLATION_POINT does this.
167
 
168
#ifdef CYGINT_ISO_PTHREAD_IMPL
169
 
170
# include <pthread.h>
171
 
172
# define CYG_CANCELLATION_POINT pthread_testcancel()
173
 
174
#else
175
 
176
# define CYG_CANCELLATION_POINT CYG_EMPTY_STATEMENT
177
 
178
#endif
179
 
180
//=============================================================================
181
// Internal exports
182
 
183
//-----------------------------------------------------------------------------
184
// Exports from misc.cxx
185
 
186
// Current directory info
187
__externC cyg_mtab_entry *cdir_mtab_entry;
188
__externC cyg_dir cdir_dir;
189
 
190
__externC int cyg_mtab_lookup( cyg_dir *dir, const char **name, cyg_mtab_entry **mte);
191
 
192
__externC void cyg_fs_lock( cyg_mtab_entry *mte, cyg_uint32 syncmode );
193
 
194
__externC void cyg_fs_unlock( cyg_mtab_entry *mte, cyg_uint32 syncmode );
195
 
196
//-----------------------------------------------------------------------------
197
// Exports from fd.cxx
198
 
199
__externC void cyg_fd_init();
200
 
201
__externC cyg_file *cyg_file_alloc();
202
 
203
__externC void cyg_file_free(cyg_file * fp);
204
 
205
__externC int cyg_fd_alloc(int low);
206
 
207
__externC void cyg_fd_assign(int fd, cyg_file *fp);
208
 
209
__externC int cyg_fd_free(int fd);
210
 
211
__externC cyg_file *cyg_fp_get( int fd );
212
 
213
__externC void cyg_fp_free( cyg_file *fp );
214
 
215
__externC void cyg_file_lock( cyg_file *fp, cyg_uint32 syncmode );
216
 
217
__externC void cyg_file_unlock( cyg_file *fp, cyg_uint32 syncmode );
218
 
219
//-----------------------------------------------------------------------------
220
// Exports from socket.cxx
221
 
222
__externC void cyg_nstab_init();
223
 
224
//-----------------------------------------------------------------------------
225
#endif // ifndef CYGONCE_FIO_H
226
// End of fio.h

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.