blob: 6340fbbc41b5f150a7e408c6399efdc2bfcf544a [file] [log] [blame]
Dave Chapmanda8bff12008-10-12 16:46:01 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
Dave Chapman08c41d42008-10-19 14:11:01 +00008 * $Id$
Dave Chapmanda8bff12008-10-12 16:46:01 +00009 *
10 * Copyright (C) 2008 by Rafaël Carré
11 *
12 * Based on Rockbox iriver bootloader by Linus Nielsen Feltzing
13 * and the ipodlinux bootloader by Daniel Palffy and Bernard Leach
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
19 *
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
22 *
23 ****************************************************************************/
24
25#include <stdio.h>
26#include <system.h>
27#include <inttypes.h>
Dave Chapmanda8bff12008-10-12 16:46:01 +000028#include "config.h"
Dave Chapman8df1a7e2008-10-29 01:42:03 +000029#include "lcd.h"
30#include "backlight-target.h"
Bertrik Sikken95726a52008-10-26 13:28:52 +000031#include "as3525-codec.h"
Dave Chapman8df1a7e2008-10-29 01:42:03 +000032#include "common.h"
Frank Gevaerts2f8a0082008-11-01 16:14:28 +000033#include "storage.h"
Dave Chapmanda8bff12008-10-12 16:46:01 +000034
35int show_logo(void);
36void main(void)
37{
Bertrik Sikken95726a52008-10-26 13:28:52 +000038 int i;
39 unsigned char buf[8];
40
Rafaël Carréb3ee07c2008-10-28 11:24:29 +000041 system_init();
Rafaël Carré6e645cc2008-11-06 15:24:19 +000042 kernel_init();
Rafaël Carréb3ee07c2008-10-28 11:24:29 +000043
Dave Chapman8df1a7e2008-10-29 01:42:03 +000044 lcd_init();
Dave Chapmanda8bff12008-10-12 16:46:01 +000045
46 show_logo();
47
Dave Chapman8df1a7e2008-10-29 01:42:03 +000048 as3525_codec_init(); /* Required for backlight on e200v2 */
49
50 _backlight_on();
51
Bertrik Sikken95726a52008-10-26 13:28:52 +000052 /* show player id to demonstrate communication with codec part */
Bertrik Sikken95726a52008-10-26 13:28:52 +000053 for (i = 0; i < 8; i++) {
54 buf[i] = as3525_codec_read(0x38 + i);
55 }
56 printf("ID: %02X%02X%02X%02X%02X%02X%02X%02X", buf[7], buf[6], buf[5], buf[4], buf[3], buf[2], buf[1], buf[0]);
Rafaël Carrée1b48382008-10-29 20:21:59 +000057
Frank Gevaerts2f8a0082008-11-01 16:14:28 +000058 storage_init();
Rafaël Carrée1b48382008-10-29 20:21:59 +000059
Dave Chapmanda8bff12008-10-12 16:46:01 +000060#ifdef SANSA_CLIP
61 /* Use hardware scrolling */
62
63 lcd_write_command(0x26); /* scroll setup */
64 lcd_write_command(0x01); /* columns scrolled per step */
65 lcd_write_command(0x00); /* start page */
66 lcd_write_command(0x00); /* steps freqency */
67 lcd_write_command(0x07); /* end page (including) */
68
69 lcd_write_command(0x2F); /* start horizontal scrolling */
70#endif
71
72 /* never returns */
73 while(1) ;
74}