D2: Obey the SD card write-protect tab

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22596 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rob Purchase 2009-09-01 21:57:38 +00:00
parent 19a5dfea28
commit db287c0971

View file

@ -50,6 +50,7 @@
#define EC_TRAN_WRITE_ENTRY 9
#define EC_TRAN_WRITE_EXIT 10
#define EC_COMMAND 11
#define EC_WRITE_PROTECT 12
/* for compatibility */
static long last_disk_activity = -1;
@ -536,6 +537,12 @@ int sd_write_sectors(IF_MD2(int card_no,) unsigned long start, int count,
const unsigned char *buf_end;
bool aligned;
if ((card_no == CARD_NUM_SLOT) && (GPIOA & 0x10))
{
/* write protect tab set */
return -EC_WRITE_PROTECT;
}
mutex_lock(&sd_mtx);
sd_enable(true);
led(true);