Subversion Repositories freemyipod

Rev

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"
15 theseven 27
#include "lcd.h"
2 theseven 28
#include "lcdconsole.h"
15 theseven 29
#include "interrupt.h"
30
#include "i2c.h"
29 theseven 31
#include "pmu.h"
58 theseven 32
#include "storage.h"
33
#include "disk.h"
15 theseven 34
#include "usb/usb.h"
2 theseven 35
 
32 theseven 36
static const char welcomestring[] INITCONST_ATTR = "emBIOS v" VERSION " r" VERSION_SVN "\n\n";
66 theseven 37
static const char initthreadname[] INITCONST_ATTR = "Initialisation thread";
38
static uint32_t initstack[0x400] INITBSS_ATTR;
15 theseven 39
 
66 theseven 40
void initthread() INITCODE_ATTR;
41
void initthread()
2 theseven 42
{
29 theseven 43
    cputs(1, welcomestring);
15 theseven 44
    i2c_init();
54 theseven 45
    power_init();
15 theseven 46
    usb_init();
66 theseven 47
    DEBUGF("Initializing storage drivers...");
58 theseven 48
    storage_init();
66 theseven 49
    DEBUGF("Initializing storage subsystem...");
58 theseven 50
    disk_init_subsystem();
66 theseven 51
    DEBUGF("Reading partition tables...");
58 theseven 52
    disk_init();
66 theseven 53
    DEBUGF("Mounting partitions...");
58 theseven 54
    disk_mount_all();
66 theseven 55
    DEBUGF("Finished initialisation sequence");
56
}
57
 
58
void init() INITCODE_ATTR;
59
void init()
60
{
61
    scheduler_init();
62
    console_init();
63
    lcd_init();
64
    lcdconsole_init();
65
    interrupt_init();
66
    thread_create(initthreadname, initthread, initstack,
67
                  sizeof(initstack), USER_THREAD, 127, true);
68
}