summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Purchase <shotofadds@rockbox.org>2009-09-01 21:57:38 +0000
committerRob Purchase <shotofadds@rockbox.org>2009-09-01 21:57:38 +0000
commitdb287c0971e6fb33e52a7301e0117f6da4eeb5db (patch)
tree2d724ada86088a4c327def49439aab242da7da71
parent19a5dfea283c89540b61d0103ba0fe8ddee17612 (diff)
downloadrockbox-db287c0971e6fb33e52a7301e0117f6da4eeb5db.tar.gz
rockbox-db287c0971e6fb33e52a7301e0117f6da4eeb5db.tar.bz2
rockbox-db287c0971e6fb33e52a7301e0117f6da4eeb5db.zip
D2: Obey the SD card write-protect tab
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22596 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/tcc780x/sd-tcc780x.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/firmware/target/arm/tcc780x/sd-tcc780x.c b/firmware/target/arm/tcc780x/sd-tcc780x.c
index bb426d8125..222bb88a15 100644
--- a/firmware/target/arm/tcc780x/sd-tcc780x.c
+++ b/firmware/target/arm/tcc780x/sd-tcc780x.c
@@ -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);