blob: a88e206c3bdddfb1fe0588500a87673515f161a7 [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"
Dave Chapmanda8bff12008-10-12 16:46:01 +000033
34int show_logo(void);
35void main(void)
36{
Bertrik Sikken95726a52008-10-26 13:28:52 +000037 int i;
38 unsigned char buf[8];
39
Rafaël Carréb3ee07c2008-10-28 11:24:29 +000040 system_init();
41
Dave Chapman8df1a7e2008-10-29 01:42:03 +000042 lcd_init();
Dave Chapmanda8bff12008-10-12 16:46:01 +000043
44 show_logo();
45
Dave Chapman8df1a7e2008-10-29 01:42:03 +000046 as3525_codec_init(); /* Required for backlight on e200v2 */
47
48 _backlight_on();
49
Bertrik Sikken95726a52008-10-26 13:28:52 +000050 /* show player id to demonstrate communication with codec part */
Bertrik Sikken95726a52008-10-26 13:28:52 +000051 for (i = 0; i < 8; i++) {
52 buf[i] = as3525_codec_read(0x38 + i);
53 }
54 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]);
55
Dave Chapmanda8bff12008-10-12 16:46:01 +000056#ifdef SANSA_CLIP
57 /* Use hardware scrolling */
58
59 lcd_write_command(0x26); /* scroll setup */
60 lcd_write_command(0x01); /* columns scrolled per step */
61 lcd_write_command(0x00); /* start page */
62 lcd_write_command(0x00); /* steps freqency */
63 lcd_write_command(0x07); /* end page (including) */
64
65 lcd_write_command(0x2F); /* start horizontal scrolling */
66#endif
67
68 /* never returns */
69 while(1) ;
70}