Subversion Repositories freemyipod

Rev

Rev 881 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
881 theseven 1
#include "global.h"
2
#include "app/umsboot/console.h"
3
#include "protocol/i2c/i2c.h"
4
#include "interface/backlight_manager/backlight_manager.h"
5
#include "interface/lcdif/lcdif.h"
6
#include "interface/lcd/lcd.h"
7
#include "interface/framebuffer/framebuffer.h"
8
#include "interface/console/console.h"
9
#include "soc/s5l87xx/i2c.h"
10
#include "device/d1759/backlight_manager.h"
11
#include "soc/s5l87xx/lcdif.h"
12
#include "board/ipodnano4g/lcd.h"
13
#include "lib/simpletextrenderer/simpletextrenderer.h"
14
#include "lib/fbconsole/fbconsole.h"
15
 
16
 
17
static const struct s5l87xx_i2c_driver_config umsboot_i2c_config =
18
{
19
    .index = 0,
20
};
21
 
22
static const struct i2c_driver_instance umsboot_i2c =
23
{
24
    .driver = &s5l87xx_i2c_driver,
25
    .driver_config = &umsboot_i2c_config,
26
};
27
 
28
static const struct d1759_backlight_manager_driver_config umsboot_backlight_config =
29
{
30
    .i2c = &umsboot_i2c,
31
    .max_current = 255,
32
    .default_fade = 1,
33
};
34
 
35
static const struct backlight_manager_instance umsboot_backlight =
36
{
37
    .driver = &d1759_backlight_manager_driver,
38
    .driver_config = &umsboot_backlight_config,
39
};
40
 
41
static const struct lcdif_instance umsboot_lcdif =
42
{
43
    .driver = &s5l87xx_lcdif_driver,
44
};
45
 
46
static const struct ipodnano4g_lcd_config umsboot_lcd_config =
47
{
48
    .interface = &umsboot_lcdif,
49
    .backlight = &umsboot_backlight,
50
};
51
 
52
static const struct lcd_instance umsboot_lcd =
53
{
54
    .driver = &ipodnano4g_lcd_driver,
55
    .driver_config = &umsboot_lcd_config,
56
};
57
 
58
static uint8_t umsboot_fb_data[320][30];
59
static const struct framebuffer_instance fb =
60
{
61
    .width = 240,
62
    .height = 320,
63
    .format = FRAMEBUFFER_FORMAT_I1,
64
    .data = umsboot_fb_data,
65
    .update_handler = lcd_fb_update_handler,
66
    .update_handler_arg = &umsboot_lcd,
67
};
68
 
69
static const struct textrenderer_instance umsboot_renderer =
70
{
71
    .driver = &simpletextrenderer_driver,
72
};
73
 
74
static const struct fbconsole_config umsboot_console_config =
75
{
76
    .fb = &fb,
77
    .renderer = &umsboot_renderer,
78
    .x = 0,
79
    .y = 0,
80
    .w = 40,
81
    .h = 40,
82
};
83
 
84
static struct fbconsole_state umsboot_console_state =
85
{
86
};
87
 
88
const struct console_instance umsboot_console =
89
{
90
    .driver = &fbconsole_driver,
91
    .driver_config = &umsboot_console_config,
92
    .driver_state = &umsboot_console_state,
93
};
94
 
95
void umsboot_console_init()
96
{
97
    lcd_init(&umsboot_lcd);
98
    lcd_fill(&umsboot_lcd, 0, 0, 240, 320, FRAMEBUFFER_FORMAT_I1, 0, FRAMEBUFFER_CONVERSION_QUALITY_CLIP);
99
    lcd_backlight(&umsboot_lcd, 100);
100
    console_init(&umsboot_console);
101
    console_puts(&umsboot_console,
911 user890104 102
        "UMSboot v0.2.1\n\n"
881 theseven 103
        "Please copy a UBI file to the mass\n"
104
        "storage device and safely eject\n"
105
        "it when you're done.\n"
106
        "If you booted this accidentally, just\n"
107
        "press and hold \e[7mMENU\e[27m+\e[7mSELECT\e[27m to reboot.\n"
108
    );
109
    console_flush(&umsboot_console);
110
}