mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 12:45:26 -05:00
Cleanup MV/MD macros a little.
When using variadic macros there's no need for IF_MD2/IF_MV2 to deal with function parameters. IF_MD/IF_MV are enough. Throw in IF_MD_DRV/ID_MV_VOL that return the parameter if MD/MV, or 0 if not. Change-Id: I7605e6039f3be19cb47110c84dcb3c5516f2c3eb
This commit is contained in:
parent
c13f21a4d5
commit
a56f1ca1ed
44 changed files with 219 additions and 218 deletions
|
|
@ -693,7 +693,7 @@ static int sd_select_bank(signed char bank)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start,
|
||||
static int sd_transfer_sectors(IF_MD(int drive,) unsigned long start,
|
||||
int count, void* buf, const bool write)
|
||||
{
|
||||
#ifndef HAVE_MULTIDRIVE
|
||||
|
|
@ -887,19 +887,19 @@ sd_transfer_error_nodma:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int sd_read_sectors(IF_MD2(int drive,) unsigned long start, int count,
|
||||
int sd_read_sectors(IF_MD(int drive,) unsigned long start, int count,
|
||||
void* buf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
mutex_lock(&sd_mtx);
|
||||
ret = sd_transfer_sectors(IF_MD2(drive,) start, count, buf, false);
|
||||
ret = sd_transfer_sectors(IF_MD(drive,) start, count, buf, false);
|
||||
mutex_unlock(&sd_mtx);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
|
||||
int sd_write_sectors(IF_MD(int drive,) unsigned long start, int count,
|
||||
const void* buf)
|
||||
{
|
||||
#ifdef VERIFY_WRITE
|
||||
|
|
@ -911,7 +911,7 @@ int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
|
|||
|
||||
mutex_lock(&sd_mtx);
|
||||
|
||||
ret = sd_transfer_sectors(IF_MD2(drive,) start, count, (void*)buf, true);
|
||||
ret = sd_transfer_sectors(IF_MD(drive,) start, count, (void*)buf, true);
|
||||
|
||||
#ifdef VERIFY_WRITE
|
||||
if (ret) {
|
||||
|
|
@ -928,10 +928,10 @@ int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
|
|||
if(transfer > UNALIGNED_NUM_SECTORS)
|
||||
transfer = UNALIGNED_NUM_SECTORS;
|
||||
|
||||
sd_transfer_sectors(IF_MD2(drive,) start, transfer, aligned_buffer, false);
|
||||
sd_transfer_sectors(IF_MD(drive,) start, transfer, aligned_buffer, false);
|
||||
if (memcmp(buf, aligned_buffer, transfer * 512) != 0) {
|
||||
/* try the write again in the hope to repair the damage */
|
||||
sd_transfer_sectors(IF_MD2(drive,) saved_start, saved_count, saved_buf, true);
|
||||
sd_transfer_sectors(IF_MD(drive,) saved_start, saved_count, saved_buf, true);
|
||||
panicf("sd: verify failed: sec=%ld n=%d!", start, transfer);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -773,7 +773,7 @@ int sd_init(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start,
|
||||
static int sd_transfer_sectors(IF_MD(int drive,) unsigned long start,
|
||||
int count, void* buf, bool write)
|
||||
{
|
||||
unsigned long response;
|
||||
|
|
@ -969,16 +969,16 @@ sd_transfer_error_no_dma:
|
|||
}
|
||||
}
|
||||
|
||||
int sd_read_sectors(IF_MD2(int drive,) unsigned long start, int count,
|
||||
int sd_read_sectors(IF_MD(int drive,) unsigned long start, int count,
|
||||
void* buf)
|
||||
{
|
||||
return sd_transfer_sectors(IF_MD2(drive,) start, count, buf, false);
|
||||
return sd_transfer_sectors(IF_MD(drive,) start, count, buf, false);
|
||||
}
|
||||
|
||||
int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
|
||||
int sd_write_sectors(IF_MD(int drive,) unsigned long start, int count,
|
||||
const void* buf)
|
||||
{
|
||||
return sd_transfer_sectors(IF_MD2(drive,) start, count, (void*)buf, true);
|
||||
return sd_transfer_sectors(IF_MD(drive,) start, count, (void*)buf, true);
|
||||
}
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue