Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Stuff
Sunday, December 10th, 2006 at 6:16:38pm UTC 

  1. Index: bootloader/SOURCES
  2. ===================================================================
  3. RCS file: /cvsroot/rockbox/bootloader/SOURCES,v
  4. retrieving revision 1.8
  5. diff -u -r1.8 SOURCES
  6. --- bootloader/SOURCES  31 Aug 2006 19:19:35 -0000        1.8
  7. +++ bootloader/SOURCES  10 Dec 2006 18:15:31 -0000
  8. @@ -2,10 +2,8 @@
  9.  ipod.c
  10.  #elif defined(GIGABEAT_F)
  11.  gigabeat.c
  12. -#elif defined(SANSA_E200)
  13. -e200.c
  14. -#elif defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
  15. -h10.c
  16. +#elif defined(IRIVER_H10) || defined(IRIVER_H10_5GB) || defined(SANSA_E200)
  17. +main-pp.c
  18.  #elif defined(ELIO_TPJ1022)
  19.  tpj1022.c
  20.  #else
  21. Index: bootloader/e200.c
  22. ===================================================================
  23. RCS file: bootloader/e200.c
  24. diff -N bootloader/e200.c
  25. --- bootloader/e200.c   16 Oct 2006 17:21:30 -0000 1.5
  26. +++ /dev/null   1 Jan 1970 00:00:00 -0000
  27. @@ -1,190 +0,0 @@
  28. -/***************************************************************************
  29. - *             __________               __   ___.
  30. - *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
  31. - *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
  32. - *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
  33. - *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
  34. - *                     \/            \/     \/    \/            \/
  35. - * $Id: e200.c,v 1.5 2006-10-16 17:21:30 dan_a Exp $
  36. - *
  37. - * Copyright (C) 2006 Daniel Stenberg
  38. - *
  39. - * All files in this archive are subject to the GNU General Public License.
  40. - * See the file COPYING in the source tree root for full license agreement.
  41. - *
  42. - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  43. - * KIND, either express or implied.
  44. - *
  45. - ****************************************************************************/
  46. -#include "config.h"
  47. -
  48. -#include <stdlib.h>
  49. -#include <stdio.h>
  50. -#include <string.h>
  51. -#include "cpu.h"
  52. -#include "system.h"
  53. -#include "lcd.h"
  54. -#include "kernel.h"
  55. -#include "thread.h"
  56. -#include "ata.h"
  57. -#include "fat.h"
  58. -#include "disk.h"
  59. -#include "font.h"
  60. -#include "adc.h"
  61. -#include "backlight.h"
  62. -#include "panic.h"
  63. -#include "power.h"
  64. -#include "file.h"
  65. -
  66. -static inline void blink(void)
  67. -{
  68. -    volatile unsigned int* ptr;
  69. -    int i;
  70. -    ptr = (volatile unsigned int*)0x70000020;
  71. -
  72. -    *ptr &= ~(1 << 13);
  73. -    for(i = 0; i < 0xfffff; i++)
  74. -    {
  75. -    }
  76. -    *ptr |= (1 << 13);
  77. -    for(i = 0; i < 0xfffff; i++)
  78. -    {
  79. -    }
  80. -}
  81. -
  82. -static inline void slow_blink(void)
  83. -{
  84. -    volatile unsigned int* ptr;
  85. -    int i;
  86. -    ptr = (volatile unsigned int*)0x70000020;
  87. -
  88. -    *ptr &= ~(1 << 13);
  89. -    for(i = 0; i < (0xfffff); i++)
  90. -    {
  91. -    }
  92. -    for(i = 0; i < (0xfffff); i++)
  93. -    {
  94. -    }
  95. -    for(i = 0; i < (0xfffff); i++)
  96. -    {
  97. -    }
  98. -
  99. -    *ptr |= (1 << 13);
  100. -    for(i = 0; i < (0xfffff); i++)
  101. -    {
  102. -    }
  103. -    for(i = 0; i < (0xfffff); i++)
  104. -    {
  105. -    }
  106. -    for(i = 0; i < (0xfffff); i++)
  107. -    {
  108. -    }
  109. -}
  110. -
  111. -static inline unsigned long get_pc(void)
  112. -{
  113. -    unsigned long pc;
  114. -    asm volatile (
  115. -        "mov %0, pc\n"
  116. -        : "=r"(pc)
  117. -    );
  118. -    return pc;
  119. -}
  120. -
  121. -/* These functions are present in the firmware library, but we reimplement
  122. -   them here because the originals do a lot more than we want */
  123. -
  124. -void reset_poweroff_timer(void)
  125. -{
  126. -}
  127. -
  128. -int dbg_ports(void)
  129. -{
  130. -    unsigned int gpio_a, gpio_b, gpio_c, gpio_d;
  131. -    unsigned int gpio_e, gpio_f, gpio_g, gpio_h;
  132. -    unsigned int gpio_i, gpio_j, gpio_k, gpio_l;
  133. -
  134. -    char buf[128];
  135. -    int line;
  136. -
  137. -    lcd_setmargins(0, 0);
  138. -    lcd_clear_display();
  139. -    lcd_setfont(FONT_SYSFIXED);
  140. -
  141. -    while(1)
  142. -    {
  143. -        gpio_a = GPIOA_INPUT_VAL;
  144. -        gpio_b = GPIOB_INPUT_VAL;
  145. -        gpio_c = GPIOC_INPUT_VAL;
  146. -
  147. -        gpio_g = GPIOG_INPUT_VAL;
  148. -        gpio_h = GPIOH_INPUT_VAL;
  149. -        gpio_i = GPIOI_INPUT_VAL;
  150. -
  151. -        line = 0;
  152. -        snprintf(buf, sizeof(buf), "GPIO_A: %02x GPIO_G: %02x", gpio_a, gpio_g);
  153. -        lcd_puts(0, line++, buf);
  154. -        snprintf(buf, sizeof(buf), "GPIO_B: %02x GPIO_H: %02x", gpio_b, gpio_h);
  155. -        lcd_puts(0, line++, buf);
  156. -        snprintf(buf, sizeof(buf), "GPIO_C: %02x GPIO_I: %02x", gpio_c, gpio_i);
  157. -        lcd_puts(0, line++, buf);
  158. -        line++;
  159. -
  160. -        gpio_d = GPIOD_INPUT_VAL;
  161. -        gpio_e = GPIOE_INPUT_VAL;
  162. -        gpio_f = GPIOF_INPUT_VAL;
  163. -
  164. -        gpio_j = GPIOJ_INPUT_VAL;
  165. -        gpio_k = GPIOK_INPUT_VAL;
  166. -        gpio_l = GPIOL_INPUT_VAL;
  167. -
  168. -        snprintf(buf, sizeof(buf), "GPIO_D: %02x GPIO_J: %02x", gpio_d, gpio_j);
  169. -        lcd_puts(0, line++, buf);
  170. -        snprintf(buf, sizeof(buf), "GPIO_E: %02x GPIO_K: %02x", gpio_e, gpio_k);
  171. -        lcd_puts(0, line++, buf);
  172. -        snprintf(buf, sizeof(buf), "GPIO_F: %02x GPIO_L: %02x", gpio_f, gpio_l);
  173. -        lcd_puts(0, line++, buf);
  174. -        line++;
  175. -        snprintf(buf, sizeof(buf), "ADC_1: %02x", adc_read(ADC_0));
  176. -        lcd_puts(0, line++, buf);
  177. -        snprintf(buf, sizeof(buf), "ADC_2: %02x", adc_read(ADC_1));
  178. -        lcd_puts(0, line++, buf);
  179. -        snprintf(buf, sizeof(buf), "ADC_3: %02x", adc_read(ADC_2));
  180. -        lcd_puts(0, line++, buf);
  181. -        snprintf(buf, sizeof(buf), "ADC_4: %02x", adc_read(ADC_3));
  182. -        lcd_puts(0, line++, buf);
  183. -        lcd_update();
  184. -    }
  185. -    return 0;
  186. -}
  187. -
  188. -void mpeg_stop(void)
  189. -{
  190. -}
  191. -
  192. -void usb_acknowledge(void)
  193. -{
  194. -}
  195. -
  196. -void usb_wait_for_disconnect(void)
  197. -{
  198. -}
  199. -
  200. -void sys_poweroff(void)
  201. -{
  202. -}
  203. -
  204. -void system_reboot(void)
  205. -{
  206. -
  207. -}
  208. -
  209. -void main(void)
  210. -{
  211. -    kernel_init();
  212. -    adc_init();
  213. -    lcd_init_device();
  214. -
  215. -    dbg_ports();
  216. -}
  217. -
  218. Index: bootloader/h10.c
  219. ===================================================================
  220. RCS file: bootloader/h10.c
  221. diff -N bootloader/h10.c
  222. --- bootloader/h10.c    28 Aug 2006 08:11:32 -0000  1.4
  223. +++ /dev/null   1 Jan 1970 00:00:00 -0000
  224. @@ -1,261 +0,0 @@
  225. -/***************************************************************************
  226. - *             __________               __   ___.
  227. - *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
  228. - *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
  229. - *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
  230. - *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
  231. - *                     \/            \/     \/    \/            \/
  232. - * $Id: h10.c,v 1.4 2006-08-28 08:11:32 barrywardell Exp $
  233. - *
  234. - * Copyright (C) 2006 by Barry Wardell
  235. - *
  236. - * Based on Rockbox iriver bootloader by Linus Nielsen Feltzing
  237. - * and the ipodlinux bootloader by Daniel Palffy and Bernard Leach
  238. - *
  239. - * All files in this archive are subject to the GNU General Public License.
  240. - * See the file COPYING in the source tree root for full license agreement.
  241. - *
  242. - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  243. - * KIND, either express or implied.
  244. - *
  245. - ****************************************************************************/
  246. -#include "config.h"
  247. -
  248. -#include <stdlib.h>
  249. -#include <stdio.h>
  250. -#include <string.h>
  251. -#include "cpu.h"
  252. -#include "system.h"
  253. -#include "lcd.h"
  254. -#include "kernel.h"
  255. -#include "thread.h"
  256. -#include "ata.h"
  257. -#include "fat.h"
  258. -#include "disk.h"
  259. -#include "font.h"
  260. -#include "adc.h"
  261. -#include "backlight.h"
  262. -#include "button.h"
  263. -#include "panic.h"
  264. -#include "power.h"
  265. -#include "file.h"
  266. -
  267. -/* Size of the buffer to store the loaded Rockbox/iriver image */
  268. -#define MAX_LOADSIZE (5*1024*1024)
  269. -
  270. -/* A buffer to load the iriver firmware or Rockbox into */
  271. -unsigned char loadbuffer[MAX_LOADSIZE];
  272. -
  273. -char version[] = APPSVERSION;
  274. -
  275. -#define DRAM_START              0x10000000
  276. -
  277. -int line=0;
  278. -
  279. -/* Load original iriver firmware. This function expects a file called
  280. -   "/System/Original.mi4" on the player. It should be decrypted
  281. -   and have the header stripped using mi4code. It reads the file in to a memory
  282. -   buffer called buf. The rest of the loading is done in main() and crt0.S
  283. -*/
  284. -int load_iriver(unsigned char* buf)
  285. -{
  286. -    int fd;
  287. -    int rc;
  288. -    int len;
  289. -   
  290. -    fd = open("/System/Original.mi4", O_RDONLY);
  291. -
  292. -    len = filesize(fd);
  293. -   
  294. -    if (len > MAX_LOADSIZE)
  295. -        return -6;
  296. -
  297. -    rc = read(fd, buf, len);
  298. -    if(rc < len)
  299. -        return -4;
  300. -
  301. -    close(fd);
  302. -    return len;
  303. -}
  304. -
  305. -/* Load Rockbox firmware (rockbox.h10) */
  306. -int load_rockbox(unsigned char* buf)
  307. -{
  308. -    int fd;
  309. -    int rc;
  310. -    int len;
  311. -    unsigned long chksum;
  312. -    char model[5];
  313. -    unsigned long sum;
  314. -    int i;
  315. -    char str[80];
  316. -   
  317. -    fd = open("/.rockbox/" BOOTFILE, O_RDONLY);
  318. -    if(fd < 0)
  319. -    {
  320. -        fd = open("/" BOOTFILE, O_RDONLY);
  321. -        if(fd < 0)
  322. -            return -1;
  323. -    }
  324. -
  325. -    len = filesize(fd) - 8;
  326. -
  327. -    snprintf(str, sizeof(str), "Length: %x", len);
  328. -    lcd_puts(0, line++ ,str);
  329. -    lcd_update();
  330. -   
  331. -    if (len > MAX_LOADSIZE)
  332. -        return -6;
  333. -
  334. -    lseek(fd, FIRMWARE_OFFSET_FILE_CRC, SEEK_SET);
  335. -   
  336. -    rc = read(fd, &chksum, 4);
  337. -    chksum=betoh32(chksum); /* Rockbox checksums are big-endian */
  338. -    if(rc < 4)
  339. -        return -2;
  340. -
  341. -    snprintf(str, sizeof(str), "Checksum: %x", chksum);
  342. -    lcd_puts(0, line++ ,str);
  343. -    lcd_update();
  344. -
  345. -    rc = read(fd, model, 4);
  346. -    if(rc < 4)
  347. -        return -3;
  348. -
  349. -    model[4] = 0;
  350. -   
  351. -    snprintf(str, sizeof(str), "Model name: %s", model);
  352. -    lcd_puts(0, line++ ,str);
  353. -    lcd_update();
  354. -
  355. -    lseek(fd, FIRMWARE_OFFSET_FILE_DATA, SEEK_SET);
  356. -
  357. -    rc = read(fd, buf, len);
  358. -    if(rc < len)
  359. -        return -4;
  360. -
  361. -    close(fd);
  362. -
  363. -    sum = MODEL_NUMBER;
  364. -   
  365. -    for(i = 0;i < len;i++) {
  366. -        sum += buf[i];
  367. -    }
  368. -
  369. -    snprintf(str, sizeof(str), "Sum: %x", sum);
  370. -    lcd_puts(0, line++ ,str);
  371. -    lcd_update();
  372. -
  373. -    if(sum != chksum)
  374. -        return -5;
  375. -
  376. -    return len;
  377. -}
  378. -
  379. -void* main(void)
  380. -{
  381. -    char buf[256];
  382. -    int i;
  383. -    int rc;
  384. -    unsigned short* identify_info;
  385. -    struct partinfo* pinfo;
  386. -
  387. -    system_init();
  388. -    kernel_init();
  389. -    lcd_init();
  390. -    font_init();
  391. -
  392. -    line=0;
  393. -
  394. -    lcd_setfont(FONT_SYSFIXED);
  395. -
  396. -    lcd_puts(0, line++, "Rockbox boot loader");
  397. -    snprintf(buf, sizeof(buf), "Version: 20%s", version);
  398. -    lcd_puts(0, line++, buf);
  399. -    snprintf(buf, sizeof(buf), "iriver H10");
  400. -    lcd_puts(0, line++, buf);
  401. -    lcd_update();
  402. -
  403. -    i=ata_init();
  404. -    if (i==0) {
  405. -      identify_info=ata_get_identify();
  406. -      /* Show model */
  407. -      for (i=0; i < 20; i++) {
  408. -        ((unsigned short*)buf)[i]=htobe16(identify_info[i+27]);
  409. -      }
  410. -      buf[40]=0;
  411. -      for (i=39; i && buf[i]==' '; i--) {
  412. -        buf[i]=0;
  413. -      }
  414. -      lcd_puts(0, line++, buf);
  415. -      lcd_update();
  416. -    } else {
  417. -      snprintf(buf, sizeof(buf), "ATA: %d", i);
  418. -      lcd_puts(0, line++, buf);
  419. -      lcd_update();
  420. -    }
  421. -
  422. -    disk_init();
  423. -    rc = disk_mount_all();
  424. -    if (rc<=0)
  425. -    {
  426. -        lcd_puts(0, line++, "No partition found");
  427. -        lcd_update();
  428. -    }
  429. -
  430. -    pinfo = disk_partinfo(0);
  431. -    snprintf(buf, sizeof(buf), "Partition 0: 0x%02x %ld MB",
  432. -                  pinfo->type, pinfo->size / 2048);
  433. -    lcd_puts(0, line++, buf);
  434. -    lcd_update();
  435. -
  436. -    i=button_read_device();
  437. -    if(i==BUTTON_LEFT)
  438. -    {
  439. -        lcd_puts(0, line, "Loading iriver firmware...");
  440. -        lcd_update();
  441. -        rc=load_iriver(loadbuffer);
  442. -    } else {
  443. -        lcd_puts(0, line, "Loading Rockbox...");
  444. -        lcd_update();
  445. -        rc=load_rockbox(loadbuffer);
  446. -    }
  447. -
  448. -    if (rc < 0) {
  449. -            snprintf(buf, sizeof(buf), "Rockbox error: %d",rc);
  450. -            lcd_puts(0, line++, buf);
  451. -            lcd_update();
  452. -    }
  453. -   
  454. -    memcpy((void*)DRAM_START,loadbuffer,rc);
  455. -   
  456. -    return (void*)DRAM_START;
  457. -}
  458. -
  459. -/* These functions are present in the firmware library, but we reimplement
  460. -   them here because the originals do a lot more than we want */
  461. -
  462. -void reset_poweroff_timer(void)
  463. -{
  464. -}
  465. -
  466. -int dbg_ports(void)
  467. -{
  468. -   return 0;
  469. -}
  470. -
  471. -void mpeg_stop(void)
  472. -{
  473. -}
  474. -
  475. -void usb_acknowledge(void)
  476. -{
  477. -}
  478. -
  479. -void usb_wait_for_disconnect(void)
  480. -{
  481. -}
  482. -
  483. -void sys_poweroff(void)
  484. -{
  485. -}
  486. Index: bootloader/main-pp.c
  487. ===================================================================
  488. RCS file: bootloader/main-pp.c
  489. diff -N bootloader/main-pp.c
  490. --- /dev/null   1 Jan 1970 00:00:00 -0000
  491. +++ bootloader/main-pp.c        10 Dec 2006 18:15:31 -0000
  492. @@ -0,0 +1,262 @@
  493. +/***************************************************************************
  494. + *             __________               __   ___.
  495. + *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
  496. + *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
  497. + *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
  498. + *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
  499. + *                     \/            \/     \/    \/            \/
  500. + * $Id: h10.c,v 1.4 2006-08-28 08:11:32 barrywardell Exp $
  501. + *
  502. + * Copyright (C) 2006 by Barry Wardell
  503. + *
  504. + * Based on Rockbox iriver bootloader by Linus Nielsen Feltzing
  505. + * and the ipodlinux bootloader by Daniel Palffy and Bernard Leach
  506. + *
  507. + * All files in this archive are subject to the GNU General Public License.
  508. + * See the file COPYING in the source tree root for full license agreement.
  509. + *
  510. + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  511. + * KIND, either express or implied.
  512. + *
  513. + ****************************************************************************/
  514. +#include "config.h"
  515. +
  516. +#include <stdlib.h>
  517. +#include <stdio.h>
  518. +#include <string.h>
  519. +#include "cpu.h"
  520. +#include "system.h"
  521. +#include "lcd.h"
  522. +#include "kernel.h"
  523. +#include "thread.h"
  524. +#include "ata.h"
  525. +#include "fat.h"
  526. +#include "disk.h"
  527. +#include "font.h"
  528. +#include "adc.h"
  529. +#include "backlight.h"
  530. +#include "button.h"
  531. +#include "panic.h"
  532. +#include "power.h"
  533. +#include "file.h"
  534. +
  535. +/* Size of the buffer to store the loaded firmware image */
  536. +#define MAX_LOADSIZE (10*1024*1024)
  537. +
  538. +/* A buffer to load the iriver firmware or Rockbox into */
  539. +unsigned char loadbuffer[MAX_LOADSIZE];
  540. +
  541. +char version[] = APPSVERSION;
  542. +
  543. +#define DRAM_START              0x10000000
  544. +
  545. +int line=0;
  546. +
  547. +/* Load original mi4 firmware. This function expects a file called
  548. +   "/System/OF.bin" on the player. It should be a mi4 firmware decrypted
  549. +   and header stripped using mi4code. It reads the file in to a memory
  550. +   buffer called buf. The rest of the loading is done in main() and crt0.S
  551. +*/
  552. +int load_original_firmware(unsigned char* buf)
  553. +{
  554. +    int fd;
  555. +    int rc;
  556. +    int len;
  557. +   
  558. +    fd = open("/System/OF.bin", O_RDONLY);
  559. +
  560. +    len = filesize(fd);
  561. +   
  562. +    if (len > MAX_LOADSIZE)
  563. +        return -6;
  564. +
  565. +    rc = read(fd, buf, len);
  566. +    if(rc < len)
  567. +        return -4;
  568. +
  569. +    close(fd);
  570. +    return len;
  571. +}
  572. +
  573. +/* Load Rockbox firmware (rockbox.*) */
  574. +int load_rockbox(unsigned char* buf)
  575. +{
  576. +    int fd;
  577. +    int rc;
  578. +    int len;
  579. +    unsigned long chksum;
  580. +    char model[5];
  581. +    unsigned long sum;
  582. +    int i;
  583. +    char str[80];
  584. +   
  585. +    fd = open("/.rockbox/" BOOTFILE, O_RDONLY);
  586. +    if(fd < 0)
  587. +    {
  588. +        fd = open("/" BOOTFILE, O_RDONLY);
  589. +        if(fd < 0)
  590. +            return -1;
  591. +    }
  592. +
  593. +    len = filesize(fd) - 8;
  594. +
  595. +    snprintf(str, sizeof(str), "Length: %x", len);
  596. +    lcd_puts(0, line++ ,str);
  597. +    lcd_update();
  598. +   
  599. +    if (len > MAX_LOADSIZE)
  600. +        return -6;
  601. +
  602. +    lseek(fd, FIRMWARE_OFFSET_FILE_CRC, SEEK_SET);
  603. +   
  604. +    rc = read(fd, &chksum, 4);
  605. +    chksum=betoh32(chksum); /* Rockbox checksums are big-endian */
  606. +    if(rc < 4)
  607. +        return -2;
  608. +
  609. +    snprintf(str, sizeof(str), "Checksum: %x", chksum);
  610. +    lcd_puts(0, line++ ,str);
  611. +    lcd_update();
  612. +
  613. +    rc = read(fd, model, 4);
  614. +    if(rc < 4)
  615. +        return -3;
  616. +
  617. +    model[4] = 0;
  618. +   
  619. +    snprintf(str, sizeof(str), "Model name: %s", model);
  620. +    lcd_puts(0, line++ ,str);
  621. +    lcd_update();
  622. +
  623. +    lseek(fd, FIRMWARE_OFFSET_FILE_DATA, SEEK_SET);
  624. +
  625. +    rc = read(fd, buf, len);
  626. +    if(rc < len)
  627. +        return -4;
  628. +
  629. +    close(fd);
  630. +
  631. +    sum = MODEL_NUMBER;
  632. +   
  633. +    for(i = 0;i < len;i++) {
  634. +        sum += buf[i];
  635. +    }
  636. +
  637. +    snprintf(str, sizeof(str), "Sum: %x", sum);
  638. +    lcd_puts(0, line++ ,str);
  639. +    lcd_update();
  640. +
  641. +    if(sum != chksum)
  642. +        return -5;
  643. +
  644. +    return len;
  645. +}
  646. +
  647. +void* main(void)
  648. +{
  649. +    char buf[256];
  650. +    int i;
  651. +    int rc;
  652. +    unsigned short* identify_info;
  653. +    struct partinfo* pinfo;
  654. +
  655. +    system_init();
  656. +    kernel_init();
  657. +    lcd_init();
  658. +    font_init();
  659. +
  660. +    line=0;
  661. +
  662. +    lcd_setfont(FONT_SYSFIXED);
  663. +
  664. +    lcd_puts(0, line++, "Rockbox boot loader");
  665. +    snprintf(buf, sizeof(buf), "Version: 20%s", version);
  666. +    lcd_puts(0, line++, buf);
  667. +    snprintf(buf, sizeof(buf), MODEL_NAME);
  668. +    lcd_puts(0, line++, buf);
  669. +    lcd_update();
  670. +
  671. +    i=ata_init();
  672. +    if (i==0) {
  673. +      identify_info=ata_get_identify();
  674. +      /* Show model */
  675. +      for (i=0; i < 20; i++) {
  676. +        ((unsigned short*)buf)[i]=htobe16(identify_info[i+27]);
  677. +      }
  678. +      buf[40]=0;
  679. +      for (i=39; i && buf[i]==' '; i--) {
  680. +        buf[i]=0;
  681. +      }
  682. +      lcd_puts(0, line++, buf);
  683. +      lcd_update();
  684. +    } else {
  685. +      snprintf(buf, sizeof(buf), "ATA: %d", i);
  686. +      lcd_puts(0, line++, buf);
  687. +      lcd_update();
  688. +    }
  689. +
  690. +    disk_init();
  691. +    rc = disk_mount_all();
  692. +    if (rc<=0)
  693. +    {
  694. +        lcd_puts(0, line++, "No partition found");
  695. +        lcd_update();
  696. +    }
  697. +
  698. +    pinfo = disk_partinfo(0);
  699. +    snprintf(buf, sizeof(buf), "Partition 0: 0x%02x %ld MB",
  700. +                  pinfo->type, pinfo->size / 2048);
  701. +    lcd_puts(0, line++, buf);
  702. +    lcd_update();
  703. +
  704. +    i=button_read_device();
  705. +    if(i==BUTTON_LEFT)
  706. +    {
  707. +        lcd_puts(0, line++, "Loading original firmware...");
  708. +        lcd_update();
  709. +        rc=load_original_firmware(loadbuffer);
  710. +    } else {
  711. +        lcd_puts(0, line++, "Loading Rockbox...");
  712. +        lcd_update();
  713. +        rc=load_rockbox(loadbuffer);
  714. +    }
  715. +
  716. +    if (rc < 0) {
  717. +            snprintf(buf, sizeof(buf), "Rockbox error: %d",rc);
  718. +            lcd_puts(0, line++, buf);
  719. +            lcd_update();
  720. +            while(1) {}
  721. +    }
  722. +   
  723. +    memcpy((void*)DRAM_START,loadbuffer,rc);
  724. +   
  725. +    return (void*)DRAM_START;
  726. +}
  727. +
  728. +/* These functions are present in the firmware library, but we reimplement
  729. +   them here because the originals do a lot more than we want */
  730. +
  731. +void reset_poweroff_timer(void)
  732. +{
  733. +}
  734. +
  735. +int dbg_ports(void)
  736. +{
  737. +   return 0;
  738. +}
  739. +
  740. +void mpeg_stop(void)
  741. +{
  742. +}
  743. +
  744. +void usb_acknowledge(void)
  745. +{
  746. +}
  747. +
  748. +void usb_wait_for_disconnect(void)
  749. +{
  750. +}
  751. +
  752. +void sys_poweroff(void)
  753. +{
  754. +}
  755. Index: firmware/SOURCES
  756. ===================================================================
  757. RCS file: /cvsroot/rockbox/firmware/SOURCES,v
  758. retrieving revision 1.146
  759. diff -u -r1.146 SOURCES
  760. --- firmware/SOURCES    9 Dec 2006 19:18:16 -0000   1.146
  761. +++ firmware/SOURCES    10 Dec 2006 18:15:32 -0000
  762. @@ -262,7 +262,11 @@
  763.  /* no i2c driver yet */
  764.  #endif
  765.  #if defined(CPU_PP)
  766. +#ifdef BOOTLOADER
  767. +target/arm/crt0-pp-bl.S
  768. +#else
  769.  target/arm/crt0-pp.S
  770. +#endif
  771.  #elif defined(CPU_ARM)
  772.  target/arm/crt0.S
  773.  #endif /* defined(CPU_*) */
  774. Index: firmware/boot.lds
  775. ===================================================================
  776. RCS file: /cvsroot/rockbox/firmware/boot.lds,v
  777. retrieving revision 1.26
  778. diff -u -r1.26 boot.lds
  779. --- firmware/boot.lds   10 Dec 2006 13:33:12 -0000 1.26
  780. +++ firmware/boot.lds   10 Dec 2006 18:15:32 -0000
  781. @@ -8,7 +8,7 @@
  782.  OUTPUT_FORMAT(elf32-littlearm)
  783.  OUTPUT_ARCH(arm)
  784.  #ifdef CPU_PP
  785. -INPUT(target/arm/crt0-pp.o)
  786. +INPUT(target/arm/crt0-pp-bl.o)
  787.  #else
  788.  INPUT(target/arm/crt0.o)
  789.  #endif
  790. Index: firmware/export/config-e200.h
  791. ===================================================================
  792. RCS file: /cvsroot/rockbox/firmware/export/config-e200.h,v
  793. retrieving revision 1.4
  794. diff -u -r1.4 config-e200.h
  795. --- firmware/export/config-e200.h       22 Nov 2006 00:49:15 -0000     1.4
  796. +++ firmware/export/config-e200.h       10 Dec 2006 18:15:32 -0000
  797. @@ -4,7 +4,8 @@
  798.  #define TARGET_TREE /* this target is using the target tree system */
  799.  
  800.  /* For Rolo and boot loader */
  801. -#define MODEL_NUMBER 12
  802. +#define MODEL_NUMBER 16
  803. +#define MODEL_NAME   "Sandisk Sansa e200"
  804.  
  805.  /* define this if you have recording possibility */
  806.  /*#define HAVE_RECORDING 1*/ /* TODO: add support for this */
  807. Index: firmware/export/config-h10.h
  808. ===================================================================
  809. RCS file: /cvsroot/rockbox/firmware/export/config-h10.h,v
  810. retrieving revision 1.20
  811. diff -u -r1.20 config-h10.h
  812. --- firmware/export/config-h10.h        9 Nov 2006 22:33:24 -0000       1.20
  813. +++ firmware/export/config-h10.h        10 Dec 2006 18:15:32 -0000
  814. @@ -6,6 +6,7 @@
  815.  
  816.  /* For Rolo and boot loader */
  817.  #define MODEL_NUMBER 13
  818. +#define MODEL_NAME   "iriver H10 20GB"
  819.  
  820.  /* define this if you have recording possibility */
  821.  /*#define HAVE_RECORDING 1*/ /* TODO: add support for this */
  822. Index: firmware/export/config-h10_5gb.h
  823. ===================================================================
  824. RCS file: /cvsroot/rockbox/firmware/export/config-h10_5gb.h,v
  825. retrieving revision 1.14
  826. diff -u -r1.14 config-h10_5gb.h
  827. --- firmware/export/config-h10_5gb.h    9 Nov 2006 22:33:24 -0000   1.14
  828. +++ firmware/export/config-h10_5gb.h    10 Dec 2006 18:15:32 -0000
  829. @@ -6,6 +6,7 @@
  830.  
  831.  /* For Rolo and boot loader */
  832.  #define MODEL_NUMBER 14
  833. +#define MODEL_NAME   "iriver H10 5/6GB"
  834.  
  835.  /* define this if you have recording possibility */
  836.  /*#define HAVE_RECORDING 1*/ /* TODO: add support for this */
  837. Index: firmware/target/arm/crt0-pp-bl.S
  838. ===================================================================
  839. RCS file: firmware/target/arm/crt0-pp-bl.S
  840. diff -N firmware/target/arm/crt0-pp-bl.S
  841. --- /dev/null   1 Jan 1970 00:00:00 -0000
  842. +++ firmware/target/arm/crt0-pp-bl.S    10 Dec 2006 18:15:33 -0000
  843. @@ -0,0 +1,174 @@
  844. +/***************************************************************************
  845. + *             __________               __   ___.
  846. + *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
  847. + *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
  848. + *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
  849. + *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
  850. + *                     \/            \/     \/    \/            \/
  851. + * $Id: crt0-pp.S,v 1.2 2006/11/22 00:49:16 dan_a Exp $
  852. + *
  853. + * Copyright (C) 2002 by Linus Nielsen Feltzing
  854. + *
  855. + * All files in this archive are subject to the GNU General Public License.
  856. + * See the file COPYING in the source tree root for full license agreement.
  857. + *
  858. + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  859. + * KIND, either express or implied.
  860. + *
  861. + ****************************************************************************/
  862. +#include "config.h"
  863. +#include "cpu.h"
  864. +
  865. +    .section .init.text,"ax",%progbits
  866. +
  867. +    .global    start
  868. +start:
  869. +
  870. +/* PortalPlayer bootloader and startup code based on startup.s from the iPodLinux
  871. + * loader
  872. + *
  873. + * Copyright (c) 2003, Daniel Palffy (dpalffy (at) rainstorm.org)
  874. + * Copyright (c) 2005, Bernard Leach <[email protected]>
  875. + *
  876. + */
  877. +#if CONFIG_CPU == PP5002
  878. +    .equ    PROC_ID,  0xc4000000
  879. +    .equ    COP_CTRL, 0xcf004058
  880. +    .equ    COP_STATUS, 0xcf004050
  881. +    .equ    IIS_CONFIG, 0xc0002500
  882. +    .equ    SLEEP,    0xca
  883. +    .equ    WAKE,     0xce
  884. +    .equ    SLEEPING, 0x4000
  885. +#else
  886. +    .equ    PROC_ID,  0x60000000
  887. +    .equ    COP_CTRL, 0x60007004
  888. +    .equ    COP_STATUS, 0x60007004
  889. +    .equ    IIS_CONFIG, 0x70002800
  890. +    .equ    SLEEP,    0x80000000
  891. +    .equ    WAKE,     0x0
  892. +    .equ    SLEEPING, 0x80000000
  893. +    .equ    CACHE_CTRL, 0x6000c000
  894. +#endif
  895. +
  896. +    msr    cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ */
  897. +
  898. +#ifndef IPOD_ARCH
  899. +    /* For builds on targets with mi4 firmware, scramble writes data to
  900. +       0xe0-0xeb, so jump past that.*/
  901. +    b      pad_skip
  902. +
  903. +.space 60*4
  904. +
  905. +pad_skip:
  906. +#endif
  907. +
  908. +/* 1 - Copy the bootloader to IRAM */
  909. +    /* get the high part of our execute address */
  910. +    ldr    r7, =0xfffffe00
  911. +    and    r4, pc, r7
  912. +
  913. +    /* Copy bootloader to safe area - 0x40000000 */
  914. +    mov    r5, #0x40000000
  915. +    ldr    r6, = _dataend
  916. +1:
  917. +    cmp    r5, r6
  918. +    ldrcc  r2, [r4], #4
  919. +    strcc  r2, [r5], #4
  920. +    bcc    1b
  921. +
  922. +/* 2 - Jump both CPU and COP there */
  923. +    ldr    pc, =start_loc    /* jump to the relocated start_loc:  */
  924. +
  925. +start_loc:
  926. +
  927. +    /* Find out which processor we are */
  928. +    ldr    r0, =PROC_ID
  929. +    ldr    r0, [r0]
  930. +    and    r0, r0, #0xff
  931. +    cmp    r0, #0x55
  932. +    beq    cpu
  933. +   
  934. +    /* put us (co-processor) to sleep */
  935. +    ldr    r4, =COP_CTRL
  936. +    mov    r3, #SLEEP
  937. +    str    r3, [r4]
  938. +    ldr    pc, =cop_wake_start
  939. +
  940. +cop_wake_start:
  941. +    /* COP: Invalidate cache */
  942. +    ldr    r0, =0xf000f044
  943. +    ldr    r1, [r0]
  944. +    orr    r1, r1, #0x6
  945. +    str    r1, [r0]
  946. +
  947. +    ldr    r0, =0x6000c000
  948. +1:
  949. +    ldr    r1, [r0]
  950. +    tst    r1, #0x8000
  951. +    bne    1b
  952. +   
  953. +    ldr    r0, =startup_loc
  954. +    ldr    pc, [r0]
  955. +
  956. +cpu:
  957. +    /* Wait for COP to be sleeping */
  958. +    ldr    r4, =COP_STATUS
  959. +1:
  960. +    ldr    r3, [r4]
  961. +    ands   r3, r3, #SLEEPING
  962. +    beq    1b
  963. +   
  964. +    /* Initialise bss section to zero */
  965. +    ldr    r2, =_edata
  966. +    ldr    r3, =_end
  967. +    mov    r4, #0
  968. +1:
  969. +    cmp    r3, r2
  970. +    strhi  r4, [r2], #4
  971. +    bhi    1b
  972. +       
  973. +    /* Set up some stack and munge it with 0xdeadbeef */
  974. +    ldr    sp, =stackend
  975. +    mov    r3, sp
  976. +    ldr    r2, =stackbegin
  977. +    ldr    r4, =0xdeadbeef
  978. +1:
  979. +    cmp    r3, r2
  980. +    strhi  r4, [r2], #4
  981. +    bhi    1b
  982. +
  983. +    /* execute the loader - this will load an image to 0x10000000 */
  984. +    bl     main
  985. +
  986. +    ldr    r1, =startup_loc
  987. +    str    r0, [r1]
  988. +
  989. +    /* Flush cache */
  990. +    ldr    r3, =0xf000f044
  991. +    ldr    r4, [r3]
  992. +    orr    r4, r4, #0x2
  993. +    str    r4, [r3]
  994. +
  995. +    ldr    r3, =0x6000c000
  996. +1:
  997. +    ldr    r4, [r3]
  998. +    tst    r4, #0x8000
  999. +    bne    1b
  1000. +
  1001. +    /* Wake up the coprocessor before executing the firmware */
  1002. +    ldr    r4, =COP_CTRL
  1003. +    mov    r3, #WAKE
  1004. +    str    r3, [r4]
  1005. +
  1006. +    mov    pc, r0
  1007. +
  1008. +startup_loc:
  1009. +    .word    0x0
  1010. +   
  1011. +#ifdef IPOD_ARCH
  1012. +.align 8    /* starts at 0x100 */
  1013. +.global boot_table
  1014. +boot_table:
  1015. +    /* here comes the boot table, don't move its offset */
  1016. +    .space 400
  1017. +#endif
  1018. Index: firmware/target/arm/crt0-pp.S
  1019. ===================================================================
  1020. RCS file: /cvsroot/rockbox/firmware/target/arm/crt0-pp.S,v
  1021. retrieving revision 1.2
  1022. diff -u -r1.2 crt0-pp.S
  1023. --- firmware/target/arm/crt0-pp.S       22 Nov 2006 00:49:16 -0000     1.2
  1024. +++ firmware/target/arm/crt0-pp.S       10 Dec 2006 18:15:33 -0000
  1025. @@ -52,15 +52,9 @@
  1026.  
  1027.      msr    cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ */
  1028.  
  1029. -#ifndef BOOTLOADER
  1030.      b      pad_skip
  1031.  
  1032. -#if defined(SANSA_E200)
  1033. -/* mi4tool writes junk between 0xe0 and 0xeb.  Avoid this. */
  1034. -.space 60*4 /* (more than enough) space for exception vectors */
  1035. -#else
  1036. -.space 50*4
  1037. -#endif
  1038. +.space 50*4 /* (more than enough) space for exception vectors */
  1039.  
  1040.  pad_skip:
  1041.  #ifdef SANSA_E200
  1042. @@ -161,7 +155,6 @@
  1043.      strhi  r5, [r3], #4
  1044.      bhi    1b
  1045.  #endif /* !STUB */
  1046. -#endif /* !BOOTLOADER */
  1047.  
  1048.      /* Initialise bss section to zero */
  1049.      ldr    r2, =_edata
  1050. @@ -181,90 +174,6 @@
  1051.      cmp    r3, r2
  1052.      strhi  r4, [r2], #4
  1053.      bhi    1b
  1054. -
  1055. -#ifdef BOOTLOADER
  1056. -    /* TODO: the high part of the address is probably dependent on CONFIG_CPU.
  1057. -       Since we tend to use ifdefs for each chipset target
  1058. -       anyway, we might as well just hardcode it here.
  1059. -     */
  1060. -       
  1061. -    /* get the high part of our execute address */
  1062. -    ldr    r0, =0xff000000
  1063. -    and    r8, pc, r0             @ r8 is used later
  1064. -
  1065. -    /* Find out which processor we are */
  1066. -    mov    r0, #PROC_ID
  1067. -    ldr    r0, [r0]
  1068. -    and    r0, r0, #0xff
  1069. -    cmp    r0, #0x55
  1070. -    beq    1f
  1071. -
  1072. -    /* put us (co-processor) to sleep */
  1073. -    ldr    r4, =COP_CTRL
  1074. -    mov    r3, #SLEEP
  1075. -    str    r3, [r4]
  1076. -    ldr    pc, =cop_wake_start
  1077. -
  1078. -cop_wake_start:
  1079. -    /* jump the COP to startup */
  1080. -    ldr    r0, =startup_loc
  1081. -    ldr    pc, [r0]
  1082. -
  1083. -1:
  1084. -   
  1085. -    /* get the high part of our execute address */
  1086. -    ldr    r2, =0xffffff00
  1087. -    and    r4, pc, r2
  1088. -
  1089. -    /* Copy bootloader to safe area - 0x40000000 */
  1090. -    mov    r5, #0x40000000
  1091. -    ldr    r6, = _dataend
  1092. -    sub    r0, r6, r5       /* length of loader */
  1093. -    add    r0, r4, r0     /* r0 points to start of loader */
  1094. -1:
  1095. -    cmp    r5, r6
  1096. -    ldrcc  r2, [r4], #4
  1097. -    strcc  r2, [r5], #4
  1098. -    bcc    1b
  1099. -
  1100. -    ldr    pc, =start_loc    /* jump to the relocated start_loc:  */
  1101. -   
  1102. -start_loc:
  1103. -
  1104. -    /* execute the loader - this will load an image to 0x10000000 */
  1105. -    bl     main
  1106. -
  1107. -    /* Wake up the coprocessor before executing the firmware */
  1108. -
  1109. -    /* save the startup address for the COP */
  1110. -    ldr    r1, =startup_loc
  1111. -    str    r0, [r1]
  1112. -
  1113. -    /* make sure COP is sleeping */
  1114. -    ldr    r4, =COP_STATUS
  1115. -1:
  1116. -    ldr    r3, [r4]
  1117. -    ands   r3, r3, #SLEEPING
  1118. -    beq    1b
  1119. -
  1120. -    /* wake up COP */
  1121. -    ldr    r4, =COP_CTRL
  1122. -    mov    r3, #WAKE
  1123. -    str    r3, [r4]
  1124. -
  1125. -    /* jump to start location */
  1126. -    mov    pc, r0
  1127. -
  1128. -startup_loc:
  1129. -    .word    0x0
  1130. -
  1131. -.align 8    /* starts at 0x100 */
  1132. -.global boot_table
  1133. -boot_table:
  1134. -    /* here comes the boot table, don't move its offset */
  1135. -    .space 400
  1136. -
  1137. -#else /* BOOTLOADER */
  1138.      
  1139.      /* Set up stack for IRQ mode */
  1140.      msr    cpsr_c, #0xd2
  1141. @@ -385,5 +294,3 @@
  1142.  /* 256 words of FIQ stack */
  1143.      .space 256*4
  1144.  fiq_stack:
  1145. -
  1146. -#endif /* BOOTLOADER */
  1147. Index: tools/configure
  1148. ===================================================================
  1149. RCS file: /cvsroot/rockbox/tools/configure,v
  1150. retrieving revision 1.245
  1151. diff -u -r1.245 configure
  1152. --- tools/configure     27 Nov 2006 02:15:39 -0000   1.245
  1153. +++ tools/configure     10 Dec 2006 18:15:37 -0000
  1154. @@ -1115,10 +1115,10 @@
  1155.      target="-DSANSA_E200"
  1156.      memory=32 # supposedly
  1157.      arm7tdmicc
  1158. -    tool="$rootdir/tools/scramble -mi4v3"
  1159. +    tool="$rootdir/tools/scramble -add=e200"
  1160.      bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
  1161.      bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
  1162. -    output="PP5022.mi4"
  1163. +    output="rockbox.e200"
  1164.      appextra="recorder:gui"
  1165.      archosrom=""
  1166.      flash=""
  1167. Index: tools/scramble.c
  1168. ===================================================================
  1169. RCS file: /cvsroot/rockbox/tools/scramble.c,v
  1170. retrieving revision 1.35
  1171. diff -u -r1.35 scramble.c
  1172. --- tools/scramble.c    31 Aug 2006 19:19:35 -0000  1.35
  1173. +++ tools/scramble.c    10 Dec 2006 18:15:38 -0000
  1174. @@ -89,7 +89,7 @@
  1175.             "\t-mi4v3  PortalPlayer .mi4 format (revision 010301)\n"
  1176.             "\t-add=X  Rockbox generic \"add-up\" checksum format\n"
  1177.             "\t        (X values: h100, h120, h140, h300, ipco, nano, ipvd\n"
  1178. -           "\t                   ip3g, ip4g, mini, x5, h10, h10_5gb)\n"
  1179. +           "\t                   ip3g, ip4g, mini, x5, h10, h10_5gb, tpj2, e200)\n"
  1180.             "\nNo option results in Archos standard player/recorder format.\n");
  1181.  
  1182.      exit(1);
  1183. @@ -207,6 +207,8 @@
  1184.              modelnum = 14;
  1185.          else if(!strcmp(&argv[1][5], "tpj2"))
  1186.              modelnum = 15;
  1187. +        else if(!strcmp(&argv[1][5], "e200"))
  1188. +            modelnum = 16;
  1189.          else {
  1190.              fprintf(stderr, "unsupported model: %s\n", &argv[1][5]);
  1191.              return 2;

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right worth-right