From 1d7fb82f0aec11331635532583617d773888b991 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 15 Sep 2014 23:49:57 +0100 Subject: stmhal: Change 64-bit arithmetic to 32-bit for SD card block addressing. By measuring SD card addresses in blocks and not bytes, one can get away with using 32-bit numbers. This patch also uses proper atomic lock/unlock around SD card read/write, adds SD.info() function, and gives error code for failed read/writes. --- stmhal/sdcard.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'stmhal/sdcard.h') diff --git a/stmhal/sdcard.h b/stmhal/sdcard.h index 3a5353467..8197768de 100644 --- a/stmhal/sdcard.h +++ b/stmhal/sdcard.h @@ -32,7 +32,9 @@ bool sdcard_is_present(void); bool sdcard_power_on(void); void sdcard_power_off(void); uint64_t sdcard_get_capacity_in_bytes(void); -bool sdcard_read_blocks(uint8_t *dest, uint32_t block_num, uint32_t num_blocks); -bool sdcard_write_blocks(const uint8_t *src, uint32_t block_num, uint32_t num_blocks); + +// these return 0 on success, non-zero on error +mp_uint_t sdcard_read_blocks(uint8_t *dest, uint32_t block_num, uint32_t num_blocks); +mp_uint_t sdcard_write_blocks(const uint8_t *src, uint32_t block_num, uint32_t num_blocks); extern const struct _mp_obj_base_t pyb_sdcard_obj; -- cgit v1.2.3