|
1 |
| -/** |
2 |
| - * |
3 |
| - * Portions COPYRIGHT 2017 STMicroelectronics |
4 |
| - * Copyright (C) 2017, ChaN, all right reserved. |
5 |
| - * |
6 |
| - ****************************************************************************** |
7 |
| - * |
8 |
| - * <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V. |
9 |
| - * All rights reserved.</center></h2> |
10 |
| - * |
11 |
| - * Redistribution and use in source and binary forms, with or without |
12 |
| - * modification, are permitted, provided that the following conditions are met: |
13 |
| - * |
14 |
| - * 1. Redistribution of source code must retain the above copyright notice, |
15 |
| - * this list of conditions and the following disclaimer. |
16 |
| - * 2. Redistributions in binary form must reproduce the above copyright notice, |
17 |
| - * this list of conditions and the following disclaimer in the documentation |
18 |
| - * and/or other materials provided with the distribution. |
19 |
| - * 3. Neither the name of STMicroelectronics nor the names of other |
20 |
| - * contributors to this software may be used to endorse or promote products |
21 |
| - * derived from this software without specific written permission. |
22 |
| - * 4. This software, including modifications and/or derivative works of this |
23 |
| - * software, must execute solely and exclusively on microcontroller or |
24 |
| - * microprocessor devices manufactured by or for STMicroelectronics. |
25 |
| - * 5. Redistribution and use of this software other than as permitted under |
26 |
| - * this license is void and will automatically terminate your rights under |
27 |
| - * this license. |
28 |
| - * |
29 |
| - * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" |
30 |
| - * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT |
31 |
| - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A |
32 |
| - * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY |
33 |
| - * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT |
34 |
| - * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
35 |
| - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
36 |
| - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, |
37 |
| - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
38 |
| - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
39 |
| - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
40 |
| - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
41 |
| - * |
42 |
| - ****************************************************************************** |
43 |
| - */ |
| 1 | +/*----------------------------------------------------------------------------/ |
| 2 | +/ FatFs - Generic FAT file system module R0.12c / |
| 3 | +/-----------------------------------------------------------------------------/ |
| 4 | +/ |
| 5 | +/ Copyright (C) 2017, ChaN, all right reserved. |
| 6 | +/ Portions Copyright (C) STMicroelectronics, all right reserved. |
| 7 | +/ |
| 8 | +/ FatFs module is an open source software. Redistribution and use of FatFs in |
| 9 | +/ source and binary forms, with or without modification, are permitted provided |
| 10 | +/ that the following condition is met: |
| 11 | +
|
| 12 | +/ 1. Redistributions of source code must retain the above copyright notice, |
| 13 | +/ this condition and the following disclaimer. |
| 14 | +/ |
| 15 | +/ This software is provided by the copyright holder and contributors "AS IS" |
| 16 | +/ and any warranties related to this software are DISCLAIMED. |
| 17 | +/ The copyright owner or contributors be NOT LIABLE for any damages caused |
| 18 | +/ by use of this software. |
| 19 | +/----------------------------------------------------------------------------*/ |
| 20 | + |
44 | 21 |
|
45 | 22 | /*---------------------------------------------------------------------------/
|
46 | 23 | / FatFs - FAT file system module configuration file
|
|
273 | 250 | / These options have no effect at read-only configuration (_FS_READONLY = 1). */
|
274 | 251 |
|
275 | 252 |
|
276 |
| -#define _FS_LOCK 0 |
| 253 | +#define _FS_LOCK 2 |
277 | 254 | /* The option _FS_LOCK switches file lock function to control duplicated file open
|
278 | 255 | / and illegal operation to open objects. This option must be 0 when _FS_READONLY
|
279 | 256 | / is 1.
|
|
285 | 262 | / lock control is independent of re-entrancy. */
|
286 | 263 |
|
287 | 264 | #define _FS_REENTRANT 0
|
| 265 | +#define _USE_MUTEX 0 |
| 266 | +/* Use CMSIS-OS mutexes as _SYNC_t object instead of Semaphores */ |
288 | 267 |
|
289 | 268 | #if _FS_REENTRANT
|
| 269 | + |
290 | 270 | #include "cmsis_os.h"
|
291 | 271 | #define _FS_TIMEOUT 1000
|
292 |
| - #define _SYNC_t osSemaphoreId |
293 |
| -#endif |
| 272 | + |
| 273 | + #if _USE_MUTEX |
| 274 | + |
| 275 | + #if (osCMSIS < 0x20000U) |
| 276 | + #define _SYNC_t osMutexId |
| 277 | + #else |
| 278 | + #define _SYNC_t osMutexId_t |
| 279 | + #endif |
| 280 | + |
| 281 | + #else |
| 282 | + #if (osCMSIS < 0x20000U) |
| 283 | + #define _SYNC_t osSemaphoreId |
| 284 | + #else |
| 285 | + #define _SYNC_t osSemaphoreId_t |
| 286 | + #endif |
| 287 | + |
| 288 | + #endif |
| 289 | +#endif //_FS_REENTRANT |
294 | 290 | /* The option _FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
|
295 | 291 | / module itself. Note that regardless of this option, file access to different
|
296 | 292 | / volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
|
|
311 | 307 | /* #include <windows.h> // O/S definitions */
|
312 | 308 |
|
313 | 309 | #if _USE_LFN == 3
|
| 310 | + |
314 | 311 | #if !defined(ff_malloc) || !defined(ff_free)
|
315 | 312 | #include <stdlib.h>
|
316 | 313 | #endif
|
|
322 | 319 | #if !defined(ff_free)
|
323 | 320 | #define ff_free free
|
324 | 321 | #endif
|
| 322 | + |
| 323 | + /* by default the system malloc/free are used, but when the FreeRTOS is enabled |
| 324 | + / the macros pvPortMalloc()/vportFree() to be used thus uncomment the code below |
| 325 | + / |
| 326 | + */ |
| 327 | + /* |
| 328 | + #if !defined(ff_malloc) || !defined(ff_free) |
| 329 | + #include "cmsis_os.h" |
| 330 | + #endif |
| 331 | +
|
| 332 | + #if !defined(ff_malloc) |
| 333 | + #define ff_malloc pvPortMalloc |
| 334 | + #endif |
| 335 | +
|
| 336 | + #if !defined(ff_free) |
| 337 | + #define ff_free vPortFree |
| 338 | + #endif |
| 339 | + */ |
325 | 340 | #endif
|
326 | 341 | /*--- End of configuration options ---*/
|
0 commit comments