blob: 5d70adf5fe5402fe783be7e3bee24caf7140c0e3 [file] [log] [blame]
Dave Chapman657dcb52006-08-31 19:19:35 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Dave Chapman
11 *
12 * Based on Rockbox iriver bootloader by Linus Nielsen Feltzing
13 *
14 * All files in this archive are subject to the GNU General Public License.
15 * See the file COPYING in the source tree root for full license agreement.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "config.h"
22
23#include <stdlib.h>
24#include <stdio.h>
25#include <string.h>
26#include "cpu.h"
27#include "system.h"
28#include "lcd.h"
29#include "kernel.h"
30#include "thread.h"
31#include "ata.h"
32#include "fat.h"
33#include "disk.h"
34#include "font.h"
35#include "adc.h"
36#include "backlight.h"
37#include "panic.h"
38#include "power.h"
39#include "file.h"
Linus Nielsen Feltzing46597c92007-02-22 15:09:49 +000040#include "common.h"
Dave Chapman657dcb52006-08-31 19:19:35 +000041
42char version[] = APPSVERSION;
43
Dave Chapman657dcb52006-08-31 19:19:35 +000044void* main(void)
45{
46 int i;
47 int rc;
48 int fd;
49 char buffer[80];
50 unsigned char* framebuffer = (unsigned char*)0x11e00000;
51
52#if 0
53 lcd_init();
54 font_init();
55
Linus Nielsen Feltzing46597c92007-02-22 15:09:49 +000056 printf("Hello World!");
Dave Chapman657dcb52006-08-31 19:19:35 +000057#endif
58
59 i=ata_init();
60
61 disk_init();
62 rc = disk_mount_all();
63
64#if 0
65 /* Dump the flash */
66 fd=open("/flash.bin",O_CREAT|O_RDWR);
67 write(fd,(char*)0,1024*1024);
68 close(fd);
69#endif
70
71#if 1
72 /* Dump what may be the framebuffer */
73 fd=open("/framebuffer.bin",O_CREAT|O_RDWR|O_TRUNC);
74 write(fd,framebuffer,220*176*4);
75 close(fd);
76#endif
77
78
79 fd=open("/gpio.txt",O_CREAT|O_RDWR|O_TRUNC);
80 unsigned int gpio_a = GPIOA_INPUT_VAL;
81 unsigned int gpio_b = GPIOB_INPUT_VAL;
82 unsigned int gpio_c = GPIOC_INPUT_VAL;
83 unsigned int gpio_d = GPIOD_INPUT_VAL;
84 unsigned int gpio_e = GPIOE_INPUT_VAL;
85 unsigned int gpio_f = GPIOF_INPUT_VAL;
86 unsigned int gpio_g = GPIOG_INPUT_VAL;
87 unsigned int gpio_h = GPIOH_INPUT_VAL;
88 unsigned int gpio_i = GPIOI_INPUT_VAL;
89 unsigned int gpio_j = GPIOJ_INPUT_VAL;
90 unsigned int gpio_k = GPIOK_INPUT_VAL;
91 unsigned int gpio_l = GPIOL_INPUT_VAL;
92
93 snprintf(buffer, sizeof(buffer), "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",gpio_a,gpio_b,gpio_c,gpio_d,gpio_e,gpio_f,gpio_g,gpio_h,gpio_i,gpio_j,gpio_k,gpio_l);
94 write(fd,buffer,strlen(buffer)+1);
95 close(fd);
96
97 /* Wait for FFWD button to be pressed */
98 while((GPIOA_INPUT_VAL & 0x04) != 0);
99
100
101 /* Now reboot */
102 DEV_RS |= 0x4;
103
104 return 0;
105}
106
107/* These functions are present in the firmware library, but we reimplement
108 them here because the originals do a lot more than we want */
Dave Chapman657dcb52006-08-31 19:19:35 +0000109void usb_acknowledge(void)
110{
111}
112
113void usb_wait_for_disconnect(void)
114{
115}