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
GitLab 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
651a1882
"lib/libc/string0.c" did not exist on "81b2ddf5d175ee810b93925da49754ca18a3e607"
Commit
651a1882
authored
9 years ago
by
Paul Sokolovsky
Browse files
Options
Downloads
Patches
Plain Diff
extmod/vfs_fat_diskio: Actually support sectors != 512 with Python blockdevs.
parent
13394a63
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
extmod/vfs_fat_diskio.c
+8
-2
8 additions, 2 deletions
extmod/vfs_fat_diskio.c
with
8 additions
and
2 deletions
extmod/vfs_fat_diskio.c
+
8
−
2
View file @
651a1882
...
...
@@ -40,6 +40,12 @@
#include
"lib/fatfs/diskio.h"
/* FatFs lower layer API */
#include
"extmod/fsusermount.h"
#if _MAX_SS == _MIN_SS
#define SECSIZE(fs) (_MIN_SS)
#else
#define SECSIZE(fs) ((fs)->ssize)
#endif
STATIC
fs_user_mount_t
*
disk_get_device
(
uint
id
)
{
if
(
id
<
MP_ARRAY_SIZE
(
MP_STATE_PORT
(
fs_user_mount
)))
{
return
MP_STATE_PORT
(
fs_user_mount
)[
id
];
...
...
@@ -122,7 +128,7 @@ DRESULT disk_read (
}
}
else
{
vfs
->
readblocks
[
2
]
=
MP_OBJ_NEW_SMALL_INT
(
sector
);
vfs
->
readblocks
[
3
]
=
mp_obj_new_bytearray_by_ref
(
count
*
512
,
buff
);
vfs
->
readblocks
[
3
]
=
mp_obj_new_bytearray_by_ref
(
count
*
SECSIZE
(
&
vfs
->
fatfs
)
,
buff
);
mp_call_method_n_kw
(
2
,
0
,
vfs
->
readblocks
);
// TODO handle error return
}
...
...
@@ -159,7 +165,7 @@ DRESULT disk_write (
}
}
else
{
vfs
->
writeblocks
[
2
]
=
MP_OBJ_NEW_SMALL_INT
(
sector
);
vfs
->
writeblocks
[
3
]
=
mp_obj_new_bytearray_by_ref
(
count
*
512
,
(
void
*
)
buff
);
vfs
->
writeblocks
[
3
]
=
mp_obj_new_bytearray_by_ref
(
count
*
SECSIZE
(
&
vfs
->
fatfs
)
,
(
void
*
)
buff
);
mp_call_method_n_kw
(
2
,
0
,
vfs
->
writeblocks
);
// TODO handle error return
}
...
...
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