Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
41249e17
Commit
41249e17
authored
10 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
stmhal, fatfs: Use stdlib for string fns; make all private fns static.
We save some code bytes by using builtin string functions.
parent
3a2795e2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
stmhal/fatfs/src/ff.c
+27
-4
27 additions, 4 deletions
stmhal/fatfs/src/ff.c
with
27 additions
and
4 deletions
stmhal/fatfs/src/ff.c
+
27
−
4
View file @
41249e17
...
...
@@ -540,15 +540,15 @@ const BYTE ExCvt[] = _EXCVT; /* Upper conversion table for extended characters *
Module Private Functions
---------------------------------------------------------------------------*/
DWORD
clust2sect
(
FATFS
*
fs
,
DWORD
clst
);
DWORD
get_fat
(
FATFS
*
fs
,
DWORD
clst
);
static
DWORD
clust2sect
(
FATFS
*
fs
,
DWORD
clst
);
static
DWORD
get_fat
(
FATFS
*
fs
,
DWORD
clst
);
#if !_FS_READONLY
FRESULT
put_fat
(
FATFS
*
fs
,
DWORD
clst
,
DWORD
val
);
static
FRESULT
put_fat
(
FATFS
*
fs
,
DWORD
clst
,
DWORD
val
);
#endif
/* !_FS_READONLY */
#if _USE_LFN
void
gen_numname
(
BYTE
*
dst
,
const
BYTE
*
src
,
const
WCHAR
*
lfn
,
WORD
seq
);
static
void
gen_numname
(
BYTE
*
dst
,
const
BYTE
*
src
,
const
WCHAR
*
lfn
,
WORD
seq
);
#endif
/* !_USE_LFN */
/*-----------------------------------------------------------------------*/
...
...
@@ -556,6 +556,11 @@ void gen_numname (BYTE* dst, const BYTE* src, const WCHAR* lfn, WORD seq);
/*-----------------------------------------------------------------------*/
/* Copy memory to memory */
#if 1
// We use the original custom version of mem_cpy so that gcc doesn't
// recognise the builtin function and then inline it. Allowing gcc
// to use the builtin memcpy increases code size by 64 bytes.
// TODO need a better (less ad-hoc) way to control this.
static
void
mem_cpy
(
void
*
dst
,
const
void
*
src
,
UINT
cnt
)
{
BYTE
*
d
=
(
BYTE
*
)
dst
;
...
...
@@ -571,8 +576,13 @@ void mem_cpy (void* dst, const void* src, UINT cnt) {
while
(
cnt
--
)
*
d
++
=
*
s
++
;
}
#else
// use stdlib
#define mem_cpy memcpy
#endif
/* Fill memory */
#if 0
static
void mem_set (void* dst, int val, UINT cnt) {
BYTE *d = (BYTE*)dst;
...
...
@@ -580,8 +590,13 @@ void mem_set (void* dst, int val, UINT cnt) {
while (cnt--)
*d++ = (BYTE)val;
}
#else
// use stdlib
#define mem_set memset
#endif
/* Compare memory to memory */
#if 0
static
int mem_cmp (const void* dst, const void* src, UINT cnt) {
const BYTE *d = (const BYTE *)dst, *s = (const BYTE *)src;
...
...
@@ -590,6 +605,10 @@ int mem_cmp (const void* dst, const void* src, UINT cnt) {
while (cnt-- && (r = *d++ - *s++) == 0) ;
return r;
}
#else
// use stdlib
#define mem_cmp memcmp
#endif
/* Check if chr is contained in the string */
static
...
...
@@ -842,6 +861,7 @@ FRESULT sync_fs ( /* FR_OK: successful, FR_DISK_ERR: failed */
/*-----------------------------------------------------------------------*/
static
DWORD
clust2sect
(
/* !=0: Sector number, 0: Failed - invalid cluster# */
FATFS
*
fs
,
/* File system object */
DWORD
clst
/* Cluster# to be converted */
...
...
@@ -860,6 +880,7 @@ DWORD clust2sect ( /* !=0: Sector number, 0: Failed - invalid cluster# */
/*-----------------------------------------------------------------------*/
static
DWORD
get_fat
(
/* 0xFFFFFFFF:Disk error, 1:Internal error, Else:Cluster status */
FATFS
*
fs
,
/* File system object */
DWORD
clst
/* Cluster# to get the link information */
...
...
@@ -903,6 +924,7 @@ DWORD get_fat ( /* 0xFFFFFFFF:Disk error, 1:Internal error, Else:Cluster status
/*-----------------------------------------------------------------------*/
#if !_FS_READONLY
static
FRESULT
put_fat
(
FATFS
*
fs
,
/* File system object */
DWORD
clst
,
/* Cluster# to be changed in range of 2 to fs->n_fatent - 1 */
...
...
@@ -1401,6 +1423,7 @@ void fit_lfn (
/* Create numbered name */
/*-----------------------------------------------------------------------*/
#if _USE_LFN
static
void
gen_numname
(
BYTE
*
dst
,
/* Pointer to generated SFN */
const
BYTE
*
src
,
/* Pointer to source SFN to be modified */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment