Skip to content

Commit 119db67

Browse files
authored
Merge pull request #68 from fpistm/Update_vs_FatFS
chore: align after FatFs update
2 parents e20b7f3 + c61f68e commit 119db67

File tree

3 files changed

+65
-49
lines changed

3 files changed

+65
-49
lines changed

src/Sd2Card.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class Sd2Card {
132132
uint8_t type(void) const;
133133

134134
private:
135-
SD_CardInfo _SdCardInfo;
135+
BSP_SD_CardInfo _SdCardInfo;
136136

137137
};
138138
#endif // sd2Card_h

src/bsp_sd.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ Please update the core or install previous library version."
5959

6060
/*SD Card information structure */
6161

62-
#define SD_CardInfo HAL_SD_CardInfoTypeDef
63-
62+
#define BSP_SD_CardInfo HAL_SD_CardInfoTypeDef
63+
/* For backward compatibility */
64+
#define SD_CardInfo BSP_SD_CardInfo
6465
/*SD status structure definition */
6566
#define MSD_OK ((uint8_t)0x00)
6667
#define MSD_ERROR ((uint8_t)0x01)

src/ffconf_default_68300.h

+61-46
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,23 @@
1-
/**
2-
*
3-
* Portions COPYRIGHT 2017 STMicroelectronics
4-
* Copyright (C) 2017, ChaN, all right reserved.
5-
*
6-
******************************************************************************
7-
*
8-
* <h2><center>&copy; 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+
4421

4522
/*---------------------------------------------------------------------------/
4623
/ FatFs - FAT file system module configuration file
@@ -273,7 +250,7 @@
273250
/ These options have no effect at read-only configuration (_FS_READONLY = 1). */
274251

275252

276-
#define _FS_LOCK 0
253+
#define _FS_LOCK 2
277254
/* The option _FS_LOCK switches file lock function to control duplicated file open
278255
/ and illegal operation to open objects. This option must be 0 when _FS_READONLY
279256
/ is 1.
@@ -285,12 +262,31 @@
285262
/ lock control is independent of re-entrancy. */
286263

287264
#define _FS_REENTRANT 0
265+
#define _USE_MUTEX 0
266+
/* Use CMSIS-OS mutexes as _SYNC_t object instead of Semaphores */
288267

289268
#if _FS_REENTRANT
269+
290270
#include "cmsis_os.h"
291271
#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
294290
/* The option _FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
295291
/ module itself. Note that regardless of this option, file access to different
296292
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
@@ -311,6 +307,7 @@
311307
/* #include <windows.h> // O/S definitions */
312308

313309
#if _USE_LFN == 3
310+
314311
#if !defined(ff_malloc) || !defined(ff_free)
315312
#include <stdlib.h>
316313
#endif
@@ -322,5 +319,23 @@
322319
#if !defined(ff_free)
323320
#define ff_free free
324321
#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+
*/
325340
#endif
326341
/*--- End of configuration options ---*/

0 commit comments

Comments
 (0)