aboutsummaryrefslogtreecommitdiff
path: root/stmhal/usbd_msc_storage.c
diff options
context:
space:
mode:
authorDamien George2014-09-15 23:49:57 +0100
committerDamien George2014-09-15 23:49:57 +0100
commit1d7fb82f0aec11331635532583617d773888b991 (patch)
treed1d408fafaa10826967abc1d872a5fc26c7299e1 /stmhal/usbd_msc_storage.c
parent6ff42c54bb2c6e950206c380a100db776e3938d8 (diff)
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.
Diffstat (limited to 'stmhal/usbd_msc_storage.c')
-rw-r--r--stmhal/usbd_msc_storage.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/stmhal/usbd_msc_storage.c b/stmhal/usbd_msc_storage.c
index b6b197226..ab2d4459a 100644
--- a/stmhal/usbd_msc_storage.c
+++ b/stmhal/usbd_msc_storage.c
@@ -321,7 +321,7 @@ int8_t SDCARD_STORAGE_PreventAllowMediumRemoval(uint8_t lun, uint8_t param) {
* @retval Status
*/
int8_t SDCARD_STORAGE_Read(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len) {
- if (!sdcard_read_blocks(buf, blk_addr, blk_len)) {
+ if (sdcard_read_blocks(buf, blk_addr, blk_len) != 0) {
return -1;
}
return 0;
@@ -336,7 +336,7 @@ int8_t SDCARD_STORAGE_Read(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_
* @retval Status
*/
int8_t SDCARD_STORAGE_Write(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len) {
- if (!sdcard_write_blocks(buf, blk_addr, blk_len)) {
+ if (sdcard_write_blocks(buf, blk_addr, blk_len) != 0) {
return -1;
}
return 0;