blob: 064d3fc8df94e34cb35ebae81f91ae3518f5b44d [file] [log] [blame]
Marcoen Hirschberg48e45f52008-09-17 23:22:11 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Greg White
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "config.h"
22
23#include <stdlib.h>
24#include <stdio.h>
25#include "inttypes.h"
26#include "string.h"
27#include "cpu.h"
28#include "system.h"
29#include "lcd.h"
30#include "kernel.h"
31#include "thread.h"
Frank Gevaerts2f8a0082008-11-01 16:14:28 +000032#include "storage.h"
Marcoen Hirschberg48e45f52008-09-17 23:22:11 +000033#include "fat.h"
34#include "disk.h"
35#include "font.h"
Marcoen Hirschberg48e45f52008-09-17 23:22:11 +000036#include "button.h"
37#include "panic.h"
38#include "power.h"
39#include "file.h"
40#include "common.h"
41#include "rbunicode.h"
42#include "usb.h"
43#include "qt1106.h"
Bertrik Sikken52ca1872009-10-25 11:31:13 +000044#include "bitmaps/rockboxlogo.h"
Marcoen Hirschberg48e45f52008-09-17 23:22:11 +000045
46#include <stdarg.h>
47
48char version[] = APPSVERSION;
49#define LONG_DELAY 200000
50#define SHORT_DELAY 50000
51#define PAUSE_DELAY 50000
52
53static inline void delay(int duration)
54{
55 volatile int i;
56 for(i=0;i<duration;i++);
57}
58
59
60void bl_debug(bool bit)
61{
62 if (bit)
63 {
64 PDAT0 ^= (1 << 2); //Toggle backlight
65 delay(LONG_DELAY);
66 PDAT0 ^= (1 << 2); //Toggle backlight
67 delay(LONG_DELAY);
68 }
69 else
70 {
71 PDAT0 ^= (1 << 2); //Toggle backlight
72 delay(SHORT_DELAY);
73 PDAT0 ^= (1 << 2); //Toggle backlight
74 delay(SHORT_DELAY);
75 }
76}
77
78void bl_debug_count(unsigned int input)
79{
80 unsigned int i;
81 delay(SHORT_DELAY*3);
82 for (i = 0; i < input; i++)
83 {
84 PDAT0 ^= (1 << 2); //Toggle backlight
85 delay(SHORT_DELAY);
86 PDAT0 ^= (1 << 2); //Toggle backlight
87 delay(2*SHORT_DELAY);
88 }
89}
90void bl_debug_int(unsigned int input,unsigned int count)
91{
92 unsigned int i;
93 for (i = 0; i < count; i++)
94 {
95 bl_debug(input>>i & 1);
96 }
97 delay(SHORT_DELAY*6);
98}
99
100void main(void)
101{
102 //Set backlight pin to output and enable
103 int oldval = PCON0;
104 PCON0 = ((oldval & ~(3 << 4)) | (1 << 4));
105 PDAT0 |= (1 << 2);
106
107 //Set PLAY to input
108 oldval = PCON1;
109 PCON1 = ((oldval & ~(0xf << 16)) | (0 << 16));
110
Bertrik Sikken52ca1872009-10-25 11:31:13 +0000111 lcd_bitmap(rockboxlogo, 0, 0, BMPWIDTH_rockboxlogo, BMPHEIGHT_rockboxlogo);
112 lcd_init_device();
113
114 // Wait for play to be pressed
Marcoen Hirschberg48e45f52008-09-17 23:22:11 +0000115 while(!(PDAT1 & (1 << 4)));
116 // Wait for play to be released
117 while((PDAT1 & (1 << 4)));
118 PDAT0 ^= (1 << 2); //Toggle backlight
119 delay(LONG_DELAY);
120
121 //power off
122 PDAT1&=~(1<<3);
123}
124