@@ -158,9 +158,8 @@ int SDIOBlockDevice::deinit()
158
158
return status;
159
159
}
160
160
161
- int SDIOBlockDevice::read (void *b , bd_addr_t addr, bd_size_t size)
161
+ int SDIOBlockDevice::read (void *buffer , bd_addr_t addr, bd_size_t size)
162
162
{
163
- // debug_if(SD_DBG, "read Card...\r\n");
164
163
lock ();
165
164
if (isPresent () == false )
166
165
{
@@ -179,7 +178,7 @@ int SDIOBlockDevice::read(void *b, bd_addr_t addr, bd_size_t size)
179
178
return SD_BLOCK_DEVICE_ERROR_NO_INIT;
180
179
}
181
180
182
- uint32_t *buffer = static_cast <uint32_t *>(b );
181
+ uint32_t *_buffer = static_cast <uint32_t *>(buffer );
183
182
184
183
// ReadBlocks uses byte unit address
185
184
// SDHC and SDXC Cards different addressing is handled in ReadBlocks()
@@ -194,7 +193,7 @@ int SDIOBlockDevice::read(void *b, bd_addr_t addr, bd_size_t size)
194
193
}
195
194
196
195
// receive the data : one block/ multiple blocks is handled in ReadBlocks()
197
- int status = SD_ReadBlocks_DMA (buffer , addr, blockCnt);
196
+ int status = SD_ReadBlocks_DMA (_buffer , addr, blockCnt);
198
197
debug_if (SD_DBG, " ReadBlocks dbgtest addr: %lld blockCnt: %lld \n " , addr, blockCnt);
199
198
200
199
if (status == MSD_OK)
@@ -227,9 +226,8 @@ int SDIOBlockDevice::read(void *b, bd_addr_t addr, bd_size_t size)
227
226
return status;
228
227
}
229
228
230
- int SDIOBlockDevice::program (const void *b , bd_addr_t addr, bd_size_t size)
229
+ int SDIOBlockDevice::program (const void *buffer , bd_addr_t addr, bd_size_t size)
231
230
{
232
- // debug_if(SD_DBG, "program Card...\r\n");
233
231
lock ();
234
232
235
233
if (isPresent () == false )
@@ -249,9 +247,8 @@ int SDIOBlockDevice::program(const void *b, bd_addr_t addr, bd_size_t size)
249
247
return SD_BLOCK_DEVICE_ERROR_NO_INIT;
250
248
}
251
249
252
- // uint32_t *buffer = static_cast< uint32_t *>(b);
253
250
// HAL layer uses uint32_t for addr/size
254
- uint32_t *buffer = (uint32_t *)(b );
251
+ uint32_t *_buffer = (uint32_t *)(buffer );
255
252
256
253
// Get block count
257
254
bd_size_t blockCnt = size / _block_size;
@@ -264,7 +261,7 @@ int SDIOBlockDevice::program(const void *b, bd_addr_t addr, bd_size_t size)
264
261
wait_ms (1 );
265
262
}
266
263
267
- int status = SD_WriteBlocks_DMA (buffer , addr, blockCnt);
264
+ int status = SD_WriteBlocks_DMA (_buffer , addr, blockCnt);
268
265
debug_if (SD_DBG, " WriteBlocks dbgtest addr: %lld blockCnt: %lld \n " , addr, blockCnt);
269
266
270
267
if (status == MSD_OK)
@@ -369,10 +366,12 @@ bool SDIOBlockDevice::_is_valid_trim(bd_addr_t addr, bd_size_t size)
369
366
370
367
bool SDIOBlockDevice::isPresent (void )
371
368
{
372
- if (_cardDetect.is_connected ())
369
+ if (_cardDetect.is_connected ()) {
373
370
return (_cardDetect.read () == 0 );
374
- else
371
+ }
372
+ else {
375
373
return true ;
374
+ }
376
375
}
377
376
378
377
} // namespace mbed
0 commit comments