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

Miscellany
Friday, August 11th, 2006 at 9:27:24am UTC 

  1. Index: bootloader/h10.c
  2. ===================================================================
  3. RCS file: /cvsroot/rockbox/bootloader/h10.c,v
  4. retrieving revision 1.1
  5. diff -u -r1.1 h10.c
  6. --- bootloader/h10.c    11 Aug 2006 08:35:26 -0000  1.1
  7. +++ bootloader/h10.c    11 Aug 2006 09:25:12 -0000
  8. @@ -66,10 +66,10 @@
  9.  }
  10.  
  11.  
  12. -/* Load original iriver firmware. This function expects a file called "H10_20GC.mi4" in
  13. -   the root directory of the player. It should be decrypted and have the header stripped
  14. -   using mi4code. It reads the file in to a memory buffer called buf. The rest of the
  15. -   loading is done in main()
  16. +/* Load original iriver firmware. This function expects a file called
  17. +   "H10_20GC.mi4" in the root directory of the player. It should be decrypted
  18. +   and have the header stripped using mi4code. It reads the file in to a memory
  19. +   buffer called buf. The rest of the loading is done in main()
  20.  */
  21.  int load_iriver(unsigned char* buf)
  22.  {
  23. @@ -93,144 +93,146 @@
  24.  
  25.  void main(void)
  26.  {
  27. -       /* Attempt to load original iriver firmware. Successfully starts loading the iriver
  28. -       firmware but then locks up once the "System Initialising" screen is displayed.
  29. -          
  30. -          The iriver firmware was decrypted and the header removed. It was then appended to
  31. -          the end of bootloader.bin and an mi4 file was created from the resulting file.
  32. -          
  33. -          The original firmware starts at 0xd800 in the file and is of length 0x47da00.
  34. -          
  35. -          The whole file (bootloader.bin + decrypted mi4) are loaded to memory by the
  36. -          original iriver bootloader on startup. This copies the mi4 part to the start
  37. -          of DRAM and passes execution to there.
  38. -       
  39. -       memmove16((void*)DRAMORIG, (void*)(DRAMORIG + 0xd800), 0x47da00);
  40. -       asm volatile(
  41. -              "mov   r0, #" SC(DRAMORIG) "\n"
  42. -              "mov   pc, r0                 \n"
  43. -       );
  44. -       */
  45. +    /* Attempt to load original iriver firmware. Successfully starts loading the
  46. +       iriver firmware but then locks up once the "System Initialising" screen
  47. +       is displayed.
  48. +       
  49. +       The iriver firmware was decrypted and the header removed. It was then
  50. +       appended to the end of bootloader.bin and an mi4 file was created from
  51. +       the resulting file.
  52. +       
  53. +       The original firmware starts at 0xd800 in the file and is of length
  54. +       0x47da00.
  55. +       
  56. +       The whole file (bootloader.bin + decrypted mi4) are loaded to memory by
  57. +       the original iriver bootloader on startup. This copies the mi4 part to
  58. +       the start of DRAM and passes execution to there.
  59. +   
  60. +    memmove16((void*)DRAMORIG, (void*)(DRAMORIG + 0xd800), 0x47da00);
  61. +    asm volatile(
  62. +        "mov   r0, #" SC(DRAMORIG) "\n"
  63. +        "mov   pc, r0                 \n"
  64. +    );
  65. +    */
  66.  
  67.      int i;
  68.      int rc;
  69. -       int btn;
  70. +    int btn;
  71. +    int fd;
  72. +    char buffer[24];
  73.  
  74.      i=ata_init();
  75.      disk_init();
  76.      rc = disk_mount_all();
  77.  
  78. -       /* Load original iriver firmware. Uses load_iriver(buf) to load the decrypted mi4 file from
  79. -       disk to DRAM. This then copies that part of DRAM to the start of DRAM and passes
  80. -          execution to there.
  81. -       
  82. -       rc=load_iriver(loadbuffer);
  83. -       memcpy((void*)DRAMORIG,loadbuffer,rc);
  84. -       asm volatile(
  85. -              "mov   r0, #" SC(DRAMORIG) "\n"
  86. -              "mov   pc, r0                 \n"
  87. -       );*/
  88. -       
  89. -       
  90. -       /* This assumes that /test.txt exists */
  91. -       int fd;
  92. -       char buffer[24];
  93. -       fd=open("/test.txt",O_RDWR);
  94. -       
  95. -       
  96. -       /* WARNING: Running this code on the H10 caused permanent damage to my H10's hdd
  97. -                   I strongly recommend against trying it.
  98. -                            
  99. -       for(i=0;i<100;i++){
  100. -              btn = button_read_device();
  101. -              switch(btn){
  102. -              case BUTTON_LEFT:
  103. -                     snprintf(buffer, sizeof(buffer), "Left");
  104. -                     write(fd,buffer,sizeof(buffer));
  105. -                     break;
  106. -              case BUTTON_RIGHT:
  107. -              break;
  108. -              case BUTTON_REW:
  109. -              break;
  110. -              case BUTTON_FF:
  111. -              break;
  112. -              case BUTTON_PLAY:
  113. -              break;
  114. -              default:
  115. -              break;
  116. -              }
  117. -              
  118. -
  119. -       }
  120. -       */
  121. -       
  122. -       
  123. -       
  124. +    /* Load original iriver firmware. Uses load_iriver(buf) to load the
  125. +       decrypted mi4 file from disk to DRAM. This then copies that part of DRAM
  126. +       to the start of DRAM and passes
  127. +       execution to there.
  128. +   
  129. +    rc=load_iriver(loadbuffer);
  130. +    memcpy((void*)DRAMORIG,loadbuffer,rc);
  131. +    asm volatile(
  132. +        "mov   r0, #" SC(DRAMORIG) "\n"
  133. +        "mov   pc, r0                 \n"
  134. +    );*/
  135. +   
  136. +   
  137. +    /* This assumes that /test.txt exists */
  138. +    fd=open("/test.txt",O_RDWR);
  139. +   
  140. +   
  141. +    /*
  142. +    for(i=0;i<100;i++){
  143. +        btn = button_read_device();
  144. +        switch(btn){
  145. +        case BUTTON_LEFT:
  146. +            snprintf(buffer, sizeof(buffer), "Left");
  147. +            write(fd,buffer,sizeof(buffer));
  148. +            break;
  149. +        case BUTTON_RIGHT:
  150. +        break;
  151. +        case BUTTON_REW:
  152. +        break;
  153. +        case BUTTON_FF:
  154. +        break;
  155. +        case BUTTON_PLAY:
  156. +        break;
  157. +        default:
  158. +        break;
  159. +        }
  160. +       
  161. +
  162. +    }
  163. +    */
  164. +   
  165. +   
  166. +   
  167.      /* Investigate gpio
  168. -       
  169. -       unsigned int gpio_a, gpio_b, gpio_c, gpio_d;
  170. +   
  171. +    unsigned int gpio_a, gpio_b, gpio_c, gpio_d;
  172.      unsigned int gpio_e, gpio_f, gpio_g, gpio_h;
  173.      unsigned int gpio_i, gpio_j, gpio_k, gpio_l;
  174.  
  175. -       gpio_a = GPIOA_INPUT_VAL;
  176. -       gpio_b = GPIOB_INPUT_VAL;
  177. -       gpio_c = GPIOC_INPUT_VAL;
  178. -
  179. -       gpio_g = GPIOG_INPUT_VAL;
  180. -       gpio_h = GPIOH_INPUT_VAL;
  181. -       gpio_i = GPIOI_INPUT_VAL;
  182. -
  183. -       snprintf(buffer, sizeof(buffer), "GPIO_A: %02x  GPIO_G: %02x\n", gpio_a, gpio_g);
  184. -       write(fd,buffer,sizeof(buffer));
  185. -       snprintf(buffer, sizeof(buffer), "GPIO_B: %02x  GPIO_H: %02x\n", gpio_b, gpio_h);
  186. -       write(fd,buffer,sizeof(buffer));
  187. -       snprintf(buffer, sizeof(buffer), "GPIO_C: %02x  GPIO_I: %02x\n", gpio_c, gpio_i);
  188. -       write(fd,buffer,sizeof(buffer));
  189. -       
  190. -       gpio_d = GPIOD_INPUT_VAL;
  191. -       gpio_e = GPIOE_INPUT_VAL;
  192. -       gpio_f = GPIOF_INPUT_VAL;
  193. -
  194. -       gpio_j = GPIOJ_INPUT_VAL;
  195. -       gpio_k = GPIOK_INPUT_VAL;
  196. -       gpio_l = GPIOL_INPUT_VAL;
  197. -
  198. -       snprintf(buffer, sizeof(buffer), "GPIO_D: %02x  GPIO_J: %02x\n", gpio_d, gpio_j);
  199. -       write(fd,buffer,sizeof(buffer));
  200. -       snprintf(buffer, sizeof(buffer), "GPIO_E: %02x  GPIO_K: %02x\n", gpio_e, gpio_k);
  201. -       write(fd,buffer,sizeof(buffer));
  202. -       snprintf(buffer, sizeof(buffer), "GPIO_F: %02x  GPIO_L: %02x\n", gpio_f, gpio_l);
  203. -       write(fd,buffer,sizeof(buffer));
  204. -       */
  205. -       
  206. -       
  207. -       
  208. -       /* Detect the scroller being touched
  209. -       
  210. -       int j = 0;
  211. -       for(j=0;j<1000;j++){
  212. -              if(gpio_c!=0xF7){
  213. -                     snprintf(buffer, sizeof(buffer), "GPIO_C: %02x\n", gpio_c);
  214. -                     write(fd,buffer,sizeof(buffer));
  215. -              }
  216. -              if(gpio_d!=0xDD){
  217. -                     snprintf(buffer, sizeof(buffer), "GPIO_D: %02x\n", gpio_d);
  218. -                     write(fd,buffer,sizeof(buffer));
  219. -              }
  220. -       }*/
  221. -       
  222. -       
  223. -       /* Apparently necessary for the data to be actually written to file */
  224. -       fsync(fd);
  225. -       udelay(1000000);
  226. -       
  227. -       /* This causes the device to shut off instantly
  228. -       
  229. -       GPIOF_OUTPUT_VAL = 0;
  230. -       */
  231. -       
  232. -       close(fd);
  233. -       udelay(1000000);
  234. +    gpio_a = GPIOA_INPUT_VAL;
  235. +    gpio_b = GPIOB_INPUT_VAL;
  236. +    gpio_c = GPIOC_INPUT_VAL;
  237. +
  238. +    gpio_g = GPIOG_INPUT_VAL;
  239. +    gpio_h = GPIOH_INPUT_VAL;
  240. +    gpio_i = GPIOI_INPUT_VAL;
  241. +
  242. +    snprintf(buffer,sizeof(buffer),"GPIO_A: %02x GPIO_G: %02x\n",gpio_a,gpio_g);
  243. +    write(fd,buffer,sizeof(buffer));
  244. +    snprintf(buffer,sizeof(buffer),"GPIO_B: %02x GPIO_H: %02x\n",gpio_b,gpio_h);
  245. +    write(fd,buffer,sizeof(buffer));
  246. +    snprintf(buffer,sizeof(buffer),"GPIO_C: %02x GPIO_I: %02x\n",gpio_c,gpio_i);
  247. +    write(fd,buffer,sizeof(buffer));
  248. +   
  249. +    gpio_d = GPIOD_INPUT_VAL;
  250. +    gpio_e = GPIOE_INPUT_VAL;
  251. +    gpio_f = GPIOF_INPUT_VAL;
  252. +
  253. +    gpio_j = GPIOJ_INPUT_VAL;
  254. +    gpio_k = GPIOK_INPUT_VAL;
  255. +    gpio_l = GPIOL_INPUT_VAL;
  256. +
  257. +    snprintf(buffer,sizeof(buffer),"GPIO_D: %02x GPIO_J: %02x\n",gpio_d,gpio_j);
  258. +    write(fd,buffer,sizeof(buffer));
  259. +    snprintf(buffer,sizeof(buffer),"GPIO_E: %02x GPIO_K: %02x\n",gpio_e,gpio_k);
  260. +    write(fd,buffer,sizeof(buffer));
  261. +    snprintf(buffer,sizeof(buffer),"GPIO_F: %02x GPIO_L: %02x\n",gpio_f,gpio_l);
  262. +    write(fd,buffer,sizeof(buffer));
  263. +    */
  264. +   
  265. +   
  266. +   
  267. +    /* Detect the scroller being touched
  268. +   
  269. +    int j = 0;
  270. +    for(j=0;j<1000;j++){
  271. +        if(gpio_c!=0xF7){
  272. +            snprintf(buffer, sizeof(buffer), "GPIO_C: %02x\n", gpio_c);
  273. +            write(fd,buffer,sizeof(buffer));
  274. +        }
  275. +        if(gpio_d!=0xDD){
  276. +            snprintf(buffer, sizeof(buffer), "GPIO_D: %02x\n", gpio_d);
  277. +            write(fd,buffer,sizeof(buffer));
  278. +        }
  279. +    }*/
  280. +   
  281. +   
  282. +    /* Apparently necessary for the data to be actually written to file */
  283. +    fsync(fd);
  284. +    udelay(1000000);
  285. +   
  286. +    /* This causes the device to shut off instantly
  287. +   
  288. +    GPIOF_OUTPUT_VAL = 0;
  289. +    */
  290. +   
  291. +    close(fd);
  292. +    udelay(1000000);
  293.  }
  294.  
  295.  /* These functions are present in the firmware library, but we reimplement
  296. Index: firmware/target/arm/iriver/h10/backlight-h10.c
  297. ===================================================================
  298. RCS file: /cvsroot/rockbox/firmware/target/arm/iriver/h10/backlight-h10.c,v
  299. retrieving revision 1.1
  300. diff -u -r1.1 backlight-h10.c
  301. --- firmware/target/arm/iriver/h10/backlight-h10.c      3 Aug 2006 20:18:19 -0000     1.1
  302. +++ firmware/target/arm/iriver/h10/backlight-h10.c      11 Aug 2006 09:25:12 -0000
  303. @@ -28,7 +28,7 @@
  304.  void __backlight_on(void)
  305.  {
  306.  #if 0   
  307. -       int level = set_irq_level(HIGHEST_IRQ_LEVEL);
  308. +    int level = set_irq_level(HIGHEST_IRQ_LEVEL);
  309.      pcf50606_write(0x38, 0xb0); /* Backlight ON, GPO1INV=1, GPO1ACT=011 */
  310.      set_irq_level(level);
  311.  #endif
  312. Index: firmware/target/arm/iriver/h10/button-h10.c
  313. ===================================================================
  314. RCS file: /cvsroot/rockbox/firmware/target/arm/iriver/h10/button-h10.c,v
  315. retrieving revision 1.2
  316. diff -u -r1.2 button-h10.c
  317. --- firmware/target/arm/iriver/h10/button-h10.c 11 Aug 2006 08:35:26 -0000       1.2
  318. +++ firmware/target/arm/iriver/h10/button-h10.c 11 Aug 2006 09:25:12 -0000
  319. @@ -33,7 +33,7 @@
  320.  
  321.  void button_init_device(void)
  322.  {
  323. -       /* No hardware initialisation required as it is done by the bootloader */
  324. +    /* No hardware initialisation required as it is done by the bootloader */
  325.  }
  326.  
  327.  bool button_hold(void)
  328. @@ -47,8 +47,8 @@
  329.  int button_read_device(void)
  330.  {
  331.      int btn = BUTTON_NONE;
  332. -       unsigned char state;
  333. -       static bool hold_button = false;
  334. +    unsigned char state;
  335. +    static bool hold_button = false;
  336.  
  337.  #if 0
  338.      /* light handling */
  339. @@ -59,25 +59,25 @@
  340.  #endif
  341.  
  342.      hold_button = button_hold();
  343. -       if (!hold_button)
  344. +    if (!hold_button)
  345.      {
  346. -              /* Read normal buttons */
  347. -              state = GPIOA_INPUT_VAL & 0xf8;
  348. -              if ((state & 0x8) == 0) btn |= BUTTON_FF;
  349. -              if ((state & 0x10) == 0) btn |= BUTTON_PLAY;
  350. -              if ((state & 0x20) == 0) btn |= BUTTON_REW;
  351. -              if ((state & 0x40) == 0) btn |= BUTTON_RIGHT;
  352. -              if ((state & 0x80) == 0) btn |= BUTTON_LEFT;
  353. -              
  354. -              /* Read power button */
  355. -              if ((GPIOB_INPUT_VAL & 0x1) == 0) btn |= BUTTON_POWER;
  356. -              
  357. -              /* Read scroller */
  358. -              if ( ((GPIOC_INPUT_VAL & 0x4)==1) && ((GPIOD_INPUT_VAL & 0x10)==1) )
  359. -              {
  360. -                     /* Scroller is pressed */
  361. -              }
  362. -       }
  363. -       
  364. +        /* Read normal buttons */
  365. +        state = GPIOA_INPUT_VAL & 0xf8;
  366. +        if ((state & 0x8) == 0) btn |= BUTTON_FF;
  367. +        if ((state & 0x10) == 0) btn |= BUTTON_PLAY;
  368. +        if ((state & 0x20) == 0) btn |= BUTTON_REW;
  369. +        if ((state & 0x40) == 0) btn |= BUTTON_RIGHT;
  370. +        if ((state & 0x80) == 0) btn |= BUTTON_LEFT;
  371. +       
  372. +        /* Read power button */
  373. +        if ((GPIOB_INPUT_VAL & 0x1) == 0) btn |= BUTTON_POWER;
  374. +       
  375. +        /* Read scroller */
  376. +        if ( ((GPIOC_INPUT_VAL & 0x4)==1) && ((GPIOD_INPUT_VAL & 0x10)==1) )
  377. +        {
  378. +            /* Scroller is pressed */
  379. +        }
  380. +    }
  381. +   
  382.      return btn;
  383.  }
  384. Index: firmware/target/arm/iriver/h10/power-h10.c
  385. ===================================================================
  386. RCS file: /cvsroot/rockbox/firmware/target/arm/iriver/h10/power-h10.c,v
  387. retrieving revision 1.1
  388. diff -u -r1.1 power-h10.c
  389. --- firmware/target/arm/iriver/h10/power-h10.c  3 Aug 2006 20:18:28 -0000 1.1
  390. +++ firmware/target/arm/iriver/h10/power-h10.c  11 Aug 2006 09:25:12 -0000
  391. @@ -71,7 +71,7 @@
  392.  
  393.  bool charger_inserted(void)
  394.  {     
  395. -       return (GPIOL_INPUT_VAL & 0x04)?true:false; /* FIXME: This only checks if USB is connected */
  396. +    return (GPIOL_INPUT_VAL & 0x04)?true:false; /* FIXME: This only checks if USB is connected */
  397.  }
  398.  
  399.  void ide_power_enable(bool on)
  400. @@ -90,10 +90,10 @@
  401.  void power_off(void)
  402.  {
  403.      /* set_irq_level(HIGHEST_IRQ_LEVEL);*/
  404. -       #ifndef BOOTLOADER
  405. +    #ifndef BOOTLOADER
  406.      /* We don't turn off the ipod, we put it in a deep sleep */
  407.      /* pcf50605_standby_mode(); */
  408.      while(1)
  409.          yield();
  410. -       #endif
  411. +    #endif
  412.  }
  413. Index: firmware/target/arm/iriver/h10/usb-h10.c
  414. ===================================================================
  415. RCS file: /cvsroot/rockbox/firmware/target/arm/iriver/h10/usb-h10.c,v
  416. retrieving revision 1.1
  417. diff -u -r1.1 usb-h10.c
  418. --- firmware/target/arm/iriver/h10/usb-h10.c    3 Aug 2006 20:18:30 -0000   1.1
  419. +++ firmware/target/arm/iriver/h10/usb-h10.c    11 Aug 2006 09:25:13 -0000
  420. @@ -92,10 +92,10 @@
  421.  
  422.  void usb_enable(bool on)
  423.  {
  424. -       (void)on;
  425. +    (void)on;
  426.  #if 0
  427. -       /* For the ipod, we can only do one thing with USB mode - reboot
  428. -          into Apple's flash-based disk-mode.  This does not return. */
  429. +    /* For the ipod, we can only do one thing with USB mode - reboot
  430. +       into Apple's flash-based disk-mode.  This does not return. */
  431.      if (on)
  432.      {
  433.        /* The following code is copied from ipodlinux */

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