summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Guay <marcguay@rockbox.org>2008-06-21 15:18:36 +0000
committerMarc Guay <marcguay@rockbox.org>2008-06-21 15:18:36 +0000
commitb93667b30699a18daf3699cc969ad858077e406f (patch)
treeb3a1932ff6227f0434e86efded2205a16864898b
parentfdd5c3f1a3c18806329a88b8f243c8775f2a8571 (diff)
downloadrockbox-b93667b30699a18daf3699cc969ad858077e406f.tar.gz
rockbox-b93667b30699a18daf3699cc969ad858077e406f.zip
Add the Sansa c100 as a build target with basic drivers.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17742 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--bootloader/telechips.c26
-rw-r--r--firmware/SOURCES21
-rw-r--r--firmware/export/config-m200.h2
-rw-r--r--firmware/export/config.h7
-rw-r--r--firmware/target/arm/tcc77x/c100/adc-target.h24
-rw-r--r--firmware/target/arm/tcc77x/c100/backlight-target.h38
-rw-r--r--firmware/target/arm/tcc77x/c100/button-c100.c62
-rw-r--r--firmware/target/arm/tcc77x/c100/button-target.h52
-rw-r--r--firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c349
-rw-r--r--firmware/target/arm/tcc77x/c100/power-c100.c66
-rw-r--r--firmware/target/arm/tcc77x/system-tcc77x.c34
-rw-r--r--tools/checkwps/targets.txt1
-rwxr-xr-xtools/configure24
13 files changed, 688 insertions, 18 deletions
diff --git a/bootloader/telechips.c b/bootloader/telechips.c
index 7563a18632..d5239d1863 100644
--- a/bootloader/telechips.c
+++ b/bootloader/telechips.c
@@ -61,13 +61,14 @@ void show_debug_screen(void)
61 int power_count = 0; 61 int power_count = 0;
62 int count = 0; 62 int count = 0;
63 bool do_power_off = false; 63 bool do_power_off = false;
64 64
65 lcd_puts_scroll(0,0,"this is a very long line to test scrolling"); 65 /*lcd_puts_scroll(0,0,"this is a very long line to test scrolling");*/
66 while(!do_power_off) { 66 while(!do_power_off) {
67
67 line = 1; 68 line = 1;
68 button = button_get(false); 69 button = button_get(false);
69 70
70 /* Power-off if POWER button has been held for a long time 71 /* Power-off if POWER button has been held for a long time
71 This loop is currently running at about 100 iterations/second 72 This loop is currently running at about 100 iterations/second
72 */ 73 */
73 if (button & POWEROFF_BUTTON) { 74 if (button & POWEROFF_BUTTON) {
@@ -77,19 +78,25 @@ void show_debug_screen(void)
77 } else { 78 } else {
78 power_count = 0; 79 power_count = 0;
79 } 80 }
80 81
81 printf("Btn: 0x%08x",button); 82 if (button & BUTTON_SELECT){
83 _backlight_off();
84 }
85 else{
86 _backlight_on();
87 }
88
89 /*printf("Btn: 0x%08x",button);
82 printf("Tick: %d",current_tick); 90 printf("Tick: %d",current_tick);
83
84 printf("GPIOA: 0x%08x",GPIOA); 91 printf("GPIOA: 0x%08x",GPIOA);
85 printf("GPIOB: 0x%08x",GPIOB); 92 printf("GPIOB: 0x%08x",GPIOB);
86 printf("GPIOC: 0x%08x",GPIOC); 93 printf("GPIOC: 0x%08x",GPIOC);
87 printf("GPIOD: 0x%08x",GPIOD); 94 printf("GPIOD: 0x%08x",GPIOD);
88// printf("GPIOE: 0x%08x",GPIOE); 95 printf("GPIOE: 0x%08x",GPIOE);*/
89 96
90#if 0 97#if 0
91 int i; 98 int i;
92 for (i = 0; i<4; i++) 99 for (i = 1; i<4; i++)
93 { 100 {
94 printf("ADC%d: 0x%04x",i,adc_read(i)); 101 printf("ADC%d: 0x%04x",i,adc_read(i));
95 } 102 }
@@ -109,6 +116,7 @@ void show_debug_screen(void)
109 116
110 printf("(NOT) POWERED OFF"); 117 printf("(NOT) POWERED OFF");
111 while (true); 118 while (true);
119
112} 120}
113#else /* !CPU_TCC77X */ 121#else /* !CPU_TCC77X */
114void show_debug_screen(void) 122void show_debug_screen(void)
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 88e48bb226..1a01fd5af4 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -972,7 +972,26 @@ target/arm/tcc77x/debug-tcc77x.c
972target/arm/tcc77x/pcm-tcc77x.c 972target/arm/tcc77x/pcm-tcc77x.c
973#endif /* BOOTLOADER */ 973#endif /* BOOTLOADER */
974#endif /* SIMULATOR */ 974#endif /* SIMULATOR */
975#endif /* LOGIK_DAX */ 975#endif /* SANSA_M200 */
976
977#ifdef SANSA_C100
978#ifndef SIMULATOR
979target/arm/tcc77x/adc-tcc77x.c
980target/arm/tcc77x/ata-nand-tcc77x.c
981target/arm/tcc77x/kernel-tcc77x.c
982target/arm/tcc77x/c100/lcd-S6B33B2.c
983target/arm/tcc77x/powermgmt-tcc77x.c
984target/arm/tcc77x/system-tcc77x.c
985target/arm/tcc77x/timer-tcc77x.c
986target/arm/tcc77x/usb-tcc77x.c
987target/arm/tcc77x/c100/button-c100.c
988target/arm/tcc77x/c100/power-c100.c
989#ifndef BOOTLOADER
990target/arm/tcc77x/debug-tcc77x.c
991target/arm/tcc77x/pcm-tcc77x.c
992#endif /* BOOTLOADER */
993#endif /* SIMULATOR */
994#endif /* SANSA_C100 */
976 995
977#ifdef IAUDIO_7 996#ifdef IAUDIO_7
978#ifndef SIMULATOR 997#ifndef SIMULATOR
diff --git a/firmware/export/config-m200.h b/firmware/export/config-m200.h
index 760474d628..e3cb42e403 100644
--- a/firmware/export/config-m200.h
+++ b/firmware/export/config-m200.h
@@ -4,7 +4,7 @@
4#define TARGET_TREE /* this target is using the target tree system */ 4#define TARGET_TREE /* this target is using the target tree system */
5 5
6/* For Rolo and boot loader */ 6/* For Rolo and boot loader */
7#define MODEL_NUMBER 28 7#define MODEL_NUMBER 29
8 8
9/* define this if you have recording possibility */ 9/* define this if you have recording possibility */
10//#define HAVE_RECORDING 10//#define HAVE_RECORDING
diff --git a/firmware/export/config.h b/firmware/export/config.h
index c7e204c5df..c0e2b43d97 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -51,6 +51,7 @@
51#define DSC25 25 51#define DSC25 25
52#define DM320 320 52#define DM320 320
53#define IMX31L 31 53#define IMX31L 31
54#define TCC770 770
54#define TCC771L 771 55#define TCC771L 771
55#define TCC773L 773 56#define TCC773L 773
56#define TCC7801 7801 57#define TCC7801 7801
@@ -83,6 +84,7 @@
83#define SANSA_M200_PAD 25 84#define SANSA_M200_PAD 25
84#define CREATIVEZV_PAD 26 85#define CREATIVEZV_PAD 26
85#define PHILIPS_SA9200_PAD 27 86#define PHILIPS_SA9200_PAD 27
87#define SANSA_C100_PAD 28
86 88
87/* CONFIG_REMOTE_KEYPAD */ 89/* CONFIG_REMOTE_KEYPAD */
88#define H100_REMOTE 1 90#define H100_REMOTE 1
@@ -122,6 +124,7 @@
122#define LCD_TL0350A 23 /* as used by the iAudio M3 remote, treated as main LCD */ 124#define LCD_TL0350A 23 /* as used by the iAudio M3 remote, treated as main LCD */
123#define LCD_COWOND2 24 /* as used by Cowon D2 - LTV250QV, TCC7801 driver */ 125#define LCD_COWOND2 24 /* as used by Cowon D2 - LTV250QV, TCC7801 driver */
124#define LCD_SA9200 25 /* as used by the Philips SA9200 */ 126#define LCD_SA9200 25 /* as used by the Philips SA9200 */
127#define LCD_S6B33B2 26 /* as used by the Sansa c100 */
125 128
126/* LCD_PIXELFORMAT */ 129/* LCD_PIXELFORMAT */
127#define HORIZONTAL_PACKING 1 130#define HORIZONTAL_PACKING 1
@@ -262,6 +265,8 @@
262#include "config-creativezv.h" 265#include "config-creativezv.h"
263#elif defined(PHILIPS_SA9200) 266#elif defined(PHILIPS_SA9200)
264#include "config-sa9200.h" 267#include "config-sa9200.h"
268#elif defined(SANSA_C100)
269#include "config-c100.h"
265#else 270#else
266/* no known platform */ 271/* no known platform */
267#endif 272#endif
@@ -391,7 +396,7 @@
391#endif 396#endif
392 397
393/* define for all cpus from TCC77X family */ 398/* define for all cpus from TCC77X family */
394#if (CONFIG_CPU == TCC771L) || (CONFIG_CPU == TCC773L) 399#if (CONFIG_CPU == TCC771L) || (CONFIG_CPU == TCC773L) || (CONFIG_CPU == TCC770)
395#define CPU_TCC77X 400#define CPU_TCC77X
396#endif 401#endif
397 402
diff --git a/firmware/target/arm/tcc77x/c100/adc-target.h b/firmware/target/arm/tcc77x/c100/adc-target.h
new file mode 100644
index 0000000000..a4dcab437e
--- /dev/null
+++ b/firmware/target/arm/tcc77x/c100/adc-target.h
@@ -0,0 +1,24 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: adc-target.h 15339 2007-10-28 11:08:10Z dave $
9 *
10 * Copyright (C) 2007 Dave Chapman
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#ifndef _ADC_TARGET_H_
20#define _ADC_TARGET_H_
21
22#define NUM_ADC_CHANNELS 8
23
24#endif /* _ADC_TARGET_H_ */
diff --git a/firmware/target/arm/tcc77x/c100/backlight-target.h b/firmware/target/arm/tcc77x/c100/backlight-target.h
new file mode 100644
index 0000000000..fefd5bc5dc
--- /dev/null
+++ b/firmware/target/arm/tcc77x/c100/backlight-target.h
@@ -0,0 +1,38 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: backlight-target.h 15599 2007-11-12 18:49:53Z amiconn $
9 *
10 * Copyright (C) 2007 by Dave Chapman
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#ifndef BACKLIGHT_TARGET_H
20#define BACKLIGHT_TARGET_H
21
22#include "tcc77x.h"
23
24#define _backlight_init() true
25
26static inline void _backlight_on(void)
27{
28 /* Enable backlight */
29 GPIOE |= 0x2;
30}
31
32static inline void _backlight_off(void)
33{
34 /* Disable backlight */
35 GPIOE &= ~0x2;
36}
37
38#endif
diff --git a/firmware/target/arm/tcc77x/c100/button-c100.c b/firmware/target/arm/tcc77x/c100/button-c100.c
new file mode 100644
index 0000000000..0183a833ae
--- /dev/null
+++ b/firmware/target/arm/tcc77x/c100/button-c100.c
@@ -0,0 +1,62 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: button-logikdax.c 15396 2007-11-01 23:38:57Z dave $
9 *
10 * Copyright (C) 2007 by Dave Chapman
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include "config.h"
21#include "cpu.h"
22#include "button.h"
23#include "adc.h"
24
25void button_init_device(void)
26{
27 GPIOA_DIR |= 0xC;
28}
29
30int button_read_device(void)
31{
32 int btn = BUTTON_NONE;
33
34 if (!button_hold()){
35 GPIOA |= 0x4;
36 GPIOA &= ~0x8;
37
38 int i=20; while (i--);
39
40 if (GPIOA & 0x10) btn |= BUTTON_PLAYPAUSE; /* up */
41 if (GPIOA & 0x20) btn |= BUTTON_RIGHT;
42 if (GPIOA & 0x40) btn |= BUTTON_LEFT;
43
44 GPIOA |= 0x8;
45 GPIOA &= ~0x4;
46
47 i=20; while (i--);
48
49 if (GPIOA & 0x10) btn |= BUTTON_VOLUP;
50 if (GPIOA & 0x20) btn |= BUTTON_VOLDOWN;
51 if (GPIOA & 0x40) btn |= BUTTON_REPEATAB; /* down */
52
53 if (GPIOA & 0x80) btn |= BUTTON_SELECT;
54 if (GPIOA & 0x100) btn |= BUTTON_MENU;
55 }
56 return btn;
57}
58
59bool button_hold(void)
60{
61 return (GPIOA & 0x2);
62}
diff --git a/firmware/target/arm/tcc77x/c100/button-target.h b/firmware/target/arm/tcc77x/c100/button-target.h
new file mode 100644
index 0000000000..139be97b55
--- /dev/null
+++ b/firmware/target/arm/tcc77x/c100/button-target.h
@@ -0,0 +1,52 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: button-target.h 15396 2007-11-01 23:38:57Z dave $
9 *
10 * Copyright (C) 2007 by Dave Chapman
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#ifndef _BUTTON_TARGET_H_
21#define _BUTTON_TARGET_H_
22
23#include <stdbool.h>
24#include "config.h"
25
26#define HAS_BUTTON_HOLD
27
28void button_init_device(void);
29int button_read_device(void);
30bool button_hold(void);
31
32/* Main unit's buttons */
33#define BUTTON_MENU 0x00000001
34#define BUTTON_VOLUP 0x00000002
35#define BUTTON_VOLDOWN 0x00000004
36#define BUTTON_PLAYPAUSE 0x00000008
37#define BUTTON_REPEATAB 0x00000010
38#define BUTTON_LEFT 0x00000020
39#define BUTTON_RIGHT 0x00000040
40#define BUTTON_SELECT 0x00000080
41
42#define BUTTON_MAIN (BUTTON_MENU|BUTTON_VOLUP|BUTTON_VOLDOWN\
43 |BUTTON_PLAYPAUSE|BUTTON_REPEATAB|BUTTON_LEFT\
44 |BUTTON_RIGHT|BUTTON_SELECT)
45
46#define BUTTON_REMOTE 0
47
48/* Software power-off */
49#define POWEROFF_BUTTON BUTTON_MENU
50#define POWEROFF_COUNT 40
51
52#endif /* _BUTTON_TARGET_H_ */
diff --git a/firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c b/firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c
new file mode 100644
index 0000000000..79e14aba70
--- /dev/null
+++ b/firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c
@@ -0,0 +1,349 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: lcd-S6B33B2.c 16981 2008-06-09 04:34:57Z jethead71 $
9 *
10 * Copyright (C) 2007 by Mark Arigo
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#include "config.h"
20#include "cpu.h"
21#include "lcd.h"
22#include "kernel.h"
23#include "system.h"
24
25/* Display status */
26static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0;
27
28/* LCD command set for Samsung S6B33B2 */
29
30#define R_NOP 0x00
31#define R_OSCILLATION_MODE 0x02
32#define R_DRIVER_OUTPUT_MODE 0x10
33#define R_DCDC_SET 0x20
34#define R_BIAS_SET 0x22
35#define R_DCDC_CLOCK_DIV 0x24
36#define R_DCDC_AMP_ONOFF 0x26
37#define R_TEMP_COMPENSATION 0x28
38#define R_CONTRAST_CONTROL1 0x2a
39#define R_CONTRAST_CONTROL2 0x2b
40#define R_STANDBY_OFF 0x2c
41#define R_STANDBY_ON 0x2d
42#define R_DDRAM_BURST_OFF 0x2e
43#define R_DDRAM_BURST_ON 0x2f
44#define R_ADDRESSING_MODE 0x30
45#define R_ROW_VECTOR_MODE 0x32
46#define R_N_LINE_INVERSION 0x34
47#define R_FRAME_FREQ_CONTROL 0x36
48#define R_RED_PALETTE 0x38
49#define R_GREEN_PALETTE 0x3a
50#define R_BLUE_PALETTE 0x3c
51#define R_ENTRY_MODE 0x40
52#define R_X_ADDR_AREA 0x42
53#define R_Y_ADDR_AREA 0x43
54#define R_RAM_SKIP_AREA 0x45
55#define R_DISPLAY_OFF 0x50
56#define R_DISPLAY_ON 0x51
57#define R_SPEC_DISPLAY_PATTERN 0x53
58#define R_PARTIAL_DISPLAY_MODE 0x55
59#define R_PARTIAL_START_LINE 0x56
60#define R_PARTIAL_END_LINE 0x57
61#define R_AREA_SCROLL_MODE 0x59
62#define R_SCROLL_START_LINE 0x5a
63#define R_DATA_FORMAT_SELECT 0x60
64
65/* TCC77x specific defines */
66#define LCD_BASE 0x50000000
67#define LCD_CMD *(volatile unsigned char*)(LCD_BASE)
68#define LCD_DATA *(volatile unsigned char*)(LCD_BASE+1)
69
70static void lcd_send_command(unsigned cmd)
71{
72 LCD_CMD = cmd;
73
74 asm volatile (
75 "nop \n\t"
76 "nop \n\t"
77 "nop \n\t"
78 );
79}
80
81static void lcd_send_data(unsigned data)
82{
83 LCD_DATA = (data & 0xff00) >> 8;
84 LCD_DATA = (data & 0x00ff);
85}
86
87/* End of TCC77x specific defines */
88
89/* LCD init */
90void lcd_init_device(void)
91{
92 uint32_t bus_width;
93
94 /* Telechips init the same as the original firmware */
95 bus_width = ((MCFG >> 11) & 0x3) ^ 3;
96
97 CSCFG1 = (bus_width << 28) |
98 (3 << 26) | /* MTYPE = 3 */
99 ((LCD_BASE >> 28) << 22) | /* CSBASE = 0x5 */
100 (1 << 20) | /* Unknown */
101 (2 << 11) | /* Setup time = 2 cycles */
102 (2 << 3) | /* Pulse width = 2+1 cycles */
103 (2 << 0); /* Hold time = 2 cycle */
104
105 GPIOE &= ~0x8;
106 sleep(HZ/100); /* 10ms */
107
108 GPIOE |= 0x08;
109 sleep(HZ/100); /* 10ms */
110
111 lcd_send_command(R_STANDBY_OFF);
112 sleep(HZ/20); /* 50ms */
113
114 lcd_send_command(R_OSCILLATION_MODE);
115 lcd_send_command(0x01);
116 sleep(HZ/100); /* 10ms */
117
118 lcd_send_command(R_DCDC_AMP_ONOFF);
119 lcd_send_command(0x01);
120 sleep(HZ/100); /* 10ms */
121
122 lcd_send_command(R_DCDC_AMP_ONOFF);
123 lcd_send_command(0x09);
124 sleep(HZ/100); /* 10ms */
125
126 lcd_send_command(R_DCDC_AMP_ONOFF);
127 lcd_send_command(0x0b);
128 sleep(HZ/100); /* 10ms */
129
130 lcd_send_command(R_DCDC_AMP_ONOFF);
131 lcd_send_command(0x0f);
132 sleep(HZ/100); /* 10ms */
133
134 lcd_send_command(R_DCDC_SET);
135 lcd_send_command(0x01);
136 sleep(HZ/100); /* 10ms */
137 sleep(HZ/10); /* 100ms */
138
139 lcd_send_command(R_TEMP_COMPENSATION);
140 lcd_send_command(0x01);
141 sleep(HZ/100); /* 10ms */
142
143 lcd_send_command(R_DRIVER_OUTPUT_MODE);
144 lcd_send_command(0x03);
145
146 lcd_send_command(R_ENTRY_MODE);
147 lcd_send_command(0x81);
148
149 lcd_send_command(R_N_LINE_INVERSION);
150 lcd_send_command(0x04);
151 lcd_send_command(0xfa);
152 lcd_send_command(0x5f);
153
154 lcd_set_contrast(0x28);
155
156 lcd_send_command(R_SPEC_DISPLAY_PATTERN);
157 lcd_send_command(0x0);
158 sleep(HZ/100); /* 10ms */
159
160 lcd_send_command(R_ADDRESSING_MODE);
161 lcd_send_command(0x0);
162 sleep(HZ/100); /* 10ms */
163
164 lcd_send_command(R_PARTIAL_DISPLAY_MODE);
165 lcd_send_command(0x0);
166 sleep(HZ/100); /* 10ms */
167
168 lcd_send_command(R_X_ADDR_AREA);
169 lcd_send_command(0);
170 lcd_send_command(0x80);
171
172 lcd_send_command(R_Y_ADDR_AREA);
173 lcd_send_command(0x0);
174 lcd_send_command(0x80);
175
176 lcd_send_command(R_DISPLAY_ON);
177
178 lcd_send_command(R_SPEC_DISPLAY_PATTERN);
179 lcd_send_command(0x0);
180
181 /* Rockbox init */
182 lcd_clear_display();
183 lcd_update();
184}
185
186/*** hardware configuration ***/
187int lcd_default_contrast(void)
188{
189 return 0x28;
190}
191
192void lcd_set_contrast(int val)
193{
194 //val &= 0xFF;
195 lcd_send_command(R_CONTRAST_CONTROL1);
196 lcd_send_command(val);
197}
198
199void lcd_set_invert_display(bool yesno)
200{
201 /* TODO: Implement lcd_set_invert_display() */
202 (void)yesno;
203}
204
205/* turn the display upside down (call lcd_update() afterwards) */
206void lcd_set_flip(bool yesno)
207{
208 lcd_send_command(R_DRIVER_OUTPUT_MODE);
209 lcd_send_command(yesno ? 0x02 : 0x07);
210}
211
212/*** update functions ***/
213
214/*** update functions ***/
215
216void lcd_yuv_set_options(unsigned options)
217{
218 lcd_yuv_options = options;
219}
220
221/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */
222extern void lcd_write_yuv420_lines(unsigned char const * const src[3],
223 int width,
224 int stride);
225extern void lcd_write_yuv420_lines_odither(unsigned char const * const src[3],
226 int width,
227 int stride,
228 int x_screen, /* To align dither pattern */
229 int y_screen);
230/* Performance function to blit a YUV bitmap directly to the LCD */
231void lcd_blit_yuv(unsigned char * const src[3],
232 int src_x, int src_y, int stride,
233 int x, int y, int width, int height)
234{
235 unsigned char const * yuv_src[3];
236 off_t z;
237
238 /* Sorry, but width and height must be >= 2 or else */
239 width &= ~1;
240 height >>= 1;
241
242 y += 0x1a;
243
244 z = stride*src_y;
245 yuv_src[0] = src[0] + z + src_x;
246 yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1);
247 yuv_src[2] = src[2] + (yuv_src[1] - src[1]);
248
249 lcd_send_command(R_ENTRY_MODE);
250 lcd_send_command(0x80);
251
252 lcd_send_command(R_X_ADDR_AREA);
253 lcd_send_command(x);
254 lcd_send_command(x + width - 1);
255
256 if (lcd_yuv_options & LCD_YUV_DITHER)
257 {
258 do
259 {
260 lcd_send_command(R_Y_ADDR_AREA);
261 lcd_send_command(y);
262 lcd_send_command(y + 1);
263
264 /* NOP needed because on some c200s, the previous lcd_send_command
265 is interpreted as a separate command instead of part of
266 R_Y_ADDR_AREA. */
267 lcd_send_command(R_NOP);
268
269 lcd_write_yuv420_lines_odither(yuv_src, width, stride, x, y);
270 yuv_src[0] += stride << 1; /* Skip down two luma lines */
271 yuv_src[1] += stride >> 1; /* Skip down one chroma line */
272 yuv_src[2] += stride >> 1;
273 y += 2;
274 }
275 while (--height > 0);
276 }
277 else
278 {
279 do
280 {
281 lcd_send_command(R_Y_ADDR_AREA);
282 lcd_send_command(y);
283 lcd_send_command(y + 1);
284
285 lcd_send_command(R_NOP);
286
287 lcd_write_yuv420_lines(yuv_src, width, stride);
288 yuv_src[0] += stride << 1; /* Skip down two luma lines */
289 yuv_src[1] += stride >> 1; /* Skip down one chroma line */
290 yuv_src[2] += stride >> 1;
291 y += 2;
292 }
293 while (--height > 0);
294 }
295}
296
297
298/* Update the display.
299 This must be called after all other LCD functions that change the display. */
300void lcd_update(void)
301{
302 lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
303}
304
305/* Update a fraction of the display. */
306void lcd_update_rect(int x, int y, int width, int height)
307{
308 const fb_data *addr;
309
310 if (x + width >= LCD_WIDTH)
311 width = LCD_WIDTH - x;
312 if (y + height >= LCD_HEIGHT)
313 height = LCD_HEIGHT - y;
314
315 if ((width <= 0) || (height <= 0))
316 return; /* Nothing left to do. */
317
318 addr = &lcd_framebuffer[y][x];
319
320 if (width <= 1) {
321 lcd_send_command(R_ENTRY_MODE); /* The X end address must be larger */
322 lcd_send_command(0x80); /* that the X start address, so we */
323 lcd_send_command(R_X_ADDR_AREA); /* switch to vertical mode for */
324 lcd_send_command(x); /* single column updates and set */
325 lcd_send_command(x + 1); /* the window width to 2 */
326 } else {
327 lcd_send_command(R_ENTRY_MODE);
328 lcd_send_command(0x82);
329 lcd_send_command(R_X_ADDR_AREA);
330 lcd_send_command(x);
331 lcd_send_command(x + width - 1);
332 }
333
334 lcd_send_command(R_Y_ADDR_AREA);
335 lcd_send_command(y);
336 lcd_send_command(y + height - 1);
337
338 /* NOP needed because on some c200s, the previous lcd_send_command is
339 interpreted as a separate command instead of part of R_Y_ADDR_AREA. */
340 lcd_send_command(R_NOP);
341
342 do {
343 int w = width;
344 do {
345 lcd_send_data(*addr++);
346 } while (--w > 0);
347 addr += LCD_WIDTH - width;
348 } while (--height > 0);
349}
diff --git a/firmware/target/arm/tcc77x/c100/power-c100.c b/firmware/target/arm/tcc77x/c100/power-c100.c
new file mode 100644
index 0000000000..eb3012fde6
--- /dev/null
+++ b/firmware/target/arm/tcc77x/c100/power-c100.c
@@ -0,0 +1,66 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: power-logikdax.c 15339 2007-10-28 11:08:10Z dave $
9 *
10 * Copyright (C) 2007 Dave Chapman
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#include "config.h"
20#include "cpu.h"
21#include <stdbool.h>
22#include "kernel.h"
23#include "system.h"
24#include "power.h"
25
26#ifndef SIMULATOR
27
28void power_init(void)
29{
30}
31
32void ide_power_enable(bool on)
33{
34}
35
36bool ide_powered(void)
37{
38 return true;
39}
40
41void power_off(void)
42{
43}
44
45#else /* SIMULATOR */
46
47bool charger_inserted(void)
48{
49 return false;
50}
51
52void charger_enable(bool on)
53{
54 (void)on;
55}
56
57void power_off(void)
58{
59}
60
61void ide_power_enable(bool on)
62{
63 (void)on;
64}
65
66#endif /* SIMULATOR */
diff --git a/firmware/target/arm/tcc77x/system-tcc77x.c b/firmware/target/arm/tcc77x/system-tcc77x.c
index 2628d9f0ed..b338281c48 100644
--- a/firmware/target/arm/tcc77x/system-tcc77x.c
+++ b/firmware/target/arm/tcc77x/system-tcc77x.c
@@ -61,15 +61,19 @@ static void gpio_init(void)
61 GPIOD_FUNC = 0; 61 GPIOD_FUNC = 0;
62 GPIOD_DIR = 0x3f0; 62 GPIOD_DIR = 0x3f0;
63 GPIOD = 0xe0; 63 GPIOD = 0xe0;
64
64 GPIOE_FUNC = 0; 65 GPIOE_FUNC = 0;
65 GPIOE_DIR = 0xe0; 66 GPIOE_DIR = 0xe0;
66 GPIOE = 0; 67 GPIOE = 0;
68
67 GPIOA_FUNC = 0; 69 GPIOA_FUNC = 0;
68 GPIOA_DIR = 0xffff1000; /* 0 - 0xf000 */ 70 GPIOA_DIR = 0xffff1000; /* 0 - 0xf000 */
69 GPIOA = 0x1080; 71 GPIOA = 0x1080;
72
70 GPIOB_FUNC = 0x16a3; 73 GPIOB_FUNC = 0x16a3;
71 GPIOB_DIR = 0x6ffff; 74 GPIOB_DIR = 0x6ffff;
72 GPIOB = 0; 75 GPIOB = 0;
76
73 GPIOC_FUNC = 1; 77 GPIOC_FUNC = 1;
74 GPIOC_DIR = 0x03ffffff; /* mvn r2, 0xfc000000 */ 78 GPIOC_DIR = 0x03ffffff; /* mvn r2, 0xfc000000 */
75 GPIOC = 0; 79 GPIOC = 0;
@@ -99,6 +103,28 @@ static void gpio_init(void)
99{ 103{
100 /* TODO - Implement for M200 */ 104 /* TODO - Implement for M200 */
101} 105}
106#elif defined(SANSA_C100)
107static void gpio_init(void)
108{
109 /* Do what the original firmware does */
110 GPIOA_FUNC = 0;
111 GPIOB_FUNC = 0x16A3;
112 GPIOC_FUNC = 1;
113 GPIOD_FUNC |= 2;
114 GPIOE_FUNC = 0;
115
116 GPIOA_DIR = 0xFFFF0E00;
117 GPIOB_DIR = 0x6FFFF;
118 GPIOC_DIR = 0x03FFFFFF;
119 GPIOD_DIR = 0x3F7;
120 GPIOE_DIR = 0x9B;
121
122 GPIOA = 0x80;
123 GPIOB = 0;
124 GPIOC = 0;
125 GPIOD |= 0xC0;
126 GPIOE = 0x9B;
127}
102#endif 128#endif
103 129
104/* Second function called in the original firmware's startup code - we just 130/* Second function called in the original firmware's startup code - we just
@@ -158,7 +184,7 @@ http://infocenter.arm.com/help/topic/com.arm.doc.ddi0201d/DDI0201D_arm946es_r1p1
158 "mcr p15, 0, r0, c6, c0, 0 \n\t" 184 "mcr p15, 0, r0, c6, c0, 0 \n\t"
159 "mcr p15, 0, r0, c6, c0, 1 \n\t" 185 "mcr p15, 0, r0, c6, c0, 1 \n\t"
160 186
161#ifdef LOGIK_DAX 187#if defined(LOGIK_DAX) || defined(SANSA_C100)
162 /* Address region 1 - addr 0x2fff0000, size=64KB, enabled*/ 188 /* Address region 1 - addr 0x2fff0000, size=64KB, enabled*/
163 "ldr r0, =0x2fff001f \n\t" 189 "ldr r0, =0x2fff001f \n\t"
164#elif defined(IAUDIO_7) 190#elif defined(IAUDIO_7)
@@ -208,7 +234,7 @@ http://infocenter.arm.com/help/topic/com.arm.doc.ddi0201d/DDI0201D_arm946es_r1p1
208 "mcr p15, 0, r0, c6, c7, 0 \n\t" 234 "mcr p15, 0, r0, c6, c7, 0 \n\t"
209 "mcr p15, 0, r0, c6, c7, 1 \n\t" 235 "mcr p15, 0, r0, c6, c7, 1 \n\t"
210 236
211 237
212 /* Register 5 - Access Permission Registers */ 238 /* Register 5 - Access Permission Registers */
213 239
214 "ldr r0, =0xffff \n\t" 240 "ldr r0, =0xffff \n\t"
@@ -218,9 +244,9 @@ http://infocenter.arm.com/help/topic/com.arm.doc.ddi0201d/DDI0201D_arm946es_r1p1
218 "mov r0, #0xa7 \n\t" 244 "mov r0, #0xa7 \n\t"
219 "mcr p15, 0, r0, c3, c0, 0 \n\t" /* set write buffer control register */ 245 "mcr p15, 0, r0, c3, c0, 0 \n\t" /* set write buffer control register */
220 246
221#ifdef LOGIK_DAX 247#if defined(LOGIK_DAX) || defined(SANSA_C100)
222 "mov r0, #0xa5 \n\t" 248 "mov r0, #0xa5 \n\t"
223#elif defined(IAUDIO_7) || defined(SANSA_M200) 249#elif defined(IAUDIO_7) || defined(SANSA_M200)
224 "mov r0, #0xa7 \n\t" 250 "mov r0, #0xa7 \n\t"
225#elif 251#elif
226 #error NOT DEFINED FOR THIS TARGET! 252 #error NOT DEFINED FOR THIS TARGET!
diff --git a/tools/checkwps/targets.txt b/tools/checkwps/targets.txt
index 9583109ddd..196f0c3694 100644
--- a/tools/checkwps/targets.txt
+++ b/tools/checkwps/targets.txt
@@ -33,4 +33,5 @@ SANSA_E200 e200
33SANSA_E200 e200r 33SANSA_E200 e200r
34SANSA_C200 c200 34SANSA_C200 c200
35SANSA_M200 m200 35SANSA_M200 m200
36SANSA_C100 c100
36ELIO_TPJ1022 tpj1022 37ELIO_TPJ1022 tpj1022
diff --git a/tools/configure b/tools/configure
index 39b8d18a6e..b2c1b7ed18 100755
--- a/tools/configure
+++ b/tools/configure
@@ -671,7 +671,7 @@ cat <<EOF
671 31) M5/M5L 41) Gigabeat S 51) Sansa e200R 671 31) M5/M5L 41) Gigabeat S 51) Sansa e200R
672 32) 7 52) Sansa c200 672 32) 7 52) Sansa c200
673 33) Cowon D2 53) Sansa m200 673 33) Cowon D2 53) Sansa m200
674 34) M3/M3L 674 34) M3/M3L 54) Sansa c100
675 675
676 ==Tatung== ==Olympus== ==Logik== 676 ==Tatung== ==Olympus== ==Logik==
677 60) Elio TPJ-1022 70) M:Robe 500 80) DAX 1GB MP3/DAB 677 60) Elio TPJ-1022 70) M:Robe 500 80) DAX 1GB MP3/DAB
@@ -1627,7 +1627,27 @@ fi
1627 t_manufacturer="tcc77x" 1627 t_manufacturer="tcc77x"
1628 t_model="m200" 1628 t_model="m200"
1629 ;; 1629 ;;
1630 1630
1631 54|c100)
1632 target_id=42
1633 modelname="c100"
1634 target="-DSANSA_C100" # The #define used in firmware/export/config.h for conditional compilation
1635 memory=32 # how many megabytes of RAM
1636 arm946cc # Which compiler to use, see the beginning of the file
1637 tool="$rootdir/tools/scramble -add=c100" # Which command to use for creating a rockbox binary to be loaded by the bootloader
1638 boottool="$rootdir/tools/scramble -tcc=crc"
1639 bootoutput="player.rom"
1640 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" # How to create a monochrome bitmap
1641 bmp2rb_native="$rootdir/tools/bmp2rb -f 4" # How to create a native bitmap
1642 output="rockbox.c100" # The name of the Rockbox binary file
1643 appextra="recorder:gui" # What directories in the apps/ tree to include in compilation
1644 plugins="" # Does it support plugins?
1645 toolset=$tccbitmaptools
1646 t_cpu="arm"
1647 t_manufacturer="tcc77x"
1648 t_model="c100"
1649 ;;
1650
1631 60|tpj1022) 1651 60|tpj1022)
1632 target_id=25 1652 target_id=25
1633 modelname="tpj1022" 1653 modelname="tpj1022"