diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2009-06-18 15:05:59 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2009-06-18 15:05:59 +0000 |
commit | 0181bc42c942797b1e215e6f7861aa760207b8db (patch) | |
tree | 92faac85684c2f2d2c5a6020662ecd04ac94dba9 /firmware | |
parent | d7681075716ca1c4ff20f16d60f74bfb95664b70 (diff) | |
download | rockbox-0181bc42c942797b1e215e6f7861aa760207b8db.tar.gz rockbox-0181bc42c942797b1e215e6f7861aa760207b8db.zip |
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
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/config-c200v2.h | 16 | ||||
-rw-r--r-- | firmware/target/arm/as3525/ata_sd_as3525.c | 19 | ||||
-rw-r--r-- | firmware/target/arm/as3525/debug-as3525.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-c200v2/button-c200v2.c | 54 |
4 files changed, 34 insertions, 57 deletions
diff --git a/firmware/export/config-c200v2.h b/firmware/export/config-c200v2.h index 03f6ac0698..ae2cd04c0b 100644 --- a/firmware/export/config-c200v2.h +++ b/firmware/export/config-c200v2.h | |||
@@ -80,7 +80,9 @@ | |||
80 | #define MAX_CONTRAST_SETTING 255 | 80 | #define MAX_CONTRAST_SETTING 255 |
81 | #define DEFAULT_CONTRAST_SETTING 85 | 81 | #define DEFAULT_CONTRAST_SETTING 85 |
82 | 82 | ||
83 | #define IRAM_LCDFRAMEBUFFER IDATA_ATTR /* put the lcd frame buffer in IRAM */ | 83 | #if 0 /* not enough room for a 16 bits framebuffer */ |
84 | #define IRAM_LCDFRAMEBUFFER IDATA_ATTR /* put the lcd frame buffer in IRAM */ | ||
85 | #endif | ||
84 | 86 | ||
85 | #define CONFIG_KEYPAD SANSA_C200_PAD | 87 | #define CONFIG_KEYPAD SANSA_C200_PAD |
86 | 88 | ||
@@ -108,7 +110,7 @@ | |||
108 | #define HAVE_FAT16SUPPORT | 110 | #define HAVE_FAT16SUPPORT |
109 | 111 | ||
110 | /* The number of bytes reserved for loadable codecs */ | 112 | /* The number of bytes reserved for loadable codecs */ |
111 | #define CODEC_SIZE 0x100000 | 113 | #define CODEC_SIZE 0x48000 |
112 | 114 | ||
113 | /* The number of bytes reserved for loadable plugins */ | 115 | /* The number of bytes reserved for loadable plugins */ |
114 | #define PLUGIN_BUFFER_SIZE 0x80000 | 116 | #define PLUGIN_BUFFER_SIZE 0x80000 |
@@ -116,7 +118,7 @@ | |||
116 | #define AB_REPEAT_ENABLE 1 | 118 | #define AB_REPEAT_ENABLE 1 |
117 | 119 | ||
118 | /* FM Tuner - suspected to be the SI4702 */ | 120 | /* FM Tuner - suspected to be the SI4702 */ |
119 | //#define CONFIG_TUNER SI4700 | 121 | #define CONFIG_TUNER SI4700 |
120 | /* #define HAVE_TUNER_PWR_CTRL */ | 122 | /* #define HAVE_TUNER_PWR_CTRL */ |
121 | 123 | ||
122 | /* Define this for LCD backlight available */ | 124 | /* Define this for LCD backlight available */ |
@@ -148,7 +150,7 @@ | |||
148 | #define CONFIG_CPU AS3525 | 150 | #define CONFIG_CPU AS3525 |
149 | 151 | ||
150 | /* Define how much SD sectors are reserved for OF */ | 152 | /* Define how much SD sectors are reserved for OF */ |
151 | #define AMS_OF_SIZE 0x5000 /* TODO : check */ | 153 | #define AMS_OF_SIZE 0x5000 |
152 | 154 | ||
153 | /* Define this if you want to use the PP5024 i2c interface */ | 155 | /* Define this if you want to use the PP5024 i2c interface */ |
154 | #define CONFIG_I2C I2C_AS3525 | 156 | #define CONFIG_I2C I2C_AS3525 |
@@ -163,14 +165,14 @@ | |||
163 | /* Define this to the CPU frequency */ | 165 | /* Define this to the CPU frequency */ |
164 | #define CPU_FREQ 250000000 | 166 | #define CPU_FREQ 250000000 |
165 | 167 | ||
166 | /* Type of LCD TODO: hopefully the same as the x5 but check this*/ | 168 | /* Type of LCD : Samsung S6B33B2 */ |
167 | #define CONFIG_LCD LCD_C200 | 169 | #define CONFIG_LCD LCD_C200 |
168 | 170 | ||
169 | #define USB_HANDLED_BY_OF | 171 | #define USB_HANDLED_BY_OF |
170 | 172 | ||
171 | #ifndef BOOTLOADER | 173 | #ifndef BOOTLOADER |
172 | //#define HAVE_MULTIVOLUME | 174 | #define HAVE_MULTIVOLUME |
173 | //#define HAVE_HOTSWAP | 175 | #define HAVE_HOTSWAP |
174 | #endif | 176 | #endif |
175 | 177 | ||
176 | /* enable these for the experimental usb stack */ | 178 | /* enable these for the experimental usb stack */ |
diff --git a/firmware/target/arm/as3525/ata_sd_as3525.c b/firmware/target/arm/as3525/ata_sd_as3525.c index 8ec90c5ced..a6265b37f4 100644 --- a/firmware/target/arm/as3525/ata_sd_as3525.c +++ b/firmware/target/arm/as3525/ata_sd_as3525.c | |||
@@ -122,7 +122,7 @@ static volatile bool retry; | |||
122 | static inline void mci_delay(void) { int i = 0xffff; while(i--) ; } | 122 | static inline void mci_delay(void) { int i = 0xffff; while(i--) ; } |
123 | 123 | ||
124 | #ifdef HAVE_HOTSWAP | 124 | #ifdef HAVE_HOTSWAP |
125 | #if defined(SANSA_E200V2) || defined(SANSA_FUZE) | 125 | #if defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_C200V2) |
126 | static int sd1_oneshot_callback(struct timeout *tmo) | 126 | static int sd1_oneshot_callback(struct timeout *tmo) |
127 | { | 127 | { |
128 | (void)tmo; | 128 | (void)tmo; |
@@ -146,7 +146,7 @@ void INT_GPIOA(void) | |||
146 | GPIOA_IC = (1<<2); | 146 | GPIOA_IC = (1<<2); |
147 | timeout_register(&sd1_oneshot, sd1_oneshot_callback, (3*HZ/10), 0); | 147 | timeout_register(&sd1_oneshot, sd1_oneshot_callback, (3*HZ/10), 0); |
148 | } | 148 | } |
149 | #endif /* defined(SANSA_E200V2) || defined(SANSA_FUZE) */ | 149 | #endif /* defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_C200V2) */ |
150 | #endif /* HAVE_HOTSWAP */ | 150 | #endif /* HAVE_HOTSWAP */ |
151 | 151 | ||
152 | void INT_NAND(void) | 152 | void INT_NAND(void) |
@@ -437,7 +437,7 @@ static void init_pl180_controller(const int drive) | |||
437 | VIC_INT_ENABLE |= | 437 | VIC_INT_ENABLE |= |
438 | (drive == INTERNAL_AS3525) ? INTERRUPT_NAND : INTERRUPT_MCI0; | 438 | (drive == INTERNAL_AS3525) ? INTERRUPT_NAND : INTERRUPT_MCI0; |
439 | 439 | ||
440 | #if defined(SANSA_E200V2) || defined(SANSA_FUZE) | 440 | #if defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_C200V2) |
441 | /* setup isr for microsd monitoring */ | 441 | /* setup isr for microsd monitoring */ |
442 | VIC_INT_ENABLE |= (INTERRUPT_GPIOA); | 442 | VIC_INT_ENABLE |= (INTERRUPT_GPIOA); |
443 | /* clear previous irq */ | 443 | /* clear previous irq */ |
@@ -886,13 +886,12 @@ tCardInfo *card_get_info_target(int card_no) | |||
886 | 886 | ||
887 | bool card_detect_target(void) | 887 | bool card_detect_target(void) |
888 | { | 888 | { |
889 | #ifdef HAVE_HOTSWAP | 889 | #if defined(HAVE_HOTSWAP) && \ |
890 | /* TODO: add e200/c200 */ | 890 | (defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_C200V2)) |
891 | #if defined(SANSA_E200V2) || defined(SANSA_FUZE) | ||
892 | return !(GPIOA_PIN(2)); | 891 | return !(GPIOA_PIN(2)); |
893 | #endif | 892 | #else |
894 | #endif | ||
895 | return false; | 893 | return false; |
894 | #endif | ||
896 | } | 895 | } |
897 | 896 | ||
898 | #ifdef HAVE_HOTSWAP | 897 | #ifdef HAVE_HOTSWAP |
@@ -901,14 +900,14 @@ void card_enable_monitoring_target(bool on) | |||
901 | if (on) | 900 | if (on) |
902 | { | 901 | { |
903 | /* add e200v2/c200v2 here */ | 902 | /* add e200v2/c200v2 here */ |
904 | #if defined(SANSA_E200V2) || defined(SANSA_FUZE) | 903 | #if defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_C200V2) |
905 | /* enable isr*/ | 904 | /* enable isr*/ |
906 | GPIOA_IE |= (1<<2); | 905 | GPIOA_IE |= (1<<2); |
907 | #endif | 906 | #endif |
908 | } | 907 | } |
909 | else | 908 | else |
910 | { | 909 | { |
911 | #if defined(SANSA_E200V2) || defined(SANSA_FUZE) | 910 | #if defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_C200V2) |
912 | /* edisable isr*/ | 911 | /* edisable isr*/ |
913 | GPIOA_IE &= ~(1<<2); | 912 | GPIOA_IE &= ~(1<<2); |
914 | #endif | 913 | #endif |
diff --git a/firmware/target/arm/as3525/debug-as3525.c b/firmware/target/arm/as3525/debug-as3525.c index 7585f76431..405b7109b1 100644 --- a/firmware/target/arm/as3525/debug-as3525.c +++ b/firmware/target/arm/as3525/debug-as3525.c | |||
@@ -65,7 +65,7 @@ | |||
65 | /* FIXME: target tree is including ./debug-target.h rather than the one in | 65 | /* FIXME: target tree is including ./debug-target.h rather than the one in |
66 | * sansa-fuze/, even though deps contains the correct one | 66 | * sansa-fuze/, even though deps contains the correct one |
67 | * if I put the below into a sansa-fuze/debug-target.h, it doesn't work*/ | 67 | * if I put the below into a sansa-fuze/debug-target.h, it doesn't work*/ |
68 | #if defined(SANSA_FUZE) || defined(SANSA_E200V2) | 68 | #if defined(SANSA_FUZE) || defined(SANSA_E200V2) || defined(SANSA_C200V2) |
69 | #define DEBUG_DBOP | 69 | #define DEBUG_DBOP |
70 | unsigned short button_dbop_data(void); | 70 | unsigned short button_dbop_data(void); |
71 | #endif | 71 | #endif |
diff --git a/firmware/target/arm/as3525/sansa-c200v2/button-c200v2.c b/firmware/target/arm/as3525/sansa-c200v2/button-c200v2.c index d3504c97e9..965006ce61 100644 --- a/firmware/target/arm/as3525/sansa-c200v2/button-c200v2.c +++ b/firmware/target/arm/as3525/sansa-c200v2/button-c200v2.c | |||
@@ -36,6 +36,12 @@ static bool hold_button = false; | |||
36 | static bool hold_button_old = false; | 36 | static bool hold_button_old = false; |
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | /* for the debug menu */ | ||
40 | unsigned short button_dbop_data(void) | ||
41 | { | ||
42 | return _dbop_din; | ||
43 | } | ||
44 | |||
39 | void button_init_device(void) | 45 | void button_init_device(void) |
40 | { | 46 | { |
41 | GPIOA_DIR &= ~(1<<3); | 47 | GPIOA_DIR &= ~(1<<3); |
@@ -54,9 +60,6 @@ static void button_read_dbop(void) | |||
54 | DBOP_TIMPOL_01 = 0xe167e167; /* Set Timing & Polarity regs 0 & 1 */ | 60 | DBOP_TIMPOL_01 = 0xe167e167; /* Set Timing & Polarity regs 0 & 1 */ |
55 | DBOP_TIMPOL_23 = 0xe167006e; /* Set Timing & Polarity regs 2 & 3 */ | 61 | DBOP_TIMPOL_23 = 0xe167006e; /* Set Timing & Polarity regs 2 & 3 */ |
56 | 62 | ||
57 | int i = 50; | ||
58 | while(i--) asm volatile ("nop\n"); | ||
59 | |||
60 | DBOP_CTRL |= (1<<15); /* start read */ | 63 | DBOP_CTRL |= (1<<15); /* start read */ |
61 | while (!(DBOP_STAT & (1<<16))); /* wait for valid data */ | 64 | while (!(DBOP_STAT & (1<<16))); /* wait for valid data */ |
62 | 65 | ||
@@ -74,52 +77,25 @@ static void button_read_dbop(void) | |||
74 | */ | 77 | */ |
75 | int button_read_device(void) | 78 | int button_read_device(void) |
76 | { | 79 | { |
77 | int delay; | ||
78 | int dir_save_c = 0; | ||
79 | int afsel_save_c = 0; | ||
80 | int btn = BUTTON_NONE; | 80 | int btn = BUTTON_NONE; |
81 | 81 | ||
82 | /* Save the current direction and afsel */ | ||
83 | dir_save_c = GPIOC_DIR; | ||
84 | afsel_save_c = GPIOC_AFSEL; | ||
85 | |||
86 | GPIOC_AFSEL &= ~(1<<6|1<<5|1<<4|1<<3); | ||
87 | GPIOC_DIR |= (1<<6|1<<5|1<<4|1<<3); | ||
88 | |||
89 | /* These should not be needed with button event interupts */ | ||
90 | /* they are necessary now to clear out lcd data */ | ||
91 | |||
92 | GPIOC_PIN(6) = (1<<6); | ||
93 | GPIOC_PIN(5) = (1<<5); | ||
94 | GPIOC_PIN(4) = (1<<4); | ||
95 | GPIOC_PIN(3) = (1<<3); | ||
96 | GPIOC_DIR &= ~(1<<6|1<<5|1<<4|1<<3); | ||
97 | |||
98 | delay = 100; | ||
99 | while(delay--) | ||
100 | asm volatile("nop\n"); | ||
101 | |||
102 | /* direct GPIO connections */ | 82 | /* direct GPIO connections */ |
103 | if (GPIOA_PIN(3)) | 83 | if (GPIOA_PIN(3)) |
104 | btn |= BUTTON_POWER; | 84 | btn |= BUTTON_POWER; |
105 | if (!GPIOC_PIN(6)) | ||
106 | btn |= BUTTON_RIGHT; | ||
107 | if (!GPIOC_PIN(5)) | ||
108 | btn |= BUTTON_UP; | ||
109 | if (!GPIOC_PIN(4)) | ||
110 | btn |= BUTTON_SELECT; | ||
111 | if (!GPIOC_PIN(3)) | ||
112 | btn |= BUTTON_DOWN; | ||
113 | |||
114 | /* return to settings needed for lcd */ | ||
115 | GPIOC_DIR = dir_save_c; | ||
116 | GPIOC_AFSEL = afsel_save_c; | ||
117 | 85 | ||
118 | if(lcd_button_support()) | 86 | if(lcd_button_support()) |
119 | button_read_dbop(); | 87 | button_read_dbop(); |
120 | 88 | ||
121 | if(_dbop_din & (1<<6)) | 89 | if(!(_dbop_din & (1<<2))) |
122 | btn |= BUTTON_LEFT; | 90 | btn |= BUTTON_LEFT; |
91 | if(!(_dbop_din & (1<<3))) | ||
92 | btn |= BUTTON_DOWN; | ||
93 | if(!(_dbop_din & (1<<4))) | ||
94 | btn |= BUTTON_SELECT; | ||
95 | if(!(_dbop_din & (1<<5))) | ||
96 | btn |= BUTTON_UP; | ||
97 | if(!(_dbop_din & (1<<6))) | ||
98 | btn |= BUTTON_RIGHT; | ||
123 | 99 | ||
124 | #ifndef BOOTLOADER | 100 | #ifndef BOOTLOADER |
125 | /* light handling */ | 101 | /* light handling */ |