mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 05:05:20 -05:00
Sansa c200v2 : support more hardware
Don't read the buttons from GPIOC but from DBOP_DIN (all directional buttons + select) Still missing hold, rec, volume up and volume down Read microsd Tuner is a si4700 but seems to suffer from the same problem than e200v2 Sound works TODO: missing buttons, lcd yuv, test lcd performance (the c200v1 lcd performance has decreased since r21321 : needs to be investigated) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21330 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
d768107571
commit
0181bc42c9
4 changed files with 34 additions and 57 deletions
|
|
@ -80,7 +80,9 @@
|
||||||
#define MAX_CONTRAST_SETTING 255
|
#define MAX_CONTRAST_SETTING 255
|
||||||
#define DEFAULT_CONTRAST_SETTING 85
|
#define DEFAULT_CONTRAST_SETTING 85
|
||||||
|
|
||||||
#define IRAM_LCDFRAMEBUFFER IDATA_ATTR /* put the lcd frame buffer in IRAM */
|
#if 0 /* not enough room for a 16 bits framebuffer */
|
||||||
|
#define IRAM_LCDFRAMEBUFFER IDATA_ATTR /* put the lcd frame buffer in IRAM */
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CONFIG_KEYPAD SANSA_C200_PAD
|
#define CONFIG_KEYPAD SANSA_C200_PAD
|
||||||
|
|
||||||
|
|
@ -108,7 +110,7 @@
|
||||||
#define HAVE_FAT16SUPPORT
|
#define HAVE_FAT16SUPPORT
|
||||||
|
|
||||||
/* The number of bytes reserved for loadable codecs */
|
/* The number of bytes reserved for loadable codecs */
|
||||||
#define CODEC_SIZE 0x100000
|
#define CODEC_SIZE 0x48000
|
||||||
|
|
||||||
/* The number of bytes reserved for loadable plugins */
|
/* The number of bytes reserved for loadable plugins */
|
||||||
#define PLUGIN_BUFFER_SIZE 0x80000
|
#define PLUGIN_BUFFER_SIZE 0x80000
|
||||||
|
|
@ -116,7 +118,7 @@
|
||||||
#define AB_REPEAT_ENABLE 1
|
#define AB_REPEAT_ENABLE 1
|
||||||
|
|
||||||
/* FM Tuner - suspected to be the SI4702 */
|
/* FM Tuner - suspected to be the SI4702 */
|
||||||
//#define CONFIG_TUNER SI4700
|
#define CONFIG_TUNER SI4700
|
||||||
/* #define HAVE_TUNER_PWR_CTRL */
|
/* #define HAVE_TUNER_PWR_CTRL */
|
||||||
|
|
||||||
/* Define this for LCD backlight available */
|
/* Define this for LCD backlight available */
|
||||||
|
|
@ -148,7 +150,7 @@
|
||||||
#define CONFIG_CPU AS3525
|
#define CONFIG_CPU AS3525
|
||||||
|
|
||||||
/* Define how much SD sectors are reserved for OF */
|
/* Define how much SD sectors are reserved for OF */
|
||||||
#define AMS_OF_SIZE 0x5000 /* TODO : check */
|
#define AMS_OF_SIZE 0x5000
|
||||||
|
|
||||||
/* Define this if you want to use the PP5024 i2c interface */
|
/* Define this if you want to use the PP5024 i2c interface */
|
||||||
#define CONFIG_I2C I2C_AS3525
|
#define CONFIG_I2C I2C_AS3525
|
||||||
|
|
@ -163,14 +165,14 @@
|
||||||
/* Define this to the CPU frequency */
|
/* Define this to the CPU frequency */
|
||||||
#define CPU_FREQ 250000000
|
#define CPU_FREQ 250000000
|
||||||
|
|
||||||
/* Type of LCD TODO: hopefully the same as the x5 but check this*/
|
/* Type of LCD : Samsung S6B33B2 */
|
||||||
#define CONFIG_LCD LCD_C200
|
#define CONFIG_LCD LCD_C200
|
||||||
|
|
||||||
#define USB_HANDLED_BY_OF
|
#define USB_HANDLED_BY_OF
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
//#define HAVE_MULTIVOLUME
|
#define HAVE_MULTIVOLUME
|
||||||
//#define HAVE_HOTSWAP
|
#define HAVE_HOTSWAP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* enable these for the experimental usb stack */
|
/* enable these for the experimental usb stack */
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ static volatile bool retry;
|
||||||
static inline void mci_delay(void) { int i = 0xffff; while(i--) ; }
|
static inline void mci_delay(void) { int i = 0xffff; while(i--) ; }
|
||||||
|
|
||||||
#ifdef HAVE_HOTSWAP
|
#ifdef HAVE_HOTSWAP
|
||||||
#if defined(SANSA_E200V2) || defined(SANSA_FUZE)
|
#if defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_C200V2)
|
||||||
static int sd1_oneshot_callback(struct timeout *tmo)
|
static int sd1_oneshot_callback(struct timeout *tmo)
|
||||||
{
|
{
|
||||||
(void)tmo;
|
(void)tmo;
|
||||||
|
|
@ -146,7 +146,7 @@ void INT_GPIOA(void)
|
||||||
GPIOA_IC = (1<<2);
|
GPIOA_IC = (1<<2);
|
||||||
timeout_register(&sd1_oneshot, sd1_oneshot_callback, (3*HZ/10), 0);
|
timeout_register(&sd1_oneshot, sd1_oneshot_callback, (3*HZ/10), 0);
|
||||||
}
|
}
|
||||||
#endif /* defined(SANSA_E200V2) || defined(SANSA_FUZE) */
|
#endif /* defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_C200V2) */
|
||||||
#endif /* HAVE_HOTSWAP */
|
#endif /* HAVE_HOTSWAP */
|
||||||
|
|
||||||
void INT_NAND(void)
|
void INT_NAND(void)
|
||||||
|
|
@ -437,7 +437,7 @@ static void init_pl180_controller(const int drive)
|
||||||
VIC_INT_ENABLE |=
|
VIC_INT_ENABLE |=
|
||||||
(drive == INTERNAL_AS3525) ? INTERRUPT_NAND : INTERRUPT_MCI0;
|
(drive == INTERNAL_AS3525) ? INTERRUPT_NAND : INTERRUPT_MCI0;
|
||||||
|
|
||||||
#if defined(SANSA_E200V2) || defined(SANSA_FUZE)
|
#if defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_C200V2)
|
||||||
/* setup isr for microsd monitoring */
|
/* setup isr for microsd monitoring */
|
||||||
VIC_INT_ENABLE |= (INTERRUPT_GPIOA);
|
VIC_INT_ENABLE |= (INTERRUPT_GPIOA);
|
||||||
/* clear previous irq */
|
/* clear previous irq */
|
||||||
|
|
@ -886,13 +886,12 @@ tCardInfo *card_get_info_target(int card_no)
|
||||||
|
|
||||||
bool card_detect_target(void)
|
bool card_detect_target(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_HOTSWAP
|
#if defined(HAVE_HOTSWAP) && \
|
||||||
/* TODO: add e200/c200 */
|
(defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_C200V2))
|
||||||
#if defined(SANSA_E200V2) || defined(SANSA_FUZE)
|
|
||||||
return !(GPIOA_PIN(2));
|
return !(GPIOA_PIN(2));
|
||||||
#endif
|
#else
|
||||||
#endif
|
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_HOTSWAP
|
#ifdef HAVE_HOTSWAP
|
||||||
|
|
@ -901,14 +900,14 @@ void card_enable_monitoring_target(bool on)
|
||||||
if (on)
|
if (on)
|
||||||
{
|
{
|
||||||
/* add e200v2/c200v2 here */
|
/* add e200v2/c200v2 here */
|
||||||
#if defined(SANSA_E200V2) || defined(SANSA_FUZE)
|
#if defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_C200V2)
|
||||||
/* enable isr*/
|
/* enable isr*/
|
||||||
GPIOA_IE |= (1<<2);
|
GPIOA_IE |= (1<<2);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined(SANSA_E200V2) || defined(SANSA_FUZE)
|
#if defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_C200V2)
|
||||||
/* edisable isr*/
|
/* edisable isr*/
|
||||||
GPIOA_IE &= ~(1<<2);
|
GPIOA_IE &= ~(1<<2);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@
|
||||||
/* FIXME: target tree is including ./debug-target.h rather than the one in
|
/* FIXME: target tree is including ./debug-target.h rather than the one in
|
||||||
* sansa-fuze/, even though deps contains the correct one
|
* sansa-fuze/, even though deps contains the correct one
|
||||||
* if I put the below into a sansa-fuze/debug-target.h, it doesn't work*/
|
* if I put the below into a sansa-fuze/debug-target.h, it doesn't work*/
|
||||||
#if defined(SANSA_FUZE) || defined(SANSA_E200V2)
|
#if defined(SANSA_FUZE) || defined(SANSA_E200V2) || defined(SANSA_C200V2)
|
||||||
#define DEBUG_DBOP
|
#define DEBUG_DBOP
|
||||||
unsigned short button_dbop_data(void);
|
unsigned short button_dbop_data(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,12 @@ static bool hold_button = false;
|
||||||
static bool hold_button_old = false;
|
static bool hold_button_old = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* for the debug menu */
|
||||||
|
unsigned short button_dbop_data(void)
|
||||||
|
{
|
||||||
|
return _dbop_din;
|
||||||
|
}
|
||||||
|
|
||||||
void button_init_device(void)
|
void button_init_device(void)
|
||||||
{
|
{
|
||||||
GPIOA_DIR &= ~(1<<3);
|
GPIOA_DIR &= ~(1<<3);
|
||||||
|
|
@ -54,9 +60,6 @@ static void button_read_dbop(void)
|
||||||
DBOP_TIMPOL_01 = 0xe167e167; /* Set Timing & Polarity regs 0 & 1 */
|
DBOP_TIMPOL_01 = 0xe167e167; /* Set Timing & Polarity regs 0 & 1 */
|
||||||
DBOP_TIMPOL_23 = 0xe167006e; /* Set Timing & Polarity regs 2 & 3 */
|
DBOP_TIMPOL_23 = 0xe167006e; /* Set Timing & Polarity regs 2 & 3 */
|
||||||
|
|
||||||
int i = 50;
|
|
||||||
while(i--) asm volatile ("nop\n");
|
|
||||||
|
|
||||||
DBOP_CTRL |= (1<<15); /* start read */
|
DBOP_CTRL |= (1<<15); /* start read */
|
||||||
while (!(DBOP_STAT & (1<<16))); /* wait for valid data */
|
while (!(DBOP_STAT & (1<<16))); /* wait for valid data */
|
||||||
|
|
||||||
|
|
@ -74,52 +77,25 @@ static void button_read_dbop(void)
|
||||||
*/
|
*/
|
||||||
int button_read_device(void)
|
int button_read_device(void)
|
||||||
{
|
{
|
||||||
int delay;
|
|
||||||
int dir_save_c = 0;
|
|
||||||
int afsel_save_c = 0;
|
|
||||||
int btn = BUTTON_NONE;
|
int btn = BUTTON_NONE;
|
||||||
|
|
||||||
/* Save the current direction and afsel */
|
|
||||||
dir_save_c = GPIOC_DIR;
|
|
||||||
afsel_save_c = GPIOC_AFSEL;
|
|
||||||
|
|
||||||
GPIOC_AFSEL &= ~(1<<6|1<<5|1<<4|1<<3);
|
|
||||||
GPIOC_DIR |= (1<<6|1<<5|1<<4|1<<3);
|
|
||||||
|
|
||||||
/* These should not be needed with button event interupts */
|
|
||||||
/* they are necessary now to clear out lcd data */
|
|
||||||
|
|
||||||
GPIOC_PIN(6) = (1<<6);
|
|
||||||
GPIOC_PIN(5) = (1<<5);
|
|
||||||
GPIOC_PIN(4) = (1<<4);
|
|
||||||
GPIOC_PIN(3) = (1<<3);
|
|
||||||
GPIOC_DIR &= ~(1<<6|1<<5|1<<4|1<<3);
|
|
||||||
|
|
||||||
delay = 100;
|
|
||||||
while(delay--)
|
|
||||||
asm volatile("nop\n");
|
|
||||||
|
|
||||||
/* direct GPIO connections */
|
/* direct GPIO connections */
|
||||||
if (GPIOA_PIN(3))
|
if (GPIOA_PIN(3))
|
||||||
btn |= BUTTON_POWER;
|
btn |= BUTTON_POWER;
|
||||||
if (!GPIOC_PIN(6))
|
|
||||||
btn |= BUTTON_RIGHT;
|
|
||||||
if (!GPIOC_PIN(5))
|
|
||||||
btn |= BUTTON_UP;
|
|
||||||
if (!GPIOC_PIN(4))
|
|
||||||
btn |= BUTTON_SELECT;
|
|
||||||
if (!GPIOC_PIN(3))
|
|
||||||
btn |= BUTTON_DOWN;
|
|
||||||
|
|
||||||
/* return to settings needed for lcd */
|
|
||||||
GPIOC_DIR = dir_save_c;
|
|
||||||
GPIOC_AFSEL = afsel_save_c;
|
|
||||||
|
|
||||||
if(lcd_button_support())
|
if(lcd_button_support())
|
||||||
button_read_dbop();
|
button_read_dbop();
|
||||||
|
|
||||||
if(_dbop_din & (1<<6))
|
if(!(_dbop_din & (1<<2)))
|
||||||
btn |= BUTTON_LEFT;
|
btn |= BUTTON_LEFT;
|
||||||
|
if(!(_dbop_din & (1<<3)))
|
||||||
|
btn |= BUTTON_DOWN;
|
||||||
|
if(!(_dbop_din & (1<<4)))
|
||||||
|
btn |= BUTTON_SELECT;
|
||||||
|
if(!(_dbop_din & (1<<5)))
|
||||||
|
btn |= BUTTON_UP;
|
||||||
|
if(!(_dbop_din & (1<<6)))
|
||||||
|
btn |= BUTTON_RIGHT;
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
/* light handling */
|
/* light handling */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue