00001 /* --------------------------------------------------------------------------- 00002 * Copyright (C) 2003 Dallas Semiconductor Corporation, All Rights Reserved. 00003 * 00004 * Permission is hereby granted, free of charge, to any person obtaining a 00005 * copy of this software and associated documentation files (the "Software"), 00006 * to deal in the Software without restriction, including without limitation 00007 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00008 * and/or sell copies of the Software, and to permit persons to whom the 00009 * Software is furnished to do so, subject to the following conditions: 00010 * 00011 * The above copyright notice and this permission notice shall be included 00012 * in all copies or substantial portions of the Software. 00013 * 00014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00015 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00016 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00017 * IN NO EVENT SHALL DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES 00018 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00019 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00020 * OTHER DEALINGS IN THE SOFTWARE. 00021 * 00022 * Except as contained in this notice, the name of Dallas Semiconductor 00023 * shall not be used except as stated in the Dallas Semiconductor 00024 * Branding Policy. 00025 * --------------------------------------------------------------------------- 00026 */ 00027 #ifndef _STDIO 00028 #define _STDIO 00029 00030 #include <stddef.h> 00031 00076 #define FS_VERSION 8 00077 00078 00079 #ifndef NULL 00080 00082 #define NULL ((void *) 0) 00083 #endif 00084 00085 #ifndef _SIZE_T 00086 00088 #define _SIZE_T 00089 typedef unsigned int size_t; 00090 #endif 00091 00092 #ifndef _OFF_T 00093 00095 #define _OFF_T 00096 typedef unsigned int off_t; 00097 #endif 00098 00099 #ifndef _FPOS_T 00100 00102 #define _FPOS_T 00103 typedef long fpos_t; 00104 #endif 00105 00106 00109 #define FILE_FLAGS_EOF 1 00110 00112 #define FILE_FLAGS_TEMP 2 00113 00118 #define FILE_TYPE_TINIFS 1 00119 00125 struct file_structure 00126 { 00127 int flags; 00128 int error; 00129 int type; 00130 void* fd; 00131 unsigned char* fname_copy; 00132 }; 00133 00136 typedef struct file_structure FILE; 00137 00138 #pragma SAVE 00139 #pragma REGPARMS 00140 00141 //Size of <stdio.h> buffers. 00142 // This doesn't really matter right now. We may add it in the future. 00143 //#define BUFSIZ 1024 00144 00145 00146 // WARNING WARNING WARNING!!! If FILENAME_MAX ever changes (unlikely), make sure to change it in nat_fs.a51 as well. 00147 00151 #define FILENAME_MAX 255 00152 00156 #define FOPEN_MAX 8 00157 00160 #define L_tmpnam 20 00161 00162 00167 #define SEEK_CUR 0x5555 00168 00172 #define SEEK_END 0x5556 00173 00176 #define SEEK_SET 0x5557 00177 00181 #define TMP_MAX 10 00182 00185 #define EOF -1 00186 00190 #define P_tmpdir "temp" 00191 00203 //--------------------------------------------------------------------------- 00204 void clearerr(FILE* f_handle); 00205 00222 //--------------------------------------------------------------------------- 00223 int fclose(FILE* f_handle); 00224 00238 //--------------------------------------------------------------------------- 00239 int feof(FILE* f_handle); 00240 00255 //--------------------------------------------------------------------------- 00256 int ferror(FILE* f_handle); 00257 00276 //--------------------------------------------------------------------------- 00277 int fgetc(FILE* f_handle); 00278 00299 //--------------------------------------------------------------------------- 00300 int fgetpos(FILE* f_handle, fpos_t* position); 00301 00327 //--------------------------------------------------------------------------- 00328 char* fgets(char* string, int num, FILE* f_handle); 00329 00350 //--------------------------------------------------------------------------- 00351 FILE* fopen(const char* filename, const char* mode); 00352 00371 //--------------------------------------------------------------------------- 00372 int fputc(int ch, FILE* f_handle); 00373 00392 //--------------------------------------------------------------------------- 00393 int fputs(const char* str, FILE* f_handle); 00394 00418 //--------------------------------------------------------------------------- 00419 size_t fread(void* ptr, size_t size, size_t num, FILE* f_handle); 00420 00440 //--------------------------------------------------------------------------- 00441 FILE* freopen(const char* newfilename, const char* mode, FILE* old_handle); 00442 00472 //--------------------------------------------------------------------------- 00473 int fseek(FILE* f_handle, long int offset, int tag); 00474 00503 //--------------------------------------------------------------------------- 00504 int fseeko(FILE* f_handle, off_t offset, int tag); 00505 00526 //--------------------------------------------------------------------------- 00527 int fsetpos(FILE* f_handle, const fpos_t* position); 00528 00549 //--------------------------------------------------------------------------- 00550 long ftell(FILE* f_handle); 00551 00572 //--------------------------------------------------------------------------- 00573 off_t ftello(FILE* f_handle); 00574 00590 //--------------------------------------------------------------------------- 00591 void flockfile(FILE* f_handle); 00592 00611 //--------------------------------------------------------------------------- 00612 int ftrylockfile(FILE* f_handle); 00613 00630 //--------------------------------------------------------------------------- 00631 void funlockfile(FILE* f_handle); 00632 00656 //--------------------------------------------------------------------------- 00657 size_t fwrite(const void* ptr, size_t size, size_t num, FILE* f_handle); 00658 00678 //--------------------------------------------------------------------------- 00679 int getc(FILE* f_handle); 00680 00700 //--------------------------------------------------------------------------- 00701 int putc(int value, FILE* f_handle); 00702 00717 //--------------------------------------------------------------------------- 00718 int remove(const char* filename); 00719 00737 //--------------------------------------------------------------------------- 00738 int rename(const char* oldname, const char* newname); 00739 00760 //--------------------------------------------------------------------------- 00761 void rewind(FILE* f_handle); 00762 00785 //--------------------------------------------------------------------------- 00786 char* tempnam(const char* dirname, const char* pfx); 00787 00801 //--------------------------------------------------------------------------- 00802 FILE* tmpfile(void); 00803 00825 //--------------------------------------------------------------------------- 00826 char* tmpnam(char* nametarget); 00827 00843 //--------------------------------------------------------------------------- 00844 int fflush(FILE* f_handle); 00845 00846 00847 00848 // Non-standard functions that are useful/necessary. 00849 00850 00851 00880 //--------------------------------------------------------------------------- 00881 int fcleaninit(char numfd, int numblocks, void* start_address); 00882 00915 //--------------------------------------------------------------------------- 00916 int finit(char numfd, int numblocks, void* start_address); 00917 00931 //--------------------------------------------------------------------------- 00932 int fexists(char* filename); 00933 00956 //--------------------------------------------------------------------------- 00957 void* fopen_fd(const char* filename, const char* mode); 00958 00981 //--------------------------------------------------------------------------- 00982 unsigned int freadbytes(void* buffer, int length, FILE* stream); 00983 01005 //--------------------------------------------------------------------------- 01006 unsigned int fwritebytes(void* buffer, int length, FILE* stream); 01007 01021 //--------------------------------------------------------------------------- 01022 unsigned long getfreefsram(); 01023 01034 //--------------------------------------------------------------------------- 01035 int mkdir(char* dirname); 01036 01037 01038 01039 01040 /* 01041 * The following functions are provided by the Keil libraries. We re-export them 01042 * since we are basically overriding stdio.h here. Please see the Keil 01043 * documentation for information on these functions. 01044 */ 01045 01052 extern char _getkey (void); 01059 extern char getchar (void); 01066 extern char ungetchar (char); 01073 extern char putchar (char); 01080 extern int printf (const char *, ...); 01087 extern int sprintf (char *, const char *, ...); 01094 extern int vprintf (const char *, char *); 01101 extern int vsprintf (char *, const char *, char *); 01108 extern char *gets (char *, int n); 01115 extern int scanf (const char *, ...); 01122 extern int sscanf (char *, const char *, ...); 01129 extern int puts (const char *); 01130 01131 01137 //--------------------------------------------------------------------------- 01138 unsigned int filesystem_version(void); 01139 01140 01141 01142 #pragma RESTORE 01143 01144 01145 #endif
| Copyright 2004 Dallas Semiconductor, Inc.. | Documentation generated by Doxygen. |