summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHristo Kovachev <bger@rockbox.org>2006-08-11 09:51:04 +0000
committerHristo Kovachev <bger@rockbox.org>2006-08-11 09:51:04 +0000
commit1204136632777e84eac790811fb074552ef2e6b7 (patch)
tree0261c054c38a06a2e0f3b9cc869a774650eb3ce9
parent79f60d4054fdf0e97dca9817c778c74847d18ba0 (diff)
downloadrockbox-1204136632777e84eac790811fb074552ef2e6b7.tar.gz
rockbox-1204136632777e84eac790811fb074552ef2e6b7.zip
Some indent/c99 style cleanup by Barry Wardell
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10524 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--bootloader/h10.c252
-rw-r--r--firmware/target/arm/iriver/h10/backlight-h10.c2
-rw-r--r--firmware/target/arm/iriver/h10/button-h10.c44
-rw-r--r--firmware/target/arm/iriver/h10/power-h10.c6
-rw-r--r--firmware/target/arm/iriver/h10/usb-h10.c6
5 files changed, 156 insertions, 154 deletions
diff --git a/bootloader/h10.c b/bootloader/h10.c
index e80e28fe5b..d7942c9583 100644
--- a/bootloader/h10.c
+++ b/bootloader/h10.c
@@ -66,10 +66,10 @@ static void memmove16(void *dest, const void *src, unsigned count)
}
-/* Load original iriver firmware. This function expects a file called "H10_20GC.mi4" in
- the root directory of the player. It should be decrypted and have the header stripped
- using mi4code. It reads the file in to a memory buffer called buf. The rest of the
- loading is done in main()
+/* Load original iriver firmware. This function expects a file called
+ "H10_20GC.mi4" in the root directory of the player. It should be decrypted
+ and have the header stripped using mi4code. It reads the file in to a memory
+ buffer called buf. The rest of the loading is done in main()
*/
int load_iriver(unsigned char* buf)
{
@@ -93,144 +93,146 @@ unsigned char loadbuffer[MAX_LOADSIZE];
void main(void)
{
- /* Attempt to load original iriver firmware. Successfully starts loading the iriver
- firmware but then locks up once the "System Initialising" screen is displayed.
-
- The iriver firmware was decrypted and the header removed. It was then appended to
- the end of bootloader.bin and an mi4 file was created from the resulting file.
-
- The original firmware starts at 0xd800 in the file and is of length 0x47da00.
-
- The whole file (bootloader.bin + decrypted mi4) are loaded to memory by the
- original iriver bootloader on startup. This copies the mi4 part to the start
- of DRAM and passes execution to there.
-
- memmove16((void*)DRAMORIG, (void*)(DRAMORIG + 0xd800), 0x47da00);
- asm volatile(
- "mov r0, #" SC(DRAMORIG) "\n"
- "mov pc, r0 \n"
- );
- */
+ /* Attempt to load original iriver firmware. Successfully starts loading the
+ iriver firmware but then locks up once the "System Initialising" screen
+ is displayed.
+
+ The iriver firmware was decrypted and the header removed. It was then
+ appended to the end of bootloader.bin and an mi4 file was created from
+ the resulting file.
+
+ The original firmware starts at 0xd800 in the file and is of length
+ 0x47da00.
+
+ The whole file (bootloader.bin + decrypted mi4) are loaded to memory by
+ the original iriver bootloader on startup. This copies the mi4 part to
+ the start of DRAM and passes execution to there.
+
+ memmove16((void*)DRAMORIG, (void*)(DRAMORIG + 0xd800), 0x47da00);
+ asm volatile(
+ "mov r0, #" SC(DRAMORIG) "\n"
+ "mov pc, r0 \n"
+ );
+ */
int i;
int rc;
- int btn;
+ int btn;
+ int fd;
+ char buffer[24];
i=ata_init();
disk_init();
rc = disk_mount_all();
- /* Load original iriver firmware. Uses load_iriver(buf) to load the decrypted mi4 file from
- disk to DRAM. This then copies that part of DRAM to the start of DRAM and passes
- execution to there.
-
- rc=load_iriver(loadbuffer);
- memcpy((void*)DRAMORIG,loadbuffer,rc);
- asm volatile(
- "mov r0, #" SC(DRAMORIG) "\n"
- "mov pc, r0 \n"
- );*/
-
-
- /* This assumes that /test.txt exists */
- int fd;
- char buffer[24];
- fd=open("/test.txt",O_RDWR);
-
-
- /* WARNING: Running this code on the H10 caused permanent damage to my H10's hdd
- I strongly recommend against trying it.
-
- for(i=0;i<100;i++){
- btn = button_read_device();
- switch(btn){
- case BUTTON_LEFT:
- snprintf(buffer, sizeof(buffer), "Left");
- write(fd,buffer,sizeof(buffer));
- break;
- case BUTTON_RIGHT:
- break;
- case BUTTON_REW:
- break;
- case BUTTON_FF:
- break;
- case BUTTON_PLAY:
- break;
- default:
- break;
- }
-
+ /* Load original iriver firmware. Uses load_iriver(buf) to load the
+ decrypted mi4 file from disk to DRAM. This then copies that part of DRAM
+ to the start of DRAM and passes
+ execution to there.
+
+ rc=load_iriver(loadbuffer);
+ memcpy((void*)DRAMORIG,loadbuffer,rc);
+ asm volatile(
+ "mov r0, #" SC(DRAMORIG) "\n"
+ "mov pc, r0 \n"
+ );*/
+
+
+ /* This assumes that /test.txt exists */
+ fd=open("/test.txt",O_RDWR);
+
+
+ /*
+ for(i=0;i<100;i++){
+ btn = button_read_device();
+ switch(btn){
+ case BUTTON_LEFT:
+ snprintf(buffer, sizeof(buffer), "Left");
+ write(fd,buffer,sizeof(buffer));
+ break;
+ case BUTTON_RIGHT:
+ break;
+ case BUTTON_REW:
+ break;
+ case BUTTON_FF:
+ break;
+ case BUTTON_PLAY:
+ break;
+ default:
+ break;
+ }
+
- }
- */
-
-
-
+ }
+ */
+
+
+
/* Investigate gpio
-
- unsigned int gpio_a, gpio_b, gpio_c, gpio_d;
+
+ unsigned int gpio_a, gpio_b, gpio_c, gpio_d;
unsigned int gpio_e, gpio_f, gpio_g, gpio_h;
unsigned int gpio_i, gpio_j, gpio_k, gpio_l;
- gpio_a = GPIOA_INPUT_VAL;
- gpio_b = GPIOB_INPUT_VAL;
- gpio_c = GPIOC_INPUT_VAL;
+ gpio_a = GPIOA_INPUT_VAL;
+ gpio_b = GPIOB_INPUT_VAL;
+ gpio_c = GPIOC_INPUT_VAL;
- gpio_g = GPIOG_INPUT_VAL;
- gpio_h = GPIOH_INPUT_VAL;
- gpio_i = GPIOI_INPUT_VAL;
+ gpio_g = GPIOG_INPUT_VAL;
+ gpio_h = GPIOH_INPUT_VAL;
+ gpio_i = GPIOI_INPUT_VAL;
- snprintf(buffer, sizeof(buffer), "GPIO_A: %02x GPIO_G: %02x\n", gpio_a, gpio_g);
- write(fd,buffer,sizeof(buffer));
- snprintf(buffer, sizeof(buffer), "GPIO_B: %02x GPIO_H: %02x\n", gpio_b, gpio_h);
- write(fd,buffer,sizeof(buffer));
- snprintf(buffer, sizeof(buffer), "GPIO_C: %02x GPIO_I: %02x\n", gpio_c, gpio_i);
- write(fd,buffer,sizeof(buffer));
-
- gpio_d = GPIOD_INPUT_VAL;
- gpio_e = GPIOE_INPUT_VAL;
- gpio_f = GPIOF_INPUT_VAL;
+ snprintf(buffer,sizeof(buffer),"GPIO_A: %02x GPIO_G: %02x\n",gpio_a,gpio_g);
+ write(fd,buffer,sizeof(buffer));
+ snprintf(buffer,sizeof(buffer),"GPIO_B: %02x GPIO_H: %02x\n",gpio_b,gpio_h);
+ write(fd,buffer,sizeof(buffer));
+ snprintf(buffer,sizeof(buffer),"GPIO_C: %02x GPIO_I: %02x\n",gpio_c,gpio_i);
+ write(fd,buffer,sizeof(buffer));
+
+ gpio_d = GPIOD_INPUT_VAL;
+ gpio_e = GPIOE_INPUT_VAL;
+ gpio_f = GPIOF_INPUT_VAL;
- gpio_j = GPIOJ_INPUT_VAL;
- gpio_k = GPIOK_INPUT_VAL;
- gpio_l = GPIOL_INPUT_VAL;
+ gpio_j = GPIOJ_INPUT_VAL;
+ gpio_k = GPIOK_INPUT_VAL;
+ gpio_l = GPIOL_INPUT_VAL;
- snprintf(buffer, sizeof(buffer), "GPIO_D: %02x GPIO_J: %02x\n", gpio_d, gpio_j);
- write(fd,buffer,sizeof(buffer));
- snprintf(buffer, sizeof(buffer), "GPIO_E: %02x GPIO_K: %02x\n", gpio_e, gpio_k);
- write(fd,buffer,sizeof(buffer));
- snprintf(buffer, sizeof(buffer), "GPIO_F: %02x GPIO_L: %02x\n", gpio_f, gpio_l);
- write(fd,buffer,sizeof(buffer));
- */
-
-
-
- /* Detect the scroller being touched
-
- int j = 0;
- for(j=0;j<1000;j++){
- if(gpio_c!=0xF7){
- snprintf(buffer, sizeof(buffer), "GPIO_C: %02x\n", gpio_c);
- write(fd,buffer,sizeof(buffer));
- }
- if(gpio_d!=0xDD){
- snprintf(buffer, sizeof(buffer), "GPIO_D: %02x\n", gpio_d);
- write(fd,buffer,sizeof(buffer));
- }
- }*/
-
-
- /* Apparently necessary for the data to be actually written to file */
- fsync(fd);
- udelay(1000000);
-
- /* This causes the device to shut off instantly
-
- GPIOF_OUTPUT_VAL = 0;
- */
-
- close(fd);
- udelay(1000000);
+ snprintf(buffer,sizeof(buffer),"GPIO_D: %02x GPIO_J: %02x\n",gpio_d,gpio_j);
+ write(fd,buffer,sizeof(buffer));
+ snprintf(buffer,sizeof(buffer),"GPIO_E: %02x GPIO_K: %02x\n",gpio_e,gpio_k);
+ write(fd,buffer,sizeof(buffer));
+ snprintf(buffer,sizeof(buffer),"GPIO_F: %02x GPIO_L: %02x\n",gpio_f,gpio_l);
+ write(fd,buffer,sizeof(buffer));
+ */
+
+
+
+ /* Detect the scroller being touched
+
+ int j = 0;
+ for(j=0;j<1000;j++){
+ if(gpio_c!=0xF7){
+ snprintf(buffer, sizeof(buffer), "GPIO_C: %02x\n", gpio_c);
+ write(fd,buffer,sizeof(buffer));
+ }
+ if(gpio_d!=0xDD){
+ snprintf(buffer, sizeof(buffer), "GPIO_D: %02x\n", gpio_d);
+ write(fd,buffer,sizeof(buffer));
+ }
+ }*/
+
+
+ /* Apparently necessary for the data to be actually written to file */
+ fsync(fd);
+ udelay(1000000);
+
+ /* This causes the device to shut off instantly
+
+ GPIOF_OUTPUT_VAL = 0;
+ */
+
+ close(fd);
+ udelay(1000000);
}
/* These functions are present in the firmware library, but we reimplement
diff --git a/firmware/target/arm/iriver/h10/backlight-h10.c b/firmware/target/arm/iriver/h10/backlight-h10.c
index b4221dd60a..51218e21be 100644
--- a/firmware/target/arm/iriver/h10/backlight-h10.c
+++ b/firmware/target/arm/iriver/h10/backlight-h10.c
@@ -28,7 +28,7 @@
void __backlight_on(void)
{
#if 0
- int level = set_irq_level(HIGHEST_IRQ_LEVEL);
+ int level = set_irq_level(HIGHEST_IRQ_LEVEL);
pcf50606_write(0x38, 0xb0); /* Backlight ON, GPO1INV=1, GPO1ACT=011 */
set_irq_level(level);
#endif
diff --git a/firmware/target/arm/iriver/h10/button-h10.c b/firmware/target/arm/iriver/h10/button-h10.c
index 7979a52976..2a5983e97a 100644
--- a/firmware/target/arm/iriver/h10/button-h10.c
+++ b/firmware/target/arm/iriver/h10/button-h10.c
@@ -33,7 +33,7 @@
void button_init_device(void)
{
- /* No hardware initialisation required as it is done by the bootloader */
+ /* No hardware initialisation required as it is done by the bootloader */
}
bool button_hold(void)
@@ -47,8 +47,8 @@ bool button_hold(void)
int button_read_device(void)
{
int btn = BUTTON_NONE;
- unsigned char state;
- static bool hold_button = false;
+ unsigned char state;
+ static bool hold_button = false;
#if 0
/* light handling */
@@ -59,25 +59,25 @@ int button_read_device(void)
#endif
hold_button = button_hold();
- if (!hold_button)
+ if (!hold_button)
{
- /* Read normal buttons */
- state = GPIOA_INPUT_VAL & 0xf8;
- if ((state & 0x8) == 0) btn |= BUTTON_FF;
- if ((state & 0x10) == 0) btn |= BUTTON_PLAY;
- if ((state & 0x20) == 0) btn |= BUTTON_REW;
- if ((state & 0x40) == 0) btn |= BUTTON_RIGHT;
- if ((state & 0x80) == 0) btn |= BUTTON_LEFT;
-
- /* Read power button */
- if ((GPIOB_INPUT_VAL & 0x1) == 0) btn |= BUTTON_POWER;
-
- /* Read scroller */
- if ( ((GPIOC_INPUT_VAL & 0x4)==1) && ((GPIOD_INPUT_VAL & 0x10)==1) )
- {
- /* Scroller is pressed */
- }
- }
-
+ /* Read normal buttons */
+ state = GPIOA_INPUT_VAL & 0xf8;
+ if ((state & 0x8) == 0) btn |= BUTTON_FF;
+ if ((state & 0x10) == 0) btn |= BUTTON_PLAY;
+ if ((state & 0x20) == 0) btn |= BUTTON_REW;
+ if ((state & 0x40) == 0) btn |= BUTTON_RIGHT;
+ if ((state & 0x80) == 0) btn |= BUTTON_LEFT;
+
+ /* Read power button */
+ if ((GPIOB_INPUT_VAL & 0x1) == 0) btn |= BUTTON_POWER;
+
+ /* Read scroller */
+ if ( ((GPIOC_INPUT_VAL & 0x4)==1) && ((GPIOD_INPUT_VAL & 0x10)==1) )
+ {
+ /* Scroller is pressed */
+ }
+ }
+
return btn;
}
diff --git a/firmware/target/arm/iriver/h10/power-h10.c b/firmware/target/arm/iriver/h10/power-h10.c
index 58dd25174f..71eae2105e 100644
--- a/firmware/target/arm/iriver/h10/power-h10.c
+++ b/firmware/target/arm/iriver/h10/power-h10.c
@@ -71,7 +71,7 @@ void power_init(void)
bool charger_inserted(void)
{
- return (GPIOL_INPUT_VAL & 0x04)?true:false; /* FIXME: This only checks if USB is connected */
+ return (GPIOL_INPUT_VAL & 0x04)?true:false; /* FIXME: This only checks if USB is connected */
}
void ide_power_enable(bool on)
@@ -90,10 +90,10 @@ bool ide_powered(void)
void power_off(void)
{
/* set_irq_level(HIGHEST_IRQ_LEVEL);*/
- #ifndef BOOTLOADER
+ #ifndef BOOTLOADER
/* We don't turn off the ipod, we put it in a deep sleep */
/* pcf50605_standby_mode(); */
while(1)
yield();
- #endif
+ #endif
}
diff --git a/firmware/target/arm/iriver/h10/usb-h10.c b/firmware/target/arm/iriver/h10/usb-h10.c
index dccdea81aa..c6d275a9be 100644
--- a/firmware/target/arm/iriver/h10/usb-h10.c
+++ b/firmware/target/arm/iriver/h10/usb-h10.c
@@ -92,10 +92,10 @@ bool usb_detect(void)
void usb_enable(bool on)
{
- (void)on;
+ (void)on;
#if 0
- /* For the ipod, we can only do one thing with USB mode - reboot
- into Apple's flash-based disk-mode. This does not return. */
+ /* For the ipod, we can only do one thing with USB mode - reboot
+ into Apple's flash-based disk-mode. This does not return. */
if (on)
{
/* The following code is copied from ipodlinux */