NetBurner 3.1
udefs_f.h
1 /*NB_REVISION*/
2 
3 #ifndef _UDEFS_F_H_
4 #define _UDEFS_F_H_
5 
6 /****************************************************************************
7  *
8  * Copyright (c) 2003 by HCC Embedded
9  *
10  * This software is copyrighted by and is the sole property of
11  * HCC. All rights, title, ownership, or other interests
12  * in the software remain the property of HCC. This
13  * software may only be used in accordance with the corresponding
14  * license agreement. Any unauthorized use, duplication, transmission,
15  * distribution, or disclosure of this software is expressly forbidden.
16  *
17  * This Copyright notice may not be removed or modified without prior
18  * written consent of HCC.
19  *
20  * HCC reserves the right to modify this software without notice.
21  *
22  * HCC Embedded
23  * Budapest 1132
24  * Victor Hugo Utca 11-15
25  * Hungary
26  *
27  * Tel: +36 (1) 450 1302
28  * Fax: +36 (1) 450 1303
29  * http: www.hcc-embedded.com
30  * email: info@hcc-embedded.com
31  *
32  ***************************************************************************/
33 
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #endif
38 
39 /****************************************************************************
40  *
41  * enable this if CAPI (Common API) is used
42  *
43  ***************************************************************************/
44 #define FN_CAPI_USED 0
45 
46 /****************************************************************************
47  *
48  * OEM name
49  *
50  ***************************************************************************/
51 #define OEM_NAME "MSDOS5.0"
52  /*#define OEM_NAME "EFFSFAT"*/
53 
54  /****************************************************************************
55  *
56  * CAPI selected includes
57  *
58  ***************************************************************************/
59 
60 #if FN_CAPI_USED
61 #include "../../fw_port.h"
62 #else
63 
64 /****************************************************************************
65  *
66  * if Unicode is used then comment in HCC_UNICODE define
67  *
68  ***************************************************************************/
69 /* #define HCC_UNICODE */
70 
71 #ifndef HCC_UNICODE
72 #define F_LONGFILENAME 1 /* 0 - 8+3 names 1 - long file names */
73 #define W_CHAR char
74 #else
75 #define F_LONGFILENAME 1 /* don't change it, because unicode version alvays uses long file name */
76 #define W_CHAR wchar
77 #endif
78 
79 #ifdef HCC_UNICODE
80 typedef unsigned short wchar;
81 #endif
82 
83 /****************************************************************************
84  *
85  * volumes definitions
86  *
87  ***************************************************************************/
88 
89 #define FN_MAXVOLUME 5 /* maximum number of volumes */
90 #define FN_MAXTASK 10 /* maximum number of task */
91 
92 #define FN_MAXPATH 256 /* maximum allowed filename or pathname */
93 
94 #define FN_CURRDRIVE 0 /* setting the current drive at startup (-1 means no default current drive)*/
95 
96 #define FN_MUTEX_TYPE OS_CRIT
97 
98 /* select path separator */
99 #if 1
100 #define F_SEPARATORCHAR '/'
101 #else
102 #define F_SEPARATORCHAR '\\'
103 #endif
104 
105 /****************************************************************************
106  *
107  * Last error usage
108  *
109  ***************************************************************************/
110 
111 #if 0
112 /* simple asignment */
113 #define F_SETLASTERROR(ec) (fm->lasterror = (ec))
114 #define F_SETLASTERROR_NORET(ec) (fm->lasterror = (ec))
115 #elif 1
116 /* function calls used for it */
117 #define F_SETLASTERROR(ec) fn_setlasterror(fm, ec)
118 #define F_SETLASTERROR_NORET(ec) fn_setlasterror_noret(fm, ec)
119 #elif 0
120 /* no last error is used (save code space) */
121 #define F_SETLASTERROR(ec) (ec)
122 #define F_SETLASTERROR_NORET(ec)
123 #endif
124 
125 /****************************************************************************
126  *
127  * Close bracket for non CAPI
128  *
129  ***************************************************************************/
130 
131 #endif /* FN_CAPI_USED */
132 
133  /****************************************************************************
134  *
135  * Common defines (for non CAPI and CAPI
136  *
137  ***************************************************************************/
138 
139 #define F_MAXFILES 10 /* maximum number of files */
140 
141 #define F_MAXSEEKPOS 8 /* number of division of fast seeking */
142 
143  /****************************************************************************
144  *
145  * functions definitions
146  *
147  ***************************************************************************/
148 
149  /* Use internal mem functions (memcpy,memset) or switch to library functions */
150  //#define INTERNAL_MEMFN
151 
152  /* Use malloc for cache items */
153  /* #define USE_MALLOC */
154 
155 #ifdef USE_MALLOC
156 #define _malloc(x) malloc(x) /* normally use malloc from library */
157 #define _free(x) free(x) /* normally use free from library */
158 #endif
159 
160 /* Enable FAT caching */
161 #define FATCACHE_ENABLE
162 #if F_LONGFILENAME
163 #define DIRCACHE_ENABLE
164 #endif
165 
166 /* define of allocation of faster searching mechanism */
167 #ifdef USE_MALLOC
168 #define FATBITFIELD_ENABLE
169 #endif
170 
171 #ifdef FATCACHE_ENABLE
172 #define FATCACHE_BLOCKS 4
173 #define FATCACHE_READAHEAD 8 /* max. 256 */
174 #endif
175 
176 #if F_LONGFILENAME
177 #ifdef DIRCACHE_ENABLE
178 #define DIRCACHE_SIZE 32 /* max. 32 (<=max. cluster size) */
179 #endif
180 #endif
181 
182 #define WR_DATACACHE_SIZE 32 /* min. 1 !!!! */
183 
184 #ifdef FATCACHE_ENABLE
185 #define FATCACHE_SIZE (FATCACHE_BLOCKS * FATCACHE_READAHEAD)
186 #endif
187 
188 #ifdef INTERNAL_MEMFN
189 #define _memcpy(d, s, l) _f_memcpy(d, s, l)
190 #define _memset(d, c, l) _f_memset(d, c, l)
191 #else
192 #include <string.h>
193 #define _memcpy(d, s, l) memcpy(d, s, l)
194 #define _memset(d, c, l) memset(d, c, l)
195 #endif
196 
197 #ifdef USE_MALLOC
198 #include <stdlib.h>
199 #endif
200 
201  /****************************************************************************
202  *
203  * Last access date
204  *
205  ***************************************************************************/
206 
207 #define F_UPDATELASTACCESSDATE 0
208  /* it defines if a file is opened for read to update lastaccess time */
209 
210  /****************************************************************************
211  *
212  * Opened file size
213  *
214  ***************************************************************************/
215 
216 #define F_FINDOPENFILESIZE 1
217  /* set F_FINDOPENFILESIZE to 0 if filelength needs to return with 0 for an opened file */
218  /* other case filelength functions can return with opened file length also */
219 
220  /****************************************************************************
221  *
222  * closing bracket for C++
223  *
224  ***************************************************************************/
225 
226 #ifdef __cplusplus
227 }
228 #endif
229 
230 /****************************************************************************
231  *
232  * end of udefs_f.h
233  *
234  ***************************************************************************/
235 
236 #endif /* _UDEFS_F_H_ */