Dave Chapman | da8bff1 | 2008-10-12 16:46:01 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
Dave Chapman | 08c41d4 | 2008-10-19 14:11:01 +0000 | [diff] [blame] | 8 | * $Id$ |
Dave Chapman | da8bff1 | 2008-10-12 16:46:01 +0000 | [diff] [blame] | 9 | * |
| 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 Chapman | da8bff1 | 2008-10-12 16:46:01 +0000 | [diff] [blame] | 28 | #include "config.h" |
Dave Chapman | 8df1a7e | 2008-10-29 01:42:03 +0000 | [diff] [blame] | 29 | #include "lcd.h" |
| 30 | #include "backlight-target.h" |
Bertrik Sikken | 95726a5 | 2008-10-26 13:28:52 +0000 | [diff] [blame] | 31 | #include "as3525-codec.h" |
Dave Chapman | 8df1a7e | 2008-10-29 01:42:03 +0000 | [diff] [blame] | 32 | #include "common.h" |
Frank Gevaerts | 2f8a008 | 2008-11-01 16:14:28 +0000 | [diff] [blame^] | 33 | #include "storage.h" |
Dave Chapman | da8bff1 | 2008-10-12 16:46:01 +0000 | [diff] [blame] | 34 | |
| 35 | int show_logo(void); |
| 36 | void main(void) |
| 37 | { |
Bertrik Sikken | 95726a5 | 2008-10-26 13:28:52 +0000 | [diff] [blame] | 38 | int i; |
| 39 | unsigned char buf[8]; |
| 40 | |
Rafaël Carré | b3ee07c | 2008-10-28 11:24:29 +0000 | [diff] [blame] | 41 | system_init(); |
| 42 | |
Dave Chapman | 8df1a7e | 2008-10-29 01:42:03 +0000 | [diff] [blame] | 43 | lcd_init(); |
Dave Chapman | da8bff1 | 2008-10-12 16:46:01 +0000 | [diff] [blame] | 44 | |
| 45 | show_logo(); |
| 46 | |
Dave Chapman | 8df1a7e | 2008-10-29 01:42:03 +0000 | [diff] [blame] | 47 | as3525_codec_init(); /* Required for backlight on e200v2 */ |
| 48 | |
| 49 | _backlight_on(); |
| 50 | |
Bertrik Sikken | 95726a5 | 2008-10-26 13:28:52 +0000 | [diff] [blame] | 51 | /* show player id to demonstrate communication with codec part */ |
Bertrik Sikken | 95726a5 | 2008-10-26 13:28:52 +0000 | [diff] [blame] | 52 | for (i = 0; i < 8; i++) { |
| 53 | buf[i] = as3525_codec_read(0x38 + i); |
| 54 | } |
| 55 | 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é | e1b4838 | 2008-10-29 20:21:59 +0000 | [diff] [blame] | 56 | |
Frank Gevaerts | 2f8a008 | 2008-11-01 16:14:28 +0000 | [diff] [blame^] | 57 | storage_init(); |
Rafaël Carré | e1b4838 | 2008-10-29 20:21:59 +0000 | [diff] [blame] | 58 | |
Dave Chapman | da8bff1 | 2008-10-12 16:46:01 +0000 | [diff] [blame] | 59 | #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 | } |