blob: 2a4f7f0ccb6e4ae4ec27b49d2f1a856605e5077d [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>
28#include "lcd.h"
29#include "common.h"
30#include "config.h"
Bertrik Sikken95726a52008-10-26 13:28:52 +000031#include "as3525-codec.h"
Dave Chapmanda8bff12008-10-12 16:46:01 +000032
33int show_logo(void);
34void main(void)
35{
Bertrik Sikken95726a52008-10-26 13:28:52 +000036 int i;
37 unsigned char buf[8];
38
Rafaël Carréb3ee07c2008-10-28 11:24:29 +000039 system_init();
40
Dave Chapmanda8bff12008-10-12 16:46:01 +000041 lcd_init_device();
42 lcd_clear_display();
43
44 lcd_update();
45
Dave Chapman08c41d42008-10-19 14:11:01 +000046#ifdef HAVE_LCD_ENABLE
Dave Chapmanda8bff12008-10-12 16:46:01 +000047 lcd_enable(true);
Dave Chapman08c41d42008-10-19 14:11:01 +000048#endif
Dave Chapmanda8bff12008-10-12 16:46:01 +000049
50 show_logo();
51
Bertrik Sikken95726a52008-10-26 13:28:52 +000052 /* show player id to demonstrate communication with codec part */
53 as3525_codec_init();
54 for (i = 0; i < 8; i++) {
55 buf[i] = as3525_codec_read(0x38 + i);
56 }
57 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]);
58
Dave Chapmanda8bff12008-10-12 16:46:01 +000059#ifdef SANSA_CLIP
60 /* Use hardware scrolling */
61
62 lcd_write_command(0x26); /* scroll setup */
63 lcd_write_command(0x01); /* columns scrolled per step */
64 lcd_write_command(0x00); /* start page */
65 lcd_write_command(0x00); /* steps freqency */
66 lcd_write_command(0x07); /* end page (including) */
67
68 lcd_write_command(0x2F); /* start horizontal scrolling */
69#endif
70
71 /* never returns */
72 while(1) ;
73}