summaryrefslogtreecommitdiff
path: root/cc3200/fatfs/src/ffconf.c
diff options
context:
space:
mode:
authorDaniel Campora <daniel@wipy.io>2015-09-16 14:09:51 +0200
committerDaniel Campora <daniel@wipy.io>2015-09-21 22:30:32 +0200
commitdffa9f6da65cd03e834b2ed3914f40428f72e49f (patch)
tree1f2e51f17c511f884db77e47d481c0f9c1b6bed2 /cc3200/fatfs/src/ffconf.c
parent660f8613fd8e38863998a9758d97eada0eebc47d (diff)
cc3200: New SD and RTC API plus os and time modules' extensions.
Diffstat (limited to 'cc3200/fatfs/src/ffconf.c')
-rw-r--r--cc3200/fatfs/src/ffconf.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/cc3200/fatfs/src/ffconf.c b/cc3200/fatfs/src/ffconf.c
index e3c425e33..5726db1bc 100644
--- a/cc3200/fatfs/src/ffconf.c
+++ b/cc3200/fatfs/src/ffconf.c
@@ -26,11 +26,11 @@
#include <string.h>
-#include "py/mpconfig.h"
-#include "py/misc.h"
+#include "py/mpstate.h"
#include "ff.h"
#include "ffconf.h"
#include "diskio.h"
+#include "moduos.h"
#if _FS_RPATH
extern BYTE ff_CurrVol;
@@ -65,31 +65,29 @@ int ff_get_ldnumber (const TCHAR **path) {
}
if (check_path(path, "/flash", 6)) {
- return 0;
+ return FLASH;
}
-#if MICROPY_HW_HAS_SDCARD
- else if (check_path(path, "/sd", 3)) {
- return 1;
- }
-#endif
else {
- return -1;
+ for (mp_uint_t i = 0; i < MP_STATE_PORT(mount_obj_list).len; i++) {
+ os_fs_mount_t *mount_obj = ((os_fs_mount_t *)(MP_STATE_PORT(mount_obj_list).items[i]));
+ if (check_path(path, mount_obj->path, mount_obj->pathlen)) {
+ return mount_obj->vol;
+ }
+ }
}
+
+ return -1;
}
void ff_get_volname(BYTE vol, TCHAR **dest) {
-#if MICROPY_HW_HAS_SDCARD
- if (vol == 0)
-#endif
- {
+ if (vol == FLASH) {
memcpy(*dest, "/flash", 6);
*dest += 6;
+ } else {
+ os_fs_mount_t *mount_obj;
+ if ((mount_obj = osmount_find_by_volume(vol))) {
+ memcpy(*dest, mount_obj->path, mount_obj->pathlen);
+ *dest += mount_obj->pathlen;
+ }
}
-#if MICROPY_HW_HAS_SDCARD
- else
- {
- memcpy(*dest, "/sd", 3);
- *dest += 3;
- }
-#endif
}