Subversion Repositories freemyipod

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 theseven 1
//
2
//
3
//    Copyright 2010 TheSeven
4
//
5
//
6
//    This file is part of emBIOS.
7
//
8
//    emBIOS is free software: you can redistribute it and/or
9
//    modify it under the terms of the GNU General Public License as
10
//    published by the Free Software Foundation, either version 2 of the
11
//    License, or (at your option) any later version.
12
//
13
//    emBIOS is distributed in the hope that it will be useful,
14
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
//    See the GNU General Public License for more details.
17
//
18
//    You should have received a copy of the GNU General Public License along
19
//    with emBIOS.  If not, see <http://www.gnu.org/licenses/>.
20
//
21
//
22
 
23
 
24
#include "global.h"
14 theseven 25
#include "thread.h"
26
#include "console.h"
85 theseven 27
#include "power.h"
28
#include "interrupt.h"
29
#ifdef HAVE_LCD
15 theseven 30
#include "lcd.h"
2 theseven 31
#include "lcdconsole.h"
85 theseven 32
#endif
33
#ifdef HAVE_I2C
15 theseven 34
#include "i2c.h"
85 theseven 35
#endif
36
#ifdef HAVE_USB
37
#include "usb/usb.h"
38
#endif
39
#ifdef HAVE_STORAGE
58 theseven 40
#include "storage.h"
41
#include "disk.h"
85 theseven 42
#endif
2 theseven 43
 
87 theseven 44
 
32 theseven 45
static const char welcomestring[] INITCONST_ATTR = "emBIOS v" VERSION " r" VERSION_SVN "\n\n";
66 theseven 46
static const char initthreadname[] INITCONST_ATTR = "Initialisation thread";
47
static uint32_t initstack[0x400] INITBSS_ATTR;
15 theseven 48
 
87 theseven 49
 
66 theseven 50
void initthread() INITCODE_ATTR;
51
void initthread()
2 theseven 52
{
85 theseven 53
    cputs(CONSOLE_BOOT, welcomestring);
54
	#ifdef HAVE_I2C
15 theseven 55
    i2c_init();
85 theseven 56
	#endif
54 theseven 57
    power_init();
85 theseven 58
	#ifdef HAVE_USB
15 theseven 59
    usb_init();
85 theseven 60
	#endif
61
	#ifdef HAVE_STORAGE
66 theseven 62
    DEBUGF("Initializing storage drivers...");
58 theseven 63
    storage_init();
66 theseven 64
    DEBUGF("Initializing storage subsystem...");
58 theseven 65
    disk_init_subsystem();
66 theseven 66
    DEBUGF("Reading partition tables...");
58 theseven 67
    disk_init();
66 theseven 68
    DEBUGF("Mounting partitions...");
58 theseven 69
    disk_mount_all();
85 theseven 70
	#endif
66 theseven 71
    DEBUGF("Finished initialisation sequence");
72
}
73
 
74
void init() INITCODE_ATTR;
75
void init()
76
{
77
    scheduler_init();
78
    console_init();
85 theseven 79
	#ifdef HAVE_LCD
66 theseven 80
    lcd_init();
81
    lcdconsole_init();
85 theseven 82
	#endif
66 theseven 83
    interrupt_init();
84
    thread_create(initthreadname, initthread, initstack,
85
                  sizeof(initstack), USER_THREAD, 127, true);
86
}