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