BSPACM  20150113
Board Support Package for ARM Cortex-M Microcontrollers
fdops.h
Go to the documentation of this file.
1 /* Copyright 2014, Peter A. Bigot
2  *
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * * Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * * Neither the name of the software nor the names of its contributors may be
16  * used to endorse or promote products derived from this software without
17  * specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
41 #ifndef BSPACM_NEWLIB_FDOPS_H
42 #define BSPACM_NEWLIB_FDOPS_H
43 
44 #include <bspacm/core.h>
45 #include <sys/types.h>
46 #include <sys/stat.h>
47 #include <stdarg.h>
48 
49 /* Forward declaration */
51 
55 
81 typedef hBSPACMnewlibFDOPSfile (* fBSPACMnewlibFDOPSdriver) (const char * pathname,
82  int flags);
83 
98 
122  int (* op_close) (struct sBSPACMnewlibFDOPSfile * fp);
123 
126  int (* op_fstat) (struct sBSPACMnewlibFDOPSfile * fp,
127  struct stat * buf);
128 
133  int (* op_isatty) (struct sBSPACMnewlibFDOPSfile * fp);
134 
137  off_t (* op_lseek) (struct sBSPACMnewlibFDOPSfile * fp,
138  off_t offset,
139  int whence);
140 
143  ssize_t (* op_read) (struct sBSPACMnewlibFDOPSfile * fp,
144  void * buf,
145  size_t count);
146 
149  ssize_t (* op_write) (struct sBSPACMnewlibFDOPSfile * fp,
150  const void * buf,
151  size_t count);
152 
154  int (* op_ioctl) (struct sBSPACMnewlibFDOPSfile * fp,
155  int request,
156  va_list ap);
158 
160 typedef struct sBSPACMnewlibFDOPSfile {
163  void * dev;
164 
171 
189 extern hBSPACMnewlibFDOPSfile xBSPACMnewlibFDOPSfile_[];
190 
200 extern const uint8_t nBSPACMnewlibFDOPSfile;
201 
207 extern hBSPACMnewlibFDOPSfile const hBSPACMnewlibFDOPSfileRESERVED;
208 
245 
246 #endif /* BSPACM_NEWLIB_FDOPS_H */
hBSPACMnewlibFDOPSfile const hBSPACMnewlibFDOPSfileRESERVED
hBSPACMnewlibFDOPSfile(* fBSPACMnewlibFDOPSdriver)(const char *pathname, int flags)
Definition: fdops.h:81
void vBSPACMnewlibFDOPSinitializeStdio_(void)
const uint8_t nBSPACMnewlibFDOPSfile
struct sBSPACMnewlibFDOPSfile * hBSPACMnewlibFDOPSfile
Definition: fdops.h:54
Common header included by all BSPACM leaf headers.
ssize_t(* op_read)(struct sBSPACMnewlibFDOPSfile *fp, void *buf, size_t count)
Definition: fdops.h:143
struct sBSPACMnewlibFDOPSfile sBSPACMnewlibFDOPSfile
hBSPACMnewlibFDOPSfile xBSPACMnewlibFDOPSfile_[]
const sBSPACMnewlibFDOPSfileOps * ops
Definition: fdops.h:168
ssize_t(* op_write)(struct sBSPACMnewlibFDOPSfile *fp, const void *buf, size_t count)
Definition: fdops.h:149
int(* op_ioctl)(struct sBSPACMnewlibFDOPSfile *fp, int request, va_list ap)
Definition: fdops.h:154
off_t(* op_lseek)(struct sBSPACMnewlibFDOPSfile *fp, off_t offset, int whence)
Definition: fdops.h:137
Definition: fdops.h:160
int(* op_close)(struct sBSPACMnewlibFDOPSfile *fp)
Definition: fdops.h:122
struct sBSPACMnewlibFDOPSfileOps sBSPACMnewlibFDOPSfileOps
Definition: fdops.h:110
int(* op_isatty)(struct sBSPACMnewlibFDOPSfile *fp)
Definition: fdops.h:133
const fBSPACMnewlibFDOPSdriver xBSPACMnewlibFDOPSdriver[]
int(* op_fstat)(struct sBSPACMnewlibFDOPSfile *fp, struct stat *buf)
Definition: fdops.h:126
void * dev
Definition: fdops.h:163