summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bootloader/telechips.c55
-rw-r--r--firmware/export/config-cowond2.h6
-rw-r--r--firmware/export/config.h2
3 files changed, 33 insertions, 30 deletions
diff --git a/bootloader/telechips.c b/bootloader/telechips.c
index dcb0c48d6c..8d2e36914b 100644
--- a/bootloader/telechips.c
+++ b/bootloader/telechips.c
@@ -43,12 +43,15 @@
43 43
44#if defined(COWON_D2) 44#if defined(COWON_D2)
45#include "i2c.h" 45#include "i2c.h"
46#define LOAD_ADDRESS 0x20000000 /* DRAM_START */
46#endif 47#endif
47 48
48char version[] = APPSVERSION; 49char version[] = APPSVERSION;
49 50
50extern int line; 51extern int line;
51 52
53#define MAX_LOAD_SIZE (8*1024*1024) /* Arbitrary, but plenty. */
54
52void* main(void) 55void* main(void)
53{ 56{
54 int button; 57 int button;
@@ -56,9 +59,9 @@ void* main(void)
56 int count = 0; 59 int count = 0;
57 bool do_power_off = false; 60 bool do_power_off = false;
58 61
59#if defined(COWON_D2) 62#if defined(COWON_D2) && defined(TCCBOOT)
60 int i,rc,fd,len; 63 int rc;
61 int* buf = (int*)0x21000000; /* Unused DRAM */ 64 unsigned char* loadbuffer = (unsigned char*)LOAD_ADDRESS;
62#endif 65#endif
63 66
64 power_init(); 67 power_init();
@@ -78,7 +81,12 @@ void* main(void)
78 81
79 _backlight_on(); 82 _backlight_on();
80 83
81#if defined(COWON_D2) 84/* Only load the firmware if TCCBOOT is defined - this ensures SDRAM_START is
85 available for loading the firmware. Otherwise display the debug screen. */
86#if defined(COWON_D2) && defined(TCCBOOT)
87 printf("Rockbox boot loader");
88 printf("Version %s", version);
89
82 printf("ATA"); 90 printf("ATA");
83 rc = ata_init(); 91 rc = ata_init();
84 if(rc) 92 if(rc)
@@ -94,36 +102,20 @@ void* main(void)
94 error(EDISK,rc); 102 error(EDISK,rc);
95 } 103 }
96 104
97#if 0 105 rc = load_firmware(loadbuffer, BOOTFILE, MAX_LOAD_SIZE);
98 printf("opening test file...");
99 106
100 fd = open("/test.bin", O_RDONLY); 107 if (rc < 0)
101 if (fd < 0) panicf("could not open test file");
102
103 len = filesize(fd);
104 printf("Length: %x", len);
105
106 lseek(fd, 0, SEEK_SET);
107 read(fd, buf, len);
108 close(fd);
109
110 printf("testing contents...");
111
112 i = 0;
113 while (buf[i] == i && i<(len/4)) { i++; }
114
115 if (i < len/4)
116 { 108 {
117 printf("mismatch at %x [0x%x]", i, buf[i]); 109 error(EBOOTFILE,rc);
118 } 110 }
119 else 111 else if (rc == EOK)
120 { 112 {
121 printf("passed!"); 113 int(*kernel_entry)(void);
114
115 kernel_entry = (void*) loadbuffer;
116 rc = kernel_entry();
122 } 117 }
123 while (!button_read_device()) {}; 118#else
124 while (button_read_device()) {};
125#endif
126#endif
127 119
128 while(!do_power_off) { 120 while(!do_power_off) {
129 line = 0; 121 line = 0;
@@ -145,6 +137,8 @@ void* main(void)
145 printf("Btn: 0x%08x",button); 137 printf("Btn: 0x%08x",button);
146 138
147#if defined(COWON_D2) 139#if defined(COWON_D2)
140 int i;
141
148 printf("GPIOA: 0x%08x",GPIOA); 142 printf("GPIOA: 0x%08x",GPIOA);
149 printf("GPIOB: 0x%08x",GPIOB); 143 printf("GPIOB: 0x%08x",GPIOB);
150 printf("GPIOC: 0x%08x",GPIOC); 144 printf("GPIOC: 0x%08x",GPIOC);
@@ -195,6 +189,9 @@ void* main(void)
195 /* Power-off */ 189 /* Power-off */
196 power_off(); 190 power_off();
197 191
192 printf("(NOT) POWERED OFF");
193#endif
194
198 return 0; 195 return 0;
199} 196}
200 197
diff --git a/firmware/export/config-cowond2.h b/firmware/export/config-cowond2.h
index 78b963c58d..9363f67683 100644
--- a/firmware/export/config-cowond2.h
+++ b/firmware/export/config-cowond2.h
@@ -6,6 +6,9 @@
6/* For Rolo and boot loader */ 6/* For Rolo and boot loader */
7#define MODEL_NUMBER 24 7#define MODEL_NUMBER 24
8 8
9/* Produce a dual-boot bootloader.bin for mktccboot */
10#define TCCBOOT
11
9/* define this if you have recording possibility */ 12/* define this if you have recording possibility */
10//#define HAVE_RECORDING 13//#define HAVE_RECORDING
11 14
@@ -63,6 +66,9 @@
63/* Define this if you have a software controlled poweroff */ 66/* Define this if you have a software controlled poweroff */
64#define HAVE_SW_POWEROFF 67#define HAVE_SW_POWEROFF
65 68
69/* Reduce Tremor's ICODE usage */
70#define ICODE_ATTR_TREMOR_NOT_MDCT
71
66/* The number of bytes reserved for loadable codecs */ 72/* The number of bytes reserved for loadable codecs */
67#define CODEC_SIZE 0x80000 73#define CODEC_SIZE 0x80000
68 74
diff --git a/firmware/export/config.h b/firmware/export/config.h
index e1c0cbc938..6a04504613 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -400,7 +400,7 @@
400 defined(CPU_COLDFIRE) || /* Coldfire: core, plugins, codecs */ \ 400 defined(CPU_COLDFIRE) || /* Coldfire: core, plugins, codecs */ \
401 defined(CPU_PP) || /* PortalPlayer: core, plugins, codecs */ \ 401 defined(CPU_PP) || /* PortalPlayer: core, plugins, codecs */ \
402 defined(CPU_TCC77X) || /* Telechips: core, plugins, codecs */ \ 402 defined(CPU_TCC77X) || /* Telechips: core, plugins, codecs */ \
403 /*defined(CPU_TCC780X) || /. Telechips: core, plugins, codecs */ \ 403 defined(CPU_TCC780X) || /* Telechips: core, plugins, codecs */ \
404 (CONFIG_CPU == PNX0101)) 404 (CONFIG_CPU == PNX0101))
405#define ICODE_ATTR __attribute__ ((section(".icode"))) 405#define ICODE_ATTR __attribute__ ((section(".icode")))
406#define ICONST_ATTR __attribute__ ((section(".irodata"))) 406#define ICONST_ATTR __attribute__ ((section(".irodata")))