Sansa Clip+: detect AMSv2 variant (just like was already done for fuze v2), this makes SD transfers work for newer clip+ players ("COMBO4E" type). Variable fuzev2_variant has been renamed to amsv2_variant.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27520 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Bertrik Sikken 2010-07-22 13:47:09 +00:00
parent 1ebdb8988f
commit 4d6c816721
6 changed files with 25 additions and 25 deletions

View file

@ -268,14 +268,14 @@ bool __dbg_hw_info(void)
{ {
while(1) while(1)
{ {
#if defined(SANSA_C200V2) || defined(SANSA_FUZEV2) #if defined(SANSA_C200V2) || defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS)
lcd_clear_display(); lcd_clear_display();
line = 0; line = 0;
lcd_puts(0, line++, "[Submodel:]"); lcd_puts(0, line++, "[Submodel:]");
#if defined(SANSA_C200V2) #if defined(SANSA_C200V2)
lcd_putsf(0, line++, "C200v2 variant %d", c200v2_variant); lcd_putsf(0, line++, "C200v2 variant %d", c200v2_variant);
#elif defined(SANSA_FUZEV2) #elif defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS)
lcd_putsf(0, line++, "Fuzev2 variant %d", fuzev2_variant); lcd_putsf(0, line++, "AMSv2 variant %d", amsv2_variant);
#endif #endif
lcd_update(); lcd_update();
int btn = button_get_w_tmo(HZ/10); int btn = button_get_w_tmo(HZ/10);

View file

@ -39,7 +39,7 @@ bool _backlight_init(void)
ascodec_write_pmu(AS3543_BACKLIGHT, 2, backlight_brightness * 10); ascodec_write_pmu(AS3543_BACKLIGHT, 2, backlight_brightness * 10);
/* needed for button light */ /* needed for button light */
if (fuzev2_variant == 1) if (amsv2_variant == 1)
ascodec_write_pmu(0x1a, 1, 0x30); /* MUX_PWGD = PWM */ ascodec_write_pmu(0x1a, 1, 0x30); /* MUX_PWGD = PWM */
return true; return true;
@ -63,7 +63,7 @@ void _backlight_off(void)
void _buttonlight_on(void) void _buttonlight_on(void)
{ {
if (fuzev2_variant == 0) if (amsv2_variant == 0)
{ {
GPIOB_DIR |= 1<<5; GPIOB_DIR |= 1<<5;
GPIOB_PIN(5) = (1<<5); GPIOB_PIN(5) = (1<<5);
@ -77,7 +77,7 @@ void _buttonlight_on(void)
void _buttonlight_off(void) void _buttonlight_off(void)
{ {
if (fuzev2_variant == 0) if (amsv2_variant == 0)
{ {
GPIOB_PIN(5) = 0; GPIOB_PIN(5) = 0;
GPIOB_DIR &= ~(1<<5); GPIOB_DIR &= ~(1<<5);

View file

@ -257,7 +257,7 @@ int button_read_device(void)
btn |= BUTTON_RIGHT; btn |= BUTTON_RIGHT;
if (GPIOB_PIN(1) & 1<<1) if (GPIOB_PIN(1) & 1<<1)
btn |= BUTTON_HOME; btn |= BUTTON_HOME;
if (fuzev2_variant == 1) if (amsv2_variant == 1)
btn ^= BUTTON_HOME; btn ^= BUTTON_HOME;
if (gpiod6 & 1<<6) if (gpiod6 & 1<<6)

View file

@ -45,7 +45,7 @@
#include "disk.h" #include "disk.h"
#endif #endif
#ifdef SANSA_FUZEV2 #if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS)
#include "backlight-target.h" #include "backlight-target.h"
#endif #endif
@ -403,8 +403,8 @@ static bool send_cmd(const int drive, const int cmd, const int arg, const int fl
MCI_ARGUMENT = arg; MCI_ARGUMENT = arg;
#ifdef SANSA_FUZEV2 #if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS)
if (fuzev2_variant == 1) if (amsv2_variant == 1)
card_no = 1 << 16; card_no = 1 << 16;
else else
#endif #endif
@ -429,8 +429,8 @@ static bool send_cmd(const int drive, const int cmd, const int arg, const int fl
/*b23 | CMD_CCS_EXPECTED unused */ /*b23 | CMD_CCS_EXPECTED unused */
/*b31 */ | CMD_DONE_BIT; /*b31 */ | CMD_DONE_BIT;
#ifdef SANSA_FUZEV2 #if defined(SANSA_FUZEV2)
if (fuzev2_variant == 0) if (amsv2_variant == 0)
{ {
extern int buttonlight_is_on; extern int buttonlight_is_on;
if(buttonlight_is_on) if(buttonlight_is_on)
@ -594,8 +594,8 @@ static int sd_init_card(const int drive)
return -17; return -17;
/* Now that card is widebus make controller aware */ /* Now that card is widebus make controller aware */
#ifdef SANSA_FUZEV2 #if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS)
if (fuzev2_variant == 1) if (amsv2_variant == 1)
MCI_CTYPE |= 1<<1; MCI_CTYPE |= 1<<1;
else else
#endif #endif
@ -604,8 +604,8 @@ static int sd_init_card(const int drive)
#endif /* ! BOOTLOADER */ #endif /* ! BOOTLOADER */
/* Set low power mode */ /* Set low power mode */
#ifdef SANSA_FUZEV2 #if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS)
if (fuzev2_variant == 1) if (amsv2_variant == 1)
MCI_CLKENA |= 1<<16; MCI_CLKENA |= 1<<16;
else else
#endif #endif
@ -709,8 +709,8 @@ static void init_controller(void)
int card_mask = (1 << hcon_numcards) - 1; int card_mask = (1 << hcon_numcards) - 1;
int pwr_mask; int pwr_mask;
#ifdef SANSA_FUZEV2 #if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS)
if (fuzev2_variant == 1) if (amsv2_variant == 1)
pwr_mask = 1 << 1; pwr_mask = 1 << 1;
else else
#endif #endif
@ -774,8 +774,8 @@ int sd_init(void)
wakeup_init(&transfer_completion_signal); wakeup_init(&transfer_completion_signal);
wakeup_init(&command_completion_signal); wakeup_init(&command_completion_signal);
#ifdef SANSA_FUZEV2 #if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS)
if (fuzev2_variant == 1) if (amsv2_variant == 1)
GPIOB_DIR |= 1 << 5; GPIOB_DIR |= 1 << 5;
#endif #endif

View file

@ -189,13 +189,13 @@ static void check_model_variant(void)
c200v2_variant = !GPIOA_PIN(7); c200v2_variant = !GPIOA_PIN(7);
GPIOA_DIR = saved_dir; GPIOA_DIR = saved_dir;
} }
#elif defined(SANSA_FUZEV2) #elif defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS)
int fuzev2_variant; int amsv2_variant;
static void check_model_variant(void) static void check_model_variant(void)
{ {
GPIOB_DIR &= ~(1<<5); GPIOB_DIR &= ~(1<<5);
fuzev2_variant = !!GPIOB_PIN(5); amsv2_variant = !!GPIOB_PIN(5);
} }
#else #else
static inline void check_model_variant(void) static inline void check_model_variant(void)

View file

@ -46,8 +46,8 @@
? (((uintptr_t)(a)) - IRAM_ORIG) \ ? (((uintptr_t)(a)) - IRAM_ORIG) \
: ((uintptr_t)(a)))) : ((uintptr_t)(a))))
#ifdef SANSA_FUZEV2 #if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS)
extern int fuzev2_variant; extern int amsv2_variant;
#endif #endif
#ifdef SANSA_C200V2 #ifdef SANSA_C200V2