2002-05-16 12:53:40 +00:00
|
|
|
|
/***************************************************************************
|
|
|
|
|
* __________ __ ___.
|
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
|
* $Id$
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2002 by Bj<EFBFBD>rn Stenberg
|
|
|
|
|
*
|
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
|
*
|
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
|
* KIND, either express or implied.
|
|
|
|
|
*
|
|
|
|
|
****************************************************************************/
|
2002-05-17 19:50:37 +00:00
|
|
|
|
#include "ata.h"
|
|
|
|
|
#include "disk.h"
|
|
|
|
|
#include "fat.h"
|
|
|
|
|
#include "lcd.h"
|
2002-06-24 13:51:40 +00:00
|
|
|
|
#include "rtc.h"
|
2002-05-17 19:50:37 +00:00
|
|
|
|
#include "debug.h"
|
|
|
|
|
#include "led.h"
|
|
|
|
|
#include "kernel.h"
|
|
|
|
|
#include "button.h"
|
2002-05-16 12:53:40 +00:00
|
|
|
|
#include "tree.h"
|
2002-05-21 14:28:10 +00:00
|
|
|
|
#include "panic.h"
|
|
|
|
|
#include "menu.h"
|
2002-05-29 09:14:38 +00:00
|
|
|
|
#include "system.h"
|
2002-05-27 06:56:35 +00:00
|
|
|
|
#ifndef SIMULATOR
|
2002-05-24 15:40:14 +00:00
|
|
|
|
#include "dmalloc.h"
|
|
|
|
|
#include "bmalloc.h"
|
2002-05-27 06:56:35 +00:00
|
|
|
|
#endif
|
2002-05-24 15:40:14 +00:00
|
|
|
|
#include "mpeg.h"
|
2002-05-24 15:51:39 +00:00
|
|
|
|
#include "main_menu.h"
|
2002-06-12 15:31:35 +00:00
|
|
|
|
#include "thread.h"
|
2002-06-20 08:59:54 +00:00
|
|
|
|
#include "settings.h"
|
2002-06-24 13:51:40 +00:00
|
|
|
|
#include "backlight.h"
|
2002-05-16 12:53:40 +00:00
|
|
|
|
|
2002-05-29 10:05:27 +00:00
|
|
|
|
#include "version.h"
|
|
|
|
|
|
|
|
|
|
char appsversion[]=APPSVERSION;
|
|
|
|
|
|
2002-06-12 15:31:35 +00:00
|
|
|
|
void init(void);
|
2002-06-10 12:42:23 +00:00
|
|
|
|
|
2002-05-21 14:28:10 +00:00
|
|
|
|
void app_main(void)
|
|
|
|
|
{
|
2002-06-10 12:42:23 +00:00
|
|
|
|
init();
|
2002-05-21 14:28:10 +00:00
|
|
|
|
browse_root();
|
|
|
|
|
}
|
|
|
|
|
|
2002-06-10 12:42:23 +00:00
|
|
|
|
#ifdef SIMULATOR
|
|
|
|
|
|
2002-06-12 15:31:35 +00:00
|
|
|
|
void init(void)
|
2002-06-10 12:42:23 +00:00
|
|
|
|
{
|
|
|
|
|
init_threads();
|
|
|
|
|
lcd_init();
|
|
|
|
|
show_logo();
|
|
|
|
|
sleep(HZ/2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#else
|
2002-05-24 15:40:14 +00:00
|
|
|
|
|
|
|
|
|
/* defined in linker script */
|
|
|
|
|
extern int poolstart[];
|
|
|
|
|
extern int poolend[];
|
|
|
|
|
|
2002-06-12 18:00:32 +00:00
|
|
|
|
void init(void)
|
2002-05-17 19:50:37 +00:00
|
|
|
|
{
|
2002-05-21 14:28:10 +00:00
|
|
|
|
int rc;
|
2002-05-30 19:41:35 +00:00
|
|
|
|
struct partinfo* pinfo;
|
2002-05-24 15:40:14 +00:00
|
|
|
|
|
2002-05-29 09:14:38 +00:00
|
|
|
|
system_init();
|
2002-06-10 14:44:15 +00:00
|
|
|
|
kernel_init();
|
2002-06-20 08:59:54 +00:00
|
|
|
|
|
|
|
|
|
reset_settings(&global_settings);
|
2002-05-29 09:14:38 +00:00
|
|
|
|
|
2002-05-30 12:17:18 +00:00
|
|
|
|
dmalloc_initialize();
|
|
|
|
|
bmalloc_add_pool(poolstart, poolend-poolstart);
|
2002-05-29 09:12:21 +00:00
|
|
|
|
lcd_init();
|
2002-05-24 15:40:14 +00:00
|
|
|
|
|
2002-06-11 08:24:33 +00:00
|
|
|
|
show_logo();
|
|
|
|
|
|
2002-05-27 09:53:28 +00:00
|
|
|
|
#ifdef DEBUG
|
2002-05-17 19:50:37 +00:00
|
|
|
|
debug_init();
|
2002-05-27 09:53:28 +00:00
|
|
|
|
#endif
|
2002-05-17 19:50:37 +00:00
|
|
|
|
set_irq_level(0);
|
|
|
|
|
|
2002-05-21 14:28:10 +00:00
|
|
|
|
rc = ata_init();
|
|
|
|
|
if(rc)
|
|
|
|
|
panicf("ata: %d",rc);
|
2002-05-17 19:50:37 +00:00
|
|
|
|
|
2002-05-30 19:41:35 +00:00
|
|
|
|
pinfo = disk_init();
|
|
|
|
|
if (!pinfo)
|
|
|
|
|
panicf("disk: NULL");
|
2002-05-17 19:50:37 +00:00
|
|
|
|
|
2002-05-30 19:41:35 +00:00
|
|
|
|
rc = fat_mount(pinfo[0].start);
|
2002-05-21 14:28:10 +00:00
|
|
|
|
if(rc)
|
|
|
|
|
panicf("mount: %d",rc);
|
2002-05-17 19:50:37 +00:00
|
|
|
|
|
2002-06-24 13:51:40 +00:00
|
|
|
|
backlight_init();
|
|
|
|
|
|
2002-05-17 19:50:37 +00:00
|
|
|
|
button_init();
|
2002-05-24 15:40:14 +00:00
|
|
|
|
mpeg_init();
|
2002-05-17 19:50:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-05-16 12:53:40 +00:00
|
|
|
|
int main(void)
|
|
|
|
|
{
|
2002-05-21 14:28:10 +00:00
|
|
|
|
app_main();
|
2002-05-17 19:50:37 +00:00
|
|
|
|
|
|
|
|
|
while(1) {
|
|
|
|
|
led(true); sleep(HZ/10);
|
|
|
|
|
led(false); sleep(HZ/10);
|
|
|
|
|
}
|
2002-05-16 12:53:40 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2002-05-21 14:28:10 +00:00
|
|
|
|
#endif
|