summaryrefslogtreecommitdiff
path: root/firmware/target/arm/ata-sd-pp.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/ata-sd-pp.c')
-rw-r--r--firmware/target/arm/ata-sd-pp.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/firmware/target/arm/ata-sd-pp.c b/firmware/target/arm/ata-sd-pp.c
index f2efd02e9d..fafc5f20d9 100644
--- a/firmware/target/arm/ata-sd-pp.c
+++ b/firmware/target/arm/ata-sd-pp.c
@@ -340,6 +340,21 @@ static int sd_wait_for_state(unsigned int state, int id)
340 } 340 }
341} 341}
342 342
343
344static inline bool card_detect_target(void)
345{
346#ifdef HAVE_HOTSWAP
347#ifdef SANSA_E200
348 return (GPIOA_INPUT_VAL & 0x80) == 0; /* low active */
349#elif defined SANSA_C200
350 return (GPIOL_INPUT_VAL & 0x08) != 0; /* high active */
351#endif
352#else
353 return false;
354#endif
355}
356
357
343static inline void copy_read_sectors_fast(unsigned char **buf) 358static inline void copy_read_sectors_fast(unsigned char **buf)
344{ 359{
345 /* Copy one chunk of 16 words using best method for start alignment */ 360 /* Copy one chunk of 16 words using best method for start alignment */
@@ -1278,20 +1293,6 @@ tCardInfo *card_get_info_target(int card_no)
1278{ 1293{
1279 return &card_info[card_no]; 1294 return &card_info[card_no];
1280} 1295}
1281
1282bool card_detect_target(void)
1283{
1284#ifdef HAVE_HOTSWAP
1285#ifdef SANSA_E200
1286 return (GPIOA_INPUT_VAL & 0x80) == 0; /* low active */
1287#elif defined SANSA_C200
1288 return (GPIOL_INPUT_VAL & 0x08) != 0; /* high active */
1289#endif
1290#else
1291 return false;
1292#endif
1293}
1294
1295#ifdef HAVE_HOTSWAP 1296#ifdef HAVE_HOTSWAP
1296static int sd1_oneshot_callback(struct timeout *tmo) 1297static int sd1_oneshot_callback(struct timeout *tmo)
1297{ 1298{