summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien <damien.p.george@gmail.com>2013-12-20 11:45:06 +0000
committerDamien <damien.p.george@gmail.com>2013-12-20 11:45:06 +0000
commitb73085d288ddb29ce23eb297ca2a3742d8aeada8 (patch)
treea6287e30537835eeb1c8218e97bee804dd47b120
parenta3dcd9e80ce8bf7abae3daa8da82f1b085499989 (diff)
downloadmicropython-b73085d288ddb29ce23eb297ca2a3742d8aeada8.tar.gz
micropython-b73085d288ddb29ce23eb297ca2a3742d8aeada8.zip
stm: add pyb.sd_test; flash cache flushed only via MSD.
-rw-r--r--stm/lib/usbd_storage_msd.c1
-rw-r--r--stm/main.c8
-rw-r--r--stm/storage.c1
3 files changed, 9 insertions, 1 deletions
diff --git a/stm/lib/usbd_storage_msd.c b/stm/lib/usbd_storage_msd.c
index a924a868d2..c22abbd11d 100644
--- a/stm/lib/usbd_storage_msd.c
+++ b/stm/lib/usbd_storage_msd.c
@@ -309,6 +309,7 @@ int8_t STORAGE_Write (uint8_t lun,
#endif
*/
disk_write(0, buf, blk_addr, blk_len);
+ storage_flush(); // XXX hack for now so that the cache is always flushed
return (0);
}
diff --git a/stm/main.c b/stm/main.c
index fb8ef28b80..a262a917e7 100644
--- a/stm/main.c
+++ b/stm/main.c
@@ -367,6 +367,13 @@ static py_obj_t pyb_info(void) {
return py_const_none;
}
+// SD card test
+static py_obj_t pyb_sd_test(void) {
+ extern void sdio_init(void);
+ sdio_init();
+ return py_const_none;
+}
+
static void SYSCLKConfig_STOP(void) {
/* After wake-up from STOP reconfigure the system clock */
/* Enable HSE */
@@ -1010,6 +1017,7 @@ soft_reset:
py_obj_t m = py_module_new();
rt_store_attr(m, qstr_from_str_static("info"), rt_make_function_0(pyb_info));
+ rt_store_attr(m, qstr_from_str_static("sd_test"), rt_make_function_0(pyb_sd_test));
rt_store_attr(m, qstr_from_str_static("stop"), rt_make_function_0(pyb_stop));
rt_store_attr(m, qstr_from_str_static("standby"), rt_make_function_0(pyb_standby));
rt_store_attr(m, qstr_from_str_static("source_dir"), rt_make_function_1(pyb_source_dir));
diff --git a/stm/storage.c b/stm/storage.c
index 576c83a560..ac0458d136 100644
--- a/stm/storage.c
+++ b/stm/storage.c
@@ -152,7 +152,6 @@ bool storage_write_block(const uint8_t *src, uint32_t block) {
uint8_t *dest = cache_get_addr_for_write(flash_addr);
memcpy(dest, src, BLOCK_SIZE);
sys_tick_counter_last_write = sys_tick_counter;
- cache_flush(); // XXX hack for now so that the cache is always flushed
return true;
} else {