Skip to content

Commit 016abcc

Browse files
committed
code cleanup
- removed comments - renamed short variable names
1 parent 2d8e3d1 commit 016abcc

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

SDIOBlockDevice.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,8 @@ int SDIOBlockDevice::deinit()
158158
return status;
159159
}
160160

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)
162162
{
163-
//debug_if(SD_DBG, "read Card...\r\n");
164163
lock();
165164
if (isPresent() == false)
166165
{
@@ -179,7 +178,7 @@ int SDIOBlockDevice::read(void *b, bd_addr_t addr, bd_size_t size)
179178
return SD_BLOCK_DEVICE_ERROR_NO_INIT;
180179
}
181180

182-
uint32_t *buffer = static_cast<uint32_t *>(b);
181+
uint32_t *_buffer = static_cast<uint32_t *>(buffer);
183182

184183
// ReadBlocks uses byte unit address
185184
// 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)
194193
}
195194

196195
// 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);
198197
debug_if(SD_DBG, "ReadBlocks dbgtest addr: %lld blockCnt: %lld \n", addr, blockCnt);
199198

200199
if (status == MSD_OK)
@@ -227,9 +226,8 @@ int SDIOBlockDevice::read(void *b, bd_addr_t addr, bd_size_t size)
227226
return status;
228227
}
229228

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)
231230
{
232-
//debug_if(SD_DBG, "program Card...\r\n");
233231
lock();
234232

235233
if (isPresent() == false)
@@ -249,9 +247,8 @@ int SDIOBlockDevice::program(const void *b, bd_addr_t addr, bd_size_t size)
249247
return SD_BLOCK_DEVICE_ERROR_NO_INIT;
250248
}
251249

252-
//uint32_t *buffer = static_cast< uint32_t *>(b);
253250
// HAL layer uses uint32_t for addr/size
254-
uint32_t *buffer = (uint32_t *)(b);
251+
uint32_t *_buffer = (uint32_t *)(buffer);
255252

256253
// Get block count
257254
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)
264261
wait_ms(1);
265262
}
266263

267-
int status = SD_WriteBlocks_DMA(buffer, addr, blockCnt);
264+
int status = SD_WriteBlocks_DMA(_buffer, addr, blockCnt);
268265
debug_if(SD_DBG, "WriteBlocks dbgtest addr: %lld blockCnt: %lld \n", addr, blockCnt);
269266

270267
if (status == MSD_OK)
@@ -369,10 +366,12 @@ bool SDIOBlockDevice::_is_valid_trim(bd_addr_t addr, bd_size_t size)
369366

370367
bool SDIOBlockDevice::isPresent(void)
371368
{
372-
if (_cardDetect.is_connected())
369+
if (_cardDetect.is_connected()) {
373370
return (_cardDetect.read() == 0);
374-
else
371+
}
372+
else {
375373
return true;
374+
}
376375
}
377376

378377
} // namespace mbed

0 commit comments

Comments
 (0)